Inspiration

I trust my coding agent with a lot. Sometimes that means destructive commands: a clean checkout, a hard reset, wiping a folder. Untracked and uncommitted files are invisible to git, so when one of those commands goes wrong, nothing can bring them back.

Kiro issue #9206 is still open. An agent running with all tools trusted ran rm -rf on folders holding 24 uncommitted markdown files, before it moved them, and the report says "Files were permanently lost." (https://github.com/kirodotdev/Kiro/issues/9206). Kiro's checkpoint docs say "Kiro also does not track file changes made by MCP tools or bash commands that it runs as part of its execution." (https://kiro.dev/docs/checkpoints/). The V3 CLI docs say /checkpoint isn't available on V3 (https://kiro.dev/docs/cli/v3/).

I tried it myself on kiro-cli 3.8.0 before building anything. I asked for a pristine checkout. The agent ran git reset --hard && git clean -fd, my two uncommitted notes were gone, and /rewind didn't bring them back.

I didn't want an agent that's afraid to touch anything. I wanted to give it permission to do destructive work without every mistake becoming permanent.

What it does

  • A hook that never blocks. A Kiro PreToolUse hook spots destructive shell commands (git clean, git reset --hard, rm, mv onto an existing file, find -delete and a few more) and copies whatever the command could destroy into a local store, before the command runs. Then it gets out of the way.
  • An honest manifest. Every destructive command gets one: what was found, what was captured, what was skipped and why. The status is PROTECTED, PARTIAL, NOT_PROTECTED or NOTHING_AT_RISK. If capture fails, it says NOT PROTECTED. A failed snapshot should never look like a safety net.
  • Restore through MCP. A small MCP server (standard library only) lets any later agent session list graves, preview a restore and restore. It never overwrites an existing file by default. Every restored file is checked against its SHA-256, and the result goes back into the manifest.
  • The git reset --hard case. After a reset, the file on disk is just the last commit. An opt-in replace_committed option swaps your captured version back in, but only if the file on disk is byte-identical to HEAD. It saves the displaced bytes first.
  • The crypt. A local dashboard where every destructive command is a grave in a moonlit cemetery. Raise brings files back using the same restore code the agent uses, never overwrites, and shows the SHA-256 result. All motion stops if you've asked your system for reduced motion.
  • A hosted demo. The page at https://reliquary-crypt.web.app is a static, read-only export of real recorded trials. It opens with a plain intro, a three-step strip and a Try the demo button, then a six-step story that walks through one real git reset --hard recovery (3 of 3 files restored, SHA-256 verified). The Raise in that story is a replay of the recorded result, labeled as a replay. Nothing on the hosted page restores anything.
  • Install. It ships as a Kiro Power (plugin.json, mcp.json, two skills), plus reliquary install for the hook, plus a custom agent, reliquary-warden.

Why the costume

Each visual in the crypt carries a status that matters. A lit candle means a grave is protected. A cracked red stone means it is not. A raised grave carries an epitaph like "Here lie 3 files, raised and verified." The one thing a safety tool has to get right is whether you are actually covered, and the costume makes that readable at a glance. A cemetery also has an obvious way in: you walk up to a grave.

How I built it with Kiro

docs/BRIEF.md is the only product text I wrote by hand: the problem, the scope and the honesty rules. Kiro built the rest, and BUILD_LOG.md records which Kiro feature did what and when. Times are Nov 30, ET, unless noted.

  • Steering (16:32). Kiro read the brief and wrote .kiro/steering/ (product, tech, structure, safety, testing). It added rules of its own that I kept, like keeping restores inside the workspace and writing manifests atomically.
  • Two specs.
    • reliquary-core started at 16:36. It's requirements-first, with EARS acceptance criteria. I pushed back through the spec flow on things like a separate NOTHING_AT_RISK status and the real hook payload shape on 3.8.0.
    • crypt-dashboard started at 17:05 as a Quick Spec. Kiro asked three design questions: whether Raise can overwrite (no), how Raise is authorized (a per-run token plus a Host/Origin check), and whether exports redact paths (yes).
    • Spec task execution ran one sub-agent per task or group of tasks, including property-based tests with hypothesis.
  • Spec-driven changes from real failures. When real trials showed a problem, I sent the fixes that mattered back through the spec rather than patching code by hand. That's how replace_committed (18:50) and the clearer preview wording (19:27) came in.
  • A spec change for the demo page (Dec 3 and Dec 4). I wanted first-time visitors to understand the product in seconds. That went through the crypt-dashboard spec as Requirements 27 and 28 (the guided intro, story and glossary, then clarity fixes), then tasks, then code. Requirement 30, on Dec 4, lined the headline up with the git reset --hard story and put the graveyard art in front of the plaque.
  • Hooks (20:09). Kiro wrote four workspace hooks and tests for them: Reliquary dogfooding itself on its own repo, a PostToolUse check for secrets and stray dash characters in prose, a Stop hook that runs the fast tests when src/ changed, and a usage ledger. Every run is logged to build-logs/hooks.jsonl. They came in partway through the build, so I don't claim they ran before that.
  • Custom agent and Power (19:22). Kiro wrote the reliquary-warden agent, which passes kiro-cli agent validate, and packaged the Power in the Agent Plugins format, with a checker that runs 26 checks.
  • Headless Kiro for evaluation (17:22). One prompt produced eval/run_trials.py. It builds a throwaway repo per trial, runs session 1 with the destructive command, then a fresh session 2 with a neutral "get it back" prompt that never names Reliquary. Then it checks SHA-256 and writes every trial to eval/RESULTS.md, failures included.

