Essay · Kiroween 2026
Why a real passing test run still shipped a broken auth check
Every coding agent has the same blind spot. It finishes implementing a feature, runs the test suite, and sees four clean passing assertions in stdout. Before marking the task complete, it performs one tiny cleanup edit inside src/auth.js:
Those green test logs in the agent’s context window are completely real. Nothing was fabricated. They just belong to the bytes that existed before && became ||. Trusting memory instead of cryptographic state, the agent checks - [x] T-01 done, hands work to the next task, and any viewer with MFA enabled can now delete billing.
SpecCoven stops that failure mode at the byte level. Every recorded check is pinned to the exact SHA-256 digests of its declared repository scope. Change one character anywhere inside src/auth.js after the suite runs, and SpecCoven invalidates the proof immediately:
Four components on one pure TypeScript core
Instead of wiring brittle wrapper scripts around an LLM prompt, SpecCoven puts one zero-dependency TypeScript verification core (verifyEvidence() plus SHA-256 hashing) behind four interfaces that agree down to the digest:
- Git plumbing CLI (
src/cli.ts,src/local/repository.ts): Inspects repository files directly viagit ls-files -vandgit cat-file, isolates documentation-only checkbox toggles withmaskCheckboxes()so flipping[ ]to[x]insidetasks.mddoes not falsely invalidate passing code evidence, renders human-readable proof cards with--pretty, and replays archived receipts offline withspeccoven replay. - Kiro hooks & stdio MCP (
src/local/kiro-hook.ts,src/mcp.ts): Enforces task gates inside Kiro via a fail-closedPreToolUsehook returning exit code2onstr_replace,fs_write,edit_file,write_file,execute_bash,bash, andshell—preventing both checkbox edits and quick shell sed bypasses—paired with a 7-tool, 2-resource JSON-RPC 2.0 MCP server. - Browser Specimen Lab (
web/lab.js): Runs real JavaScript assertions inside an ES-module Web Worker under strict Content Security Policy (zerounsafe-eval) with Web Crypto SHA-256 hashing, letting anyone watchSTALE_EVIDENCE,MISSING_EVIDENCE, andT-01 → T-02handoff gating live in the browser. - SVG notary seals & EARS fuzzer (
src/core/seal.ts,web/pbt.js): Exports standalone.svgnotary seals embedding canonical receipt payloads inside<metadata id="speccoven-proof">so any receipt stays verifiable offline without servers, alongside a browser fuzzer exercising propertiesP1–P5across 1,250 randomized mutation trials in under200 ms.
The Kiro hook bug that shaped the architecture
SpecCoven was built spec-first inside Kiro from 8 EARS requirements (34 acceptance criteria), design.md, and an 18-task implementation plan tracked in .kiro/specs/speccoven-core/. Early in Phase 2, testing on kiro-cli 3.7.1 surfaced an unexpected harness limitation: PostFileSave hooks had their stdout and stderr suppressed even when exiting non-zero (exit 1), making post-save warnings invisible to the active agent session. We documented the reproduction in SPIKE_LOG.md and designed a fail-closed architecture around it rather than trusting silent advisory hooks:
{
"trigger": "PreToolUse",
"matcher": "^(str_replace|fs_write|fs_append|edit_file|write_file|execute_bash|bash|shell)$",
"command": "node bin/kiro-hook.js",
"timeout": 10
}
That .kiro/hooks/speccoven.json contract drives three deliberate architectural boundaries, verified live on kiro-cli 3.8.1:
- Out-of-band diagnostics + steering rules: Post-save audit summaries are persisted to
.speccoven/out/last-save-report.jsonand surfaced alongside rules in.kiro/steering/epistemic-rules.mdso neither agent nor user flies blind. - Fail-closed
PreToolUseinterception:bin/kiro-hook.jsinspects proposed file edits and shell commands before execution, returning exit2whenever a checked task lacks fresh passing evidence for its current file hashes. - Structured MCP inspection: Agents query verification state, task handoffs, and saved receipts cleanly over 7 MCP tools and 2 resources configured in
.kiro/settings/mcp.json.
When we attempted to mark T-01 complete in a live kiro-cli 3.8.1 session while src/auth.js carried unverified edits, Kiro stopped the tool call cold:
[tool] Read File
[tool] status: Completed
[tool] Replace in File
[tool] status: Failed: Replace in File
A hook blocked the edit. Here is the verbatim output:
SpecCoven blocked T-01: {"task_id":"T-01","task_type":"code","task_checked":false,"verdict":"STALE_EVIDENCE","checks":[{"check_id":"test","command":"node test/auth.js","exit_code":0,"status":"STALE","file_drift":[{"path":"src/auth.js","recorded":{"sha256":"f90711ea8ca88eef74cf8c597d97c2fa351db0c7dd8df7bb89d9c6be883c3e9f","mode":"100644"},"current":{"sha256":"5850cdd7f2ae69bd203d6309de3fd79d76a3dae5be915326f45d3b185aba0748","mode":"100644"}}]}],"changed_paths":["src/auth.js"],"unscoped_paths":[]}
Self-verification, benchmarks, and limits
Rather than relying solely on synthetic examples, SpecCoven verified its own development commits across 14 archived evidence pairs in .kiro/specs/speccoven-core/evidence/. Every invariant is exercised across both Node.js and the browser Web Worker:
You can reproduce the entire suite and replay an archived SpecCoven self-verification pair locally from the repository root:
npm ci && npm test
node bin/speccoven.js replay \
--bundle .kiro/specs/speccoven-core/evidence/phase-2/T-01/evidence-bundle.json \
--manifest .kiro/specs/speccoven-core/evidence/phase-2/T-01/current-state-manifest.json \
--pretty
Honest v1 boundary: SpecCoven v1 binds test receipts to Git commits, file modes, and SHA-256 content hashes for local determinism and offline replay. It does not claim asymmetric hardware signing or CI identity attestation—adding Sigstore or GitHub OIDC provenance on top of the exact same receipt schema is the natural next step for shared CI pipelines.
Try it live
Nothing in the workflow requires trusting slides. You can open the live Specimen Lab, break src/auth.js yourself, inspect all 14 self-verification receipts, or load a pre-generated STALE_EVIDENCE snapshot directly via URL fragment:
- Interactive Lab, Offline Verifier & Browser Fuzzer pauljones0.github.io/speccoven/ →
- Preloaded STALE_EVIDENCE #proof= Snapshot Open in Verifier →
- MIT Source Repository, Kiro Specs & SPIKE_LOG github.com/pauljones0/speccoven →