Skip to main content
The store is plain text in the repository, committed with the code. The memory therefore matches the branch being checked: a branch that changes a function also carries the claims that were re-checked for it.

Layout

Commit everything under .hibi/ except what its own .gitignore excludes. Nothing outside .hibi/ is written by hibi, apart from the cache in your user cache directory.

Shards and lines

A claim lives in claims/<s>.jsonl, where <s> is the first hex digit of the BLAKE3 hash of its subject’s locator. Its marks and retirements live in marks/<s>.jsonl, the shard of their claim. All claims about one document are therefore in one shard. Each line is one record as canonical JSON (RFC 8785: sorted keys, no extra whitespace), and each shard is sorted by id. A claim line and a retirement line from the walkthrough:
output
hibi schema claim, hibi schema mark and hibi schema retirement print the record schemas.

Merging branches

.hibi/.gitattributes, as init writes it, marks the shards for git’s union merge:
Records are immutable lines whose ids are derived from their content. Two branches that add different claims to the same shard add different lines, and the union merge keeps both without a conflict. A merged shard may be unsorted or hold a line twice; hibi reads it correctly and the next write sorts it again. The repository’s tests cover a two-branch merge into one shard. Because a deleted line does not survive a union merge, nothing is ever deleted: a claim that no longer applies gets a retirement record instead. Whether GitHub’s own merge button honours merge=union has not been verified. If a pull request shows a conflict in a shard, merge locally with git.

Writes

Every write takes an exclusive lock on .hibi/.lock (waiting up to 10 seconds, then failing with store_locked), re-reads each shard it changes, writes a temporary file, syncs it to disk and renames it over the shard. Claim shards are written before mark shards, so a crash can leave at worst a claim without its mark, which reads as stale. A write that would make a shard larger than 64 MiB, or all shards together larger than 256 MiB, is refused with store_full before anything is written. Retired claims stay in the store by design, so a store does not shrink.

Damage and refusals

The remediation for store_corrupt says to look at the named file first, with git diff -- <file>. Restoring it with git checkout -- <file> also discards every record in it that is not committed yet, so keep those lines if there are any. For a missing directory it says to look with git status -- <dir>: restoring the directory from git brings back the committed records only.

Stores from hibi 0.x

hibi 0.x kept its store in .claims/. This version does not read, convert or delete it, and refuses to run in a repository that has one:
output
Only version, schema and completions run in such a repository.

Finding the root

The root is the directory given by --root, or else the nearest directory, upward from the working directory, that contains .hibi/hibi.toml. None is the error not_initialized. init creates the store at the top level of the git repository.