KB is a local-first knowledge system built for AI-assisted development. It gives you a CLI and runtime for storing durable facts, querying them by intent, and keeping project knowledge close to your code.
kb submit "Auth tokens expire after 15 minutes, not 24 hours"
kb query "token expiry policy"
kb invalidate "Auth tokens expire after 24 hours" "Auth tokens expire after 15 minutes, not 24 hours"
Every project accumulates decisions, constraints, and tribal knowledge that lives in Slack threads, PR comments, and people’s heads. KB gives that knowledge a home with a queryable structure — so your AI agent (or you) can retrieve the right context before making a change.
Store durable facts — not ephemeral chat history. Facts are versioned in Git alongside your code.
Query by intent — kb query understands what you’re asking, not just what words you typed.
Hybrid retrieval — SQLite full-text search + vector-style ranking returns relevant docs even when phrasing differs between the query and the stored fact.
Knowledge graph — entities and relationships are extracted automatically, so you can ask “what depends on X?” and get a traversal, not just a keyword match.
Install the latest published release:
npm install -g https://github.com/rosenjcb/kb/releases/latest/download/kb-cli-node22.tgz
command -v kb
Or build and install from source:
pnpm install
pnpm run check
npm run install:global
command -v kb
KB expects
Node 22+in the shell that runskb.
KB auto-detects whichever API key is in your environment (ANTHROPIC_API_KEY, OPENAI_API_KEY). To set a provider explicitly:
kb config set llm.provider anthropic
kb use myproject # use for this session
kb use --default myproject # persist as the default base
Each base stores its SQLite index under ~/.kb/sessions/<base>/.
kb init
kb init reads your README, CLAUDE.md, and other project docs, then runs a multi-pass LLM pipeline to produce a set of focused, retrieval-ready fact documents. Takes 1–3 minutes for a typical repo.
kb query "how does authentication work?"
kb submit "OAuth tokens are short-lived; use the refresh endpoint after 15 min"
kb invalidate "passwords are hashed with MD5" "passwords are hashed with bcrypt"
# Before making a change — pull relevant context
kb query "topic I'm about to touch"
# After a decision — record it
kb submit "we chose option B because option A required a schema migration"
# Repair stale knowledge
kb invalidate "the queue is strongly consistent" "the queue is eventually consistent"
Source files collected directly from the repository during kb init. These reflect the raw project documentation.
View the published entity graph extracted from your KB:
LLM-synthesized documents produced by kb init and stored in the knowledge base.