Repository avatar
Developer Tools
v0.2.1
active

krusch-coding-harness

dev.krusch/krusch-coding-harness

Two-phase commit coding harness that stages diffs, runs sandboxed tests, and applies atomically.

Documentation

KRUSCH CODING HARNESS (v0.2.0)
PostgreSQL-backed coding harness (krusch-coding-harness) that stages diffs, runs sandboxed tests, and only then writes to disk. Models are ephemeral workers.

Version 0.2.0 Node Version PostgreSQL CI Trajectory Eval CI Gate License MIT Tests Golden DAG 100/100 HOL Guard Catalog

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.


⚡ 5-Minute External Engineer Verification & Recorded 5-Step Demo

Watch Recorded 20s Live Execution (PostgreSQL 16 + Bubblewrap)

▶️ Watch 20s Recorded Live Execution (720p MP4) · Raw Terminal Output (.txt) · Source (scripts/demo-full-harness-loop.mjs) · 15s SIGKILL-Only Clip

Real execution against PostgreSQL 16 and Bubblewrap (bwrap --unshare-net) with zero mocks: (1) stages a flawed AI billing patch in krusch_staged_diffs without 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) kills applyDiffBatch() mid-apply with SIGKILL after file 1 is renamed and rolls back torn state via cold-worker recoverInFlightApplies(), and (5) cleanly applies both files (status=APPLIED).

Agent-Assisted Setup

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.

