BrainCTL

by tschonleber

Not rated yet

About

Persistent memory for AI agents. Single SQLite file, 192 MCP tools. FTS5 search, knowledge graph, session handoffs, write gate. No server, no API keys, no LLM calls.

Explore

Setup

Install BrainCTL in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/tschonleber/brainctl

Follow the installation instructions in the repository README, then restart your MCP client.

{ "mcpServers": { "brainctl": { "command": "brainctl-mcp" } } }

Add to~/.claude/claude_desktop_config.json,~/.cursor/mcp.json, or equivalent. Full tool list and decision tree:MCP_SERVER.md. v1→v2 name migration map:docs/TOOL_MIGRATION_V2.md.

As of 2.8.0, the public MCP surface is100 visible tools(370 registered internally). Tier-1 tools —memory_add,memory_search,event_add,entity_,agent_orient,agent_wrap_up,decision_add,handoff_add,trigger_— are called directly by name. Brain-region operations route through action-discriminated dispatchers:

// Discover what's available subsystem_list() // 27 brain subsystems subsystem_list_actions(name="lc") // valid actions for LC // Then act subsystem_status(name="lc", agent_id="me") subsystem_emit(name="lc", action="fire", payload={"trigger_name":"x", "surprise_magnitude":0.7}) belief(action="collapse", payload={...}) trust(action="show", payload={"agent_id":"me"})

The shape of the surface fits the ~100-tool cap that several MCP clients enforce (Google Antigravity, etc.) and cuts the system-prompt token cost from ~50k → ~12k. v1 tool names remain callable internally for backwards compatibility; only their visibility intools/listchanges.

brainctl memory add "content" -c convention # store a memory brainctl search "query" # FTS5 search brainctl vsearch "semantic query" # vector search (requires [vec]) brainctl entity create "Alice" -t person # create entity brainctl entity relate Alice works_at Acme # link entities brainctl event add "deployed v3" -t result # log an event brainctl decide "title" -r "rationale" # record a decision brainctl export --sign -o bundle.json # signed export brainctl verify bundle.json # verify a bundle brainctl wallet new # create managed signing wallet brainctl wallet export-key # base58 private key for Phantom/Backpack/Solflare/Glow import brainctl stats # DB overview brainctl doctor # health check brainctl lint # quality issues brainctl gaps scan # coverage + orphan + broken-edge scans brainctl consolidate cycle # full consolidation pass

- Write gate(W(m)): surprise scoring rejects redundant writes. Bypass withforce=True.
- Three-tier routing: high-value memories get full indexing; low-value get lightweight storage.
- Duplicate suppression: near-duplicates reinforce existing memories instead of creating new rows.
- Half-life decay: unused memories fade at a rate set by category. Recalled memories are reinforced.
- Consolidation: Hebbian learning, temporal promotion, compression — runs on a cron schedule.

Tested with default settings, no tuning for benchmark data. Two harnesses ship in the tree:

- tests/bench/— single-system retrieval baselines forBrain.searchandcmd_search, gated against regression in CI.
- tests/bench/competitor_runs/— same-fixture head-to-head harness with adapters for Mem0, Letta, Zep, Cognee, MemPalace, OpenAI Memory. Skip-not-fabricate contract: missing SDK / API key raisesCompetitorUnavailableinstead of returning a fake 0. Each result row carries aprovenanceblock recordingretrieval_mode,vector_enabled,embedding_model,rerankers_active, and the fullsearch_argsso the JSON is self-describing.

LongMemEval(289-question retrieval-friendly subset oflongmemeval_s):

LongMemEval lock snapshot(old FTS-only baseline vs final locked, n=289):

LOCOMO(1,982 questions, 5 categories, 10 conversations):

LOCOMO latest retrieval operating points(n=1,982, no-LLM retrieval):

Interpretation: hybrid leads session on hit@1, hit@5, MRR, and multi-hop hit@5, ties temporal hit@5, and slightly trails on single-hop hit@5.

The Brain.search baseline remains weaker on hop-heavy categories (single-hop/multi-hop hit@1 0.167 / 0.174). Root cause: recency and salience rerankers bias toward recent memories; LOCOMO uses uniform synthetic timestamps with gold evidence concentrated in early sessions, so reranking can fight lexical evidence. A--benchmarkpreset that flattens recency/salience is available for evaluation runs.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.