Skip to main content
The examples continue the repository from the quickstart. Later in that repository’s history docs/retry.md gains a section ## Timeouts with the sentence “Each attempt times out after 10 seconds.”, and the claim c1-xwck on its delay sentence is recorded as in the ranges page. Ids are the ones those runs printed.
hibi keeps three kinds of records. None of them is ever edited or deleted.

Claim

A claim is a statement that was checked, and what it was checked against. A claim with no evidence is allowed. Its subject alone is fingerprinted, so it goes stale when the sentence changes. With a recheck period it also expires after that time, which suits statements whose truth lives outside the repository:
The “sides” of a claim are its subject (side 0) and its evidence (side 1, 2 and so on).

Mark

A mark records that the claim was checked: the time (at), optionally who (by) and a note, and the fingerprint of every side as it was at that moment. hibi claim writes the first mark itself. hibi mark adds another after a re-check. A claim can have any number of marks.
output
mark requires every side to resolve to exactly one unit, exactly. A side that is missing or matches several units makes the command fail with side_missing or side_ambiguous; use reanchor to point that side at the right unit. That includes a side whose stored anchor is no longer found exactly: mark never follows a candidate. mark prints which sides were not the same, not what changed in them. Read the change, for example with git diff, before you mark.

Retirement

A retirement records that a claim no longer applies. It is permanent. A retired claim stays in the store, is no longer evaluated, and no longer covers anything.
output
--replaced-by <claim-id> names the claim that takes the place of the retired one. It must be a live claim, not one of those being retired.

Changing a claim

Claims are immutable. hibi reanchor builds a new claim from an old one and, in one write, stores the new claim, a mark for it and a retirement of the old claim that names the new one in replacedBy. Use it to change the statement, replace or add or drop an anchor, or change the recheck period or the note:
If the rebuilt claim is the same as another live claim, by the rule of running the same claim again, reanchor marks that claim and retires the old one into it instead of writing a new claim; the JSON result then has "merged": true and new is the id of the existing claim. Like mark, the result reports what the old claim was before the write. Without options, reanchor resolves every side again and stores each selector as it is completed now, with the current text around each quote and its current container. Every side must resolve exactly, as for mark. When nothing changed since the selectors were stored, it writes nothing. For a claim in another example repository whose files did not change:
output
Evidence numbers in --evidence and --drop-evidence are the numbers of the old claim. A kept side that does not resolve exactly is named by its old number too, also when a lower number is dropped in the same command. Here the declaration of evidence 2 was renamed from RETRIES to MAX_RETRIES:
output
When several kept sides need a new anchor, reanchor fails once and names all of them. Its fix line repeats your arguments with a placeholder for each such side:
output
reanchor marks every changed side it keeps, not only the side it re-points, and prints after “is now:” the text the new claim has for each side that was not same before the write, re-pointed or not. A side that was same gets no such text. Because reanchor writes a mark, run it only after you checked the statement against every changed side.

Ids

Every record has an id derived from its content: c1- for a claim, m1- for a mark, r1- for a retirement, followed by 20 characters of a BLAKE3 hash of the record. Two consequences:
  • A claim with exactly the same statement, stored anchors, recheck and note is the same claim.
  • A claim with the same body as a retired claim is that retired claim, and claim fails with claim_retired. The error says whether the claim was retired or replaced by another claim (see running the same claim again).

Running the same claim again

Running the same hibi claim again adds a mark to the existing claim and prints marked instead of created. The stored anchors hold the text around a quote and its container (see anchors), and you may write an anchor differently the second time, so the new claim could get a different id. hibi therefore looks for a live claim that is the same in every other respect: the same statement, recheck and note, the same number of sides with the same locators, and every stored side resolving to the same unit as the anchor you gave. Selectors are not compared, so #MAX_ATTEMPTS and a quote on that constant name the same side, and so do a quote and a longer quote in one sentence. If it finds such a claim, it marks it (the one whose id is the id the new claim would get, if there is one, and otherwise the one with the smallest id) and does not rewrite its stored anchors. The result says what the claim was before the mark. This is how a stale claim shows up when you claim it again after the function changed:
output
In JSON each entry carries accepted: null for a new claim, otherwise {"was": <state before>, "sides": [...]} listing the sides that were not same, each with index, role, loc, state and reason. The lines after “is now:” show the text that was accepted. Here the claim was made with the quote gives up after 3 attempts, and is claimed again with the whole sentence:
output
In JSON the entry has "created": false. A side of the existing claim must resolve to exactly one unit. When it is missing or ambiguous, for example after its heading was renamed, the existing claim is not the same claim, and claim writes a second one. Re-anchor the existing claim instead. The same rule finds a retired claim. When no live claim is the same claim and a retired one is, claim fails with claim_retired, however the anchors are written: a retirement is a decision, and another way of writing an anchor does not undo it. Here a claim made with #MAX_ATTEMPTS was retired, and the same statement is claimed with quotes:
output
A different note makes another claim, so it records the statement again. For a claim that reanchor replaced, the error follows the chain of replacements to its last claim. It says was replaced by <new> when the replacement is live, and was replaced, and the last claim of that chain is <last> for a longer chain; the fix line then tells you to run hibi status on that claim, so look at it before anything else. When the chain ends in a retired claim, it says was replaced, and the last claim of that chain, <last>, was retired, with the fix line of a retired claim. Two elements of one --stdin batch that are the same claim make one claim. The second reports the first one’s id, and the same mark when both elements have the same by; a different by adds a second mark:
output
Commands accept a unique prefix of an id with at least 4 characters after the type prefix, such as c1-c5dm. A prefix that matches several records is the error ambiguous_id, and the message lists them.

Reading the history

hibi list reads the store only: nothing is resolved and no state is computed, so it works when files or providers are missing.
output
With an id, list prints the stored claim, its marks in time order and its retirement:
output
--loc <glob> keeps claims with a side whose locator matches, and --text <substring> keeps claims whose statement contains the text (case-sensitive).