# Anchors and Resolution: How Hibi Pins Claims to Code Source: https://hibi.mintlify.app/anchors Each side of a claim stores a text quote with context, a position, and on the code side an AST fingerprint and a literal. Resolution is an ordered cascade with fixed constants. A claim has two sides. The **doc side** is the documented sentence. The **code side** is one or more spans of code the sentence describes. Each side is a **selector bundle**: one file plus a list of selectors that point at the same span in different ways. ``` Anchor = { doc: SelectorBundle, code: SelectorBundle[] } ``` The store holds the anchor, not a copy of the prose. At check time Hibi re-reads the live span from the file. ## Selector kinds | Selector | Side | What it stores | | --------------- | ---- | ---------------------------------------------------------------------------------------------------------------- | | `text-quote` | both | the exact text plus 48 characters of prefix and suffix context | | `text-position` | both | the character offsets at record time; a locate bias and the `moved` tiebreaker | | `ast-node` | code | the smallest enclosing named tree-sitter node with a structural hash and a semantic hash; used for reason labels | | `value` | code | the first literal that lies inside the quoted span, so `5` becoming `50` is caught | | `coarse` | code | a file or glob pattern (`--glob`); navigation only, never graded as drift | The `value` selector is stored only when a literal lies inside the quoted span. If the span has no literal, no value selector is stored and no value check runs. Quote the load-bearing token (`MAX_ATTEMPTS = 5`), not the whole line. A coarse anchor is never reported as drift. It answers "which claims touch this area" and nothing more. A claim whose only code side is coarse cannot gate; record it with `--suggest`. Tree-sitter grammars (TypeScript, Python, Rust, Go, Java) load lazily, per language present in the anchors being checked. `--no-ast` skips them. ## The resolution cascade Each side is resolved by an ordered cascade. There is no weighted score. Find exact occurrences of the stored quote. If there are several, rank them by how well the stored 48-character prefix and suffix match. If there is no exact occurrence, run a bitap fuzzy match biased toward the stored position. The match is accepted only when its edit distance to the stored quote is within the error budget `min(256, floor(len × 0.4))`, where `len` is the quote length. A candidate over the budget counts as not found. A missing file, or no match within the budget, is `orphaned`. When more than one exact occurrence ties on context, the side is `ambiguous`. Quotes shorter than 8 characters are exempt from this check; their candidates are picked by position. The side is `changed` when any of these holds: normalized text similarity to the stored quote is below 0.9; the semantic AST hash differs; the literal inside the quoted span differs from the stored value; on a prose span, a number in the sentence changed. Otherwise the text is the same. If the located start is within 4 characters of the stored position, the side is `unchanged`; further away, it is `moved`. Position is only a bias during locate and the tiebreaker between `unchanged` and `moved`. It never decides `changed`. ## Reason labels A `changed` side carries a reason in `notes` and in `evidence.changedEvidence`: | Condition | Label | `changedEvidence.kind` | | -------------------------------------------- | ---------------------------------- | ---------------------- | | semantic hash differs, structural hash equal | `identifiers or literals renamed` | `ast` | | both hashes differ | `restructured` | `ast` | | in-span literal differs | ``value changed (was `5`)`` | `value` | | number in a prose sentence differs | `a number in the sentence changed` | `text` | | similarity below 0.9 | `text changed (NN% similar)` | `text` | ## The constants All constants live in `src/algo/params.ts`. There are no hidden weights. | Constant | Value | Effect | | ------------------------------ | ---------------------------------- | ------------------------------------ | | fuzzy error budget | `min(256, floor(len × 0.4))` edits | a candidate over it is `orphaned` | | text-quote context | 48 characters each side | ranks exact occurrences | | same-text similarity | 0.9 | below it, `changed` | | move awareness | 4 characters | beyond it, same text is `moved` | | ambiguity minimum quote length | 8 characters | shorter quotes are never `ambiguous` | ## Doc-first resolution The doc side resolves first. The documented span is the source of truth, and a verifier runs only when the doc side is `unchanged` or `moved` (see [Behavioral claims](/behavioral)). The verdict still reports both sides, so a `doc:changed` verdict also shows what the code did. ## Record-time checks `record` and `reanchor` refuse a doc quote shorter than 8 characters, a quote that does not occur in its file, and a `--code-file` that does not exist. A doc quote that occurs more than once is refused when the context cannot single out one occurrence, and recorded with a warning when it can; widen the span with `--doc-range` to avoid both. ## Next How the five states become a verdict, a remediation menu, and an exit code. Verifiers for sentences that text and AST resolution cannot judge. # Status Banners: Stamp Drift Warnings Into Your Docs Source: https://hibi.mintlify.app/banners hibi check --write stamps a sentinel-delimited banner into the top of each suspect document so a reader without hibi still sees the flag. A **status banner** is a block of plain text that `hibi check --write` writes into the top of a suspect document. It exists because a reader, human or agent, reads the raw file and trusts it. A flag that lives only in CI output is invisible to that reader. Stamping is opt-in: a banner is written only under `check --write`. Only an enforced claim can put a document into the suspect set. Without `--write`, `check` is read-only. ## What a banner looks like ```markdown theme={null} ``` * **`HIBI:BEGIN v1 `** and **`HIBI:END v1 `** are the sentinels. They are line-anchored and version-tagged. `` is generated once per repository by `hibi init` and stored in `.claims/config.json`; a document that merely quotes the banner format uses a different nonce and is never matched. * The **headline** is `STALE DOCUMENT — N suspect claim(s) — re-verify before trusting.` where `N` counts the body lines. A document whose only notice is its lifecycle gets `DOCUMENT STATUS — N notice(s) — re-verify before trusting.` * **Body lines** are one per suspect proposition, sorted by id, in the form `[status] (id) text`. `status` is side-tagged (`code:changed`, `doc:orphaned`, `code:moved`, `behavior:refuted`, `expired`) or a lifecycle value (`superseded`, `archived`). `text` is the live documented sentence. There is no timestamp, no run id, and no checksum. Re-stamping a document whose status has not changed produces no diff. Each write reports one `bannerAction`: `insert`, `replace`, `remove`, or `noop`. Clearing a banner restores the exact pre-banner bytes. A banner written by an older hibi, whose END line carried a checksum, is still recognized once so that it gets replaced. ## Placement and comment style The banner goes at the top of the file. If the file opens with a `---` frontmatter fence, it goes immediately after the fence. | Format | Wrapping | | --------------------------------------------------------------- | ------------- | | Markdown, HTML, XML | `` | | Python, shell, YAML, TOML, Ruby | `#` per line | | TypeScript, JavaScript, Rust, C, Go, Java, Kotlin, Swift, Scala | `//` per line | | other | plain lines | ## Instruction files `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, and `.github/copilot-instructions.md` are loaded into an agent's context on every turn. For those files the body collapses to one line: ```markdown theme={null} ``` The set is configurable with `StoreConfig.instructionFiles` (a list of globs in `.claims/config.json`). The per-claim detail comes from `hibi check --doc `. ## Pristine documents Some documents must never be written: a vendored spec, a third-party README. List globs in `StoreConfig.pristine`; `check --write` skips any document that matches. The globs are evaluated at stamp time. Verdicts for a pristine document still appear in the JSON and the exit code. ## What the engine writes The engine owns the region between the sentinels and nothing else. It never edits prose. Older versions also wrote a status key into Markdown frontmatter; that is no longer written, and `check --write` removes a leftover one. ## Where to go next The `superseded` and `archived` lines that can appear in a banner body. Wiring `check --write` and `check --doc` into CI, hooks, and agent sessions. # Behavioral Claims and Verifiers in Hibi Source: https://hibi.mintlify.app/behavioral A claim is behavioral when it carries a verifier. Verifiers run only under check --run-verifiers and set behavior to supported or refuted. Some sentences cannot be checked by locating text: "retries with exponential backoff", "sorts ascending". Text and AST resolution can tell you the code changed; they cannot tell you the behavior still holds. For that Hibi runs a **verifier** the author attached to the claim. ## What makes a claim behavioral A claim is behavioral if and only if it has at least one verifier. There is no keyword heuristic and no separate flag. Attach a verifier at record time with `--verifier kind:ref` (repeatable), or with the `verifier` key in a `--from-file` spec: ```sh theme={null} hibi record --doc README.md --doc-quote "Failed uploads retry with backoff" \ --code-file src/upload.ts --code-quote "retryWithBackoff(" \ --verifier command:"bun test upload" ``` `kind` is an open string used as a dispatch key. The built-in runner handles `command`: it runs `ref` as a shell command from the anchor root (the current directory, or `--cwd`), exit `0` is `supported`, non-zero is `refuted`. An external resolver can declare other kinds in its `describe` response (see [Resolvers](/resolvers)). ## Running verifiers Verifiers execute only under: ```sh theme={null} hibi check --run-verifiers [--verifier-timeout ] ``` The default timeout is 120 seconds per verifier. A timeout or spawn failure produces no result for that verifier. The result lands in the verdict's `behavior` field: | State | Meaning | | ----------- | ------------------------------------------------------- | | `supported` | at least one verifier ran and every one that ran passed | | `refuted` | at least one verifier failed | Without `--run-verifiers`, or on a claim with no verifier, `behavior` is absent. `refuted` gates on an enforced claim. `supported` is clean. ## The doc-first guard A verifier runs only when the doc side resolved `unchanged` or `moved`. If the documented sentence is `changed`, `orphaned`, or `ambiguous`, Hibi does not run the verifier, because the sentence being verified is no longer known. The doc-side state is reported instead. ## Why verifiers are opt-in A verifier is a command committed to the repository. Whoever can commit decides what runs on the machine of whoever checks. Hibi therefore never runs a verifier implicitly: `check` without `--run-verifiers`, `list`, and `coverage` never spawn a verifier process. External runner resolvers additionally require an entry in the default-deny manifest `.claims/resolvers.json`. ## Remediation for `refuted` The menu for `behavior:refuted` offers `fix-code` and `fix-claim`, and never `reanchor`. Reanchoring would clear the flag without fixing the behavior. ## Where this fits The two axes, the gates rule, and the exit codes. The out-of-process protocol that hosts external verifier runners. # Integrating Hibi into CI, Git Hooks, and Agent Loops Source: https://hibi.mintlify.app/ci Run hibi check in GitHub Actions, a git hook, or an agent session, and act on its exit code: 0 clean, 2 gating, 1 error. Hibi is one command with one exit-code contract, so it fits anywhere a non-zero exit can block: CI, a git hook, or an agent's session hooks. `hibi check` flags; a person or agent decides what the prose should now say. | Code | Meaning | | ---- | ------------------------------------------------------------------------------------------------------------------------------------- | | `0` | clean, or only `moved` warnings | | `2` | a gating verdict on an enforced claim (`changed`, `orphaned`, `ambiguous`, `expired`, `refuted`); or a warning under `--fail-on warn` | | `1` | operational error (no store, unknown flag, unknown `--since` ref) | ## GitHub Action The repository is itself a composite action. It installs Bun and runs `hibi check` (falling back to `bunx @npupko/hibi` when no binary is on PATH). ```yaml theme={null} name: docs-drift on: [push, pull_request] jobs: hibi: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # needed when `since` compares refs - uses: npupko/hibi@v0 with: fail-on: gating since: origin/${{ github.base_ref }} ``` ### Inputs `gating`, `warn`, or `never`. Same vocabulary as the CLI's `--fail-on`. A git ref. When set, the action runs `check --since ` and evaluates only the claims that touch a file changed since that ref. When `true`, passes `--write` so banners are stamped into suspect documents. Commit the result separately. When `true`, passes `--run-verifiers`. Verifiers execute repo-committed commands, so this stays off unless you opt in. The directory holding the `.claims/` store. A ready-made workflow file ships with the Claude Code plugin at `plugins/hibi-cli/skills/hibi/assets/hibi-ci.yml`. ### Strictness | `fail-on` | Build fails when | | --------- | ----------------------------------------------- | | `gating` | any enforced claim gates. The default. | | `warn` | any enforced claim gates or has a `moved` side. | | `never` | never. The JSON still reports everything. | ## Gating a plan with `coverage --fail-uncovered` ```sh theme={null} hibi coverage --doc plan.md --fail-uncovered # exit 2 while any sentence is uncovered ``` An uncovered region is a sentence no claim backs. Hibi does not judge whether code implements a sentence; the author anchors each promise to its code, and `--fail-uncovered` checks that the anchoring is complete. ## git hooks ```bash pre-push theme={null} #!/bin/sh hibi check --since origin/main || { echo "hibi: documentation drift detected; re-verify before pushing." >&2 exit 1 } ``` ```bash pre-commit theme={null} #!/bin/sh hibi check || { echo "hibi: documentation drift detected; re-verify before committing." >&2 exit 1 } ``` `check --since ` suits a pre-push hook; plain `check` suits pre-commit. Register the same command in lefthook or husky if you use one. Leave `--write` off in a hook unless you want each developer to re-stamp banners locally. ## Agent sessions An agent reads an instruction file and trusts it. Two moments close the gap: `hibi check --doc CLAUDE.md`. Exit 2 means a sentence in that file no longer matches the code. The agent reads the verdicts and does not act on the flagged sentences as written. `hibi check --since origin/main`. The `documents` array names the files whose sentences the edit invalidated. The agent fixes the prose and runs the `command` from each verdict's remediation menu. Both commands are read-only. For instruction files the stamped banner is one line, `STALE — N claim(s); run hibi check --doc `, so the always-loaded file stays short (see [Banners](/banners)). The Claude Code skill that teaches these loops is on the [Claude Code](/claude-code) page. An MCP shim that serves verdicts must recompute them on every request. A cached index would itself drift. Add `--no-hints` (or `HIBI_ADVICE=0`) for shorter CI logs. Add `--explain` when you need the evidence behind a verdict. ## Where to go next Every flag on `check` and `coverage`. The gates rule behind the exit codes. What `--write` stamps into a document. The Agent Skill that teaches the two moments above. # Hibi Agent Skill for Claude Code Source: https://hibi.mintlify.app/claude-code Install the Hibi Agent Skill so Claude Code records claims, runs hibi check, and acts on remediation menus. Hibi ships a [Claude Code](https://claude.com/claude-code) **Agent Skill**: instructions the agent loads on demand. The skill covers the vocabulary, the five commands an agent needs (`init`, `record` via JSON on stdin, `check`, `list`, `reanchor`), the JSON shapes, when to run each command, and the verdict-to-action rule. Hibi is deterministic, so the skill never asks the agent to judge whether a doc is out of date. It teaches the agent to ask Hibi and act on the answer. ## Install ``` /plugin marketplace add npupko/hibi ``` ``` /plugin install hibi-cli@hibi ``` Run `/plugin marketplace update` to pull a newer version. The skill does not bundle the `hibi` binary; the agent installs Hibi with the prebuilt binary or `bun add @npupko/hibi`. ## The two moments ```mermaid theme={null} sequenceDiagram participant A as Coding agent participant H as hibi A->>H: before trusting a doc: check --doc CLAUDE.md H-->>A: exit 0 (clean) or exit 2 (verdicts + remediation) A->>A: edits code A->>H: after editing: check --since origin/main H-->>A: which sentences the change invalidated A->>A: run remediation.recommended's command, or fix the prose ``` ## What the skill teaches The agent sends a JSON array on stdin to `hibi record --from-file -`; keys mirror the flags in camelCase. It quotes the load-bearing token on the code side and sets `verified: true` only after reading the code. New claims are enforced by default; `suggest: true` makes one advisory. `hibi coverage --doc

