Inspiration

Wikipedia's PHP article says Microsoft Azure can be used with the Windows Azure SDK for PHP, and cites a Microsoft page. Click it today and you land on an Indonesian lottery site. The page answers 200 OK, so every dead-link checker in the world reports it as alive.

Editors know this happens. They tag these citations by hand (url-status=usurped), and 155,603 English Wikipedia articles already carry at least one such tag. Nobody knows how many are untagged, in Wikipedia or in the READMEs, docs and reference lists the rest of us write. Dead links are a solved problem. Links that came back wrong are not.

What it does

Give Revenant a Wikipedia article, a GitHub README or file, a web page or pasted text. It extracts every link with the sentence it supports, then examines each one:

  • ☠ Possessed: the domain changed hands (parked, for sale, gambling or spam). Signals include an RDAP registration date later than the citation, spam vocabulary in seven languages that the archived copy never had, and redirects to gambling-named domains.
  • ◐ Changeling: same site, but the cited content was replaced.
  • ◌ Ghost: a soft 404 (error page with 200 OK, a deep link redirected to the home page, or a made-up sibling URL that returns the same page).
  • ✝ Buried: a plain 404 or a dead domain.
  • ? Unknown: a bot wall or timeout. Revenant never pretends to be a browser, so a person should look.

Then it raises the dead. It picks the Wayback Machine capture closest to the date the author read the page, never one captured after the takeover, because the archive keeps crawling squatters. It checks with Gemini, or by word overlap without a key, that the copy actually supports the citing sentence. It writes the fix in Wikipedia's own vocabulary (archive-url, archive-date in the citation's date style, url-status=usurped|dead|deviated) and touches no other byte. You copy the patch, download a .patch, or open the Wikipedia or GitHub editor. Revenant never edits anything for you.

It also counts at scale. A Graveyard Census scans a whole Wikipedia category, the articles linking to a domain, or a list of titles, examines each distinct link once, and publishes a worklist of possessed citations nobody has tagged, with the evidence and the fix, as CSV or as a wikitext table for a WikiProject page. A census can be stopped and resumed.

It also meets agents where links are written: an MCP server (stdio and Streamable HTTP), a Kiro Power, an agent hook that checks the Markdown your agent just saved, a CLI that fails CI on possessed links, and a GitHub Action.

How we built it

  • One TypeScript engine shared by the web app (Next.js 16), the CLI and the MCP server. Extraction and the verdict procedure are pure functions; network access is injected, so the whole pipeline is testable offline and the patcher runs in the browser.
  • Data: the Wayback Machine CDX API, RDAP (rdap.org), the MediaWiki API, GitHub, and the live web, fetched as an honest bot with per-host limits and an SSRF guard on every redirect hop.
  • 103 tests, including 29 fast-check properties: byte-preserving citation patches, "never resurrect a copy captured after the takeover", census resume and de-duplication, verdict invariants, extraction spans and the SSRF guard.
  • Built with Kiro: see "How Kiro was used".

Measured, not claimed

Wikipedia editors' tags are ground truth. On a held-out sample (seed 4040, never used for tuning), Revenant, without seeing the tags, flagged 60 of 67 judgeable citations tagged usurped (90%) and called 0 of 80 citations tagged live possessed. Every row is in the repo.

The census, run on 2026-11-15 on two categories (not a random sample): in the first 60 articles of Category:Defunct websites (1,297 citations), 12 possessed citations no editor had tagged, 9 of them confirmed by opening the live page. In Category:PHP (732 citations), none, and the one editors had tagged was found again.

Challenges we ran into

  • The archive remembers the squatter too. The newest Wayback capture of a possessed link is usually the casino. Snapshot selection excludes captures after the RDAP registration date, skips captures that are spam, and steps three years back when every nearby capture is spam.
  • Our own benchmark humbled us. The first run read Thai casino pages as alive (the lexicon was English and Indonesian, and Thai has no spaces between words), cached archive outages as "no snapshots", and timed requests out while they waited in the per-host queue. Ten defects in all, each now a regression test that quotes the real page, documented in a Kiro bugfix spec.
  • One silent server stopped a census. A site answered 200 and then never sent its body, and the fetch's abort signal did not end the read. Every body read now has its own deadline.
  • Being polite costs coverage. Sites behind bot checks become "unknown". We chose that over spoofing browsers, and enforced it with a Kiro PreToolUse hook.

