Inspiration

Dead packages don't stop being installed. lodash.set 4.3.2 had its last release on 2016-08-13, carries a HIGH prototype-pollution advisory with no fixed version, and still had 2,034,648 weekly downloads and 10,593 dependents when I analysed it. inflight 1.0.6 lives in an archived repository and still had 125,872,941 weekly downloads.

A scanner can only tell you to replace such a package, which often means a rewrite nobody has time for. I wanted to bring the package itself back, fixed. But a fix written by an AI agent is only worth installing if you can prove it changed the one behaviour it was meant to change, and nothing else. Graveyard Shift is built around that proof.

The figures come from the npm registry, npm downloads and deps.dev, fetched by the Coroner on 2026-11-16 and 2026-11-17. Each one is shown with its source and fetch time on the site.

What it does

Four roles take a package from the graveyard to a signed, re-checked resurrection:

  1. Coroner analyses the package and writes a death certificate: status, time of death, causes, risk score and open vulnerabilities. Every fact carries its source URL and fetch time.
  2. Gravedigger applies eligibility rules (licence, no dependencies, module type, size, status, causes, an open advisory), each with its own provenance. inflight fails three of them and is shown as not resurrected, with its successor lru-cache.
  3. Medium is a Kiro CLI agent that runs locally. It reads the certificate and the original files through a read-only MCP server and writes only three things: the fixed package, a deltas.json that declares each intended behaviour change, and a harness.json that says how to test it. A hook blocks every other write.
  4. Undertaker is GitHub Actions. It validates the Medium's output, then runs the Proof of Life: a property-based comparison of original and resurrection in a sandbox. It passes only if every other behaviour is identical and every declared change is demonstrated. If it does, it signs the tarball, proof report and certificate as GitHub attestations and publishes the entry to graveyard/.

Every night a workflow replays each proof, verifies the three attestations and re-checks advisories against OSV. Then the Crypt site rebuilds with the results. The site shows only what the committed files say, and states plainly what it has not checked itself.

How I built it

Kiro is used twice here: as the IDE that built the project spec-first, and as the agent inside the product.

  • Specs. Five Kiro specs, each with requirements, design and tasks: autopsy-engine, proof-of-life-engine, resurrection-pipeline, medium-agent and crypt-ui. Together they hold 811 acceptance criteria. npm run trace maps each test file's // Requirements: header to those criteria. Every criterion without a test is classified (manual, documentation only, optional) in docs/traceability-gaps.json.
  • Steering. structure.md and tech.md keep the layout (pure core/, thin shell/), the commands and the test budgets in front of every Kiro session.
  • Custom agent. The Medium is .kiro/agents/medium.json, run with kiro-cli chat --v3 --no-interactive --require-mcp-startup --agent medium.
  • Hook. A PreToolUse hook, the Write_Guard, blocks any write outside the resurrection outputs (exit code 2). The allowed paths come from the same module the CI intake uses.
  • MCP. A dependency-free stdio MCP server, mediumcontext, gives the agent six read-only tools: certificate, eligibility, advisories, file list, file read, and the preset menu with the output schemas.
  • Boundaries. The agent runs only on the developer's machine, with tokens, keys and secrets removed from its environment. CI never calls an LLM, and a test enforces that. CI re-derives and proves everything the agent produced before anything is signed.
  • Workflow. Implementation in Kiro Spec mode with the Auto model, a stronger model only for planning. Kiro ran typecheck, lint and single test files; full suites, builds and every credit-spending run were done by hand at checkpoints. Each result is recorded in docs/kiro-journal.md with its date and command.

Challenges I ran into

The first real attempts failed, and the safety checks are what caught them.

  • The agent didn't know the output format. On the first lodash.set run, the Medium stopped without writing deltas.json. The fix was to serve the JSON Schemas of both output files, with a worked example, in the MCP preset menu.
  • A fix that was too broad. The first ip attempt was rejected locally. The intake refused a date-only fetch time, the fix changed more than the advisory needed, and README was missing from the copy. I added date normalisation, written definitions for each input class, and a rule to copy every original file unchanged except the fix.
  • Proving the guard, not trusting it. I ran the real Write_Guard inside real kiro-cli. Writes to README.md, .github/, .kiro/ and a look-alike Resurrection/ folder were denied; writes to resurrection/ and deltas.json were allowed.
  • Property tests found my own bugs. One counterexample showed the nightly accepted four "ok" attestation results; it now requires exactly three. Another led to the advisory rule citing OSV instead of the npm registry.
  • Static hosting edge cases. Next.js static export refuses an empty route list, so an empty crypt now builds a placeholder page that is never linked. CI typecheck failed on Linux because a generated next-env.d.ts was missing, which I fixed with a committed declaration. At 320 px wide, long hashes overflowed the page until they were allowed to wrap.

Accomplishments that I'm proud of

Two real packages, each with a HIGH advisory that had no fix, are alive, signed and re-verified, and every claim on the site can be checked by anyone.

Package Versions Declared change PR Signing run Nightly 2026-11-18
lodash.set 4.3.2 → 4.3.3 no prototype pollution (GHSA-p6mc-m468-83gw), demonstrated #8 44131158893 replay identical, 3 attestations verified
ip 2.0.1 → 2.0.2 isPublic SSRF miscategorisation fixed (GHSA-2p57-rm9w-gvfp, CVE-2024-29415), demonstrated #9 44143541821 replay identical, 3 attestations verified
inflight 1.0.6 not eligible; successor lru-cache — — not resurrected, no new advisories

Nightly results come from run 44294930577, which also started the site deploy that shows them.

  • Tests. 229 test files, 2,658 tests passed and 12 skipped on 2026-11-18, across engine, pipeline, proof and UI projects. Each project stayed within its time budget.
  • Traceability. Of 811 acceptance criteria, 722 are cited by tests. The other 89 are each classified with a reason.
  • Cheap agent runs. The two successful Medium runs moved the Kiro credit meter 2160.48 → 2162.31 (lodash.set) and 2192.7 → 2195.15 (ip). The whole build used 2677.41 of 4,000 credits.
  • No production vulnerabilities. npm audit --omit=dev reports 0. One dev-only advisory (picomatch, via vitest) is documented and accepted.

What I learned

  • Specs are the contract with the agent. Each Kiro task named the criteria it met, so a checkpoint could say exactly what was done and what was not.
  • Enforce in code, not in the prompt. The prompt asks the Medium to write only its outputs; the hook and the CI intake make sure it does. The failed attempts were caught by checks, not by reading the agent's words.
  • Proof beats review. A property-based comparison over hundreds of generated cases (211 for lodash.set) says more about "nothing else changed" than any diff review.
  • Honest output is a feature. The site says "This site has not verified the attestations" and gives the commands to do it. Missing data is shown as not provided, never filled in.

What's next for Graveyard Shift

  • More presets. Each package needs input generators the proof can trust (lodash.set paths, IP address classes). A wider preset library opens up more of the graveyard.
  • Publishing. Today nothing is published to npm, by design, and a test enforces that. The next step is a reviewed path to a registry under a clear name, so projects can depend on a resurrection.
  • Alerts. Open an issue automatically when a nightly re-verification fails or a new advisory appears.
  • Handing packages back. Offer each proven fix to the original maintainers, with the proof report attached.

Built With

Share this project:

Updates

Submission history