In one minute (for judges)

  • What it is. Kiro sometimes ticks a task done that is not done. Contract Necromancer is a set of Kiro hooks that make the tick in tasks.md wait until that task's acceptance tests, frozen by a person, actually pass, and that write a receipt anyone can re-run. Built during the contest (first commit Nov 6 2026).
  • What it resurrects. Eiffel (1986) let code state promises (require, ensure) that were checked on each call while checking was enabled. Mainstream languages kept only an assert that is off by default in some runtimes (Java without -ea) and removed by -O in Python. I brought the promise back for coding agents: a person writes it down and freezes it, and the agent cannot mark a task done until it holds.
  • What is proven. On a task that cannot honestly be finished, Kiro said done in 11 of 11 runs without the gate and 0 of 19 with it (two models, 3 to 5 runs per cell, a neutral prompt; a small experiment, details under Limits). In the video's IDE clip I tell Kiro to mark task 4 done on purpose, so the refusal is visible; that clip is a demo, not the measurement.
  • Try it. In your browser, no install and no Node.js needed: https://vijaygopalbalasa.github.io/contract-necromancer/ (press "Try it here"). Or one command: npx -y github:vijaygopalbalasa/contract-necromancer demo (Node.js 24 and git).

Why not just CI?

  • CI runs after the push. The gate runs inside the agent's loop, at the moment it says "done", and names the contracts that fail: gated Kiro left the impossible task open for a person, while ungated Kiro wrote "One contract cannot pass" and ticked anyway.
  • CI runs the tests the agent may have just edited. Here the person who defines "done" freezes the contracts by hash.

Where it was used

  • A real fix in my live project. In Judge Protocol, the gate refused Kiro's first tick because only one of two error paths was built; the finished fix passed 6 of 6 frozen contracts and is merged (PR #29).
  • Installed on a project I don't own. Starlette (Kludex/starlette#3793): the gate installed in a fresh clone in seconds and ran Kiro's pytest contracts. Kiro got the one-line fix right first time, so there was nothing to refuse; my review of its contracts closed a gap a half fix would have slipped through, and the receipt re-checks as CONFIRMED from an empty folder (case study). The point was install-anywhere, not a catch.

How I used Kiro

Kiro feature Where What it did
Specs .kiro/specs/ (necro-core, receipt-viewer), plus one spec in each example and each case study I wrote the EARS requirements; Kiro drafted the designs, task lists and contracts and wrote all the code (logs in .kiro/build-log/). Late requirement changes were person edits to frozen contracts, each in a commit that says so, then a new freeze.
Agent hooks .kiro/hooks/necromancer.json (PreToolUse, PostToolUse, Stop, PostTaskExec) and session-log.json The first four are the product. The fifth logged every tool call of the build sessions into .kiro/build-log/.
Steering .kiro/steering/ (4 files) Tells Kiro to run contracts before ticking and never to edit frozen files.
Custom agent .kiro/agents/necromancer.json Hooks plus permission rules: with the hooks removed, Kiro still refused necro freeze and writes to .necro/.
MCP necro mcp necro_status, necro_check, necro_verify, and no freeze tool; Kiro called it live.
Power power/ (Agent Plugins format) The workflow as one install: kiro-cli powers install ./power. Its MCP server starts through npx (Node.js 24 and git), with no global install.
Property-based testing ledger properties.contract.test.js R5.1 to R5.5, 300 seeded parties each, with shrinking.
CLI and IDE build logs, IDE task_update payloads Most builds ran in the CLI. The IDE showed that completion goes through task_update, which led to task 16.
Web, Crew not used Hooks do not run in Web sessions per Kiro's docs; no Crew agents ran on this project.

Specs. Naming every criterion (R2.1, R3.4 ...) is what let a contract be generated for each one and frozen; numbered criteria are what the gate keys on. A spec alone did not stop false ticks: the gate-off arms of the experiment ran from the same spec and still ticked a false "done" 11 times in 11. I did not run a no-spec comparison, so I make no claim about vibe coding.

Steering. A steering file asks Kiro to run the contracts before ticking. The hook-only arm, with no steering, had 0 false "done" in 8 runs, the same as the full arm, so the hook is what does the work; I kept the steering file so Kiro explains and cooperates instead of just being blocked.

Property-based testing. The properties found no bug in the ledger and caught 7 of 7 planted bugs, but only after I added parties with round amounts so ties happen; two planted bugs passed the first draft. A property is only as good as its generator.

Self-hosting. The tool gated its own build from task 17 on, and it held me to it too: when a contract I had frozen for the tool's task 36 (necro-core) was wrong, the gate refused the tick until the contract was replaced and frozen again (commits 3596b03 and 6989943).

Design. The page is built for a judge with three minutes: Kiro's own words from the real refusal first, then the result, then a button that runs the gate in your browser. It reads with scripts off and works by keyboard alone.