Accomplishments that we're proud of

  • A verdict nobody else gives: links that are alive, harmful and invisible to every existing checker.
  • Patches that change exactly three parameters and nothing else, proven by property tests on generated citations.
  • An honest benchmark with development and held-out seeds and published rows.

What we learned

A good spec turns a feature into a checklist you can trust: the Graveyard Census came out of one Kiro session because its requirements, design and correctness properties were written first, and the properties became real property tests before any UI existed. Steering made the agent behave like a good guest on other people's servers without being reminded, and hooks gave every edit a safety net. The biggest surprise was how much the live web teaches that no spec can: running the census on real Wikipedia articles found two defects the spec could not, and each became a regression test.

What's next

  • Larger, sampled censuses, so a share of affected citations can be quoted for Wikipedia as a whole.
  • Memento fallbacks (archive.today, national web archives) when the Wayback Machine has no clean copy.
  • A pull-request mode that opens PRs with the user's own GitHub login.

How Kiro was used

Surfaces

  • Kiro IDE (agent chat). The Graveyard Census, the newest feature, was built in one Kiro IDE session from its spec: targets, the run engine, the report, the CLI command, the /census page, the MCP tool, 47 new tests, then two real censuses of Wikipedia categories. The same session found and fixed two defects by running the census on the live web, and corrected a hook whose trigger name the IDE log rejected.
  • Kiro CLI 3.3.0, headless (kiro-cli chat --v3 --no-interactive --agent …), for the two custom agents: gravedigger audited the repository's Markdown through Revenant's own MCP server, and verdict-reviewer reviewed a past lexicon commit.
  • Not used: Kiro Web, Kiro Crew.

Steering: making Kiro respect a fragile web

Seven steering files, chosen by when the knowledge matters:

  • Always: product.md fixes the vocabulary (alive, buried, ghost, possessed, changeling, unknown) and its mapping to Wikipedia's url-status, so every spec, UI string and commit uses the same words. tech.md records where Next.js 16 differs from older training data (no runtime export with Cache Components, Suspense around runtime data) and a fast-check pitfall we hit (returning expect(...) from a predicate fails the property). structure.md keeps src/core browser-safe.
  • fileMatch: web-politeness.md loads only when code that talks to other people's servers is open: honest bot identity, per-host limits, never cache a failure. verdict-rules.md loads only around the decision logic: start from a real misjudged page, write the regression test first, re-measure on a fresh seed. ui-voice.md loads for UI files: verdicts are never colour alone, plain English before atmosphere.
  • Auto: citation-patching.md is pulled in by description when the conversation is about rewriting citations.

Where the rules changed what Kiro did during the census work:

  • Honest bot, even when checking by hand. To confirm the 12 untagged possessed rows, Kiro opened each URL with curl -A "RevenantBot/0.1 (+repo; manual check)", not a browser user agent (web-politeness.md). Sites that block bots stay unknown.
  • No tuning without a page and a seed. The census and the reviewer both surfaced lexicon questions. Kiro did not change the lexicon, because verdict-rules.md requires a real misjudged page, a regression test first and a fresh benchmark seed.
  • No invented numbers. The home page shows census totals only from a finished, published run (npm run census:publish); the two smoke tests were never published (ui-voice.md, product.md).

Spec-driven development

Kiro IDE validates spec files against its own format, and the census session showed it: tasks.md opened with "Missing required section: ## Task Dependency Graph". The six specs had been written by hand before they were opened in Kiro, and together they had 73 format issues (missing ## Task Dependency Graph, properties written as bullets Kiro does not recognise, a bugfix document without ## Bug Analysis, no .config.kiro). The agent read the validator's rules from Kiro itself, restructured all six specs without changing their content, renumbered the census properties C1–C5 to 24–28 (Kiro expects Property N: with a number) and renamed the tests to match. One warning is left: the agent-surfaces design has no generated properties, only example tests, and says so. Six specs in .kiro/specs/, written in EARS. Each design lists Correctness Properties that map one-to-one to fast-check tests (Property N in the design = it("Property N: …") in tests/property/):

  • link-classifier, resurrection-engine, citation-patcher, agent-surfaces: the engine and its surfaces.
  • benchmark-misses is a bugfix spec (Current / Expected / Unchanged behaviour). It records ten real defects found by benchmarking against Wikipedia editors' own tags, among them Thai casino pages read as alive, outages cached as "no snapshots", and bot challenges read as soft 404s. Each one has a regression test quoting the real page.
  • graveyard-census was the open spec, and it was implemented in the Kiro IDE chat by asking the agent to build it "following the docs". The agent read the requirements, design and tasks, implemented tasks 1–4 in order, and marked them done in tasks.md (in chat, not with the per-task buttons in the Specs panel). Then it ran task 5, a real census.
    • What the spec settled up front: "a URL is examined at most once per run", "resume after any prefix gives the same report", "≥ 2 independent signals or it goes to review", CSV round-trip, wikitext that cannot break a page. These became properties 24–28 before the UI existed.
    • Where the agent changed the design, and wrote it down. The design said progress lives in Redis. A serverless function cannot outlive its request, so the hosted census runs from the browser and saves to localStorage; the CLI saves JSON files. The agent added a "Decisions" section to design.md explaining this, and the other choices (what counts as an independent signal, what "tagged" means, why an article is committed all at once).
    • What running it on the live web found (the spec could not): a site that answers 200 and then never sends the body held a census for good, and citations inside infoboxes produced "claims" like | released =. Both were fixed with regression tests.
    • Result: in the first 60 articles of Category:Defunct websites, 12 possessed citations nobody had tagged, 9 confirmed by opening the live page; in Category:PHP, none. docs/CENSUS.md publishes both runs, chosen before their results were known.

Hooks

Hook Trigger What it automates
core-tests-on-save PostFileSave src/core/**, tests/** vitest with 29 properties on every engine edit
typecheck-ui-on-save PostFileSave UI files typegen + tsc, catching wrong Next 16 guesses early
docs-link-check PostFileSave *.md Revenant checks the links Kiro just wrote (dogfooding through revenant hook)
signal-change-needs-evidence PostFileSave src/core/signals/** agent prompt: real page, invariants, unused seed
guard-bot-etiquette PreToolUse shell blocks spoofed browser user agents, anti-bot tooling and staging private//.env
spec-task-verify PostTaskExec tests after every spec task
stop-run-tests Stop + confirm offers a full check before handing back

The guard exists for a real reason: while debugging timeouts, comparing responses with a browser user agent was the tempting shortcut. Revenant's whole promise is that it is an honest bot, so the guard makes that rule enforceable instead of aspirational.

What the logs show:

  • The Kiro IDE log rejected one hook: Hook trigger is not a recognized name {"trigger":"PostTaskExecution"}. The v1 name is PostTaskExec; the hook file was corrected.
  • In the census session the workspace had not been trusted yet, and the log says hooks.v2.executionDisabledUntrustedWorkspace: Kiro loaded the hooks but did not run them in the IDE. The tests they would have run were run by hand after each step.
  • After trusting the workspace and reloading the window, the log shows isTrusted=true and hooks.reload.loaded {"read":7,"registered":7}, with the corrected trigger accepted. Then:
    • guard-bot-etiquette blocked the agent itself. Testing the hooks, the agent tried a shell command whose text included a dry run of staging a file from private/. The PreToolUse hook stopped it before it ran: "Blocked by Revenant guard (stage-private): private/ and .env files must never be committed: the repository is public." It matches the phrase even inside a quoted prompt, which is strict on purpose.
    • docs-link-check ran when the agent saved a Markdown file with the PHP article's Azure SDK link. Run with the same payload, the command reports: "possessed link … The page is now full of online-gambling terms ("casino", "slot gacor", "togel") that the archived copy never used."
    • stop-run-tests asks before the agent hands back whether to run typecheck, lint and tests.
  • In kiro-cli headless runs, hooks also run: the stop-run-tests Stop hook fired at the end of every run and was denied, because a confirm prompt cannot be answered without a person.
  • Lesson: in Kiro IDE, hooks, workspace agents, steering and MCP config from a cloned repository do nothing until the workspace is trusted, and the IDE reads trust once at start, so trusting needs a window reload.

Custom agents

  • gravedigger (JSON): read-only; writes and shell are denied by permission rules; uses Revenant's own MCP tools to audit the repo's Markdown.
    • Real run (private/kiro-logs/gravedigger.txt): it read README.md and the five docs, called @revenant/scan_document six times, and reported no possessed, ghost, changeling or buried links except the three links to the not-yet-deployed app (buried, "The server answers 404 Not Found."). Its first run had no permission to read files (headless mode denies every "ask"), and it said it could not check anything rather than inventing verdicts.
  • verdict-reviewer (Markdown): reviews diffs to the verdict logic against verdict-rules.md, shell limited to git diff/git log/tests, ends with SHIP / SHIP WITH NOTES / HOLD.
    • The agent config had a bug the CLI exposed. Its rules allowed git diff* and then denied *. Kiro evaluates permissions deny-overrides, so the deny removed the shell tool entirely; two runs answered HOLD because they could not review. The deny now uses exclude: for the allowed commands.
    • Real review of commit 38d023b (the lexicon fix for "This website is for sale!" pages): tests green (18), invariants intact, no weights changed, verdict HOLD. Its main finding is correct and was confirmed: one sentence "This website is for sale!" matches two nested parking phrases, which alone reaches the possessed threshold. It also flagged three ordinary Indonesian phrases. Not fixed yet, because a lexicon change needs a fresh benchmark seed.

MCP

  • revenant (stdio) in .kiro/settings/mcp.json: the product is its own tool. The gravedigger run above used it through kiro-cli.
  • context7: current library docs (Next 16, MCP SDK 1.32) instead of stale memory. Not used in the census session.
  • The same tools are served over Streamable HTTP at /api/mcp, which is what the Power uses. The census added a fifth tool, census_category. The deployed endpoint (https://revenant-links.vercel.app/api/mcp) lists all five.

Property-based testing

29 fast-check properties: byte-preserving citation patches (generated templates in four spacing styles), "never resurrect a copy captured after the takeover", verdict invariants, extraction spans, the SSRF guard, and the census (24–28). Property 17 shrank to http://a.aa?#: URL normalisation was not idempotent, because an empty query left a dangling ?.

For the census, the properties found no counterexample in the finished code. To make sure that meant something, the agent broke the code on purpose: removing the cross-article de-duplication failed Properties 24 and 25 at once, and a resume that forgot the URLs already seen failed 25 after 14 runs. The generators for 27 and 28 build text from the pieces that break CSV and wikitext (", ,, newlines, |, {{, ]], -->, a leading =).

Kiro Powers

powers/revenant/ packages the remote MCP server and two skills (link-hygiene, wikipedia-citations) in the Agent Plugins format, with keywords such as "dead link", "citation", "link rot" and "wikipedia". The link-hygiene skill now also tells the agent when to use census_category.

  • Installed from the public repo with kiro-cli powers install on a fresh clone; Kiro IDE's Powers panel then lists it under Installed (screenshot 12-powers-revenant-installed.png).
  • Used in a project that has nothing to do with Revenant (a two-link README about PHP on Azure). Asked to check the README's links, the Kiro IDE agent loaded the link-hygiene skill and called the hosted scan_document tool, which answered: possessed, confidence 0.99, "The page is now full of online-gambling terms ("casino", "slot gacor", "togel") that the archived copy never used", plus "The domain's current registration began on 2024-07-29", and an archived copy to use instead.
  • In kiro-cli headless runs the skill activated but the Power's MCP tools never reached the session, whatever --trust-tools selectors were passed; the docs do not cover this case. The agent said it could not check the links rather than guessing.

Built With

Share this project:

Updates

Submission history