Krusch Grounded Harness

v0.2.2
dev.krusch/grounded-harness Checked 1 hour ago Published 7 days ago

Turn-0 workspace grounding, spin-loop blocker, and defect-only stop gate for AI coding agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

krusch_ground_workspace

Introspect local workspace schemas (CSV/TSV, JSON/JSONL, read-only SQLite DDL, source symbols, and 256/32 Raw-RAG docs) with 0 LLM calls, apply BM25 tool deferral, and emit a KV-cache-stable prompt bundle.

ParameterTypeDescription
activeParamsBnumberOptional active parameter count in billions.
deferThresholdintegerTool count threshold triggering BM25 deferral.
goalstringTask goal used to retrieve relevant doc chunks.
maxGroundingTokensintegerMaximum Turn-0 grounding token budget.
modelstringTarget model identifier for scale-aware directive.
pinnedToolNamesarrayCore tools kept eagerly exposed.
standingInvariantsarrayStanding rules/invariants included in the static cache prefix.
thinkingEnabledbooleanWhether native reasoning/thinking is enabled.
toolsarrayFull tool registry definitions to gate via BM25 deferral.
totalParamsBnumberOptional total parameter count in billions.
workspaceDirstringDirectory path to introspect.

krusch_resolve_scale_profile

Deterministically map a model identifier and parameter/thinking hints into SMALL_MODEL, MID_MODEL, or FRONTIER_REASONING harness policy.

ParameterTypeDescription
activeParamsBnumberOptional active parameter count in billions.
explicitTierstringOptional explicit tier override.
modelstringModel identifier (e.g., qwen2.5-coder:7b, gemma4:31b, gemini-4-argon).
preferThinkingStepForSmallActivebooleanOpt small-active MoE models into the compact PLAN->BIND->ACT directive.
reasoningEffortstringOptional reasoning effort hint.
thinkingEnabledbooleanWhether native thinking mode is active.
thinkingLevelstringOptional thinking level hint.
totalParamsBnumberOptional total parameter count in billions.

krusch_grounded_session_start

Create or reset a SQLite-tracked grounded session seeded with Turn-0 chunk IDs, file digests, scale profile, and schema token savings.

ParameterTypeDescription
goal *stringUser or task goal.
activeParamsBnumber
all_toolsarray
allowed_scopesarray
anchor_datestringOptional ISO anchor date (YYYY-MM-DD).
exposed_toolsarray
file_digestsobject
max_bulk_limitinteger
max_duplicate_writesinteger
max_stalled_mutationsintegerConsecutive zero-progress verified edit cycles before STALLED_MUTATION_LOOP hold (default 3).
modelstringTarget model identifier.
prefix_hashstringOptional 64-char Turn-0 prompt cache prefix hash.
seen_chunk_idsarray
session_idstringOptional explicit session identifier.
thinkingEnabledboolean
totalParamsBnumber
turn0_tokensinteger

krusch_grounded_intercept

Check a proposed tool call against the frozen policy floor, secret-leak guard, duplicate-write guard, mutation-stall guard (INV-GH-13), read memoization cache (maxReadStreak=0), and small-model placeholder soft-holds.

ParameterTypeDescription
session_id *stringActive grounded session ID.
tool_name *stringInvoked tool name.
allow_stalled_mutationbooleanExplicitly override STALLED_MUTATION_LOOP hold after human guidance (INV-GH-13).
argsobjectTool call arguments.
block_spin_loopbooleanPassively block identical repeat calls via BLOCK_SPIN_LOOP.
mutatingbooleanOptional explicit mutability override.
stepinteger0-based or 1-based agent turn index.
suppress_turn0_readsbooleanShort-circuit unchanged Turn-0 file reads.

krusch_grounded_outcome

Commit or fail a pending intercepted tool call, memoizing read previews, preserving partial stdout on timeouts, tracking passed test cases (INV-GH-13), and updating staged diff verification counters.

ParameterTypeDescription
session_id *stringActive grounded session ID.
call_signaturestringFallback 64-char call signature.
event_idstringEvent ID returned by krusch_grounded_intercept.
mutated_pathsarrayExplicit session-mutated relative paths.
okbooleanWhether the underlying tool succeeded.
partial_stdoutstringPartial stdout captured prior to timeout.
passed_casesintegerPassing test/replay case count for INV-GH-13 progress tracking.
pending_diffs_deltaintegerChange in unverified staged code/disk diffs.
reground_file_digestsobjectRefreshed baseline SHA-256 file digests after re-grounding.
reset_mutation_stallbooleanReset stalled mutation streak after user clarification.
result_previewstringBounded preview cached for read memoization.
timed_outbooleanWhether sandbox/subprocess execution timed out.
total_casesintegerTotal test/replay case count for INV-GH-13 progress tracking.
verification_passedbooleanWhether automated verification passed.

krusch_grounded_verify_stop

Approve zero-overhead completion when pendingDiffsCount=0 and output has 0 objective defects while blocking unverified code diffs, upstream source fingerprint drift (INV-GH-14), unexplained panics/stubs (INV-GH-15), empty/null/NaN bailouts, truncations, raw DataFrame/numpy reprs, and leaked <tool_call> tags.

ParameterTypeDescription
session_id *stringActive grounded session ID.
assistant_textstringFinal assistant response text.
audited_filesarrayOptional edited fallible modules audited for unexplained unwrap/panic!/process.exit/todo! (INV-GH-15).
candidate_answerOptional structured or scalar final answer value.
current_file_digestsobjectOptional current file SHA-256 map checked against Turn-0 baseline digests (INV-GH-14).
expect_non_empty_answerbooleanFlag empty/null/NaN/[]/{} bailouts as output defects.
finish_reasonstringOptional provider finish reason (e.g., STOP, MAX_TOKENS).
latest_verification_passedboolean
mutated_files_countinteger
pending_diffs_countinteger
tool_callsarray
verification_commandstring
workspace_dirstringOptional workspace directory used to verify upstream baseline SHA-256 digests (INV-GH-14).

krusch_grounded_summary

Retrieve session metrics including exploratory foraging ratio, memoized reads, spin loops blocked, output defects caught, partial-stdout timeouts, Turn-0 suppressed duplicates, schema token savings, and ordered events.

ParameterTypeDescription
session_id *stringGrounded session ID.