The problem is not model intelligence
My daily setup is Claude Code for implementation, Codex for review and acceptance checks, an orchestrator agent that runs scheduled jobs, and a chat bot on my phone. Each one is capable. None of them remembered that I had already decided which search engine to use, why a refactor was rejected last month, or that I want options presented as exactly five one-line choices.
Built-in "memory" features did not solve it. They are per-tool, they store whatever the chat happened to contain, and I could not audit or correct them. What I wanted was closer to a team wiki: one place, owned by me, that every agent reads from — and that no agent can quietly pollute.
The architecture is deliberately boring
The whole brain is a folder of Markdown files plus about 1,100 lines of Node.js. Its only runtime dependencies are the MCP SDK and zod.
- Storage: plain Markdown notes with a few metadata lines — ID, kind, status, source date, confidence, who reviewed it, and what it supersedes. It opens fine in Obsidian, diffs fine in git, and survives any tool change.
- One MCP server, every agent: Claude Code and Codex both launch the same stdio MCP server; Claude Code falls back to a CLI if MCP is unavailable. Because every client goes through one
searchBrain(), a ranking fix lands for all agents at once. Machines on my private network reach it over an HTTP variant that binds only to the private interface and requires a bearer token. - Eleven small tools:
brain_search,brain_get(one full note),brain_context(a bounded bundle of notes),brain_links(neighbours in the graph),brain_remember(propose knowledge),brain_rehearse(pre-decision scenarios) and a few status tools.
Hybrid search, with recency set to zero
Search is a weighted mix: keyword overlap ×2, lexical similarity ×6, vector similarity ×12, knowledge-graph proximity ×3 and source trust ×2, plus small title and path boosts. Vectors come from bge-m3 running locally in Ollama, so nothing leaves the machine. If Ollama is down, a circuit breaker drops the vector term after three failures for 60 seconds and search keeps working on the other signals.
The weight I am proudest of is the one set to zero: recency. A file's modified time is not the date a decision became valid. Instead, notes carry explicit validFrom / validUntil dates and supersedes / contradictedBy links, and agents can ask for temporal=current or a historical asOf date. "Newest file wins" caused real wrong answers before this.
Agents can propose, never publish
This is the part that made the brain trustworthy. brain_remember never edits the wiki. It drops a candidate into an inbox. A separate review step then decides:
- High-confidence items that pass the safety filter may be approved automatically.
- Anything flagged as needing human review waits for me.
- An import filter hard-blocks credentials, private keys, bearer tokens, JWTs, known token formats, company-confidential material, and raw chat transcripts.
Across more than 1,100 recorded review decisions: 345 auto-approved, 408 approved by a person, 169 rejected, 100 merged into existing notes, 83 turned into updates, and 5 deleted. Roughly one candidate in seven was rejected — exactly the noise that would otherwise have become "memory."
I am honest about the limit: the rules about what may be stored are routing policy for the agents, not file-level permission isolation. The filter enforces the dangerous categories in code; the rest relies on the agents following instructions and on review.
Answers must admit when they don't know
Every search returns an evidence label. insufficient means the agent must say there is no record instead of guessing. conflicting means it must show both sources and let me choose. retrieved means "candidate only" — the agent has to open the full note with brain_get before relying on a specific claim.
Deciding "was anything actually found?" turned out to be subtle. A hybrid total score always produces a winner, because ranking is relative. So the gate uses the absolute vector score: a hit counts if the top similarity is at least 0.55, or at least 0.50 with a clear lead over the runner-up. In my logs, real hits sit around 0.60–0.73 and misses around 0.45–0.47.
The numbers after four months
- 790 reviewed notes: 282 know-how, 106 reference knowledge, 87 decisions, 61 skills, 12 SOPs and the rest in profile and project areas.
- A knowledge graph of 962 nodes and 5,972 edges.
- 7,609 logged queries since August. Of the 6,251 that were not self-tests, 547 (8.8%) found nothing useful — and each miss is logged as a candidate gap to fill.
- The local vector index is about 28 MB; embedding runs in batches of 20 (ten documents in 1.9 s on a 16 GB machine) with a 3-second query timeout.
Mistakes that taught me the most
My "semantic" search had no vectors. A function named semanticScore() was doing string overlap. The embedding model was configured but never called. Measuring fixed it: on a test query, content vectors scored 0.568 for the right note versus 0.469 for a distractor, while title-only vectors could barely separate them (0.433 vs 0.370). Embed the content, not just the titles.
I blamed the wrong thing for token cost. I assumed having many MCP servers connected was expensive. Measuring one 82k-token session showed messages were about 73% of it, while fixed overhead (tools, skills, memory, system prompt) was about 22k and paid once. Deferred tool definitions did not count at all. The real cost was oversized search replies that got re-read every turn. Trimming one search response from over 9,000 bytes to about 1,560 (and the default result count from 8 to 4) did more than disconnecting anything. Separate "paid every turn" from "paid once."
The review queue silently filled up. The code that explained an approval and the code that granted it used different confidence thresholds, so qualifying items were held forever with a plausible-looking reason.
The safety filter rejected good notes. It matched words like "session" in the file name rather than the content, so legitimate know-how about session handling was stuck. Filters need tests on false positives, not just false negatives.
The pipeline captured heartbeats, not knowledge. Early on, agents logged that they had run, not what they had learned. The rule now: after solving and verifying a real problem, submit the root cause, the verified fix, the failed attempts and the source — never the whole conversation.
If you want to build one
- Start with Markdown and one MCP server. Every agent you add later gets the brain for free.
- Make writes go through review. An agent that can write straight into memory will eventually write something wrong with full confidence.
- Track validity explicitly; never let file dates decide which decision is current.
- Return an evidence label with every answer, and make "no record" an acceptable answer.
- Log misses. The 8.8% of empty searches is my best list of what to write next.
None of this needs a vector database, a cloud account or a framework. It needs a boundary: the person owns the memory, agents borrow it.
