Inspiration

COBOL still runs a huge share of the world's benefit, banking and insurance code, and the people who wrote it have mostly left. Rewriting it is the easy part. Knowing the rewrite behaves the same is the hard part, because the old program does things no document mentions. We wanted to resurrect a dead language's behaviour and prove, case by case, where the new code differs.

What it does

Necromancer is a differential verification workbench for legacy COBOL migrations.

  • The oracle is the real program. UICALC, a small unemployment-benefit calculator we wrote in COBOL for this project, is compiled with GnuCOBOL 3.1.2. Whatever it prints is the truth.
  • The twin is the rewrite. A Python twin was written from the written rules alone. The harness feeds both the same 80-byte records and compares the 40-byte answers.
  • It shrinks disagreements. Every mismatch is cut down to the smallest claimant that still breaks, with a rule trace that shows which of the ten rules fired.
  • A person decides. Each run ends in an approval card ("Bury or revive?") and recorded decision records. Nothing ships by itself.

On the hosted demo, the baseline run matches 3,901 of 3,901 cases. Injecting a planted bug (mutation M4) drops that to 3,289 of 3,901, with 612 mismatches, and the shrink step lands on a claimant. After the recorded patch, a larger rerun matches 40,838 of 40,838 and still waits for human approval.

A real paragraph, translated by Kiro

We took one verbatim paragraph from the AWS CardDemo sample, 1300-COMPUTE-INTEREST, and had Kiro translate it to Python from a task file alone.

  • kiro_v1 differed from the COBOL in 2,393 of 51,251 cases (338 of the 3,251 cases the hosted page runs). Every one was an overflow: the COBOL has no ON SIZE ERROR and keeps the low-order digits, while the translation raised an error.
  • kiro_v2 (after we chose to preserve the wrap): 3 mismatches, where the COBOL stores negative zero and the translation returned positive zero.
  • kiro_v3 (after we chose to preserve that too): 0 mismatches in 51,251 cases.

The two decisions are drafted as records and are marked unconfirmed until a reviewer signs them.

How we built it

Python for the twin, harness, API and the MCP server. A React and TypeScript front end. GnuCOBOL for the oracle. Hypothesis for property-based tests. Vercel for hosting. The .kiro directory holds steering docs, five specs, three custom agents, two hooks and an MCP registration for the oracle server. See the Kiro write-up in Additional info, and KIRO.md in the repository for a plain account of what was and was not run in Kiro.

Challenges

  • Making every number carry its denominator. The site never says "verified". It says what happened on the cases counted.
  • Counting honestly: the console runs a 3,901-case demo profile, the Legacy page runs a 3,251-case hosted sample, and the full runs are larger. We label which is which.
  • Kiro's shell did not work inside the IDE in our setup, so the Kiro-written code was checked outside Kiro, and we say so.

What we learned

A rewrite that agrees on thousands of cases can still disagree on the one the business cares about. Planting known bugs and checking that the harness catches them (5 of 5 named and 5 of 5 hidden mutants caught over 4,090 cases, a recorded sweep) tells you more about the harness than a green run does.

Honest limits

UICALC is synthetic. Its rules are not any state's law. Results are evidence over the cases counted, never proof of equivalence. Only the pinned GnuCOBOL version was exercised.

What's next

More COBOL dialects and compilers, real record layouts, and a reviewer workflow for signing decision records.

Built With

Share this project:

Updates

Submission history