I also asked an outside AI assistant to read the demo and the writing the way a first-time visitor or judge would. It gave notes. It did not write product code.

The full suite (tests/ and tools/hooks/) has 1,717 tests passing, 0 failed. That is 1,690 in tests/ plus 27 hook tests.

Real results

These come from clean-environment runs with claude-haiku-5.5 on kiro-cli 3.8.0, Linux only. The trials used Kiro's default agent with the hook and MCP server set up inside each throwaway repo. They did not use the reliquary-warden agent.

  • git clean -fd: 5 of 5 trials restored, every file SHA-256 verified
  • rm -rf: 5 of 5
  • git reset --hard: 6 of 6, after the fix described below (2 of 5 in the clean run before it)

Session 1 asks for the destructive command outright. So this measures recovery, not whether an agent deletes things on its own. SHA-256 only checks file bytes. Across every git reset --hard run in the repo, including the earlier ones affected by the stale environment (named in the README) and the pre-fix runs, 10 of 21 trials restored. All of them are listed in eval/RESULTS.md.

Challenges

  • git reset --hard failed 5 of 5 at first. The hook captured every file, but after a reset the files still exist with their committed bytes. Restore refused to overwrite them, and the agent correctly stopped. I added the opt-in replace_committed option through the spec. The first clean-environment run after that restored 2 of 5. In the misses, the agent stopped twice to ask for permission, and once it misread a field called matches_head as describing the saved copy instead of the file on disk. Kiro renamed it current_file_matches_head and added a plain sentence per file. The next clean run was 6 of 6, and every restore record shows replace_committed true and overwrite false. Two things changed at once and the samples are small, so I can't tell you which one did it, or rule out luck.
  • Kiro's own tests caught a bug that would have lied. A spec sub-agent wrote the test for find ... -delete and it failed. The code had made find's start paths absolute, so -path './deep/*' matched nothing and the manifest said NOTHING_AT_RISK while find would have deleted files. Kiro stopped, explained, and offered two fixes. The fix runs find exactly as the real command would.
  • I contaminated my own trials once. My shell still had RELIQUARY_HOME and PYTHONPATH set from a smoke test. The hook and MCP server got their paths from their own config, but I couldn't prove the stale values had no effect, so I reran everything from a clean environment. The earlier runs stay in RESULTS.md, and the README and eval/README.md say which ones were affected. I don't quote them as headline numbers.
  • The "3 saved, 2 restored" question. In my first test run, the hook saved two notes and a log file, but only the notes came back. That turned out to be correct: I'd only asked for the notes. The manifest now records that per file as not_requested.

Accomplishments that I'm proud of

  • A tool that says "NOT PROTECTED", in red, when a capture fails, instead of letting a failed snapshot look like a safety net.
  • Real trial numbers with the failures left in, instead of one clean demo.
  • A restore that never overwrites by default, verifies every file by SHA-256, and still handles the awkward git reset --hard case without guessing.
  • A hosted demo a stranger can open and follow without reading any docs, built through the spec flow, with real recorded data only.
  • 1,717 passing tests, with the spec, the tasks and the build log in the repo for anyone to check.

What I learned

Honest status matters more than coverage. A tool like this is only useful if it never says "you're protected" when you aren't. I also learned how much the wording of tool output matters to an agent. A renamed field and a plain sentence per file went along with reset recovery moving from 2 of 5 to 6 of 6, and I'd like to test that properly instead of guessing at the cause.

What's next

  • More trials, other models, and macOS. So far it's one model, kiro-cli 3.8.0, Linux only.
  • Covering writes made by MCP tools and editors, which Reliquary doesn't watch today.
  • Running the trials with the reliquary-warden agent, so its ask-before-replace_committed rule gets tested on a live run. The approval turn is built but hasn't been triggered yet.
  • An idea I tested but cut to keep this to one product: a hook that re-injects steering files changed mid-session. In early tests a running session kept following an edited rule's old version.

How Kiro was used

Kiro built the product. I wrote the brief. Kiro wrote the steering files, two specs (reliquary-core and crypt-dashboard, with EARS requirements, designs and task lists), the property-based tests, the hook, the MCP server, the CLI, the crypt dashboard, four workspace hooks, the reliquary-warden custom agent and the Kiro Power. The fixes that came out of real trials went back through the spec flow instead of a hand patch. Headless Kiro also ran the evaluation: one prompt wrote the trial harness, and Kiro sessions played both the agent that ran the destructive command and the fresh agent that restored the files. The specs are in .kiro/specs/, the steering in .kiro/steering/, and BUILD_LOG.md has the timeline.

Built With

Share this project:

Updates

Submission history