` lists the sentences no claim backs, so the agent grounds them or removes them. `hibi check` (with `--doc`, `--since`, `--overview`), `hibi list`, and `hibi coverage` are pre-approved in the skill's `allowed-tools`, so the agent runs them without a permission prompt. The mutating verbs (`record`, `reanchor`, `retire`, `supersede`, `archive`, and `check --write`) are not, so a change to the store or a document always passes through you. Each verdict has `doc` and `code` anchor states, `behavior` when a verifier ran, `expired`, `gates`, and a `remediation` block. The agent reads `remediation.recommended`, finds that action in `actions[]`, and runs its `command`. When there is no `command` (`fix-code`, `fix-claim`, `supersede`), the agent does the work the title names, then runs `hibi check` again. See [Verdicts](/verdicts). Rewriting a sentence to silence a banner. Deleting a `.claims/` file instead of running `hibi retire `. Reanchoring a `behavior:refuted` claim. `hibi supersede --from --to ` relocates the claims whose sentence carried over verbatim and reports the rest as misses. `hibi archive --doc

[--successor

]` moves a document out of the read path. See [Lifecycle](/lifecycle). ## Session hooks You can bind the two moments to Claude Code hooks in your own settings: * **SessionStart**: `hibi check --doc CLAUDE.md` * **Stop**: `hibi check --since origin/main` Hibi ships no hook configuration. Both commands are read-only. ## Where this fits The same exit codes in GitHub Actions and git hooks. Record a claim by hand to see what the skill automates. `SKILL.md`, the generated CLI reference, the cookbook, and a drop-in CI workflow. # Hibi CLI Reference: Every Command, Flag, and Exit Code Source: https://hibi.mintlify.app/cli-reference Complete reference for all hibi commands: record, check, diff, status, query, list, ignore, reanchor, retire, relocate, supersede, retract, archive, doctor, schema, and more. `hibi` is a single self-contained executable. **Output is TTY-aware:** in a terminal you get a rich, grouped-by-document human view (color paired with symbols, honoring `NO_COLOR`); piped, redirected, or in CI you get compact JSON, so the machine contract is preserved. The JSON is **decision-first**: every payload leads `{ ok, action, schemaVersion, … }`, the verdict and its `remediation` menu come before any supporting detail, so a truncated read still surfaces the decision and what to do about it. Force a specific shape with the flag vocabulary: `--json` (compact JSON — the machine contract agents and SDKs read), `--json --pretty` (indented JSON), `--pretty` (rich human view even when piped), `--compact` (one line per claim), `--color auto|always|never` (also honors `NO_COLOR` / `FORCE_COLOR`), and `--simple` (ASCII symbols). `hibi completions ` prints a shell completion script. Two flags tune how much each JSON payload carries — the agent hot path: * **`--explain`** (alias `--detailed`): the JSON is **concise by default** (decision fields plus the remediation menu, bulky evidence dropped). `--explain` appends the `evidence` tail, an `advisories` list, and the proposition `fingerprint` to every verdict. * **`--no-hints`** (or `HIBI_ADVICE=0`): drop the `remediation` action menu from every verdict and `list` row, for noise-sensitive harnesses. All commands operate against a committed claim store (`.claims/`, one file per claim) beside your docs. The anchor is its own baseline, so every command runs offline and is correct under a shallow clone (`git clone --depth=1`). ## Commands | Command | What it does | | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `hibi init` | Create `.claims/` with a per-repo banner nonce. | | `hibi record` | Record a span-first claim: a doc span, anchored to zero or more code spans. | | `hibi check` | Verify every claim, emit verdicts and lifecycle, exit per the contract below. `--run-verifiers` additionally executes declared verifiers. | | `hibi diff --since ` | What did this change invalidate? Scopes to files touched since a base ref. | | `hibi status` | A repo-wide document health overview: every tracked doc with its worst status, claim counts, owner, and lifecycle. | | `hibi status --doc

