0 is clean, 2 gates (a confirmed problem
that should block), 3 is advisory (a re-anchorable moved or a
behavioral at-risk — it warns but never gates), and 1 is an operational error.
Because no model runs in the check loop, the same working tree always yields the
same verdicts. That is what makes “is this doc stale?” a signal you can gate a
pipeline on rather than a probabilistic guess.
A flag is a request to re-verify, not a claim that the doc is wrong. Hibi
reports that the evidence under a claim moved; the person or agent who reads the
flag decides the fix.
The three consumer contexts
GitHub Action
A published action that runs
hibi check or hibi diff
on every push or pull request and fails the build when a claim drifts.git hook
A pre-commit or pre-push hook that runs Hibi locally and blocks the commit or
push before drift ever reaches the remote.
Agent hooks
A coding agent calls
hibi status before it trusts a doc, and
hibi diff after it edits code, so it never acts on or leaves
behind a stale page.MCP shim
A Model Context Protocol server that serves verdicts to a tool, re-computed
live on every request, never from a cached index.
GitHub Action
The Hibi repository is itself a published GitHub Action. Reference it by release tag (npupko/hibi@v0.2.3 to pin a release, or @main to track the
tip) and pass its behavior through with: inputs. The action installs Bun and
runs the hibi binary for you, so a minimal drift gate is a few lines:
Inputs
string
default:"check"
Which verb to run:
check (verify every claim in the store) or diff (verify
only the claims touched by a range of changes). Defaults to check.string
default:"gating"
Strictness: when a non-zero exit should fail the job. Uses Hibi’s canonical
--fail-on vocabulary: gating (default), warn, tamper, or never. See
the table below.string
Base ref for
command: diff: the point to compare against (a branch, tag, or
commit). Ignored when the command is check.boolean
default:"false"
When
true, Hibi stamps status banners into the drifted documents. Leave it
false for a read-only gate that only reports; turn it on when you want CI to
also mark the artifacts.boolean
default:"false"
When
true, the action passes --run-verifiers to the command, so declared
verifiers execute during the run and behavioral claims can reach supported
or refuted. Off by default: verifiers execute repo-committed commands — a
supply-chain surface — and Hibi never runs them without this explicit opt-in.string
default:"."
Directory to run Hibi in: the anchor root that contains the
.claims/ store.
Defaults to the repository root.Strictness levels
fail-on decides which verdicts turn into a failing build. The vocabulary is
shared with the CLI’s --fail-on flag, so a local run and the action agree.
Proving behavioral claims — check --run-verifiers
A plain hibi check grades anchors deterministically but never runs a verifier.
To also prove behavioral claims — turning at-risk into supported or
refuted — add --run-verifiers, which executes each claim’s declared verifier
command. Hibi dogfoods exactly this: its own CI runs
hibi check --run-verifiers --fail-on gating, so a broken behavioral gate turns
the build red without human review.
Gating a plan — coverage --fail-uncovered
The plan-verification loop is the mirror image of drift-checking: instead of
guarding recorded claims, you assert that a plan document is fully grounded —
every promise anchored to the code that implements it.
hibi coverage --doc plan.md --fail-uncovered makes that CI-enforceable: it
exits with the gating code 2 while any block of the plan is still uncovered,
and 0 once every block is backed by a claim.
--fail-uncovered
guards that the anchoring is complete.
git hooks
A git hook moves the same gate one step earlier, onto the developer’s machine, before a commit or push reaches the remote. Hibi has no hook manager of its own; it is a command that exits non-zero on drift, so it drops into whatever you already use.hibi diff --since <ref> is the natural fit for a pre-push hook: it asks
“what did the changes on this branch invalidate?” and only re-verifies the claims
in range. hibi check verifies the entire store and suits a pre-commit hook
or a belt-and-braces final gate. Either way the hook gates on Hibi’s exit code,
exactly as CI does.
Agent hooks
The third context is an AI coding agent in an edit loop. The risk here is sharp: a naive agent reads a doc (often an always-loaded instruction file likeCLAUDE.md)
and trusts it as current. If the doc has drifted, the agent acts on a stale
page. Hibi closes that gap by sitting at two points in the agent’s lifecycle.
Hibi is the deterministic half of the loop: it flags. The agent or human rewrites
prose, then re-runs check.
1
SessionStart: gate before trusting a doc
At the start of a session the agent runs
hibi status --doc CLAUDE.md (or
whichever instruction file it is about to rely on). status is the read-time
gate: it exits 2 if any claim in that doc is gating, 3 if a claim is
moved or at-risk, and 0 when the doc is clean. The agent trusts the doc
only on a clean result; on a stale one it sees the banner and the exit code
and knows not to act on the page as written.2
Stop: report what an edit invalidated
After the agent edits code, a Stop hook runs
hibi diff --since <base>. Hibi
reports which claims that change invalidated, so the agent can draft
the corresponding prose fix. The agent (or the human reviewing the change)
writes the new wording; Hibi never writes prose itself.3
Re-run check
Once the prose is updated, re-running
hibi check confirms the claims resolve
again and the verdict returns to clean.STALE — N claim(s); run hibi status --doc <p>) so the always-loaded file
stays lean and the full detail lives in the JSON that status returns. The
mechanics of that banner are covered on the status banners page; the
ready-made Agent Skill that teaches a coding agent these loops lives on the
Claude Code page.
An MCP shim that exposes Hibi to a tool must serve live-recomputed verdicts:
it re-runs the resolution flow on every request and never returns a cached
index. A cache would re-introduce the drift Hibi exists to kill: the
stored answer would itself fall out of sync with the code.
Exit codes recap
Every context above gates on the same four exit codes. They are reproduced here for convenience; the full verdict model behind them lives on the verdicts page.moved and at-risk never gate, and suggested claims never set a failing exit
code, so a build only breaks on a confirmed, enforced claim whose evidence
moved. That keeps the suspect set tight: a gate you can trust, not noise you learn
to ignore.
Where to go next
CLI reference
Every command and flag behind these hooks (
check, diff, status) and
the --fail-on strictness levels in full.Verdicts, states & exit codes
The two-axis verdict model and the complete gating exit-code contract.
Status banners
How Hibi stamps staleness into the artifact, and the compact pointer used for
agent instruction files.
Claude Code skill
The official Agent Skill that teaches a coding agent the SessionStart and Stop
loops described above.

