runhmd (hmd): a verification gate for AI coding agents
hmd is a command-line test gate for AI coding agents that runs as git pre-commit and pre-push hooks. runhmd makes your coding agent's work pass a test it didn't write — and proves that test can fail — before the push lands.
hmd is the one CLI; Heimdall is the engine underneath (NAMING.md). One prompt in, a gated, receipted change out. The gate is a plain git hook that hmd init installs, so it holds in any git repo, whichever agent or person made the commit. Your agent's own tests are a claim; the oracle it wires is external, and is first shown to go red on a planted defect before its green is trusted.
Works with, today: Claude Code and Cursor (installing hmd needs Claude Code 1.0+, git and jq: prerequisites).


Why
An AI coding agent writes the change and the tests that approve it, so "tests pass" is the agent's own claim, and a test that cannot fail proves nothing. hmd moves the judgment outside the agent:
- The check is external. An oracle is a reference the implementing agent never sees (oracle registry), not the agent's own tests.
- The check is shown able to fail first. Planted defects ("mutants") must turn a gate red, or
bin/falsify exits non-zero (run it yourself).
- The check sits in git.
hmd init installs pre-commit and pre-push hooks; a red gate exits non-zero and names what failed, so the commit or push does not go through.
- A human does the merge.
test/no-auto-merge.test.sh fails if any shipped code path merges, pushes or deploys without a classified human trigger.
Install — pinned to a tag and sha256-checked; if the digest fails, nothing runs (what it writes to your machine · what leaves it):
curl -fsSL https://raw.githubusercontent.com/randomittin/heimdall/v2.4.19/install.sh -o heimdall-install.sh \
&& echo "95663fc0477d863cd3c0406eab4bdb0ece49539f2ec1e0d50d20664354c33980 heimdall-install.sh" | shasum -a 256 -c - \
&& bash heimdall-install.sh
Or from npm: npx runheimdall installs hmd with the same pinned script and sha256 check; npx runhmd <path> runs hmd attack <path> and installs hmd first if it is missing (the runhmd package).
Then attack a planted bug (the installer clones this repo to ~/.heimdall; hmd attack asks for consent before it runs anything):
hmd attack ~/.heimdall/fixtures/attack/buggy-webhook
Real output from this tree (hmd attack fixtures/attack/buggy-webhook --card --yes):
╭──────────────────────────────────────╮
│ 🛡 runhmd attack │
│ │
│ VERDICT: DENIED │
│ │
│ 23 attacks · 17 survived · 6 killed │
│ │
│ ✗ duplicate settlement (webhook+retry│
│ within 50ms) │
│ │
│ Cost: $0.00 · Time: 0.5s │
╰──────────────────────────────────────╯
What hmd attack does
hmd attack <path> asks "can I break this?" and answers PROVEN or DENIED, with a counterexample.
- Target: a directory that declares its attack surface in
runhmd.attack.json, or a single .mjs module. A directory that declares nothing exits 2: a verdict over nothing would be a false green. --diff and PR URLs are not supported in this build.
- Engine: deterministic and offline: no model, no network, $0.00. The target runs in an ephemeral temp dir, in a scrubbed environment.
- Output: the card above;
--json prints the canonical runhmd.verdict/1 document; --out DIR writes the evidence.
- Exit codes: 0 PROVEN · 1 DENIED · 2 usage/config · 3 consent required (non-TTY without
--yes) · 4 budget cap · 5 infrastructure.
- Receipts:
--receipt issues a signed runhmd.receipt/1, stored locally and checked with hmd receipt verify. The hosted runhmd.dev service is not built yet (docs/RECEIPTS.md).
hmd demo is dry by default: it scaffolds a full-stack task into ./heimdall-demo-app and prints the next step; it executes nothing until you add --run.
How hmd differs from an agent grading its own work