` | Read-time gate: is this one doc still current? | | `hibi query --path

` | What claims are anchored to / cover this **doc OR code path**? Both directions; includes coarse edges. | | `hibi list [--state …]` | Triage: one lean row per claim (handle, status, severity, recommended action), most-severe-first. `--state` accepts `all\|gating\|warning\|clean\|orphaned\|suggested`. | | `hibi completions ` | Print a shell completion script. | | `hibi coverage --doc

` | Report which blocks of a doc are backed by a claim vs uncovered (the grounding-audit worklist). Read-only. | | `hibi reanchor ` | Re-resolve both anchors against current content; reset state. `--doc

` / `--code-file ` relocate a side to a **different file**. | | `hibi retire ` | Withdraw one claim: flip its `enforcement` to `retired`. Idempotent; a retired claim never gates or warns. | | `hibi ignore --claim --reason ` | Acknowledge a behavioral `at-risk` you re-verified by hand: non-gating while the acknowledged evidence stands, lapses automatically when it moves again. | | `hibi relocate --from

--to

` | Re-home every live claim stranded on `--from` onto `--to`, in one pass; claims whose sentence is absent from `--to` are reported as misses. | | `hibi supersede --new

--old

--type ` | Record that one doc supersedes or amends another. | | `hibi retract --doc

` | Mark that the author withdrew the claim. | | `hibi archive --doc

` | Move an obsolete doc out of the read path (tombstone). | | `hibi doctor` | Store-health report: orphaned anchors, anchorless `suggested` claims, stranded claims, duplicate propositions, plus the behavioral flag-rate and doc-side drift rates. Informational; always exits `0`. | | `hibi schema` | Emit the generated JSON Schema(s) for the data model and protocol. | `version` and `help` round out the set. ## `hibi record` `record` is **span-first**: the documented sentence's span supplies the claim text (the doc side), and you anchor zero or more code spans that back it (the code side). The doc span is the only source of the claim text — there is no side-channel override. ```sh theme={null} hibi record \ --doc README.md --doc-quote "Retries are capped at 5 attempts" \ --code-file src/retry.ts --code-quote "MAX_ATTEMPTS = 5" \ --trust verified --ref PR-1234 --enforce --owner alice ``` | Flag | Description | | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--doc

` | The document the claim lives in. | | `--doc-quote ` / `--doc-range L42:L44` / `--doc-line ` | The doc span that supplies the claim text (one of these). | | `--code-file ` | A source file the claim is anchored to. | | `--code-quote ` / `--code-range L1:L9` / `--code-line ` | The code span to anchor on (matched fuzzily). | | `--coarse` / `--glob ` | Anchor to a whole file or glob: navigation and blast-radius only; never reported as stale. | | `--trust verified\|inferred\|assumed` | Authored trust. `verified` requires an anchor plus a `--ref`. | | `--enforce` / `--enforcement ` | Mark `enforced`, or set `suggested` \| `enforced` \| `retired`. | | `--behavioral` / `--no-behavioral` | Declare the claim behavioral, or opt out of behavioral classification. Mutually exclusive — passing both is an error. Omit both and the deterministic heuristic decides (see the note below). | | `--verifier :` | Link an executable verifier (repeatable), e.g. `--verifier command:"bun test retry"`. `kind` is any non-empty string, matched against the `verifierKinds` a runner resolver declares. Conventional kinds (recommendation, not schema): `command`, `example`, `snapshot`, `contract`, `property`, `metamorphic`, `formal`. | | `--pristine` | Mark the document pristine: hibi never stamps a banner or frontmatter into it — verdicts surface via JSON, `status`, and exit codes only. For third-party, vendored, or read-only docs. | | `--ttl ` | Expire the claim after an ISO-8601 instant. | | `--owner ` | Who vouches for the claim. | | `--ref ` | The justification (PR, issue, commit). Required for `verified` trust. | | `--inline-id` | Write a hidden inline marker near the paragraph in an owned doc. | **How a claim becomes behavioral.** `--behavioral` makes it behavioral, wording irrelevant. With neither flag, the claim is behavioral iff the deterministic keyword heuristic matches (keyword, comparison/ordering, temporal/sequencing, or exception/error language) **or** it declares at least one verifier. `--no-behavioral` skips the heuristic entirely and requires the verifier list to be empty — a verifier is itself a behavioral declaration, so the combination is a contradictory record, rejected by the schema at `record` time and at store load. The error names the two legitimate noise levers: narrow `behaviorScope` (exclude globs, or `depth: 0`) or `hibi ignore --claim --reason `. Free-form kind labels (e.g. "retry") belong in the open `attrs` bag; the engine does not interpret them. `record` **refuses** an enforced claim unless the doc side resolves, a `--ref` is present, the code side is precise (not coarse or glob-only), and every code target resolves. Otherwise the record lands as `suggested`. Coarse and `--glob` targets are navigation-only and cannot back an enforced claim. **Record-time doc-quote guard.** The doc span must anchor reliably, so `record` (including `--from-file`) and `reanchor` reject a doc-side quote that cannot. Two rejections, each exiting `1`: * **Too short** — a quote under 8 characters: `doc quote is shorter than 8 characters — too short to anchor reliably. Record a wider span (--doc-range) that covers the full sentence.` * **Ambiguous** — a quote that occurs more than once and whose 48-character context can't single out one occurrence: `doc quote occurs N times in and the surrounding context does not select a single occurrence. Record a wider span (--doc-range), or add an inline ID and re-record.` In a `--from-file` batch, one failing spec fails the whole batch — nothing is written. When a recorded claim lands `suggested`, its JSON carries a `warning` — *"recorded as suggested — won't gate the build; pass `--enforce` to make it gating"* — so the advisory status never passes silently. And when the claim's proposition was reached by **fingerprint dedup** (the same sentence is already claimed), the JSON adds `existingClaims` (the other claims asserting that proposition) and a `next` hint — *"this proposition is already claimed — did you mean `hibi reanchor`?"* — so you re-point the existing claim instead of recording a duplicate. ### Batch authoring — `--from-file` To author many claims at once — onboarding a repo, or an agent grounding a set of docs — pass a JSON array of claim specs instead of one claim's worth of flags. This avoids shell-quoting verbatim spans and records the whole set in one pass. `-` reads the array from stdin. ```sh theme={null} hibi record --from-file claims.json cat claims.json | hibi record --from-file - ``` Each item's keys mirror the flags in camelCase. `doc` plus one doc-span key are required; everything else is optional: ```json theme={null} [ { "doc": "docs/retry.md", "docQuote": "Retries are capped at 5 attempts", "codeFile": "src/retry.ts", "codeQuote": "MAX_ATTEMPTS = 5", "trust": "verified", "owner": "alice" } ] ``` Keys: `doc`, `docQuote` / `docRange` / `docLine`, `codeFile`, `codeQuote` / `codeRange` / `codeLine`, `glob`, `coarse`, `inlineId`, `trust` (default `inferred`), `enforce` / `enforcement`, `behavioral`, `verifier`, `pristine`, `owner`, `ref`, `ttl`. Every spec is validated **before any write** — a malformed item fails the whole batch, never leaving half of it recorded. Propositions still dedup by fingerprint, so the same sentence recorded from two files shares one meaning. ## `hibi reanchor` `reanchor` re-resolves a claim's anchors against the current working tree and resets its state to `unchanged` — the supported way to settle a `moved` claim or re-point one after an edit. It **preserves the claim's identity** (same id, owner, and history); only its anchors and evidence baseline change. Whether authored trust survives depends on `--ref` — reanchoring **with** `--ref` asserts "I re-verified this" and retains trust; reanchoring **without** it downgrades `verified` trust to `inferred` (see the flag table). ```sh theme={null} # Re-localize both sides in place (e.g. after a code move): hibi reanchor asrt_1a2b3c # Relocate the CODE anchor to a different file: hibi reanchor asrt_1a2b3c --code-file src/new/path.ts --code-quote "MAX_ATTEMPTS = 5" # Relocate the DOC anchor to a different file (the sentence moved docs): hibi reanchor asrt_1a2b3c --doc docs/subsystems/retry.md --doc-quote "Retries are capped at 5 attempts" ``` | Flag | Description | | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--doc

