Persistent memory MCP server for Codex sessions.
BRAIN stores structured decisions, outcomes, tasks, and preferences in SQLite, then exposes retrieval and synchronization tools through an MCP server.
- Maturity: beta
- Runtime: production-capable for local/operator workflows
- Quality model: benchmark and done-state gated
Most memory systems stop at storage. BRAIN is built for operational follow-through:
- retrieve relevant policy and context at turn start,
- track decisions and close them with outcomes,
- enforce measurable memory quality gates,
- keep a human-readable
MEMORY.mdmirror synced from structured data.
Project memory tools:
get_contextprepare_turnrecallcleanup_stale_decisionsprovider_healthjust_works_statusrecord_eventupsert_preferencerecord_decisionrecord_outcomesync_memory
Project continuity tools:
upsert_project_profilerecord_taskupdate_tasklist_taskssuggest_next
mcp/brain/: MCP runtime and evaluation modulesbin/: install and quality-gate scriptsdocs/: evaluation, done-state, and release docsskills/brain/: skill instructions for memory workflow
git clone <repository-url> brain
cd brainbash ./bin/install.shInstaller behavior:
- links the
brainskill into~/.codex/skills, - writes or refreshes
mcp_servers.brainin~/.codex/config.toml, - points MCP runtime at
python3 -m brainwithPYTHONPATH=<repo>/mcp, - initializes
~/.codex/brain/brain.envwith secure permissions (chmod 600).
Restart is required so the MCP server is loaded in the current session.
Deterministic fixture check:
bash ./bin/check_ci_fixture.shExpected outcome includes:
just_works_status=healthygate=passdone_state=pass
Optional real-dataset check:
bash ./bin/run_memory_eval.sh --report-done-state --enforce-gate --enforce-done-stateBRAIN writes local operational state that should not be committed:
MEMORY.md- SQLite runtime files (
brain.db,*.db-wal,*.db-shm)
MEMORY.example.md documents the expected shape for memory mirrors.
bash ./bin/uninstall.shBy default, uninstall keeps local DB files. Set REMOVE_DB=1 to remove them.
Before shipping:
python3 -m compileall mcp
bash ./bin/check_ci_fixture.sh
bash ./bin/run_memory_eval.sh --report-done-state --enforce-gate --enforce-done-stateSee docs/release-checklist.md for full checklist.
MIT. See LICENSE.