1. The EVOLVE Thesis: Generating Code Is Not Knowing It Is Safe to Merge
On Friday evening, November 13, 2026, I checked into EVOLVE at 8090's Redwood City headquarters with my travel workstation (an Early 2015 MacBook Pro running Linux Mint) and a strict clean-room constraint: zero lines of hackathon application code written prior to the 7:10 PM kickoff, and less than 20 hours on the clock before the Saturday 3:30 PM hard code freeze. Under Section 10(c) of the event agreement, I brought my pre-existing MIT open-source libraries (@krusch/toolkit v1.8.1 and krusch-stack v1.1.0) as disclosed package dependencies, and built the entire DEADBOLT control plane, polyglot scanner, self-rejection validator, 8090 Tri-API bridge, and 3-tab React Breaker Panel during the event window.
Watching autonomous coding pipelines fail in production shaped my architectural thesis before I wrote a single route. When an enterprise engineering team hands a brownfield billing or compliance repository to a single-model coding agent, three failure modes compound immediately:
- 2-Hop Blindness Across Unmentioned Files: A ticket asks an agent to adjust per-item fee math in
src/fee-engine.js. Local single-line unit tests pass, so the agent opens a pull request, completely unaware thatsrc/sox-reconciler.jstwo call-graph hops downstream enforces strict zero-cent batch conservation across split invoices. - Reward-Hacking Workarounds When Tests Fail: When an unconstrained coding agent sees a downstream reconciliation test fail, the shortest path to a green exit code is often mutating the assertion file itself (widening cent tolerance or toggling
strictSox = false) rather than implementing integer largest-remainder allocation. - Same-Family Reviewer Blind Spots and Context Stuffing: Asking the same model family that wrote a buggy patch to review its own diff rubber-stamps subtle rounding and SSRF flaws, while stuffing an entire legacy repository into every frontier prompt burns budget and degrades attention past the middle of the window.
Instead of pitching a competing agent framework against 8090, I designed DEADBOLT to snap directly into 8090's Software Factory (1. Refinery -> 2. Planner -> 3. Foundry -> 4. Validator). 8090 builds the software; DEADBOLT acts as the deterministic governance breaker panel that makes unsafe AI changes harder to merge.
2. Stage 1 (Refinery) & Stage 2 (Planner): 6-Modality Context and 2-Hop Polyglot Blast Radius
In 8090's Software Factory, Refinery turns scattered organizational knowledge into structured requirements, and Planner decomposes blueprints into executable Work Orders. DEADBOLT instruments both stages so the downstream coding model never acts as a lossy memory bank:
- Bounded 6-Modality Organizational Context (
src/engines/refinery-context.js): For Work OrderWO-101,createRefineryEnginehydrates governing invariants across all six enterprise context sources: 8090 Work Orders/Blueprints (tickets), exact source line spans (codebaseSpans), prior failed agent traces withINV-FIN-02 -> INV-FIN-03supersession lineage (pastSessions), controller audit rules (emails),#billing-engengineering warnings (chats), and architecture review notes (transcripts). Using SQLiteFTS5/BM25,Raw-RAGwindows, and HydraDB Dual-Live (CloudAPI-Version: 2hybrid retrieval paired with self-hostedhydradb:0.4.0OpenCypher:DEPENDED_ON_BYand:SUPERSEDESedges), Refinery packs the active contract in under4,000tokens while verifyingINV-12SHA-256 line-span hashes (VALIDvs.STALE_DRIFT) and wrapping untrusted ticket comments insidedelimitUntrustedContent. - Portable WebAssembly Tree-sitter CST Blast Radius (
src/engines/treesitter-ast.js&src/engines/planner-graph.js): Native C++ Tree-sitter bindings frequently break across container architectures and serverless build environments. I built DEADBOLT's CST analyzer on pure WebAssembly (web-tree-sitter+tree-sitter-wasms), preloading11compiled.wasmgrammars covering10languages and14enterprise extensions (.js,.mjs,.cjs,.jsx,.ts,.tsx,.py,.php,.java,.cs,.go,.rb,.rs, and.kt). WhenWO-101targetssrc/fee-engine.js,analyzeBlastRadiuswalks the 2-hop call and import graph (src/fee-engine.js -> src/settlement-service.js -> src/sox-reconciler.js) before a model writes a single token. - Parallel Disjoint AST Leases & Sub-25µs CPU Routing: Because Planner knows exact 2-hop file neighborhoods, it computes disjoint AST file leases across concurrent Work Orders so
WO-101(billing fee math),WO-102(constant-time webhook HMAC insrc/webhook-handler.js), andWO-103(signed keyset pagination insrc/invoice-list.js) can run in parallel without merge collisions. Simultaneously, the pure-CPU in-process Stage-0 syntactic gate (selectCascadeTierfrom@krusch/toolkit/cascade, completing its routing decision in<25µsprior to model inference) keeps bounded single-file plumbing on fast worker models while escalating multi-hop financial invariants to frontier reasoning and cross-family verification.
3. Stage 3 (Foundry) & Stage 4 (Validator): The +1¢ SOX Self-Rejection Loop
The centerpiece of my live EVOLVE demo is the split-screen WO-101 execution inside the DEADBOLT Breaker Panel. A legacy billing service splits a $100.00 invoice across three line items (3334¢ + 3333¢ + 3333¢ = 10000¢ gross) at a 2.5% (250 bps) processor fee. At the batch level, 2.5% of 10000¢ is 250¢, leaving an expected net settlement of 9750¢. Under INV-FIN-03, the sum of settled line-item net payouts plus the batch fee must equal the gross invoice total with zero cent variance.
| Execution Path on WO-101 | Patch Strategy | Single-Line $100 Test | 3-Way Split Ledger | Policy Floor & Review | Final Outcome |
|---|---|---|---|---|---|
| Baseline: Standard Single-Model Agent | Naive per-item Math.round in fee-engine.js |
Passes (False Green) | 9751¢ vs. 9750¢ (+1¢ drift) |
Misses 2-hop sox-reconciler.js; same-family rubber-stamp |
UNSAFE MERGE (SOX batch violation) |
| DEADBOLT Attempt 1 | Naive per-item Math.round (83¢ + 83¢ + 83¢ = 249¢ fee) |
Passes | deltaCents = +1 caught in Node 22 sandbox |
Halted before LLM review | GATE_REJECTED (penny variance) |
| DEADBOLT Attempt 2 (Sneaky Workaround) | Agent edits src/sox-reconciler.js (MAX_TOLERANCE_CENTS = 2; strictSox = false) |
N/A (Blocked pre-exec) | Protected path & CST bypass detected | FLOOR-PATH-PROTECTED + ElevenLabs Foreman alert |
WORKAROUND_REJECTED (audit logged) |
| DEADBOLT Attempt 3 (Remediation) | Integer basis-point largest-remainder carry in src/fee-engine.js |
Passes | 9750¢ === 9750¢ (0¢ delta) |
<1ms Slop Breaker 0 hits + Gemini & DeepSeek approve |
VERIFIED PR + SHA-256 8090 Receipt |
Crucially, createValidatorEngine (src/engines/validator-gate.js) enforces a strict, non-overridable four-step execution order (INV-DB-04):
- Step 1A: Import-Frozen Policy Floor (
SOX_POLICY_PROTECTED_PATHS&SOX_TOLERANCE_BYPASS_RULE): Before running any candidate code or calling any reviewer LLM, DEADBOLT inspects the staged diff against anObject.freezepolicy floor and WebAssembly Tree-sitter CST nodes. Any attempt to touchsrc/sox-reconciler.js,src/settlement-service.js, or.sw-factory/policy.lock, escape the Work Order's file lease, or assignstrictSox = falseorMAX_TOLERANCE_CENTS > 0is deterministically rejected asWORKAROUND_REJECTED, appended to the HMAC SHA-256 hash-chained audit log, and announced out loud by the ElevenLabs Factory Foreman voice alert. - Step 1B: Sub-Millisecond Slop Breaker & Sandboxed SOX Ledger Execution: Candidate edits must score zero findings on
@krusch/toolkit's 16-rule<1msstatic Slop Breaker (scoreLegoBrickCoverage) and execute inside an isolated Node 22--permissionchild process stripped of host secrets, verifyingdeltaCents === 0across holdout multi-line split invoices. - Step 2: Fail-Closed Separate-Family Model Review: Only after every deterministic gate passes does DEADBOLT invoke two distinct model families concurrently (
Gemini+DeepSeekviaPromise.allSettledwith a bounded4500mstimeout). My fail-closed parser (parseReviewerVerdictPayload) strips reasoning<think>...</think>blocks and requires explicit structuredAPPROVEconsensus. - Step 3: Disagreement Escalation & Measured Cost Accounting: No model vote can ever override a failed deterministic check, and if the two reviewer families disagree (or a live provider errors out), DEADBOLT halts automatic promotion with
ESCALATE_TO_HUMANrather than silently degrading to single-model approval.
4. Five Hardening Problems I Solved Building and Auditing DEADBOLT
Shipping a governance layer meant holding DEADBOLT's own code to strict L0 Principal Engineer and Chief Security Officer audits (`0` `krusch-lego audit` boilerplate findings across `src/` and `client/src/`, `18/18` automated integration tests passing). Five concrete engineering challenges stood out:
1. Multi-Process Worker SIGKILL and Cold SQLite WAL Journal Recovery (INV-DB-06)
Staging diffs in memory is meaningless if a crash mid-promotion leaves a repository half-written on disk. In src/engines/foundry-staging.js, stageWorkOrderEdits isolates unverified edits inside a scratch copy backed by SQLite WAL intent rows, and applyVerifiedStage records preimages in a symlink-guarded persisted journal (.krusch-stack/repo-apply.db) before executing per-file POSIX renameSync swaps.
// Real 2-process crash drill (POST /api/drills/crash-recovery):
// 1. Spawn apply worker on isolated drill-stack.db
// 2. Pause & send OS SIGKILL immediately after the 1st renameSync (state = APPLYING)
// 3. Cold-boot a fresh Node process running recoverInFlight()
// Result: preimages restored deterministically, halfWrittenFiles === 0
renameSync swap is atomic, whereas a multi-file batch is crash-recoverable rather than an atomic cross-filesystem transaction: another OS process reading mid-batch could briefly observe file 1 updated before file 2 until completion or cold-process WAL rollback restores the preimages.
2. Defeating Comment, Raw-String, and Destructured AST Bypass Tricks (INV-DB-TS-01)
Regex-based policy guards fail in both directions: they false-positive when a developer documents // Never set strictSox = false in a comment, and they miss obfuscated workarounds such as destructured aliasing or bracket-property writes in dynamic languages. By pairing a state-machine JavaScript regex/template literal masker with WebAssembly Tree-sitter CST traversal across all 11 loaded grammars, DEADBOLT ignores policy strings inside Python docstrings, Go/Rust raw strings, and JS comments while catching obfuscated CST mutations on protected reconciliation state.
3. Node 22 Permission Sandboxes, Credential-Less Clones & Confused-Deputy Gates (INV-DB-07)
DEADBOLT's Tab 2 lets a user paste any public GitHub URL (including messy browser URLs like /tree/master/... or /blob/main/...) to run a 28-rule polyglot brownfield scan and head-to-head modernization wave. Allowing arbitrary repository URLs and untrusted issue text introduces immediate SSRF, Git hook, and prompt-injection vectors. I hardened all three boundaries:
- DNS-Pinned URL Validation & Hardened Shallow Clone:
normalizeGitHubRepoInputrejects path-traversal segments (..) and reserved GitHub routes, validates hosts throughvalidateOutboundUrl, and runsgit clone --depth 1 --single-branch --filter=blob:limit=256kviaexecFile(shell: false) with credential helpers, symlinks, and Git LFS disabled. - Subprocess Env Stripping & Filesystem Lockdown: Candidate billing patches run inside a child Node 22 process using experimental
--permissionflags restricted strictly to the ephemeral scratch directory, with all host API keys stripped from the child environment. - 3-Layer Confused-Deputy Gate Before Composio Dispatch: Untrusted Slack/ticket comments containing prompt-injected instructions (verified live via
POST /api/drills/confused-deputy) are sanitized withsanitizeAgentMessage, delimited as untrusted data, and blocked from triggering outbound Composio PR creation until Stage 4 returns a cryptographicVERIFIEDaudit entry.
4. 8090 Tri-API Governance Control Plane & Stage-4 Receipt Forgery Lock (INV-DB-09)
To integrate natively with 8090's platform rather than treating it as a mock webhook, src/connectors/sponsors.js wires all three 8090 Software Factory v2 API surfaces (Organization Admin sofa-admin-*, External Project API sofa-ext-*, and Reporting sf-rpt-*) alongside a 5-tool MCP server (src/mcp/deadbolt-mcp.js) that mirrors 8090's exact MCP permission model: 4 read-only tools (readOnlyHint: true -> 8090 Allow for unattended Drift Bot automations) and 1 mutating action tool (deadbolt_apply_verified_stage -> 8090 Confirm human approval gate). In addition, POST /api/sofa/sync-receipt refuses to write governance receipts back to an 8090 Work Order unless findLatestVerifiedEntry locates a genuine 64-hex SHA-256 validator.verified ledger entry for that exact workOrderId (returning 409 UNVERIFIED_STAGE_BLOCKED on unverified stages or cross-tool modernizer.verified collisions).
5. Head-to-Head Legacy Modernization Without Venue Network Stalls (INV-DB-08)
In Tab 2 of the Breaker Panel (src/engines/modernizer-benchmark.js), DEADBOLT benchmarks legacy repository modernization (such as porting taniarascia/pdo PHP CRUD SQL anti-patterns into governed Next.js App Router bricks) across two arms: Arm A (a single frontier model stuffed with full-repo context) versus Arm B (HydraDB 2-hop dependency slicing + <25µs CPU Cascade routing + <1ms Golden Brick & vm.Script syntax validation + 2-family consensus, writing :SUPERSEDES lineage back to HydraDB strictly when verification succeeds). To survive congested hackathon Wi-Fi without hanging the UI, I added 1500ms fast-break probes on optional local GPU endpoints, strict 3500ms header/body timeouts with deterministic PCM16 WAV fallback on ElevenLabs voice synthesis, and honest costPerVerifiedTaskUsd telemetry that reports null whenever a run is unverified or executed in offline deterministic mode.
5. Where Deterministic Factory Governance Fits in Production
1. FinTech, Billing & Ledger Pipelines
Sub-cent rounding drift, idempotency races, and webhook spoofing hide behind green single-record unit tests. Pairing 2-hop CST blast-radius planning with out-of-process integer-cent invariants blocks silent ledger corruption before human code review begins.
2. High-Throughput Brownfield Modernization
Enterprise teams migrating PHP, Java, C#, Python, or legacy Node monoliths cannot afford full-repo frontier context stuffing on every ticket. Slicing 2-hop subgraphs via Tree-sitter and HydraDB lets fast models apply pre-audited Golden Bricks safely in parallel.
3. Audited AI Software Factories
Compliance and security teams need cryptographic proof that an autonomous agent could not weaken its own test suite or exfiltrate secrets via prompt-injected tickets. Import-frozen policy floors and HMAC SHA-256 audit chains make every automated PR inspectable.
6. Run the DEADBOLT Breaker Panel or Attach via MCP
DEADBOLT is open-source under the MIT License at github.com/kruschdev/deadbolt. You can boot the full 3-tab Breaker Panel locally, run the 18-test invariant and SIGKILL recovery suite, or attach the 5-tool stdio MCP server directly to 8090 Software Factory, Claude Code, Cursor, or Antigravity:
git clone https://github.com/kruschdev/deadbolt.git
cd deadbolt
cp .env.example .env
npm ci && npm test
npm start
# Open http://127.0.0.1:4090 for the 3-tab Breaker Panel, or run `npm run mcp`