` | Re-home the doc anchor onto a **different file**, updating the claim's document. Omit to keep it on the current file. | | `--doc-quote ` / `--doc-range` / `--doc-line` | The doc span to re-resolve (in the new file, if `--doc` is given). Omit to re-localize the existing selectors. | | `--code-file ` | Re-home the code anchor onto a different file. | | `--code-quote ` / `--code-range` / `--code-line` / `--glob` / `--coarse` | The code span to re-resolve. | | `--ref ` | Attest re-verification: records the new `@ref` and **retains authored trust**. Omitted, the re-anchor still lands, but `verified` authored trust is **downgraded to `inferred`**; the downgrade is recorded and surfaced in `status` and the JSON. | | `--dry-run` | Compute the would-be result and write nothing. The envelope gains `dryRun: true` and `next: "re-run without --dry-run to apply"`. | | `--suggest` | **Read-only orphan recovery** (see below): localize the claim's stored doc quote against every registered document and print ranked candidate targets. Never writes the store or any document; exits `0`. Cannot be combined with `--ref` / `--doc-range` or any other mutation flag. | ### Recovering an orphan — `--suggest` When a claim's documented sentence has been deleted from its file, `reanchor` alone can't repair it — it has no span to resolve against. `hibi reanchor --suggest` is the **read-only recovery aid**: it takes the claim's stored doc-side `text-quote` and localizes it against the current content of **every document registered in the store**, then prints the ranked candidate targets so you can pick one and re-anchor with an explicit `--doc-range`. It never writes the store or any document, and it always exits `0` (an operational error still exits `1`). It refuses to be combined with any mutation flag, failing with exactly: `--suggest is read-only and cannot be combined with mutation flags.` ```json theme={null} { "action": "reanchor-suggest", "claimId": "asrt_1a2b3c", "candidates": [ { "doc": "docs/retry.md", "start": 120, "end": 152, "similarity": 1.0, "snippet": "Retries are capped at 5 attempts" } ] } ``` Candidates keep a similarity **≥ 0.5**, are sorted by similarity descending, then document path ascending, then region start ascending, and are **capped at 5**; each `snippet` is the matched region text trimmed to 120 characters. Zero candidates is a valid result (an empty array). The `doc:orphaned` remediation action carries this command pre-filled, so you run it, inspect the candidates, then `hibi reanchor --doc-range …` to re-anchor. Relocating a doc anchor (`--doc`) moves the claim, it does not copy it: the source document is left intact as audit, and the claim no longer anchors to it — so the old file can be deleted without orphaning anything. This is the generic primitive behind doc splits, merges, renames, and promotions; it is **not** [supersession](/lifecycle), which records a document-to-document edge. ## `hibi relocate` `relocate` is the **batch consolidation primitive**: it re-homes *every* live (non-retired) claim stranded on `--from` onto `--to` in one pass, instead of making you `reanchor` each one by hand. A claim is re-homed when its current documented sentence appears **verbatim** in `--to`; each move rides the same `reanchor` machinery, so it keeps the claim id, code side, and history, and only the `documentId` changes. Claims whose sentence is **absent** from `--to` are never silently dropped — they are reported as **misses** for you to `reanchor` or `retire` by hand. ```sh theme={null} # Fold every claim from the old doc into the merged one: hibi relocate --from docs/old.md --to docs/merged.md # Preview without writing: hibi relocate --from docs/old.md --to docs/merged.md --dry-run ``` | Flag | Description | | ------------ | --------------------------------------------------------------------------------------------------------------------------------- | | `--from

` | The document the claims are stranded on. Must differ from `--to`. | | `--to

` | The document to re-home them onto. Must exist on disk, or `relocate` throws `Document not found on disk: `. | | `--dry-run` | Compute the would-be result and write nothing. The envelope gains `dryRun: true` and `next: "re-run without --dry-run to apply"`. | The JSON reports what moved and what did not: ```json theme={null} { "ok": true, "action": "relocate", "schemaVersion": "v1", "from": "docs/old.md", "to": "docs/merged.md", "relocated": [ { "claimId": "asrt_1a2b3c", "doc": "unchanged", "code": "unchanged" } ], "misses": [ { "claimId": "asrt_9f8e7d", "reason": "documented sentence not found in docs/merged.md — reanchor or retire by hand" } ], "next": "hibi check" } ``` `doc` and `code` on each `relocated` entry are the post-reanchor per-side `AnchorState`s (e.g. `unchanged`). `misses` lists the claims that need a manual `reanchor` or `retire`. ## `hibi list` `list` is the triage view: **one lean row per claim**, ordered most-severe-first, so you can see the whole suspect set at a glance and pick the next claim to act on. Narrow it with `--state`: ```sh theme={null} hibi list # every claim hibi list --state gating # only claims that would fail a gate hibi list --state warning # only re-anchorable warnings (moved / at-risk) hibi list --state clean # only claims that resolve cleanly hibi list --state orphaned # only claims with an orphaned doc OR code side (un-relocatable) hibi list --state suggested # only non-gating advisory claims (enforcement === suggested) ``` Each row carries just the handle and the headline decision — `claimId`, `propositionId`, `documentPath`, `codePath`, `status`, `severity`, `gates`, and the `recommended` remediation action (or `null`). It is the fast path to "which claim, and what do I do," with the full verdict a `check` away. Pass **`--ids-only`** (on `list` or `query`) to drop the JSON envelope entirely and emit a bare, de-duplicated, newline-delimited list of claim ids to stdout — the shape a shell loop wants: ```sh theme={null} for id in $(hibi list --state orphaned --ids-only); do hibi retire "$id"; done ``` ## `hibi coverage` `coverage` is the **grounding-audit worklist**: it segments a document into blocks (blank-line separated; fenced code blocks kept whole) and reports each block as **covered** — a live, code-grounded claim's doc anchor resolves cleanly into it — or **uncovered**. Read-only; it writes nothing and judges nothing. ```sh theme={null} hibi coverage --doc README.md ``` ```json theme={null} { "ok": true, "action": "coverage", "schemaVersion": "v1", "doc": "README.md", "summary": { "blocks": 12, "coveredBlocks": 7, "uncoveredBlocks": 5, "uncoveredExecutableBlocks": 1, "coverageRatio": 0.58 }, "regions": [ { "range": { "start": 120, "end": 244 }, "preview": "Retries are capped at 5 attempts…", "covered": true, "executable": false, "claimIds": ["asrt_897e054b48d040db"] } ], "next": "1 uncovered block(s) are executable — record them with --verifier command:\"…\"; ground or prune the rest — hibi record --from-file " } ``` A block counts as covered only when the claim is **live and code-grounded** and its doc anchor resolves `unchanged`/`moved` — a doc-only `suggested` placeholder or a drifted anchor does not count (that is `check`'s concern). Walk the `covered: false` regions and decide **ground-or-prune**: anchor the blocks a code span backs (`hibi record`, or the batch `--from-file`), and cut the prose nothing backs. Hibi never extracts claims from prose — the judgment on every uncovered block stays with you. Note `range` offsets are banner-normalized (the HIBI banner is stripped before segmenting), so identify a block by its `preview` text rather than byte-slicing the raw file at `range`. Each region also carries `executable: true` when its block **is or contains a fenced code block** whose info string is one of the exact set `sh`, `bash`, `zsh`, `shell`, `console` — the whole detection rule, no other heuristics (a ` ```json ` or ` ```ts ` block is not executable). An **uncovered executable** block is the highest-value grounding target: it can carry a `command:` verifier and reach a `supported`/`refuted` behavioral verdict, so when any exist the `next` hint leads with them and `summary.uncoveredExecutableBlocks` counts them; the general ground-or-prune steer for any remaining prose blocks still follows. `coverage` only tags — it never records a claim; creation stays explicit. ### Gating a plan — `--fail-uncovered` By default `coverage` is a pure report and always exits `0`. Pass **`--fail-uncovered`** to make it gate: when any uncovered block remains, the command exits with the gating exit code **2** (the same code `check` uses for a gating verdict). JSON and human output are unchanged — only the exit code differs. This is the CI-enforceable form of "this plan must be fully grounded": an uncovered block is an unimplemented or unpruned plan item. ```sh theme={null} hibi coverage --doc plan.md --fail-uncovered # exit 2 while any block is uncovered, 0 once fully grounded ``` ## `hibi retire` `retire` **withdraws a single claim**: it flips that claim's `enforcement` to `retired`, and a retired claim never gates or warns again. It is the supported way to silence a claim that is genuinely obsolete — never hand-delete the claim's file from `.claims/`, which loses the audit trail. ```sh theme={null} hibi retire asrt_897e054b48d040db ``` The call is **idempotent**: retiring an already-retired claim succeeds and reports `alreadyRetired: true`. Most drift verdicts that recommend retiring already hand you the exact command in their `remediation` menu, claim id pre-filled. Pass `--dry-run` to see what *would* be withdrawn without writing — the envelope gains `dryRun: true` and `next: "re-run without --dry-run to apply"`. ## `hibi ignore` `ignore` **acknowledges a behavioral `at-risk` you have re-verified by hand**: it stores the acknowledged evidence — the current `{ path → hash }` map — plus your reason on the assertion (`suppressed`). While every acknowledged path still carries its acknowledged hash, the at-risk is non-gating: the verdict surfaces `suppressed: true` in JSON and does not affect exit codes. ```sh theme={null} hibi ignore --claim asrt_1a2b3c --reason "retry cap re-verified by hand against PR-1301" ``` | Flag | Description | | ----------------- | ---------------------------------------------------------------------------------------- | | `--claim ` | The claim whose current `at-risk` you are acknowledging. | | `--reason ` | Why this flag is safe to suppress. **Required** — an unexplained suppression is refused. | The suppression **lapses automatically**: the moment any acknowledged evidence path's hash moves past the acknowledged one, or a new evidence path appears, the claim flags again. `ignore` silences one specific, inspected change-set — never the claim itself. To withdraw a claim for good, use `hibi retire`. ## `hibi doctor` `doctor` is a **store-health report**: it surfaces the dead state that `check` hides — claims and propositions that are not *drifting* but are nonetheless broken or redundant. It is **purely informational and always exits `0`**, so it never gates a build; run it to triage the store, not to guard it. ```sh theme={null} hibi doctor ``` It reports four categories: | Category | What it flags | | ----------------------- | ---------------------------------------------------------------------------------------------------------------------- | | `orphanedAnchors` | `[{ claimId, side, path }]` — a side (`doc` or `code`) whose span is deleted or unresolvable. | | `suggestedNoCode` | `[{ claimId, docPath }]` — a `suggested` claim with no precise code anchor. | | `staleDocClaims` | `[{ claimId, docPath, lifecycle }]` — a live claim stranded on a superseded / retracted / amended / archived document. | | `duplicatePropositions` | `[{ fingerprint, propositionIds, claimIds }]` — distinct propositions sharing one content fingerprint. | Beyond the categories, `doctor` reports two **rate metrics**, computed from a read-only resolution pass (`doctor` never runs verifiers, and it still always exits `0`): * **Behavioral flag-rate** — the share of behavioral claims currently `at-risk` or `refuted`. Guidance: above \~30% on a typical commit, tighten the change gate — narrow `behaviorScope` with `exclude` globs or a smaller `depth`. * **Doc-side orphaned / moved / changed rates**. Guidance: above \~30% orphan rate on typical edits, use inline IDs for high-severity claims. The envelope adds a `counts` object (one tally per category), a `healthy: boolean` (true iff every category is empty), and a `next` hint that routes to the most pressing category (e.g. `hibi list --state orphaned`): ```json theme={null} { "ok": true, "action": "doctor", "schemaVersion": "v1", "orphanedAnchors": [ { "claimId": "asrt_1a2b3c", "side": "code", "path": "src/retry.ts" } ], "suggestedNoCode": [], "staleDocClaims": [ { "claimId": "asrt_9f8e7d", "docPath": "docs/old.md", "lifecycle": "superseded" } ], "duplicatePropositions": [], "counts": { "orphanedAnchors": 1, "suggestedNoCode": 0, "staleDocClaims": 1, "duplicatePropositions": 0 }, "rates": { "behavioralFlagRate": 0.08, "docOrphanedRate": 0.02, "docMovedRate": 0.05, "docChangedRate": 0.11 }, "healthy": false, "next": "hibi list --state orphaned" } ``` ## The verdict, in brief Hibi never collapses a claim into one word. A verdict carries **two independent axes plus a flag**: anchor resolution per side (`doc:unchanged · code:changed`, from the vocabulary `unchanged · moved · changed · ambiguous · orphaned`), an optional behavioral belief on behavioral claims (`unverified · at-risk · supported · refuted`), and an orthogonal `expired` TTL flag. The JSON is decision-first — the verdict and its `remediation` menu lead, the bulky evidence trails (and only appears under `--explain`) — so a truncated read still surfaces the decision and the next step. "Drift" and "stale" are only the human roll-up for any claim needing attention, never machine states. States, confidence bands, grading, the remediation menu, and how a verdict becomes an exit code, all live on the Verdicts page. ## JSON output shapes Every payload leads `{ ok, action, schemaVersion, … }`, where `schemaVersion` (e.g. `"v1"`) is emitted *in the payload* so a consumer can branch on the contract version without reading a filename. **`check` / `diff` / `status`** return a decision-first envelope: an `ok`/`action`/ `schemaVersion` header, a `summary` of counts, a `verdicts` array, and a `documents` roll-up. Each verdict is concise by default — `{ assertionId, propositionId, documentId, doc, code, behavior?, expired, suppressed?, gates, changed?, remediation, notes }` — with the `evidence` tail, `advisories`, and `fingerprint` added only under `--explain`. The `changed?` field is the one-line behavioral carve-out: it appears on `behavior:at-risk` / `refuted` verdicts even on the concise path so you learn *what* moved. `suppressed?` is `true` on an `at-risk` acknowledged via `hibi ignore` — the verdict is surfaced but never affects exit codes. `diff` additionally reports `since` and `changedFiles`. **Mutating verbs add a `next` field** — the exact follow-up command to run — and `record`, `reanchor`, and `retire` also return the resulting `claimId`: ```json theme={null} { "ok": true, "action": "retire", "schemaVersion": "v1", "claimId": "asrt_897e054b48d040db", "alreadyRetired": false, "next": "hibi check" } ``` **`list`** returns `{ ok, action, schemaVersion, state, count, claims[] }`, where each claim row is the lean handle described above. **`query`** returns `{ ok, action, schemaVersion, path, count, hits[] }` — the way you find a claim's id before editing. **`coverage`** returns `{ ok, action, schemaVersion, doc, summary: { blocks, coveredBlocks, uncoveredBlocks, uncoveredExecutableBlocks, coverageRatio }, regions[], next }` — see [`hibi coverage`](#hibi-coverage) above. ## Exit codes Hibi communicates results through its exit code, so it slots straight into CI and git hooks: | Code | Meaning | | ---- | -------------------------------------------------------------------------------------------------------------- | | `0` | All clean. | | `2` | Gating: `changed` / `orphaned` / `ambiguous` (either side), `expired`, or `refuted`, on an **enforced** claim. | | `3` | Warning: `moved` or `at-risk` (re-anchorable / advisory). | | `1` | Operational error. | `moved` and `at-risk` **never gate**. `suggested` claims never set a failing exit code; only `enforced` claims can. ## Strictness: `--fail-on` `--fail-on` tunes which states fail the run: ```sh theme={null} hibi check --fail-on gating # default — fail on gating verdicts hibi check --fail-on warn # also fail on moved / at-risk warnings hibi check --fail-on tamper # fail only on banner tampering hibi check --fail-on never # report, never fail the run ``` In CI, pair `hibi check` with `--fail-on` to choose how strict the gate is. The official GitHub Action wraps this. ## Running verifiers: `check --run-verifiers` Verifiers execute **repo-committed commands** — a supply-chain surface — so they run **only** under `check --run-verifiers`. `status`, `query`, `list`, `doctor`, and plain `check` never spawn a verifier process. ```sh theme={null} hibi check --run-verifiers # also execute declared verifiers hibi check --run-verifiers --verifier-timeout 300 # raise the per-verifier timeout ``` The built-in **command runner** handles `kind: "command"`: it runs the verifier's `ref` as a shell command via `sh -c` on POSIX or `cmd /c` on Windows (cwd = repo root), so cross-platform repos should keep verifier refs shell-neutral (e.g. `bun test retry`, not a shell builtin or `&&` chain). Exit `0` → `supported`; non-zero → `refuted`; a timeout or spawn failure produces no result, so the belief stays at the deterministic baseline. The per-verifier timeout defaults to **120 seconds**; tune it with `--verifier-timeout `. External runner resolvers still require the default-deny manifest (`.claims/resolvers.json`). Verifier results beat change-gate routing: any failing verifier → `refuted` (gating on an enforced claim); all passing → `supported`; otherwise the gate result stands. ## Global options These apply to every command: | Option | Effect | | --------------------------------- | ------------------------------------------------------------------------------------------ | | `--pretty` | Human-readable output instead of JSON. | | `--explain` / `--detailed` | Append the `evidence` tail, `advisories`, and `fingerprint` to the otherwise-concise JSON. | | `--no-hints` (or `HIBI_ADVICE=0`) | Drop the `remediation` action menu from verdicts and `list` rows. | | `--cwd