Path A: Zero-Postgres, Zero-API-Key Verification (<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

Path B: Full PostgreSQL 16 + Bubblewrap 5-Step Crash-Recovery Loop (<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 in krusch-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.


What You Get If You Only Clone krusch-coding-harness

When 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.


Architecture Diagram

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

🧭 System Principles & Invariants

  1. State Lives in PostgreSQL: Primary task state, turns, events, and proposed file edits never live in transient scratchpads. All state persists to relational tables.
  2. Pre-Commit Staging Invariant: File edits generated by models are staged into krusch_staged_diffs with SHA-256 validation. Physical disk files are never touched until tests pass and approval is granted.
  3. Hard Sandbox Isolation: Verification does not run unconstrained on the user's checkout. It executes in an unprivileged Bubblewrap container (or process jail) with a read-only base tree, network isolation (--unshare-net), scrubbed credentials (cleanEnv), memory/time limits, capability allowlisting, and process group termination.
  4. Actionable Failure Attribution: Failures are classified into specific modules (ContextManagement, ToolUse, ObservationManagement, AgentLoop) using KruschFailureClassifier rather than blind re-prompting.
  5. Storage-Engine-Grade Apply Journal: the 2PC apply journal (my name for a journaled, crash-recoverable multi-file apply protocol) provides per-file atomic replacement, upfront drift detection, and idempotent crash recovery. It does not make a multi-file batch atomically visible: other processes can observe a partly-applied batch until it completes or is rolled back.

📊 Empirical Benchmarks (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 49 SHA-256-pinned raw audit log bundles (64 files) across 335,000+ queries/traces and 14 external suites published openly on Hugging Face at krush420/sovereign-g4-benchmarks and interactively at krush420/sovereign-router-arena (including the maintainer-merged RouteWorks/RouterArena PR #169 receipt bundle on main @ 844e93b). No outside party has yet re-run these harness evaluations; reproduction issues and independent verification attempts are welcome.

1. Aider Polyglot (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:

TrackExercises1-Shot Pass@1krusch-coding-harness 2PC Verify-on-Stop Pass@2Tasks Self-HealedMultiplier
Overall (Aider Polyglot)22519.56% (44/225)51.56% (116/225)+722.64x (+32.00 pp)
Rust (cargo test -- --include-ignored)3036.67% (11/30)66.67% (20/30)+91.82x
JavaScript (npm test, xtest unskipped)4918.37% (9/49)59.18% (29/49)+203.22x
Go (go test ./...)3925.64% (10/39)53.85% (21/39)+112.10x
Python (pytest)3414.71% (5/34)47.06% (16/34)+113.20x
C++ (cmake -DEXERCISM_RUN_ALL_TESTS=1)263.85% (1/26)42.31% (11/26)+1011.00x
Java (./gradlew test, @Disabled stripped)4717.02% (8/47)40.43% (19/47)+112.38x

Attribution: The 19.56% -> 51.56% lift (+72 tasks) comes from isolated sandbox test execution, compiler/test error feedback, and bounded repair retries (Pass@2 Verify-on-Stop), reaching parity with published single-model Claude 3.5 Sonnet (51.6%) reference scores at $0 external API cost with 0 truncated diffs committed.

2. BIRD-SQL Mini-Dev (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):

StrategyQueriesExecution Accuracy (EX)R-VESValid Executable SQLVerify-on-Stop Healed
raw_ddl_oneshot (Raw CREATE TABLE DDL Only)50026.00% (130/500)24.15%97.80%0
schema_value_grounded_pass1 (FK + Sample Cell Grounded)50037.60% (188/500)33.30%99.40%0
krusch_2pc_sql_heal (krusch-coding-harness 2PC)50040.20% (201/500, 1.55x)35.75%100.00% (500/500)+13 (45 retries = 0.09/q)

Lifts toxicology 5.00x (12.50% → 62.50%), moderate difficulty from 32.40% → 50.00%, and challenging difficulty from 27.87% → 39.35% while eliminating 100% of invalid/syntax-errored SQL.

3. ETH SpyLab AgentDojo v1.2.2 (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 StrategyBenign 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/949 hijacked (0.00% ASR across 1,046 episodes) is a benchmark-specific finding under active import-frozen Object.freeze policy floors, network-disabled bwrap --unshare-net sandboxes, and taint guards, not a claim of universal prompt-injection immunity.

4. Official DolphinBench & Generalized 2PC Tool-Action Harness (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 ScoreCostStatus & Key Result
Gemini 4 Argon (Low, Std. Harness)91.17% (547/600)$24.54Uploaded 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.00Highest 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.00Std. 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.00Oracle@28 = 98.33% (590/600, <= 1.67% retrieval miss) · $0.00 Open-Weights Oracle@17 = 83.17% (499/600)

🔒 The Safety Story: Hard Sandbox Isolation

Physical disk protection is meaningless if the verification step can escape and mutate the tree or leak credentials. Krusch enforces hard boundaries:

  • Bubblewrap Unprivileged Container: Mounts the host and project root read-only (--ro-bind / /), isolates the network (--unshare-net), isolates process namespaces (--unshare-pid), and overlays the staged modifications.
  • Process Jail Fallback: On environments where bwrap is unavailable, executes in a detached process group and kills the entire group (SIGKILL) on timeout or failure.
  • Capability Allowlist: 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.
  • Durable Replay Token: Every run records the sandbox type, environment snapshot, file manifest, command, exit code, and a deterministic SHA-256 replay token in krusch_verification_runs.

💾 Storage Engine & Apply Journal

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 atomic rename, and recoverInFlightApplies() 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. Run node scripts/demo-full-harness-loop.mjs (or node scripts/demo-crash-recovery.mjs) to see a SIGKILL mid-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)────────────┘
  1. Content-Addressed Blobs: Identical file contents across tasks and turns are deduplicated in krusch_blobs.
  2. Upfront Drift Detection: Before any file is modified, disk hashes are compared to original base preimages. If working-tree drift is detected, the entire batch aborts with zero disk writes.
  3. Crash-Recoverable Multi-File Apply: Files are written to temporary siblings, 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.
  4. Idempotent Recovery: Recovery operations can run multiple times without side effects.

🎛️ Operator CLI & FSM Controls

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

🛡️ Production Agentic Safety, Resilience & Golden DAG CI Systems

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 ImportCore Class / RunnerProduction Invariants & :3778 Control Bridge Routes
krusch-coding-harness/hitlAsyncHitlSlackGate (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-killswitchCostKillSwitchMiddleware (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-fallbackApiToBrowserFallbackAgent (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-evalrunTrajectoryEvalGate (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).

🔌 Model Context Protocol (MCP) Interface

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

Frozen Tool Protocol

Tool NamePhase ScopeBehavioral Invariant AnnotationsDescription
krusch_runAnyopenWorldHint: trueAsynchronously initialize and run a task in PostgreSQL.
krusch_task_statusAnyreadOnlyHint: true, idempotentHint: truePoll task phase, verification runs, active diffs, and blockers.
krusch_explainAnyreadOnlyHint: true, idempotentHint: trueExplain next transition feasibility with SQL invariant tags.
krusch_diffAnyreadOnlyHint: true, idempotentHint: trueRetrieve unified diff of staged modifications.
krusch_rejectAPPROVAL_GATEdestructiveHint: trueReject a staged diff before application.
krusch_abortAny non-terminaldestructiveHint: trueAbort a task and record the operator reason in krusch_events.
krusch_apply_diffAPPROVAL_GATEdestructiveHint: trueCommit verified staged diffs to disk via the 2PC journal.

🧪 Verification & Test Suite

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

🚫 Non-Goals

To preserve reliability and prevent architectural bloat:

  1. No IDE or GUI components: Krusch is a pure headless execution engine and control plane. Antigravity, Claude Code, Cursor, or the :3778 HTTP Bridge serves as the interaction surface.
  2. No required external routers: Routing is decoupled behind src/router/interface.js. The in-tree heuristic gate runs with zero external dependencies.
  3. No direct disk mutations: All mutations must proceed through stage_diff -> sandboxed VERIFY -> APPROVAL_GATE -> 2PC apply.
  4. No shell execution in IMPLEMENT: Freeform shell commands (run_command) are strictly forbidden during PLAN and IMPLEMENT phases.
  5. No unconstrained agent loops: Phase revisit budgets cap oscillation between VERIFY and IMPLEMENT to prevent runaway spending, automatically escalating or aborting tasks that do not converge.
  6. No client-side state authority: Ephemeral model context windows cannot override database invariants; PostgreSQL triggers, row locks, lease TTLs, and transitions are the sole source of truth.
  7. No unmediated enterprise SoR mutations: Krusch is a staging and verification harness for engineering agents writing integration code; live mutations to external systems of record (SAP, CRM, production DWH) must execute through governed corporate CI/CD pipelines, never unmediated agent calls.

License

MIT · Copyright (c) 2026 kruschdev