Listed from the MCP registry; nobody on Odel publishes it.
Two-phase commit coding harness that stages diffs, runs sandboxed tests, and applies atomically.
Runs on your machine from its package; the steps are below.

At most: moves money, runs code or commands, deletes data, or sends messages for you.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
npx -y krusch-coding-harness
MCP client config
{
"mcpServers": {
"krusch-coding-harness": {
"command": "npx",
"args": [
"-y",
"krusch-coding-harness"
]
}
}
}
KRUSCH CODING HARNESS (v0.2.2)
PostgreSQL-backed coding harness (krusch-coding-harness) that stages diffs, runs sandboxed tests, and only then writes to disk. Models are ephemeral workers.
Core Thesis: Models are ephemeral compute; PostgreSQL is the brain. Keep workflow, context, tests, and approvals consistent while making models interchangeable. Deterministic gates do not guarantee that a model's plan is semantically right; they bound blast radius, block repeatable defect classes, and guarantee clean rollback when verification fails.
▶️ Watch 20s Recorded Live Execution (
720pMP4) · Raw Terminal Output (.txt) · Source (scripts/demo-full-harness-loop.mjs) · 15sSIGKILL-Only ClipReal execution against
PostgreSQL 16andBubblewrap(bwrap --unshare-net) with zero mocks: (1) stages a flawed AI billing patch inkrusch_staged_diffswithout touching disk, (2) fails isolated sandbox tests (exitCode=1) and rejects the diff (status=REJECTED), (3) stages and sandbox-verifies the repaired 2-file integer-cent fix (exitCode=0), (4) killsapplyDiffBatch()mid-apply withSIGKILLafter file 1 is renamed and rolls back torn state via cold-workerrecoverInFlightApplies(), and (5) cleanly applies both files (status=APPLIED).
Ask your coding agent (Claude Code, Codex, Cursor, Windsurf, or Antigravity):
Read https://raw.githubusercontent.com/kruschdev/krusch-coding-harness/main/INSTALL.md and set up krusch-coding-harness on this machine.
<30 seconds)Runs in-process using built-in PGlite and deterministic fixtures (no Docker, no database server, no API keys):
git clone https://github.com/kruschdev/krusch-coding-harness.git
cd krusch-coding-harness
npm ci
# 1. Run 52 fast unit tests (AST indexer, router gate, Slack HITL, cost kill-switch, SSRF fallback, policy floor)
npm run test:unit
# 2. Replay all 100 golden trajectories across 10 failure categories
npm run eval:trajectories
# 3. Verify TypeScript .d.ts declarations and run a complete ephemeral PGlite task
npm run typecheck
./bin/krusch-coding-harness.js run "Verify arithmetic module fix" --mock --ephemeral --auto-approve
<3 minutes)# 1. Start PostgreSQL 16 (defaults to postgresql://postgres:postgres@localhost:5432/krusch)
docker compose up -d
# 2. Apply all 11 SQL schema & row-lock invariant migrations
npm run migrate
# 3. Run all 118 unit, ephemeral, and PostgreSQL integration tests (includes real SIGKILL crash test)
npm test
# 4. Run the live 5-step stage -> fail -> repair -> SIGKILL recovery -> apply loop
node scripts/demo-full-harness-loop.mjs
When simpler suffices: For a single interactive developer session, an isolated
git worktree, staged diff, and sandboxed test run (the zero-Docker SQLite default inkrusch-stack) achieves practical safety with less operational surface. PostgreSQL write-ahead journaling targets unattended background daemons and multi-worker queues where crash recovery, file-lease concurrency, and durable audit state justify a database.
krusch-coding-harnessWhen you clone this repository, you get a fully functional, self-contained headless execution engine with zero external cloud API dependencies:
┌────────────────────────────────────────────────────────────────────────┐
│ IN-TREE CAPABILITIES IN THIS REPO │
├────────────────────────────────────────────────────────────────────────┤
│ ✓ Pre-Commit Staging Engine: SHA-256 content-addressed blobs │
│ ✓ PostgreSQL FSM: Row-locked phase transitions (INIT ➔ COMMITTED) │
│ ✓ Isolated VERIFY Sandbox: Bubblewrap (bwrap) / process jail │
│ ✓ Capability Allowlist: Test runners only; freeform shells blocked │
│ ✓ "2PC" Apply Journal: crash-recoverable fsync + per-file rename │
│ ✓ In-Memory Postgres: Zero-setup local evaluation via PGlite │
│ ✓ AST Symbol Indexer: JS, TS, Python, Go, Rust structural symbols │
│ ✓ Async HITL Slack Gate: 72h lease + fail-closed HMAC-SHA256 resume │
│ ✓ $0.50 Cost Kill-Switch: Loop-depth & local Ollama fallback router │
│ ✓ API-to-Browser Fallback: SSRF-hardened REST ➔ GUI failover │
│ ✓ Golden DAG CI Gate: 100-trajectory PR blocker across 10 categories │
│ ✓ OpenTelemetry Spans & Cost Ledger: Audit trace JSON per task │
│ ✓ Unified Control Plane: Doctor, :3778 HTTP Bridge & 7-Tool MCP │
└────────────────────────────────────────────────────────────────────────┘
Note
Decoupled Architecture: Sibling packages (krusch-pre-router, krusch-cascade-router, krusch-context-mcp, krusch-git) are dynamically resolved adapters. This repository includes its own in-tree regex heuristic gate and deterministic mock adapter that run out of the box with zero external git dependencies or cloud keys.
flowchart TD
subgraph ControlPlane ["Unified Headless Control Plane"]
CLI["CLI (bin/krusch-coding-harness.js | bin/krusch.js: doctor / ci / serve / bench)"]
Bridge["HTTP Control Bridge (127.0.0.1:3778)"]
MCP["MCP Server (stdio - 7 tools)"]
end
subgraph Workflow ["Workflow & Safety Engine"]
FSM["KruschStateMachine (Row-Locked FSM)"]
Guard["TrajectoryGuard (Loop & Escalation)"]
Classifier["ModularRSI (Failure Attribution)"]
end
subgraph StorageEngine ["PostgreSQL Brain (ACID State)"]
Tasks["krusch_tasks (Budgets & Revisit Caps)"]
Blobs["krusch_blobs (Content-Addressed Deduplication)"]
Diffs["krusch_staged_diffs (Leases & Pre-Commit Hashes)"]
Journal["krusch_apply_journal (2PC State & Preimages)"]
Runs["krusch_verification_runs (Replay Tokens & Envs)"]
end
subgraph Sandbox ["Isolated VERIFY Sandbox"]
Bwrap["Bubblewrap (bwrap) / Process Jail"]
BaseRO["Base Tree (Read-Only Bind)"]
Overlay["Overlay / Staged Tree Copy"]
Allowlist["Capability Allowlist (Test Runners Only)"]
Bwrap --> BaseRO
Bwrap --> Overlay
Bwrap --> Allowlist
end
subgraph Disk ["Physical Working Tree"]
WorkingTree["Physical Disk Files"]
end
CLI --> FSM
MCP --> FSM
FSM --> StorageEngine
FSM --> Sandbox
Sandbox -->|Record Results & Exit Code| Runs
StorageEngine -->|Verified & Approved: 2PC Crash-Recoverable Apply| WorkingTree
krusch_staged_diffs with SHA-256 validation. Physical disk files are never touched until tests pass and approval is granted.--unshare-net), scrubbed credentials (cleanEnv), memory/time limits, capability allowlisting, and process group termination.ContextManagement, ToolUse, ObservationManagement, AgentLoop) using KruschFailureClassifier rather than blind re-prompting.95/95 Clean-Room SHA-256 Gates, Self-Run in Lab)Evaluation Provenance & Third-Party Reproduction Status: Every benchmark below uses a public external dataset run in my lab, with
49SHA-256-pinned raw audit log bundles (64files) across335,000+queries/traces and14external suites published openly on Hugging Face atkrush420/sovereign-g4-benchmarksand interactively atkrush420/sovereign-router-arena(including the maintainer-mergedRouteWorks/RouterArenaPR #169 receipt bundle onmain @ 844e93b). No outside party has yet re-run these harness evaluations; reproduction issues and independent verification attempts are welcome.
225 / 225 Multi-Language Coding Tasks)Evaluated hermetically across all 225 official Aider-AI/polyglot-benchmark tasks (cpp, go, java, javascript, python, rust with mandatory upstream test un-skipping: --include-ignored, xtest → test, -DEXERCISM_RUN_ALL_TESTS=1, @Disabled stripped, pristine test-hash verification, and clean-workspace .meta/.docs/test exclusion) pairing open-weights gpt-oss:120b with isolated bwrap sandbox test execution + evaluateVerifyOnStop:
| Track | Exercises | 1-Shot Pass@1 | krusch-coding-harness 2PC Verify-on-Stop Pass@2 | Tasks Self-Healed | Multiplier |
|---|---|---|---|---|---|
Overall (Aider Polyglot) | 225 | 19.56% (44/225) | 51.56% (116/225) | +72 | 2.64x (+32.00 pp) |
Rust (cargo test -- --include-ignored) | 30 | 36.67% (11/30) | 66.67% (20/30) | +9 | 1.82x |
JavaScript (npm test, xtest unskipped) | 49 | 18.37% (9/49) | 59.18% (29/49) | +20 | 3.22x |
Go (go test ./...) | 39 | 25.64% (10/39) | 53.85% (21/39) | +11 | 2.10x |
Python (pytest) | 34 | 14.71% (5/34) | 47.06% (16/34) | +11 | 3.20x |
C++ (cmake -DEXERCISM_RUN_ALL_TESTS=1) | 26 | 3.85% (1/26) | 42.31% (11/26) | +10 | 11.00x |
Java (./gradlew test, @Disabled stripped) | 47 | 17.02% (8/47) | 40.43% (19/47) | +11 | 2.38x |
Attribution: The
19.56% -> 51.56%lift (+72tasks) comes from isolated sandbox test execution, compiler/test error feedback, and bounded repair retries (Pass@2Verify-on-Stop), reaching parity with published single-modelClaude 3.5 Sonnet(51.6%) reference scores at$0external API cost with0truncated diffs committed.
500 / 500 Dirty Enterprise SQLite Queries × 11 Databases)Evaluated across all 500 official birdsql/bird_mini_dev queries (11 SQLite databases, runtime JS Proxy blocking .SQL / .gold_sql, read-only DatabaseSync(..., { readOnly: true }) schema/FK/cell-value grounding, createKruschPolicyFloor DDL/DML blocklist, and evaluateVerifyOnStop execution-error / empty-set self-healing on gpt-oss:120b):
| Strategy | Queries | Execution Accuracy (EX) | R-VES | Valid Executable SQL | Verify-on-Stop Healed |
|---|---|---|---|---|---|
raw_ddl_oneshot (Raw CREATE TABLE DDL Only) | 500 | 26.00% (130/500) | 24.15% | 97.80% | 0 |
schema_value_grounded_pass1 (FK + Sample Cell Grounded) | 500 | 37.60% (188/500) | 33.30% | 99.40% | 0 |
krusch_2pc_sql_heal (krusch-coding-harness 2PC) | 500 | 40.20% (201/500, 1.55x) | 35.75% | 100.00% (500/500) | +13 (45 retries = 0.09/q) |
Lifts
toxicology5.00x(12.50%→62.50%),moderatedifficulty from32.40%→50.00%, andchallengingdifficulty from27.87%→39.35%while eliminating100%of invalid/syntax-errored SQL.
1,046 / 1,046 Indirect Prompt-Injection Episodes)Evaluated across all 1,046 official ethz-spylab/agentdojo (v1.2.2) episodes (97 benign user tasks + 949 ImportantInstructionsAttack adversarial episodes across workspace, banking, slack, and travel on gpt-oss:120b, zero hardcoded benchmark tokens):
| Defense Strategy | Benign Utility (n=97) | Attacked Utility (n=949) | Targeted Attack Success Rate (ASR ↓) | Defense Rate (↑) | Policy-Floor Blocks |
|---|---|---|---|---|---|
raw_unprotected_agent (No Guard) | 61.86% (60/97) | 55.32% | 19.28% (183/949 hijacked) | 80.72% | 0 |
spotlighting_delimited_only (<UNTRUSTED_CONTENT> Only) | 69.07% (67/97) | 54.58% | 14.86% (141/949 hijacked) | 85.14% | 0 |
krusch_sovereign_defense (createKruschPolicyFloor + Taint Guard) | 61.86% (0.00 pp loss) | 49.95% | 0.00% (0/949 hijacked) | 100.00% | 83 |
Scope Qualification:
0/949hijacked (0.00%ASR across1,046episodes) is a benchmark-specific finding under active import-frozenObject.freezepolicy floors, network-disabledbwrap --unshare-netsandboxes, and taint guards, not a claim of universal prompt-injection immunity.
28 Runs, 16,800 openai/gpt-5.6-sol Traces, 6 Families)Evaluated across 28 official 600-task DolphinBench runs (16,800 openai/gpt-5.6-sol traces across 6 model families; 28/28 passing dolphinbench.submission.validate, 8 flagship .zip archives uploaded & status: "queued" on dolphinbench.ai awaiting leaderboard acceptance; full paper: Return on Memory):
Configuration (Checkpoint + Tool Loop) | Official gpt-5.6-sol Score | Cost | Status & Key Result |
|---|---|---|---|
Gemini 4 Argon (Low, Std. Harness) | 91.17% (547/600) | $24.54 | Uploaded dolphinbench.ai submission UUID c047b063 (status: "queued"; Argon Low + Grounded v0.3 = 90.67% [544/600 @ $30.54] in self-run clean-room eval) |
Model-Matched: GPT 5.6 Luna (High + Grounded / Std.) | 81.50% (489) / 81.33% (488) | $1.35 | +10.83 pp (+65 tasks) higher & 71.1x cheaper than published 70.67% GPT 5.6 Luna + Mem0 ($96.21); Luna (Low) = 76.67% (460/600 @ $1.10) |
Open-Weights: Gemma 4 31B (Wave-6 + Grounded / Stock) | 57.33% (344) / 54.17% (325) | $0.00 | Highest open-weights score in self-run 28-run eval (57.33% krush420/gemma4-31b-sre-lora); stock 54.17% uploaded & queued (UUID 288671ad) |
Qwen3-Coder-30B-A3B Wave-4 (Std. Harness vs. + 2PC) | 42.67% / 42.00% | $0.00 | Std. Harness = 256/600; + 2PC = 252/600, cutting duplicate MCP calls by -95.2% (42 -> 2) and lifting 2-pass 30B Oracle@2 to 50.33% (302/600) |
Ensembles (Oracle@28 Global / Oracle@17 $0.00 Open-Weights) | 98.33% / 83.17% | N/A / $0.00 | Oracle@28 = 98.33% (590/600, <= 1.67% retrieval miss) · $0.00 Open-Weights Oracle@17 = 83.17% (499/600) |
Physical disk protection is meaningless if the verification step can escape and mutate the tree or leak credentials. Krusch enforces hard boundaries:
--ro-bind / /), isolates the network (--unshare-net), isolates process namespaces (--unshare-pid), and overlays the staged modifications.bwrap is unavailable, executes in a detached process group and kills the entire group (SIGKILL) on timeout or failure.run_command and verification commands are restricted to recognized test runners (npm test, node --test, pytest, cargo test, go test, vitest, jest). Destructive shell patterns (curl, wget, rm -rf, interactive shells) are rejected before execution.krusch_verification_runs.Terminology: what "2PC" means here. In this project, "2PC" is the name of a journaled, crash-recoverable multi-file apply protocol: PostgreSQL records durable write-ahead intent (
krusch_apply_journal,krusch_staged_diffs.status = 'APPLYING'), each file is written to a temporary sibling,fsync'd, and swapped in with a POSIX atomicrename, andrecoverInFlightApplies()repairs any interrupted batch on restart. It is not classic distributed two-phase commit with transactional participants. Each individual file replacement is atomic, but a multi-file batch is not atomically visible: another process can observe a partly-applied batch until it completes or recovery rolls it back. Runnode scripts/demo-full-harness-loop.mjs(ornode scripts/demo-crash-recovery.mjs) to see aSIGKILLmid-apply and cold-worker recovery.
The apply engine treats disk writes like database transactions:
[ PENDING ] ──(Verification Passed & Approved)──> [ APPLYING ] ──(fsync & rename)──> [ APPLIED ]
│ │
│ (Crash Detected)
│ │
└─────────────(Idempotent Crash Recovery)────────────┘
krusch_blobs.fsync'd to storage media, and renamed. If a crash occurs mid-batch, startup recovery inspects krusch_apply_journal, restores renamed files to base preimages, and removes orphaned temporary files.krusch-coding-harness provides operator commands to unstick, audit, and manage tasks. CLI commands support krusch-coding-harness as well as backwards-compatible aliases krusch-harness and krusch:
# Check 3-Tier ecosystem health & dependencies
krusch-coding-harness doctor
# Start headless HTTP Control Bridge daemon (:3778)
krusch-coding-harness serve
# Run automated Headless CI gate
krusch-coding-harness ci
# Run 2PC Crash-Recoverable Apply & Verification Latency Benchmark
krusch-coding-harness bench
# Prove 7-Step Write Invariant & Working-Tree Drift Refusal
krusch-coding-harness demo-invariant
# Verify byte-for-byte system prompt prefix parity across model wire formats
krusch-coding-harness verify-models
# Inspect task status, blocker explanations, and SQL invariant diagnostics
krusch-coding-harness status <taskId>
# Audit task trace as OpenTelemetry spans and token cost ledger
krusch-coding-harness status <taskId> --json
# Abort an active or stuck task with audit reason
krusch-coding-harness abort <taskId> --reason "Operator manual abort"
# Retry a task from VERIFY or IMPLEMENT phase
krusch-coding-harness retry <taskId> --from VERIFY
# Reject a staged diff
krusch-coding-harness reject <taskId> [diffId] --reason "Style violation"
# Inspect and export PR-ready unified diffs
krusch-coding-harness diff <taskId>
krusch-coding-harness diff <taskId> --export patch.patch
# Concurrency lease management
krusch-coding-harness lease list
krusch-coding-harness lease unlock src/calculator.js
krusch-coding-harness lease prune
# Replay all 100 golden trajectories across 10 categories (Golden DAG CI Gate)
krusch-coding-harness eval-trajectories --strict
krusch-coding-harness eval-trajectories --json
krusch-coding-harness exports four standalone zero-cloud-dependency subpath modules (types/agentic-15.d.ts typed) and exposes matching :3778 HTTP Control Bridge endpoints (full state-machine design in Paper #23: The 15 Production Agentic Systems):
| Subpath Import | Core Class / Runner | Production Invariants & :3778 Control Bridge Routes |
|---|---|---|
krusch-coding-harness/hitl | AsyncHitlSlackGate (src/approvals/hitl-slack-gate.js) | Serializes high-stakes mutations to crash-safe .tmp + renameSync state journals with a 72-hour (259,200,000 ms) approval lease (PENDING_APPROVAL → APPROVED | REJECTED | EXPIRED) and fail-closed crypto.timingSafeEqual Slack v0= HMAC-SHA256 signature + ±300s replay window verification (POST /api/hitl/draft, GET /api/hitl/status, POST /api/hitl/slack-webhook). |
krusch-coding-harness/cost-killswitch | CostKillSwitchMiddleware (src/router/cost-killswitch.js) | Tracks per-task loopDepth, cumulative spentUsd, and worst-case projectedTurnUsd; automatically downgrades paid frontier calls to $0.00 sovereign local qwen2.5-coder:7b before breaching $0.50 and hard-halts paid spend at $0.50 (POST /api/cost/evaluate, POST /api/cost/record). |
krusch-coding-harness/browser-fallback | ApiToBrowserFallbackAgent (src/tools/api-browser-fallback.js) | Executes primary REST calls with deterministic AbortController timeouts; seamlessly fails over to headless browser GUI workflows on 404/408/429/5xx/network timeouts while failing closed on 400/401/403 client errors and blocking IPv4/IPv6-mapped (::ffff:*, fd00:ec2::254, 169.254.169.254) SSRF targets (POST /api/fallback/execute). |
krusch-coding-harness/trajectory-eval | runTrajectoryEvalGate (src/eval/trajectory-dag-gate.js) | Replays 100 golden trajectories across 10 categories (test/fixtures/golden-trajectories-100.json) in GitHub Actions (.github/workflows/trajectory-eval.yml), blocking PRs on requiredTools, forbiddenTools, precedenceEdges, requirePassingPrerequisite (ok === true), argGuards, or maxSteps violations (POST /api/eval/trajectories). |
krusch-coding-harness runs as a headless stdio MCP server for coding agents and IDEs (Antigravity, Claude Code, Cursor, Windsurf). The MCP server configuration key remains krusch-harness with the frozen 7-tool krusch_* protocol:
./bin/krusch-coding-harness.js mcp
# Backwards-compatible alias: ./bin/krusch.js mcp
| Tool Name | Phase Scope | Behavioral Invariant Annotations | Description |
|---|---|---|---|
krusch_run | Any | openWorldHint: true | Asynchronously initialize and run a task in PostgreSQL. |
krusch_task_status | Any | readOnlyHint: true, idempotentHint: true | Poll task phase, verification runs, active diffs, and blockers. |
krusch_explain | Any | readOnlyHint: true, idempotentHint: true | Explain next transition feasibility with SQL invariant tags. |
krusch_diff | Any | readOnlyHint: true, idempotentHint: true | Retrieve unified diff of staged modifications. |
krusch_reject | APPROVAL_GATE | destructiveHint: true | Reject a staged diff before application. |
krusch_abort | Any non-terminal | destructiveHint: true | Abort a task and record the operator reason in krusch_events. |
krusch_apply_diff | APPROVAL_GATE | destructiveHint: true | Commit verified staged diffs to disk via the 2PC journal. |
The test suite exercises unit behavior, storage engine properties, sandbox isolation, PostgreSQL integration, and the 100-trajectory Golden DAG gate:
# Run fast unit tests (52 tests across AST indexer, router heuristics, HITL, cost kill-switch, browser fallback, DAG gate)
npm run test:unit
# Replay all 100 golden trajectories across 10 production categories
npm run eval:trajectories
# Run storage engine property & PostgreSQL integration tests
npm run test:integration
# Run full test suite (118 tests across unit, integration, and ephemeral)
npm test
# Verify TypeScript declarations (zero errors across types/index.d.ts & types/agentic-15.d.ts)
npm run typecheck
# Check package manifest and npm pack contents
npm pack --dry-run
To preserve reliability and prevent architectural bloat:
:3778 HTTP Bridge serves as the interaction surface.src/router/interface.js. The in-tree heuristic gate runs with zero external dependencies.stage_diff -> sandboxed VERIFY -> APPROVAL_GATE -> 2PC apply.run_command) are strictly forbidden during PLAN and IMPLEMENT phases.VERIFY and IMPLEMENT to prevent runaway spending, automatically escalating or aborting tasks that do not converge.MIT · Copyright (c) 2026 kruschdev