` | The anchor root all paths resolve against. | | `--store-dir ` | Where the claim store lives (default `/.claims`). | | `--no-ast` | Skip the tree-sitter structural tier (text selectors only). | ## Next The two-axis model in full: every state, the confidence bands, and gating. Wire these commands into a GitHub Action, a git hook, or an agent's edit loop. # Why Hibi: Deterministic Doc-Drift Detection Source: https://hibi.mintlify.app/design The problem Hibi solves, its threat model (a reader trusts the raw file), and the principles behind every design decision. Documentation drifts. Someone edits the code, the sentence that described it stays, and the page now misleads whoever reads it. Often that reader is an AI coding agent that loads `CLAUDE.md` or a README at the start of a session and acts on every line. Hibi makes that drift detectable and visible in the file itself, deterministically. For the mechanics, start with [Verdicts](/verdicts). ## The problem and the threat model A **claim** is a sentence in a document anchored to the code it describes. Claims rot in three ways: | Drift type | What changed | Example | | ------------ | ---------------------------------------------- | ----------------------------------------------------------------------- | | Code drift | The code moved on; the prose stayed. | A doc says "retries 5 times" after the constant became `50`. | | Doc drift | The documented sentence was edited or deleted. | Someone rewrote the paragraph; the claim no longer points at live text. | | Supersession | A newer document replaced this one. | An ADR is marked superseded; readers still find the old page. | The threat model is one sentence: **a reader reads the raw file and trusts it.** It does not consult a dashboard or a CI log. So the status has to land in the file. That is what `check --write` and the [banner](/banners) are for. A flag is a request to re-verify. Hibi reports that the text or code under a sentence moved. A person or agent decides what the prose should now say. Hibi never rewrites prose. ## The principles No model runs in the check loop. The same working tree yields the same verdicts. Resolution is an ordered cascade with named constants ([Anchors](/anchors)), not a score. An external advisory resolver may attach notes; it never decides a verdict and never gates. Hibi reports that evidence moved, never that a claim is false. Confirming falsity means reading both sides and judging intent, which is a human or agent act. A tool that flags too much gets muted. Coarse anchors are never reported as drift. `moved` is a warning, not a gate. When several exact matches tie, the answer is `ambiguous`, not a guess. The store holds anchors, not a copy of the prose. Re-reading the live sentence at check time is what catches doc drift as well as code drift. The primary user is a coding agent. JSON is the contract, and `record --from-file -` is the primary recording path. A new claim is enforced by default; a claim that cannot fail anything does not prevent false claims. `--suggest` opts out. There is no per-format parser. Markdown, plain text, AsciiDoc, and editor rule files are all handled the same way; the only format-specific knowledge is which comment syntax wraps a banner. ## Why no model sits on the verdict path Published results on model-based doc verification are not strong enough to gate on: * The best published doc-behavior verification tops out at an F1 of about 0.58 (precision about 0.72, recall about 0.48). * LLM-as-judge consistency falls to about 0.57 under sampling, and audits have shown judges accepting up to about 63% of intentionally wrong answers. * Noisy analyzers report up to about 96% spurious warnings, and trust lost in one tier spreads to every tier. So Hibi splits the work. Text and AST resolution say where something changed. Author-supplied verifiers, run only under `check --run-verifiers`, judge behavior. A model may advise through an advisory resolver, but it may not gate and may not mark a claim supported. ## Prior art | Prior work | What Hibi takes from it | | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | Hypothesis fuzzy anchoring | The ordered cascade: exact match with context, then fuzzy match within an error budget, position as a weak bias. | | W3C Web Annotation Data Model | The `text-quote` and `text-position` selectors; several matches means ambiguous, not a guess. | | Fiberplane Drift | tree-sitter plus an AST fingerprint committed to a lock. Hibi adds the doc side, graded states, supersession, and in-file stamping. | | Doorstop | A link marked "suspect" that demands an explicit re-baseline. | | Gerrit ported comments | Degrade precision rather than guess. | | RFC Obsoletes / ADR supersession | A typed `supersedes` edge authored on the new document. | | FEVER | The `supported` / `refuted` vocabulary. | ## Where the reasoning becomes mechanics The claim model, the two axes, the remediation menu, and the exit codes. The selectors and the resolution cascade with its constants. Verifiers and why they are opt-in. # Hibi: Keep Docs and AI-Agent Instructions Up to Date Source: https://hibi.mintlify.app/index Hibi tracks claims in docs and agent instruction files, anchors them to source code, and flags drift deterministically with no model in the check loop. You change a constant in `src/auth.ts`. Two sentences in `README.md` and `CLAUDE.md` are now wrong, and nobody notices until a teammate or an agent trusts one of them. `hibi check --since origin/main` names those sentences and gives you the command to fix each. Hibi (日々, "day after day") tracks **claims**: a sentence in a document, anchored to the code it describes. When either side changes, `hibi check` flags the claim and can stamp a status banner into the document, so a reader without hibi still sees the flag. Run it in CI, in a git hook, or as the check an agent makes before it trusts an instruction file. ## The model You record a claim with `hibi record`, pointing at a span of prose and the code span it describes. Hibi stores an **anchor** for each side (pointers, not a copy of the prose) in a committed `.claims/` directory, one file per claim. On `hibi check`, each side is located again in the current files and graded as `unchanged`, `moved`, `changed`, `ambiguous`, or `orphaned`. An enforced claim **gates** (exit 2) when a side is `changed`, `orphaned`, or `ambiguous`, when its ttl passed, or when a verifier failed. `moved` is a warning. Every suspect verdict carries a remediation menu with the next command filled in. No model runs in the check loop. The same working tree yields the same verdicts. A flag means re-verify; Hibi does not decide that a doc is wrong, and it never edits prose. ## Start here Install Hibi and record a claim. The claim model, the anchor states, the remediation menu, and the exit codes. The problem, the threat model, and why no model sits on the verdict path. Every command and flag. Add out-of-process resolvers and verifier runners in any language. The Agent Skill that teaches coding agents to use Hibi. ## What you can rely on The check loop runs text matching, tree-sitter, and fixed constants. No model. Hibi reports that the text or code under a claim moved. It does not declare a doc wrong. Docs are text. Markdown, plain text, AsciiDoc, and instruction files work without a per-format parser. The anchor is its own baseline. `check` reads files, not git history. # Enforcement and Document Lifecycle in Hibi Source: https://hibi.mintlify.app/lifecycle Claims are enforced, suggested, or retired. Documents are active, superseded, or archived. Three verbs manage both: retire, supersede, archive. Two separate questions: may this claim gate a build, and where is this document in its life. Hibi answers each with its own field and its own verb. ## Enforcement Enforcement lives on the claim. | Enforcement | Meaning | | ----------- | ---------------------------------------------------------------------------------------------------------------------- | | `enforced` | The default. May gate a build and may stamp a banner. | | `suggested` | Advisory. Never gates, never warns. Recorded with `record --suggest`. May have a coarse (`--glob`) or empty code side. | | `retired` | Withdrawn with `hibi retire`. Kept for history; ignored by every verdict. | `--verified` on `record` is a separate boolean: it records that the author confirmed the code backs the sentence. It does not change enforcement. ### `retire` ```sh theme={null} hibi retire [--dry-run] ``` Flips the claim's `enforcement` to `retired`. Idempotent: a second call reports `alreadyRetired: true`. A retired claim never gates, never warns, is excluded from `clean`, and is never stamped. Do not delete the file under `.claims/` by hand; the record is the audit trail. ## Document lifecycle Lifecycle lives on the document. | Lifecycle | Meaning | | ------------ | ----------------------------------------------------------------------------------------------------------- | | `active` | In the read path. | | `superseded` | Replaced in full by another document. The new document carries a `supersedes` edge pointing at the old one. | | `archived` | Moved out of the read path with a tombstone at its old path. | A live claim on a `superseded` or `archived` document is **stranded**. `hibi list --state stranded` lists them. A stranded claim still resolves and can still gate; the document's lifecycle is added to its banner status. ### `supersede` ```sh theme={null} hibi supersede --from --to [--dry-run] ``` In one pass: 1. Registers `--to` if needed and authors the `supersedes` edge on it. 2. Flips `--from` to `superseded`. 3. Relocates every live claim on `--from` whose sentence appears verbatim in `--to`. A relocated claim keeps its id, code side, and history; only its document changes. The result lists `relocated`, `misses` (claims whose sentence was not found verbatim, with a reason), and `strandedClaims` (the live claims still on the old document after the pass). For each miss, either move it by hand with `hibi reanchor --doc --doc-quote "…"` (use `hibi reanchor --suggest` to find the sentence) or withdraw it with `hibi retire `. When `strandedClaims` is empty the old file can be deleted or archived without orphaning anything. ### `archive` ```sh theme={null} hibi archive --doc [--successor ] [--dry-run] ``` Moves the file to `archive/`, leaves a tombstone at the old path (pointing at `--successor` when given), and sets the document's lifecycle to `archived`. Claims are not moved; the result reports `strandedClaims`. To withdraw a document that has no successor, archive it without `--successor`. ## Deleting or renaming a document Claims are content. Move them in the same change as the prose: 1. `hibi list --path ` to see the claims on it. 2. `hibi supersede --from --to `. 3. Resolve each entry in `misses` with `reanchor` or `retire`. 4. When `strandedClaims` is empty, delete or archive the old file. Skipping steps 2 and 3 leaves the claims `doc:orphaned` after the delete. Orphaned is not retired: it is a live record pointing at a missing file. ## Who does what The engine flags, stamps, and records edges. The author or agent rewrites prose and re-runs `hibi check`. The engine never writes prose. ## Where to go next How lifecycle and drift appear in the file itself. `retire`, `supersede`, `archive`, and the rest of the verbs. # Install Hibi and Record Your First Claim Source: https://hibi.mintlify.app/quickstart Install Hibi, record a claim anchored to source code, run hibi check, and read the verdict. Hibi tracks **claims**: sentences in your docs or agent instruction files, each anchored to the code it describes. `hibi check` flags a claim when either side changes. A flag is a request to re-verify, not a statement that the doc is wrong. ## Install ```sh Prebuilt binary theme={null} curl -fsSL https://raw.githubusercontent.com/npupko/hibi/main/scripts/install.sh | sh ``` ```sh Bun theme={null} bun add @npupko/hibi # then: bunx hibi … bunx @npupko/hibi --help # or run it once without installing ``` The npm package targets [Bun](https://bun.sh). For a machine with no JS runtime, use the prebuilt binary. ## Record and check a claim `hibi init` creates a `.claims/` directory with a per-repo banner nonce. One file per claim. Commit it. ```sh theme={null} hibi init ``` Point at the documented sentence and at the code span that backs it. Quote the load-bearing token on the code side. ```sh theme={null} hibi record \ --doc README.md --doc-quote "Retries are capped at 5 attempts" \ --code-file src/retry.ts --code-quote "MAX_ATTEMPTS = 5" \ --verified --owner alice ``` The claim is enforced by default. `--verified` records that you confirmed the code backs the sentence. Because the code span contains the literal `5`, changing it to `50` later trips the claim even if nothing else moves. Agents record in batches on stdin: ```sh theme={null} echo '[{"doc":"README.md","docQuote":"Retries are capped at 5 attempts", "codeFile":"src/retry.ts","codeQuote":"MAX_ATTEMPTS = 5","verified":true}]' \ | hibi record --from-file - ``` ```sh theme={null} hibi check # verify every claim hibi check --write # also stamp a banner into each suspect document ``` `hibi check` exits `0` when clean, `2` when an enforced claim gates (`changed`, `orphaned`, or `ambiguous` on either side, `expired`, or `refuted`), and `1` on an operational error. A `moved` side is a warning and exits `0` unless you pass `--fail-on warn`. ## Everyday commands ```sh theme={null} hibi check --doc CLAUDE.md # is this document still current? hibi check --since origin/main # what did this change invalidate? hibi check --overview # per-document table hibi list --path src/retry.ts # which claims depend on this file? hibi list --state gating # one row per gating claim hibi coverage --doc README.md # which sentences have no claim? hibi reanchor # re-resolve and store the new baseline hibi reanchor --suggest # candidate locations for a lost span hibi retire # withdraw a claim hibi supersede --from v1.md --to v2.md hibi archive --doc old.md --successor new.md ``` Every suspect verdict carries a remediation menu: a `recommended` action id and an ordered `actions` list, each with a `command` when Hibi can perform the step. Output is JSON when piped and human-readable on a TTY. `--format human|compact|json|json-pretty` overrides; `--json` is short for `--format json`. `--explain` adds the evidence tail; `--no-hints` drops the remediation menu. `hibi --help` prints that command's options. The claim model, the five anchor states, the gates rule, and the exit codes. # Hibi Resolvers: Extend Drift Detection in Any Language Source: https://hibi.mintlify.app/resolvers External resolvers grade anchor kinds, run verifiers, or attach advisories over JSONL-RPC on stdio. They are off until listed in .claims/resolvers.json. A **resolver** is a program that grades an anchor, runs a verifier, or attaches advisory notes to a verdict. The built-in drift resolver runs **in-process** and does not speak the wire protocol. External resolvers run out-of-process and talk to the engine over JSONL-RPC on stdin and stdout. ## Roles | Role | Method | Effect | | ---------------------------- | --------- | ---------------------------------------------------------------------------------------------------- | | Anchor grader (non-advisory) | `resolve` | Produces the verdict for the anchor kinds it declares. May gate. | | Verifier runner | `verify` | Runs a verifier and returns `supported` or `refuted`. Dispatched only under `check --run-verifiers`. | | Advisor (`advisory: true`) | `resolve` | Attaches `advisories` to a verdict. Never changes a state, never gates. | There is no built-in supersession resolver and no semantic advisor; supersession is an engine operation (`hibi supersede`). ## The protocol Newline-delimited JSON-RPC, one object per line. Three methods: Returns `{ name, version, kinds, tier, advisory, verifierKinds? }`. The engine calls it first and routes work only to a resolver that claimed it. Params: `{ assertion, files: { doc, code: { path: content } }, proposition? }`. Returns `{ verdict?, advisories? }`. The engine reads the files; the resolver never touches the filesystem. Params: `{ assertion, verifier, changedEvidence }`. No file contents are sent. Returns `{ behavior: "supported" | "refuted", advisories?, notes? }`; `advisories` and `notes` default to empty. An error response, a timeout, or a spawn failure counts as no result. Print any message schema with `hibi schema --name ` (for example `ResolveParams`, `VerifyParams`, `Verdict`). `hibi schema` with no name lists the names. The schemas in `schemas/*.v3.json` are generated from the Zod model. ## Enabling a resolver The manifest is default-deny. A resolver not listed in `.claims/resolvers.json` is never launched. ```json theme={null} { "resolvers": [ { "name": "my-grader", "command": "bun", "args": ["run", "resolvers/my-grader.ts"], "timeoutMs": 5000 } ] } ``` | Field | Default | Meaning | | ------------------------- | --------------- | ------------------------------------------------------- | | `name`, `command`, `args` | | How to spawn it. | | `timeoutMs` | `5000` | Per-request timeout; a slow resolver is killed. | | `kinds` | from `describe` | Optional explicit allow-list of anchor kinds. | | `override` | `false` | Allow a non-advisory resolver to claim a built-in kind. | | `modelBacked` | `false` | The resolver's advisories are produced by a model. | ### `override` The built-in kinds are `text-quote`, `text-position`, `ast-node`, `value`, and `coarse`. A non-advisory external resolver that claims one of them replaces the deterministic core verdict for every anchor carrying that kind. That is refused by default: without `"override": true` on the manifest entry, the built-in kinds are dropped from the resolver's list with a warning on stderr. An advisory resolver may declare any kinds; it never produces a verdict. ### Provenance for model-backed advisors An advisory from a `modelBacked` resolver must carry `provenance: { model, promptHash, contextHash, params? }`. The registry drops advisories without it and prints one warning per run per resolver. ## Verifier kinds and the built-in command runner A verifier's `kind` is an open string matched against the `verifierKinds` a runner declares. The built-in runner handles `command`: it executes `ref` as a shell command from the repository root. Exit `0` is `supported`, non-zero is `refuted`, a timeout or spawn failure is no result. The default timeout is 120 seconds, set with `--verifier-timeout `. Verifiers execute repo-committed commands. They run only under `check --run-verifiers`. `check` without that flag, `list`, and `coverage` never spawn a verifier. External runners also require the manifest. ## Writing your own Import the server from the main package: ```ts theme={null} import { serveResolver } from "@npupko/hibi/resolver"; serveResolver({ describe: () => ({ name: "my-grader", version: "1", kinds: ["my-kind"], tier: 2, advisory: false, }), resolve: ({ assertion, files }) => ({ verdict: grade(assertion, files) }), }); ``` `serveResolver` owns the framing and dispatch. The same module exports the protocol types (`ResolveParams`, `ResolveResult`, `VerifyParams`, `VerifyResult`, `DescribeResult`) and the model types (`Assertion`, `Verdict`, `Selector`, and the rest). A resolver in another language reads requests on stdin, writes responses on stdout, and validates against `hibi schema`. ## Where to go next The `@npupko/hibi/resolver` export. Where `verify` fits. # The Hibi Resolver SDK Source: https://hibi.mintlify.app/sdks The @npupko/hibi/resolver export handles JSONL-RPC framing so a TypeScript resolver only implements describe, resolve, and verify. A resolver is a program Hibi spawns to grade an anchor kind, run a verifier, or attach advisories. Hibi talks to it in JSONL-RPC over stdio. The SDK is one export from the main package that handles the framing: ```ts theme={null} import { serveResolver } from "@npupko/hibi/resolver"; ``` For the protocol, the manifest, and `override`, see [Resolvers](/resolvers). ## The handler ```ts theme={null} import { serveResolver, type ResolverHandler } from "@npupko/hibi/resolver"; const handler: ResolverHandler = { describe: () => ({ name: "echo", version: "1", kinds: ["echo"], tier: 2, advisory: false, verifierKinds: ["echo-cmd"], }), resolve: ({ assertion, files }) => ({ verdict: /* … */ }), verify: ({ assertion, verifier, changedEvidence }) => ({ behavior: "supported" }), }; serveResolver(handler); ``` | Method | Params | Returns | | ---------- | --------------------------------------------------- | ------------------------------------------------------------- | | `describe` | none | `{ name, version, kinds, tier, advisory, verifierKinds? }` | | `resolve` | `{ assertion, files: { doc, code }, proposition? }` | `{ verdict?, advisories? }` | | `verify` | `{ assertion, verifier, changedEvidence }` | `{ behavior: "supported" \| "refuted", advisories?, notes? }` | `verify` receives no file contents. A grader that only handles anchors omits `verify` (the server answers with an unknown-method error, and the engine records no result). A runner can return an empty `kinds` list and handle only `verify`. `tier` defaults to 1; 3 is the advisory tier. ## Exports `@npupko/hibi/resolver` exports `serveResolver`, `ResolverHandler`, the protocol types (`DescribeResult`, `ResolveParams`, `ResolveResult`, `VerifyParams`, `VerifyResult`, `RpcRequest`, `RpcResponse`, `PROTOCOL_VERSION`, `LineFramer`, `encodeLine`), and the model types (`Assertion`, `Anchor`, `AnchorState`, `BehaviorState`, `Selector`, `SelectorBundle`, `Verdict`, `VerdictEvidence`, `Verifier`, `Advisory`, `ChangedEvidence`, `Enforcement`, `Proposition`). ## Other languages Every message has a JSON Schema generated from the Zod model. Print one with `hibi schema --name `, or read `schemas/*.v3.json` in the repository. A resolver in any language reads one JSON object per line on stdin and writes one per line on stdout. ## Next The protocol, the manifest, and the `override` flag. Where `verify` fits. # Hibi Verdicts: Claim States, Remediation, and Exit Codes Source: https://hibi.mintlify.app/verdicts How Hibi models a claim, grades it on anchor resolution and behavior, attaches a remediation menu, and maps the result to an exit code. Hibi tracks **claims**: a sentence in a document, anchored to the code it describes. On every `hibi check`, each claim produces a **verdict**: a per-side anchor state, an optional behavior state, an `expired` flag, a `gates` flag, and a remediation menu. Verdicts are computed from the current files and never stored. ## The model * A **Document** is a file with claims on it. It has a lifecycle: `active`, `superseded`, or `archived`. * A **Proposition** is the sentence, deduplicated by content fingerprint. Two documents that state the same sentence share one proposition. * An **Assertion** is one claim: this sentence, in this document, anchored to this code, with an owner, an enforcement level, an optional ttl, and zero or more verifiers. * An **Anchor** has a **doc side** (one selector bundle for the sentence) and a **code side** (zero or more bundles for the code). The code side may be empty only on a `suggested` claim. The store holds anchors, not copies of the prose. The stored quote is anchoring material; the live document span is the truth and is re-read on every run. Selector kinds and the resolution rules are on the [Anchors](/anchors) page. A flag is a request to re-verify. Hibi reports that the text or code under a claim moved. It does not decide that the sentence is wrong, and it never edits prose. ## The flow `hibi record` stores an anchor for the doc span and the code span(s). The anchor is the baseline, so `check` runs offline and under a shallow clone. `check` locates the documented sentence in the current document. If the sentence is gone or changed, the verdict says so on the doc side. Each code bundle is located in its file and graded through the cascade on the Anchors page. The worst code bundle sets the verdict's `code` state. Under `check --run-verifiers`, a claim with verifiers runs them and gets a `behavior` state. See [Behavioral claims](/behavioral). Hibi emits the verdict, sets the process exit code, and with `--write` stamps a banner into each suspect document. ## The two axes ### Anchor resolution One vocabulary, applied to each side and reported as `doc:` and `code:`. | State | Meaning | | ----------- | ------------------------------------------------------------------ | | `unchanged` | found, same text, same place | | `moved` | found, same text, new place | | `changed` | found, but the text, the AST, or a literal inside the span differs | | `ambiguous` | matches in several places equally well | | `orphaned` | not found | ### Behavior Present only when a verifier ran. A claim is behavioral if and only if it carries at least one `--verifier kind:ref`. | State | Meaning | | ----------- | ------------------------------ | | `supported` | every verifier that ran passed | | `refuted` | at least one verifier failed | Without `--run-verifiers`, or on a claim with no verifier, the `behavior` field is absent. ### The `expired` flag A claim may carry a `ttl` (an ISO-8601 instant). Past it, the verdict has `expired: true`. It is a flag alongside the axes, not a state on them. ## The gates rule `gates` is true if and only if the claim is `enforced` and at least one of these holds: * `doc` or `code` is `changed`, `orphaned`, or `ambiguous`; * `expired` is true; * `behavior` is `refuted`. `moved` never gates. A `moved` side on an enforced claim is a **warning**. A `suggested` claim never gates and never warns. A `retired` claim is listed but counted as neither clean, gating, nor warning. ## The verdict shape ```json theme={null} { "assertionId": "asrt_897e054b48d040db", "propositionId": "prop_d6185fc85e2a4e52", "documentId": "doc_5c9e4f99d90e2cfd", "doc": "unchanged", "code": "changed", "expired": false, "gates": true, "changed": "src/auth.ts: value changed (was `30`)", "remediation": { "recommended": "update-claim", "actions": [ /* … */ ] }, "notes": ["code: value changed (was `30`)"] } ``` `behavior` appears only when a verifier ran. `changed` is a one-line summary present when a side is `changed`. `notes` carries the reason labels ("identifiers or literals renamed", "restructured", "value changed", "a number in the sentence changed", "quote not found"). Pass `--explain` to append the evidence tail: `evidence.docRegion`, `evidence.codeRegions`, `evidence.similarity` (normalized similarity of the located span to the stored quote), and `evidence.changedEvidence` (`{ path, kind: text|ast|value|verifier-source, detail }`), plus `advisories`. The full `check` payload is `{ ok, action: "check", schemaVersion: "v3", ref, since?, changedFiles?, doc?, exitCode, summary, verdicts, documents }`. `summary` has `total`, `gating`, `warning`, `clean`, `retired`, per-state histograms `doc`, `code`, `behavior`, and `expired`. Each entry in `documents` has `id`, `path`, `lifecycle`, `suspect: [{ propositionId, status }]`, and `bannerAction` when `--write` touched the file. The `status` vocabulary is side-tagged: `code:changed`, `doc:orphaned`, `code:moved`, `behavior:refuted`, `expired`, `superseded`, `archived`. ## The remediation menu Every suspect verdict carries a `remediation` block: `recommended` (an action id, or `null` when Hibi cannot infer intent) and an ordered `actions` list. Each action is `{ id, title, rationale, command? }`. `command` is present when Hibi can perform the step, with the claim id filled in. | Verdict | `recommended` | Actions, in order | | -------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------- | | `code:changed` | `update-claim` | `update-claim` ("Update the sentence, then reanchor", `hibi reanchor `), `reanchor` (as is), `retire` | | `doc:changed` | `reverify-doc` | `reverify-doc`, `reanchor`, `retire` | | `doc:changed` and `code:changed` | `reconcile` | `reconcile`, `reanchor`, `retire` | | `*:orphaned` | `reanchor` | `reanchor` (`hibi reanchor --suggest`), `retire`, `supersede` | | `*:ambiguous` | `reanchor` | `reanchor` (pass a wider span) | | `*:moved` | `reanchor` | `reanchor` | | `behavior:refuted` | `null` | `fix-code`, `fix-claim` | | any of the above with `expired` | as above, or `reverify-and-rerecord` | the row's actions plus `reverify-and-rerecord` | Notes on the table: * The orphan menu leads with a runnable command: `hibi reanchor --suggest` lists candidate locations, after which you reanchor with an explicit span. * `behavior:refuted` never offers `reanchor`. A failing verifier means the behavior is wrong, not that the anchor moved. * `expired` composes. When the base menu recommends `reanchor`, or there is no base menu, the recommendation becomes `reverify-and-rerecord`. * Orphan precedence: an orphaned side produces the orphan menu even when a verifier was refuted. `--no-hints` (or `HIBI_ADVICE=0`) drops the `remediation` block from every verdict and `list` row. ## Exit codes | Code | Meaning | | ---- | ---------------------------------------------------------------------------------- | | `0` | clean, or only warnings | | `2` | at least one gating verdict; or a warning under `--fail-on warn` | | `1` | operational error: no store, unknown flag, unknown `--since` ref, missing document | `--fail-on` sets the threshold: `gating` (default), `warn` (a `moved` side also exits 2), `never` (always exit 0; read the JSON). ## Finding ungrounded sentences Claims enter the store deliberately; Hibi does not extract them from prose. `hibi coverage --doc ` splits a document into sentence-level regions and reports which are backed by a live, code-grounded claim. The uncovered regions are the candidates for a new claim or for removal. `--fail-uncovered` exits 2 while any region is uncovered. A missing document is exit 1. ## Where to go next The selector kinds and the resolution cascade that produces each state. Verifiers, `--run-verifiers`, and the doc-first guard. `retire`, `supersede`, and `archive`. Every command and flag. # Workflows: When to Run Which Hibi Command Source: https://hibi.mintlify.app/workflows Eight moments, each with the one command that answers it: trust-check, post-change check, blast radius, grounding audit, plan gating, triage, document consolidation, orphan recovery. Each section is a moment, the command for it, and what to do with the result. The same flows appear as an agent playbook with raw JSON in the [skill cookbook](https://github.com/npupko/hibi/blob/main/plugins/hibi-cli/skills/hibi/references/cookbook.md). Running example: `src/retry.ts` (`MAX_ATTEMPTS = 5`), `src/auth.ts` (`TOKEN_TTL_MIN = 30`), a `README.md`, and a `CLAUDE.md` that says "Auth tokens expire after 30 minutes." ## 1. Trust-check before following an instruction file ```sh theme={null} hibi check --doc CLAUDE.md ``` Exit 2 means a sentence in the file no longer matches the code. `doc: unchanged`, `code: changed` means the sentence is intact and the code moved. Do not act on that sentence as written. The verdict's `remediation.recommended` is `update-claim`: rewrite the sentence if it is now wrong, then run `hibi reanchor `. ## 2. Keep docs honest in the same PR as the code change ```sh theme={null} hibi check --since origin/main ``` Only claims touching a file changed since the ref are evaluated. `changedFiles` lists the files; `documents` names the docs whose sentences the edit invalidated. Fix the prose in the same PR. `--explain` adds `evidence.changedEvidence` when the one-line `changed` field is not enough. An unknown ref exits 1. ## 3. See the blast radius before you refactor ```sh theme={null} hibi list --path src/auth.ts ``` One row per claim anchored to that path on either side, with `claimId`, `text`, `documentPath`, `codePath`, `status`, `severity`, `enforcement`, `recommended`, and `side`. Keep the ids: after the edit you `reanchor` the claims still true and `retire` the ones now wrong. ## 4. Go from zero to protected on an existing repo ```sh theme={null} hibi init hibi coverage --doc README.md ``` `coverage` splits the document into sentence-level regions and reports each as covered or uncovered, with a `coverageRatio`. Hibi does not extract claims from prose. For each uncovered region, either record a claim (a code span backs the sentence) or remove the sentence (nothing does). Record the grounded set in one batch: ```sh theme={null} echo '[{"doc":"README.md","docQuote":"Requests are retried up to 5 times before failing.", "codeFile":"src/retry.ts","codeQuote":"MAX_ATTEMPTS = 5","verified":true}]' \ | hibi record --from-file - ``` The batch is validated before any write; a bad item fails the whole batch. New claims are enforced by default; pass `"suggest": true` for an advisory claim. Re-run `coverage` to confirm the ratio rose, then `hibi check`. ## 5. Verify built code against a plan ```sh theme={null} hibi coverage --doc plan.md --fail-uncovered ``` Exit 2 while any region of the plan is uncovered, 0 once every region is backed by a claim. A sentence you cannot anchor to code is an unimplemented plan item. Give behavioral promises a `--verifier command:"…"` and prove them with `hibi check --run-verifiers`. ## 6. Triage ```sh theme={null} hibi list --state gating ``` One row per gating claim, most severe first. Act on each row's `claimId`: `hibi reanchor ` if the sentence still holds, `hibi retire ` if it is obsolete. Other filters: `warning`, `clean`, `orphaned`, `suggested`, `stranded` (live on a superseded or archived doc), `duplicate` (a sentence claimed more than once). `--ids-only` prints bare ids for a shell loop. ## 7. Consolidate a document and bring its claims along ```sh theme={null} hibi supersede --from docs/old.md --to docs/merged.md ``` Authors the `supersedes` edge, flips the old document to `superseded`, and relocates every live claim whose sentence appears verbatim in the new document. Claims whose sentence was reworded or cut come back in `misses`; `strandedClaims` lists what is still on the old document. Resolve each miss with `hibi reanchor --doc docs/merged.md --doc-quote "…"` or `hibi retire `. When `strandedClaims` is empty, delete or `archive` the old file. Add `--dry-run` to preview. ## 8. Recover an orphaned claim ```sh theme={null} hibi reanchor asrt_1a2b3c --suggest hibi reanchor asrt_1a2b3c --doc docs/retry.md --doc-quote "Retries are capped at 5 attempts" ``` `--suggest` is read-only. It ranks candidate locations for the stored doc quote across every registered document and for each code quote across files in the same language; each candidate has `side`, `file`, `start`, `end`, `similarity`, `snippet`. Reanchor to the one you pick with an explicit span. `reanchor` refuses to proceed on a side that was not found unless you pass a new span for it. If no candidate fits, `hibi retire asrt_1a2b3c`. ## How to respond to a flag Every suspect verdict carries a [remediation menu](/verdicts#the-remediation-menu). Read `recommended`, run its `command`, or do the prose work its `title` names. Do not rewrite a sentence to make a banner go away; re-verify, then act.