A card catalog and a fact-checker for your repo's knowledge — so your coding agent reads 2 docs instead of 200, and never asserts a stale number.
Project description
repo-librarian
A card catalog and a fact-checker for your repo's knowledge — so your coding agent reads 2 docs instead of 200, and never asserts a stale number.
Zero runtime dependencies. No embeddings, no vector DB, no server. Deterministic, git-native, auditable — if you can read a markdown table, you can audit it.
$ pipx install repo-librarian # or: uvx repo-librarian, pip install repo-librarian
The problem
An information-rich repo — docs, SQL, notebooks, data exports, meeting transcripts — is an enterprise brain your coding agent can't use well. It either reads everything (a token bonfire) or greps (which finds the doc that mentions a term most, not the one that's authoritative for it). And worst of all: it confidently repeats whatever the docs say, however stale.
The drift story
The project this tool was extracted from had docs saying 164 facilities. Production
said 181. That number had been asserted in three deliverables before anyone noticed.
librarian verify turns each such fact into a check against its live source — the
drift became a red line in CI instead of a wrong number in an exec deck.
How it works — three moves
- Frontmatter on every doc —
domain,read_when(task phrases: the routing signal),last_verified/recheck(the freshness gate),status, and anauthoritytier (verified > curated > unverified). Non-markdown artifacts (SQL, notebooks, exports) get an entry inlibrarian-artifacts.tomlinstead. - A generated card catalog —
librarian indexwrites_index/CATALOG.md(the inventory, by domain),_index/STALENESS.md(what needs attention: flagged docs, open conflicts, coverage gaps, intake queue), and_index/catalog.json(the machine surface for hooks andlibrarian search). - An agent protocol —
librarian initscaffoldsAGENTS.md(read by Cursor, Copilot, Codex, …) and Claude Code glue (/librariancommand, session-start freshness nudge): route via the catalog, never read the whole corpus, freshness-gate facts, capture discoveries back into docs, and resolve conflicts by authority tier, never by recency — a contradicted claim gets quarantined in place, not silently trusted or deleted.
And the piece that makes the verified tier real: librarian verify runs
declarative command-runner checks from .librarian.toml — any shell command (psql,
mysql, aws athena, curl + jq, grep, pytest…), an extractor, and an expected value
(assert, drift fails the run) or tracked baseline (track, changes warn).
60-second quickstart
$ cd your-big-repo
$ librarian init # config + protocol + agent glue + hooks
$ librarian backfill docs/ --write # skeleton frontmatter onto existing docs
$ librarian index # generate _index/CATALOG.md + STALENESS.md
$ $EDITOR .librarian.toml # add your first [[verify.checks]]
$ librarian verify # facts vs live sources
$ git config core.hooksPath .githooks # catalog refresh on every commit
Or take the guided tour in the batteries-included demo (a planted drifting fact, a stale baseline, a quarantined conflict, an intake queue — all offline):
$ cd examples/demo-repo && librarian verify
[PASS] demo-db stations_no_region_column expect=0 live=0
[PASS] demo-db active_station_count expect=17 live=17
[DRIFT] demo-db min_dock_count_is_20 expect=20 live=15
-> update: docs/schema.md
[CHANGED] demo-db total_rides baseline=1210 live=1284
-> update: docs/overview.md
Commands
| Command | Does |
|---|---|
librarian init |
Scaffold config, protocol, agent glue, hooks (--upgrade / --uninstall; idempotent) |
librarian index |
Rebuild the catalog (--check gates CI on [index].fail_on) |
librarian verify |
Fact-check docs vs live sources (--update-baselines, --stamp, --json) |
librarian status |
One-screen health summary (--hook powers the session nudge) |
librarian search "task phrase" |
Route by read_when/tags/title — cheaper and truer than grep |
librarian backfill DIR --write |
Bulk-stamp skeleton frontmatter onto existing docs |
librarian suggest [--write] |
Auto-draft registry entries for uncovered SQL/scripts/notebooks/CSVs (harvests comments, docstrings, headers) |
librarian ingest FILE |
Triage an _inbox/ upload: tier → frontmatter → file it |
librarian dream [--json] [--mark-done] |
Build the maintenance worklist (conflicts, dup docs, weak routing); drives the /librarian-dream propose-only cycle |
librarian doctor |
Sanity-check config, registry, hooks, and verify sources |
Exit codes everywhere: 0 clean · 1 findings (drift / gate / attention) · 2 config
error. Every read command takes --json.
The numbers (measured, warts included)
We benchmarked it the hard way: a 200-doc synthetic company repo with planted failure modes (stale numbers echoed into fresher-dated docs, a fact that lives in no doc, frontmatter-only provisional flags), answered start-to-finish by identical frontier-model agents — one with the librarian, one without (methodology + full log):
| With librarian | Bare repo | |
|---|---|---|
| Task accuracy | 8/8 | 7/8 |
| "What's the current backlog?" (truth in no doc) | ran the registered check, caught the drifted baseline, quoted live: 93 | refused to quote, never found the live source — no answer |
| Provenance (authority + freshness) cited | every answer | most answers |
| Session tokens | 40.3k | 17.9k |
The honest read: against a strong agent, this is not a token-saver — it's a
correctness layer with a bounded, amortized cost (~7.5k tokens of always-load
catalog at 200 files; warned at a configurable budget via librarian status). It pays
for itself on any fact whose truth lives outside the docs, any corpus where drift
echoes outnumber the source, and any deliverable where one stale number costs more
than a few thousand tokens. Modern agents grep well; docs don't know when they're
wrong. This fixes the second problem.
What it is not
Not RAG. Retrieval systems retrieve stale facts faster; nothing in a vector index knows the number is wrong. This is the opposite bet: a small deterministic inventory the agent reads first, plus checks that keep the facts honest. (More in the FAQ.)
Docs
Quickstart · The protocol · Verify cookbook (psql, mysql, Athena, curl, dbt, pytest…) · Taxonomy guide · Conflict resolution · The dream cycle (overnight/on-nudge maintenance) · Adopting in a large repo · NAVIGATOR authoring · FAQ
Requirements
Python ≥ 3.11, stdlib only. verify shells out via /bin/sh (Linux, macOS, WSL,
Git Bash); everything else is pure-Python portable.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file repo_librarian-0.3.0.tar.gz.
File metadata
- Download URL: repo_librarian-0.3.0.tar.gz
- Upload date:
- Size: 68.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8366e1cdfb7cd52e8e4d0193a4478a9d31f7b18696d4703d8a63078ebea08f93
|
|
| MD5 |
1c0f2d67f5f098fe871870443004343b
|
|
| BLAKE2b-256 |
2f82a9150dc88bf9a3381970d08b950b94c77b58e9abad5070ec0be259b12dcd
|
Provenance
The following attestation bundles were made for repo_librarian-0.3.0.tar.gz:
Publisher:
release.yml on CCROWN2246/repo-librarian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
repo_librarian-0.3.0.tar.gz -
Subject digest:
8366e1cdfb7cd52e8e4d0193a4478a9d31f7b18696d4703d8a63078ebea08f93 - Sigstore transparency entry: 2101324890
- Sigstore integration time:
-
Permalink:
CCROWN2246/repo-librarian@b2502dc8044307c9a0b8cb8e52b3f60054b450ce -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/CCROWN2246
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2502dc8044307c9a0b8cb8e52b3f60054b450ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file repo_librarian-0.3.0-py3-none-any.whl.
File metadata
- Download URL: repo_librarian-0.3.0-py3-none-any.whl
- Upload date:
- Size: 62.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9613c652ef24e11bec92636066ed186983044707b2661b24d8b257288742dc12
|
|
| MD5 |
84af4a4989fc2c6a3ef914ddbfeb22f7
|
|
| BLAKE2b-256 |
0e1b768e9cead42837a9bd060aadaebc18e1d75bae68a2952a31676969284e8d
|
Provenance
The following attestation bundles were made for repo_librarian-0.3.0-py3-none-any.whl:
Publisher:
release.yml on CCROWN2246/repo-librarian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
repo_librarian-0.3.0-py3-none-any.whl -
Subject digest:
9613c652ef24e11bec92636066ed186983044707b2661b24d8b257288742dc12 - Sigstore transparency entry: 2101325138
- Sigstore integration time:
-
Permalink:
CCROWN2246/repo-librarian@b2502dc8044307c9a0b8cb8e52b3f60054b450ce -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/CCROWN2246
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2502dc8044307c9a0b8cb8e52b3f60054b450ce -
Trigger Event:
push
-
Statement type: