The code tells you what a system does. It doesn't tell you why totals are rounded per line, why a declined card is never retried, or that someone already compared three payment SDKs last spring.
That knowledge usually lives in a wiki nobody reviews, or in one person's head. My AI coding agent has it even worse: every session starts from zero, so it happily suggests the approach we rejected a month ago. I wanted the reasons in the repo, where both people and agents read them, and a check that tells me when they stop being true. So I wrote knowledge_base.
What it gives you
- A fixed place for decisions, feature docs, research notes, and a glossary, all plain Markdown in
docs/ - One index per folder, one line per doc, so a reader opens only what matters
- A block in
CLAUDE.mdorAGENTS.mdthat tells your agent to read the indexes before it works - A
/captureskill that proposes what to keep when a task is done - A checker with thirteen checks, made for CI
It works with any language and any repo. Dart is only needed to run it.
Set it up in a minute
dart pub global activate --source git https://github.com/NoaTubic/knowledge_base cd my_project knowledge_base init knowledge_base new feature "Payments" --paths "src/payments/**" knowledge_base check init creates the docs folder, the three indexes, the glossary, an optional config file, and the agent wiring. It picks the agent setup your project already uses, or you choose with --agent claude, agents, both, or none. Files that already exist are kept, and running it again only updates its own block between two markers.
new starts a doc from a template and adds the index line for you. Decisions get the next free number, and research notes get today's date.
How a doc knows it is out of date
A feature doc names the code it is about in its frontmatter:
--- title: Payments paths: - "src/payments/**" updated: 2026-11-10 --- Those two fields are the whole trick. If a path matches no file, the code was moved or deleted. If git shows commits under those paths after the updated date, the code moved on without the doc.
I tried it on a small demo repo. I pointed the payments doc at an old folder that no longer exists, changed the payment code twice after the doc's date, and added a cart doc that I forgot to index and that links to a page I never wrote. This is what check said:
knowledge_base docs/ · 1 decision · 2 feature docs · 0 research notes docs/features/cart.md error Not listed in FEATURES-INDEX.md (index_missing) error 10 Link to a missing file: checkout.md (broken_link) docs/features/payments.md warn 5 Path matches no file: src/payments_v1/** (dead_path) info 6 2 commits changed the code this doc covers since 2026-11-10 (latest 2026-11-26). Re-read it, then set updated (stale_doc) 2 errors, 1 warning, 1 info It exited with code 1, so CI would fail on the two errors. The stale doc is only info by default. A doc can be right even after the code changes, so the tool asks you to re-read it instead of blocking the merge. If your team wants it stricter, one line in knowledge_base.yaml turns it into a warning or an error.
Knowing what to read before you change code
The for command goes the other way. Give it files and it lists the feature docs that cover them:
knowledge_base for src/payments/retry.ts knowledge_base for --since origin/main docs/features/payments.md Payments src/payments/retry.ts With --since it looks at everything your branch changed, which makes a good last step before a merge.
Letting the agent propose, not write
At the end of a task you type /capture in your agent, optionally with a topic, like /capture payment retries. The agent goes back over the session and tests each thing it learned against three questions. Would someone act differently for knowing it? Is it missing from the code, tests, and history? Is it still true at the end of the session?
Whatever passes gets a home: a decision, a feature doc, a research note, a glossary term, or a one-line note in the nearest CLAUDE.md. Then it shows you a plan with the files and the rule behind each one. It writes only after you approve, and it never commits.
The bar is high on purpose. Most tasks add nothing, and the skill says so plainly. I'd rather have ten docs that are true than a hundred that are noise.
Running it in CI
- uses: dart-lang/setup-dart@v1 - run: dart pub global activate --source git https://github.com/NoaTubic/knowledge_base - run: knowledge_base check --format github The github format turns findings into annotations on the pull request. Give the checkout fetch-depth: 0 so the stale check can see the full history. There is also --format json for scripts and --only to run a subset of checks.
Start with one doc
Run knowledge_base init in a repo you work on every day, write one feature doc for the part that confuses new people most, and add the check to CI. The code and the full list of checks are here:
NoaTubic / knowledge_base
A knowledge base that lives in your repo: decisions, feature docs, research notes and a glossary as Markdown, wired into your AI coding agent, with a checker for CI.
knowledge_base
A knowledge base that lives in your repo, and a checker that keeps it true.
The code shows what a system does. It does not show why a decision was made which caveat will mislead the next reader, or what was already investigated and rejected. knowledge_base gives that knowledge a fixed place in the repo, as plain Markdown, reviewed in the same pull request as the code it describes It wires the docs into your AI coding agent, so the agent reads them before it works and proposes what to keep when it is done.
It works with any language and any repo. Dart is only needed to run it.
$ knowledge_base knowledge_base docs/ · 4 decisions · 7 feature docs · 0 research notes docs/adr/0006-round-totals-per-line.md error Not listed in DECISIONS-INDEX.md (index_missing) docs/features/checkout.md info 8 4 commits changed the code this doc covers since 2026-01-17 (latest 2026-01-25). Re-read it,…Feedback and issues are welcome on GitHub.