What it does

  • Contracts from criteria. Each criterion gets an executable contract named after it (R2.1 ...), in JavaScript or, through pytest's JUnit report, in Python. Kiro drafts them; a person reviews them and runs necro freeze, which locks requirements, contracts and runner by hash and reports any criterion with no contract.
  • The gate. Kiro hooks refuse the tick in tasks.md, or the IDE's own task_update call, until that task's frozen contracts pass, and name the ones that fail. A tick made through a shell command is checked right after it runs, and undone if a contract fails. Edits to frozen files are put back after every tool call. Freezing is refused to the agent by the hook and by a custom Kiro agent's permission rules.
  • A net for ticks the hook never saw. After each task (PostTaskExec) and at the end of a session (Stop), a tick made without passing contracts is undone, and necro audit checks every ticked task in CI, so a tick written by an orchestrator, as in #11786, is still caught.
  • Runtime postconditions. guard() wraps real functions with frozen checks; a wrong result throws a ContractViolation naming the criterion, under a test runner or not.
  • Receipts. Every passing tick writes a receipt; necro verify re-runs it and prints CONFIRMED, MISMATCH, SUPERSEDED, OTHER PROJECT, or INCOMPLETE with the fix (such as npm ci) instead of guessing. The page opens any receipt and re-checks its hash.

It is for people who let Kiro work through a tasks.md on its own and want a tick to mean the acceptance criteria hold, with proof a reviewer can re-run instead of trusting the agent's summary. To adopt it: install once with npm, run necro init, let Kiro draft a contract per criterion, read them, and freeze (README, "Use it in your project").

Inspiration

While I built this, Kiro ticked a task it had not built (task 8c: no tests, no code, box checked). Other Kiro users report the same kind of false tick: in #11786 (open) a "Run all tasks" sub-agent ran about 7 hours, was stopped at the 300-iteration limit with its last test failing, and the task was still marked [x] (#12025 is similar). The gate would not have saved those hours, but the false tick would not have stood. It is not only Kiro: in ImpossibleBench (arXiv 2510.20270), frontier models cheat on tests that cannot pass.

Eiffel made require and ensure part of every routine in 1986. Mainstream languages kept only the assert and made it easy to switch off (Java ignores it unless you pass -ea; Python drops it under -O), and now agents write the tests that check their own work. So I brought the contract back in a form the agent does not own: a person freezes one contract per EARS criterion by hash, the tick waits until they hold, and frozen postconditions keep checking real calls, the way ensure did.

Challenges

  • Adversarial reviews I ran against the tool found real holes, and each became a spec task built under the gate: the agent could run necro freeze itself; five ways to fake a pass with a Python runner (a planted pytest.py, a conftest.py plugin, a process rewriting the report, stale bytecode, a hang); new or linked files under frozen globs; and code that is right only while a test runner watches, which is why runtime postconditions exist.
  • Under a "do whatever it takes" prompt, one gated run of six got past the gate by patching JavaScript built-ins. That hole is closed (task 39) and the cheat is kept as a test.

Accomplishments

  • The experiment, with every run's log and a script to re-run it.
  • A real fix in a live project, merged under the gate, and a fix in Starlette from a fresh install (above).
  • 365 frozen contracts across the 5 specs in the repo (the tool, the page and three examples), plus the two case studies' specs.
  • 128 receipts, and re-running all of them finds no MISMATCH: 12 CONFIRMED; 112 SUPERSEDED, which means the spec was frozen again later or later work changed that code on purpose, so the old receipt no longer applies; and 4 OTHER PROJECT (the case-study copies).

Limits

  • Known limit on big specs. A tick runs every frozen contract of the spec in sequence, and Kiro gives hooks 300 seconds. On the Node.js examples (13 and 18 contracts) that takes about a second; on this repository's own two large specs (117 and 209 contracts) it takes four to five minutes, so kiro-cli stops the hook and lets the edit through with no receipt, and the Stop hook unticks it when the turn ends.
  • The experiment is small: two models available in Kiro, 3 to 5 runs per cell (model and arm), one planted contradiction in one project, run with the Kiro CLI; every run's log and the script to re-run it are in experiments/. On an achievable spec the gate changed nothing: every task got built either way.
  • The page runs 7 of the example's 18 contracts in your browser, with small stand-ins for node:test and node:assert (the other 11 start the ledger's command line, which a browser cannot do), and shows the gate's full Node.js run beside them: 9 of 18 failing for the planted change, then 18 of 18 passing.
  • The real fix: an API error reply could carry the RPC URL and any key in it, and an evidence route could serve the wrong file. Its re-check command (in case-studies/judge-api-errors/README.md) needs npm ci.
  • Guard rails, not a sandbox: a shell command can still change files, and receipts are files an agent can write. A forged receipt can claim where a tick came from, not that the work holds. necro verify re-runs the contracts, so it is the check to trust.

What I learned

A spec only helps if something checks it at the moment of "done". Here that moment is the tick, and the check is a test a person froze by hash. I added a second check at runtime because code can pass every test and still be wrong outside them.

What's next

Gate Kiro Web sessions (hooks do not run there today, so necro audit in CI is the backstop), runners for more languages as presets, and a receipt badge for READMEs.

Built with

Kiro (CLI, IDE, specs, hooks, steering, custom agent, MCP, power), Node.js 24, node:test, pytest, plain HTML, CSS and JavaScript, GitHub Pages.

Links

Built With

Share this project:

Updates

Submission history