Persistent local memory for AI agents — 16 BrainBar MCP tools, semantic search, knowledge graph, SQLite
pip install brainlayer==1.6.6 Copy PIP instructions
Every architecture decision, every debugging session, every preference you've expressed — gone between sessions. You repeat yourself constantly. Your agents rediscover bugs they already fixed, and re-make choices the team already reasoned through.
BrainLayer gives any MCP-compatible AI agent persistent memory across conversations — and gives a whole fleet of agents a shared organizational memory: what one agent learns (a fix, a decision, what eroded and why) becomes experience the others inherit before they repeat the mistake. One SQLite file. No cloud. No Docker. Just pip install.
"What approach did I use for auth last month?" → brain_search "Remember this decision for later" → brain_store "What was I working on yesterday?" → brain_recall "Ingest this meeting transcript" → brain_digest "What do we know about this person?" → brain_get_person Quick Start pip install brainlayer MCP examples require the Homebrew BrainLayer bridge. On Intel, replace /opt/homebrew/opt/brainlayer with /usr/local/opt/brainlayer.
Add to your MCP config (~/.claude.json for Claude Code):
{ "mcpServers": { "brainlayer": { "command": "/opt/homebrew/opt/brainlayer/bin/brainlayer-mcp-stdio-bridge" } } } That's it. Your agent now remembers everything. BrainBar must be running and owning /tmp/brainbar.sock; brainlayer-mcp-stdio-bridge ships with the package, reconnects if BrainBar restarts, and uses an absolute path. Raw socat wiring, {"command": "socat", "args": ["STDIO", "UNIX-CONNECT:/tmp/brainbar.sock"]} exits on BrainBar restart and leaves persistent clients disconnected. Use brainlayer setup --migrate-mcp to back up and upgrade owned legacy configs. See docs/mcp-config.md.
{ "context_servers": { "brainlayer": { "command": { "path": "/opt/homebrew/opt/brainlayer/bin/brainlayer-mcp-stdio-bridge", "args": [] } } } } VS Code (.vscode/mcp.json):
{ "servers": { "brainlayer": { "command": "/opt/homebrew/opt/brainlayer/bin/brainlayer-mcp-stdio-bridge" } } } MCP Tools (16) The agent-facing MCP server is BrainBar on /tmp/brainbar.sock. It defines 16 tools, and every definition carries ToolAnnotations so agents know which calls are safe to run without confirmation.
Sessions boot into a core palette of 5. By default tools/list returns brain_search, brain_store, brain_recall, brain_expand, and expand_palette — with short descriptions, to keep the boot payload small. Call expand_palette (or set BRAINLAYER_MCP_PROFILE=full on the server) to get all 16 with their full descriptions. Calling a gated tool before expanding returns an error that tells you to expand.
brain_store answers with an explicit outcome word, so an agent never has to guess whether a write landed (#725):
Once a row is committed, the handler can no longer answer REJECTED or ERROR — a durable write is never reported as "nothing was stored".
The rules for agents using BrainLayer live in the tool descriptions, so tools/list never drops a description to fit a transport limit (#727). When a response would exceed the frame budget, compaction runs as a ladder: first annotations and inputSchema prose are dropped, and only if that still does not fit are descriptions shortened to the largest budget that does — each marked …[truncated], with a result._meta["brainlayer/descriptionsTruncated"] notice naming every affected tool. Descriptions are never removed outright; if even the floor does not fit, the response ships over the limit with its contract intact and logs why. The shipped palettes are covered by a test that fails if a newly added tool ever pushes them into truncation.
Legacy brainlayer_* names (brainlayer_search, brainlayer_store, brainlayer_recall, and 11 more) are still accepted by the Python library handlers under src/brainlayer/mcp/. They are not served by BrainBar, which is the agent transport — new wiring should use the brain_* names.
graph LR A["Claude Code / Cursor / Zed"] -->|MCP| B["BrainLayer
16 tools"] B --> C["Hybrid Search
vector + FTS5"] C --> D["SQLite + sqlite-vec
single .db file"] B --> KG["Knowledge Graph
entities + relations"] KG --> D E["JSONL conversations"] --> W["Real-time Watcher
≥30s poll interval"] W --> D I["BrainBar UI
NSStatusItem + NSPopover"] -->|UDS /tmp/brainbar.sock| BB["BrainBarDaemon
MCP + brain bus"] BB -->|MCP socket protocol| B Memory indexing, search, and the local knowledge graph run on-device. Axiom telemetry and Drive backups remain optional network integrations.
Optional native Swift menu bar companion split into two launchd-managed processes:
LSUIElement UI"] -->|"watch-brain-bus + commands
/tmp/brainbar.sock"| D["BrainBarDaemon
headless MCP server"] D -->|"single writer queue + reads"| DB["SQLite WAL
~/.local/share/brainlayer/brainlayer.db"] D -->|"helper subprocess IPC"| H["Hybrid search helper"] BrainBarDaemon owns the MCP server, /tmp/brainbar.sock, the single-writer path, the watch-brain-bus stream, and helper subprocess lifecycle. BrainBar owns only the NSStatusItem, transient NSPopover, SwiftUI surfaces, hotkey routing, and a reconnecting socket subscriber. Killing the UI does not stop the daemon socket.
bash brain-bar/build-app.sh # Build, sign, install LaunchAgent The build script builds both BrainBar and BrainBarDaemon, embeds both binaries in BrainBar.app, then installs com.brainlayer.brainbar.plist and com.brainlayer.brainbar-daemon.plist with ProcessType=Interactive. It refuses non-canonical checkouts and dirty trees by default (#265) and stamps each bundle with GitCommit, GitDescribe, and BuildTimeUTC in Info.plist (#264) so a stale install is diagnosable in seconds.
Background producers run with BRAINLAYER_ARBITRATED=1 and append writes to ~/.brainlayer/queue/; com.brainlayer.drain.plist drains that queue every 500ms as the single writer. Trigram FTS maintenance is explicit via brainlayer repair-fts and the weekly com.brainlayer.repair-fts.plist, not synchronous startup work. See docs/arbitration.md.
Historical two-week stability sprint. Every line below traces to a merged PR. Enrichment work listed here is retired; history: CHANGELOG.
Phase B preventive infra (2026-05-01) — one canonical artifact per environment
Test gates — pre-push gate is mandatory before any push to main
Reliability sprint (2026-05-02) — PR #251, merged
Phase 5 ship wave (2026-05-17) — ingest hygiene + KG regression fix
index takes a source directory as a positional argument — there is no --source flag. Claude Desktop, WhatsApp, and Markdown have extractors in src/brainlayer/pipeline/ (extract_claude_desktop.py, extract_whatsapp.py, extract_markdown.py) but no CLI subcommand wired to them yet.
LLM chunk and session enrichment is retired. Existing metadata remains readable; indexing, search, offline evaluation, and the local knowledge graph remain available. History: CHANGELOG; retirement details.
Installed hotlane jobs may still require the Google credential gate until the release re-renders their plists; retain its configuration as described in Configuration.
Run brainlayer backup auth once to authorize BrainLayer's Drive backups in your browser. The private token lives at ~/.config/brainlayer/drive-tokens.json; BRAINLAYER_DRIVE_TOKEN_PATH overrides it. BrainBar uses brainlayer backup auth --status --json to check and brainlayer backup auth --json to authorize.
brainlayer setup # Create ~/.config/brainlayer/brainlayer.env brainlayer setup --launchd # Create config and install launchd agents brainlayer init # Interactive setup wizard brainlayer index # Batch index conversations brainlayer watch # Real-time watcher (persistent, ≥30s poll interval) brainlayer search "query" # Semantic + keyword search brainlayer stats # Database statistics brainlayer brain-export # Brain graph JSON for visualization brainlayer export-obsidian # Export to Obsidian vault brainlayer dashboard # Interactive TUI (source checkout only) Testing pip install -e ".[dev]" git config core.hooksPath .githooks # install repo pre-push hook once per clone pytest tests/ # 4,386 Python tests pytest tests/ -m "not integration" # Unit tests only (fast) ruff check src/ && ruff format src/ # Lint + format # BrainBar: 890 Swift tests (cd brain-bar && swift test) Configuration (environment variables) Variable Default Description BRAINLAYER_DB ~/.local/share/brainlayer/brainlayer.db Database file path AXIOM_TOKEN (unset) Axiom telemetry token (optional) BRAINLAYER_SANITIZE_EXTRA_NAMES (empty) Names to redact from indexed content See full configuration reference for all options.
pip install "brainlayer[brain]" # Brain graph visualization + FAISS pip install "brainlayer[youtube]" # YouTube transcript indexing pip install "brainlayer[ast]" # AST-aware code chunking (tree-sitter) pip install "brainlayer[kg]" # GliNER entity extraction (209M params) pip install "brainlayer[telemetry]" # Axiom observability pip install "brainlayer[dev]" # Development: pytest, ruff Contributing Contributions welcome! See CONTRIBUTING.md for dev setup, testing, and PR guidelines.
BrainLayer is part of the Golems MCP agent ecosystem:
Originally developed as "Zikaron" (Hebrew: memory). Extracted into a standalone project because every developer deserves persistent AI memory.
Both files in this release have provenance metadata.
ast brain dev docs kg style telemetry youtube
ai-agent claude embeddings knowledge-graph mcp memory semantic-search sqlite-vec
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Both files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




