Keep what matters.
Decisions, notes, and lessons stay in your files. A local index connects the pieces.
NOTES → LOCAL INDEXA LOCAL MEMORY FOR CODING AGENTS
Your memory. Your stack.
Combine vector recall and graph connections. Change the engines, keep the knowledge.
Open source · Apache-2.0 · Free for everyone
A model brings intelligence. You bring the history. Local Brain connects your memory files, project docs and notes through adapters, so the context you built can return across sessions.
Session 01 → 05 · Starting context across sessions. Conceptual illustration, not a performance benchmark.
Decisions, notes, and lessons stay in your files. A local index connects the pieces.
NOTES → LOCAL INDEXHost hooks surface relevant memories as you type. Guidance returns before matching risky actions.
CONTEXT → ACTIONCalibrate against your own corpus. Compare retrieval with grep and the agent working alone.
MEASURE → CALIBRATEThree illustrative terminal scenes: automatic recall, an exact trigger phrase, and guidance before a risky action. Example memories, not a live agent.
Let’s continue the payments refactor.
Related memories, found automatically
memories / payments.mdPhase 2 stopped at the webhook retry. Tests live in tests/payments.
memories / idempotency.mdEvery retry carries an idempotency key.
A host hook reads your prompt and attaches only memories above your corpus’s retrieval threshold.
Declare a phrase in a memory’s front matter. Type it to bring that context back directly, without a relevance score.
Your guidance appears before push, rebase or migration. Discover rules from your own tool history.
brain rules --discoverAnd when the agent asks: twelve MCP tools.
recallrememberneighborsbrain_statusbrain_suggestbrain_feedbackreindextimelinebrain_analysebrain_viewmemory_historybrain_capabilitiesAn address, a preference or a technical decision can change. When your agent records a revision—what it replaces, when it takes effect, why, and the evidence—recall answers with the current fact, and every earlier version stays in history.
recall("Where do releases ship from?")
release_branchReleases ship from the release branch.
release_main_tagsReleases ship from main, one tag per version.
release_main_ciReleases ship from main; CI publishes each tag.
The question matched the oldest wording. Recall followed both recorded replacements and answered with the current fact.
Every revision with its status, effective date, reason and evidence. Nothing was overwritten.
as_of returns the explicit record in effect on that date. It is effective-time history, not a replay of what the system knew back then.
Illustrative example records. Not a live agent.
memory_history returns the same chain by old or current name: revisions, dates, reasons, evidence and bounded diffs, plus snapshots of the file observed each time it was indexed.
recallview="history"as_ofmemory_historyWhen one fact has several active records that are not linked as revisions, Brain marks them disputed instead of picking the latest. Disputed facts stay available for explicit lookup and are kept out of automatic hook output.
disputedRetracting or archiving a fact is itself a revision, with a date and evidence. It leaves current answers without reviving an older version. The files remain in history; nothing is deleted automatically.
retracted · archivedUpdates through Brain need the SHA last read. A stale writer gets a conflict instead of overwriting, a repeated identical save is a no-op, and file replacement is atomic. recall and remember return JSON by default.
expected_sha · noopExisting notes start untracked, not certified current. Brain does not infer contradictions on its own: the writing agent confirms the change and records the relation. No personal note is silently rewritten.
supersedes · valid_fromThe core stays the same. Hosts, AI engines, sources, databases and schedulers plug in around it. Vector search and graph traversal work together — Qdrant + Neo4j is a combined setup, not an either/or choice.
Vector database
Similarity search
Graph database
Connected context
brain addMemories remain plain Markdown files. The built-in local copy is canonical; dedicated databases are serving indexes. Switching means syncing, not re-embedding. A ledger sends only changes. Before sync, or if a database is unavailable, the local copy answers.
Ask both stores the same questions and verify matching answers. Move your memory between machines with brain export / brain import.
MEASURED · AUTHOR’S CORPUS · 2026-10-07
Similarity search · Qdrant
All-document, one-hop neighbors · Neo4j
1,909 documents · 9,590 chunks · 3,376 links. Matching answers on every compared query. These are corpus-specific measurements, not promised speeds for your setup.
README ↗Install by role with pinned images. Ports bind only to 127.0.0.1. Data lives in ordinary folders under the brain home, not Docker volumes, and survives reinstalling. Database usage reporting is disabled and verified by measurement.
Your notes, feedback and tool history shape how memory returns. Local Brain measures and adjusts from your evidence, with checks before changes—not a promise that every session performs better.
Interactive illustration of the adaptation loop. Select a step. No live learning, personal data or performance measurements in this demo.
The hook threshold is your corpus’s noise floor × a margin learned from your samples. Short prompts (the shortest 30% of yours), filename-prefix types and corpus language are measured from your data.
brain calibrateThe margin starts at 1.35 with broad uncertainty. Each calibration resamples your data 200 times; a one-dimensional Kalman filter weights the observation by confidence. Until three rounds of new evidence accumulate, it only measures. A regression guard rejects worse thresholds. If the corpus is too small to measure, it stays quiet rather than guessing.
brain calibrateMark a memory useful, wrong or stale. That feedback changes its next ranking; negative feedback also lowers its semantic priority and how readily the hook lets it through. It is a retrieval preference, not a factual retraction. Send it through the CLI or the brain_feedback MCP tool.
brain feedback <name> useful|wrong|staleNo rules ship by default. Discovery finds candidates in your tool history; --auto promotes candidates that pass the threshold. The wording lives in your memory files. Edit the memory, change the guidance.
brain rules --discover
brain rules --autoAutomatic personalisation is built in. Corpus calibration, learned vocabulary, feedback-based ranking and a background policy-selection loop are part of Brain. Serving advanced candidate policies remains opt-in.
detect finds memory candidates with evidence; --add registers them. suggest proposes cleanup for stale, orphaned or duplicate memories.
brain detect --add · brain suggestWho sets a number? You, your data, your host or engine, then the method. A value measured on someone else’s notes is not your optimum. Compare your own points in time with score --history and --axes.
brain score --history · brain score --axesExport and import move your memory. Calibration values are deliberately excluded: the new corpus should be measured again.
brain export · brain importRetrieval thresholds are measured on your documents. A Kalman filter learns the safety margin as feedback accumulates.
KalmanCompare accuracy, recall, text read and speed against grep and an agent alone. Every test runs the controls first.
brain score --compareLexical search opens no sockets. AI engines are opt-in. Secret-shaped values are masked before they can become context.
brain privacyOn macOS and Linux, the MCP server reloads changed code and configuration before the next request. Reconnect clients to refresh cached tool descriptions. On Windows, restart the MCP client.
MCPZero third-party dependencies in the core. Python 3.8+ standard library. Add engines and dedicated databases only when you need them.
Python 3.8+An HTML dashboard shows status and performance comparisons. Six interface languages. Your memories travel with export and import.
MCP initialization, recall/remember descriptions and hook context share one language preference. Explicit conversation requests come first, then response_language and other configured preferences, then the latest message’s language. auto follows the conversation. This instructs the host; it does not guarantee its reply. Original text and quotations keep their language.
brain dashboard · response_languageEVENT-DRIVEN INDEXING
A session start indexes nothing by itself. It checks for events that need work—a changed source, pending work, a moved repository, a ruler that no longer fits the corpus—and only then starts one detached worker, which does that work once for every open session.
Before · per session
Now · all twenty together
CPU time for twenty sessions opening together when nothing changed, as stated in the Local Brain README. Previously each session ran a full index and recalibration.
Indexing no longer stops at twelve chunks. Completed chunks survive interruption; the next build fills the gaps. Only changed chunks need re-embedding.
brain vec buildCosmos Orbit is an open-source local companion for Claude Code and Codex CLI. Local Brain supplies relevant knowledge from earlier work; Orbit tracks what the current task still needs to finish. Either one also works on its own.
Memory from earlier work
Keeps the current task on course
Optional integration: Orbit retrieves attributed context from Brain and can queue memories for retry-safe saving.
Open source. Apache-2.0. Free for everyone.
Read the code, make it yours, build on it.
Clone, then install recall hooks and the action guard. Or give SETUP-PROMPT.md to your agent and let it guide installation.
git clone https://github.com/honeyground-org/local-brain ~/tools/local-brain
cd ~/tools/local-brain && ./install.sh --with-hook --with-guardOptional: install Qdrant for vectors and Neo4j for graph connections together with Docker. An existing install can use brain stores --docker.
./install.sh --all --stores dockerOptional: run Google embeddinggemma-300m on your computer. Prepare the separate Python runtime, start its local service and place its manifest in the Brain home, then select it explicitly below. Brain calls it directly; failure does not fall back to a paid provider or silently change your engine. The core stays standard-library Python.
Prepare the local runtime ↗brain engines --set embed=embeddinggemma --model google/embeddinggemma-300m --base-url http://127.0.0.1:18081/v1
brain vec build
brain vec calibrate