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.
- 7,261lines of Rust
- 14modules
- 39unit tests
- 26files
- Rust 7,261
- Markdown 803
- TOML 36
- Text 22
- Shell 10
How it fits together
One binary, a folder of markdown, an index you can delete.
The modules
14 files of Rust, each with one job.
-
main.rs
The CLI: every command, the shared listing layout, record/update/ack flows.
useshooksindexlibrarianlinksmaintainreportsetupstoreuiupgrade
-
store.rs
Entries on disk: format, kinds, validation, the secret scan, refs and staleness, git commits.
-
index.rs
SQLite search index: FTS5 keywords + section embeddings, fused by reciprocal rank.
-
ai.rs
OpenAI-compatible / Azure client: embeddings and chat, keyless Azure sign-in, safe destinations.
-
librarian.rs
Optional model that reviews stale entries against git diffs and widens --deep searches.
-
hooks.rs
Agent hooks: session start, every message, end of turn. Milliseconds, no model calls.
-
setup.rs
The five-step setup wizard: identity, providers, agent tools, projects.
-
report.rs
doctor, stats and digest: the human-facing reports.
-
ui.rs
Terminal styling: colours only on a TTY, wrapping, the shared listing pieces.
-
tests.rs
Unit tests, each in a throwaway brain.
usesaihooksindexlibrarianlinksprivacyreportsetupstoreuiupgrade
-
links.rs
Links between entries: `related` (both directions, shown as backlinks), `supersedes` / `replaced_by` (a newer entry takes over), and `status: retired`.
usesstore
-
maintain.rs
`brain maintain`: the nightly upkeep, safe to run unattended.
-
privacy.rs
Masking before text leaves the machine.
usesstore
-
upgrade.rs
brain upgrade: fetch the source clone, show what's new, fast-forward, rebuild.
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:
relatedandsupersedesmust name existing entries;brain getshows links in both directions ("see also", "replaces", "linked from");brain checklists broken links;brain rmrefuses 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 getshows "may contradict";brain doctorcounts contradictions and says when maintain last ran.nightly.shnow 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 getshows 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_tokensand a custom temperature; brain now retries once withmax_completion_tokensand 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_PROXYproxy, 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?queryare refused (keys belong inauth), and so isuser: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 oraz's raw error output. Masking also catchesip:2001:db8::1and Windows home folders written with forward slashes (c:/users/<name>).
Start reading