Local plain-file knowledge store for agents and humans. Zero dependencies, single static binary, ~2ms per query.
One place for skills, API notes, memories, MCP notes — anything an agent might need. Nothing is injected automatically: agents call brain explicitly when told to remember something, recall context, or load a skill. A local, personalized RAG queried on demand.
cargo install --path .Cross-platform (macOS / Linux / Windows) — pure std; the only platform-specific line resets SIGPIPE on unix so brain ... | head exits quietly.
Every entry carries created: / updated: timestamps, written automatically. Ages show everywhere as (2h), (3d), (5mo) so stale knowledge is visible at a glance. Recent entries rank higher in search; brain recall with no terms returns the freshest memories first (brain recent does the same for any category).
Nothing is lost silently: overwriting or rm-ing an entry snapshots the previous version into .trash/ (last 10 per entry, auto-pruned).
brain history memories deploy-strategy # list saved versions
brain restore memories deploy-strategy # roll back (or pass a ts= handle)| scope | location | purpose |
|---|---|---|
| global | ~/.brain ($BRAIN_HOME overrides) |
machine-wide |
| local | <repo-root>/.brain |
per project, auto-added to .gitignore on brain init |
The local folder name is configurable: brain config set local-dir docs.
Reads merge both scopes (local wins); writes go local when a local brain exists, else global. Force with --local / --global.
install-skill / uninstall-skill manage harness skills (not brain entries) — the folder-and-frontmatter layout the agent runtime discovers, default Claude Code's .claude/skills/<name>/SKILL.md:
brain install-skill pr-review --desc "use when reviewing pull requests" --file body.md
brain install-skill pr-review # no content = scaffold TODOs + print what to fill in
brain uninstall-skill pr-review # removes; SKILL.md + helper files backed up to brain trashScope: local (<repo>/.claude/skills/, git-ignored automatically) when inside a git repo, else global (~/.claude/skills/); force with --local / --global. It eliminates hand-building the folder/frontmatter — the command scaffolds it right and prints instructions for finishing the skill. Recover uninstalled skills with brain history claude-skills <name>. Other harness? brain config set skills-dir <relative/path>.
The same skill tends to exist several times — ~/.claude/skills, ~/.codex/skills, ~/.agents/skills, ~/.cursor/skills, a copy per repo, the repo that authored it, plugin caches — and the copies drift.
brain find-skill senior-reviewer # every SKILL.md copy, drift marked
brain find-skill senior-reviewer --paths # bare paths, pipe-friendly
brain find-skill # all skills with copy counts
brain update-skill senior-reviewer --sync # newest copy → all others
brain update-skill senior-reviewer --all --file new.md
brain update-skill senior-reviewer --at ~/.codex/skills/senior-reviewer/SKILL.md --desc "..."senior-reviewer — 3 source(s), 2 distinct version(s)
1. [claude] ~/.claude/skills/senior-reviewer/SKILL.md (2w)
2. [codex] ~/.codex/skills/senior-reviewer/SKILL.md (1w) ≠ #1 newest
3. [repo matchmaker] ~/work/matchmaker/.claude/SKILLS/senior-reviewer/SKILL.md (2w) ≠ #1
Lookups are ~ms: they read a plain-text index (~/.brain/skills.index) and stat a few paths, never walk the disk. The index is built by brain scan-skills — a pruned, depth-limited walk of skill-roots (default: your home; narrow with brain config set skill-roots ~/code,~/work) that skips .git, node_modules, target, caches. It runs automatically on first use and once on a miss; standard harness dirs are probed directly every time, so a fresh install is found without rescanning. install-skill / uninstall-skill keep it current. Body updates keep each copy's own frontmatter; a full file (starting with ---) replaces it. Every overwrite is snapshotted to the brain trash (brain history claude-skills <name>).
<brain>/<category>/<name>.md entries (markdown + frontmatter)
<brain>/.trash/<category>/ previous versions of overwritten/removed entries
Categories are plain folders (defaults: memories/ skills/ apis/ knowledge/ mcps/; any new category is created on first add). Frontmatter: description:, tags:, created:, updated:. Edit files by hand freely — the CLI is just a front-end.
brain init # local brain in this repo (git-ignored)
brain init --global # machine-wide brain
brain remember "deploys are blue-green on fly.io"
brain remember deploy-strategy "canary first" # named (slug-like first arg)
brain recall deploy # or no terms = freshest first
brain add apis stripe --desc "payments notes" --file notes.md
brain apis stripe # search within a category
brain get apis stripe # print full entry (clean stdout)
brain get-skill release-checklist
brain search "stripe webhook" -n 20 --json # --json on search/recall/recent/list/get
brain recent # what changed lately
brain listbrain usage prints the full agent-oriented manual — point agents at it.