Big Brain v0.4.0

Browse the source · v0.4.0

Read every line before you run it.

This is exactly what git clone gives you: 26 files and 8,132 lines (not counting Cargo.lock). The default build downloads nothing but its Rust crates; only the optional local-embeddings feature also fetches ONNX Runtime and a model. Start with the map below, or press / to jump to any file or function.

How it fits together

One binary, a folder of markdown, an index you can delete.

How Big Brain fits together Agents call the brain CLI through the skill and hooks. The CLI writes entries as markdown in a git repository and keeps a SQLite search index. The index gets its vectors from an embedding model: local, on Azure, or any OpenAI-compatible service. The optional librarian (LM Studio, Azure or OpenAI-compatible) reviews stale entries. vectors reviews Your agents Claude Code · CodexGrok · Copilot skill + hooks brain CLIsearch · record · stale main.rs · hooks.rs Entriesmarkdown in git · store.rs Search indexSQLite FTS5 + vectors Librarianoptional · reviews stale entries LM Studio · Azure · OpenAI Embeddingsmeaning for search local · Azure · OpenAI

The modules

14 files of Rust, each with one job.

What's new

0.4.0 (2026-11-02)

Giga Brain is now Big Brain. The command is still brain and existing brains keep working: an install that already has giga-brain data/cache folders keeps using them; new installs use big-brain (whichever folder actually holds data wins, so an empty new folder can't hide an existing brain; brain doctor warns if both hold entries). brain setup installs the agent skill as big-brain, replaces its old managed block in AGENTS.md, and moves the old giga-brain copies it had installed (only ones it recognises, never user skills) into <tool>/big-brain-migration/; nothing is deleted.

Keeping a shared brain accurate as it grows (ideas studied from GBrain and Gigabrain, both MIT; no code taken).

  • Links between entries: related and supersedes must name existing entries; brain get shows links in both directions ("see also", "replaces", "linked from"); brain check lists broken links; brain rm refuses to delete an entry others link to unless --yes.
  • Retiring: brain retire <id> --why "…" [--by <new-id>]. Retired and superseded entries drop out of search, lists, stale checks, reviews and hooks, and stay readable (brain get, --all), so an old procedure can't outrank its replacement.
  • brain maintain: nightly upkeep that never edits entries: index, librarian review of stale entries, broken links, near-duplicates, and a contradiction check of closely related entries (each pair judged once per version, confident verdicts only). brain get shows "may contradict"; brain doctor counts contradictions and says when maintain last ran. nightly.sh now runs it.
  • Privacy masking: emails, IP addresses and home-folder user names are masked in text sent to remote models, plus your own patterns ([privacy] patterns); local models get text unchanged.
  • Trust tie-break: when two results score about the same, the verified one ranks first.
  • Safer automatic context: hooks name stale entries and how many of their files changed, never file names (entry text is untrusted); brain get shows librarian verdicts, and their free-text notes only with --notes. Nothing that looks like a secret is sent to any model, search queries included. Masking fails closed on a bad pattern, more than 50 patterns, or more than 64 KB of text.
  • OpenAI's newer models work as the librarian: OpenAI's GPT-5 and reasoning models refuse max_tokens and a custom temperature; brain now retries once with max_completion_tokens and keeps using it. Azure, LM Studio and other OpenAI-compatible services are unchanged.
  • Hardening (Grok audit): requests to this machine (LM Studio, local servers) never go through an HTTP_PROXY/HTTPS_PROXY/ALL_PROXY proxy, since that traffic is unmasked and may carry a key. A service's error replies are no longer shown (only the HTTP status and a short error code), so a hostile endpoint can't put instructions or echoed keys in front of agents. Endpoint URLs with a ?query are refused (keys belong in auth), and so is user:password@ with any auth setting. Short passwords, quoted passphrases with spaces and YAML | blocks are caught as secrets, while references ($DEPLOY_KEY, ${TOKEN}), placeholders and ordinary code (password: String, self.password, unquoted only: a quoted value is a literal) still pass (checked against about 6,000 files of real code). Network errors and privacy-pattern errors are fixed descriptions: no proxy URL, server text or pattern text in them. Quoted passwords made of ordinary words are secrets too; escaped Windows paths (C:\\Users\\… in JSON or code) are masked; the Azure VM sign-in request never follows redirects. Service error codes are shown only if they're on a known list. Doctor and sign-in errors no longer show a token command's arguments or az's raw error output. Masking also catches ip:2001:db8::1 and Windows home folders written with forward slashes (c:/users/<name>).

Full changelog →

Start reading

All files