Brain Memory
UnexploredPersistent memory for AI agents: one brain shared across Claude, Cursor, Codex and more.
Install
mcp_config.json
{
"mcpServers": {
"ai-brainmemory-brain": {
"url": "https://mcp.brainmemory.ai/mcp",
"type": "streamable-http"
}
}
}Documentation
Brain Memory
A hierarchical, file-system-based memory plugin for AI coding agents. Inspired by human neuroscience — memories are organized into deep nested life-domain categories, connected via associative networks, strengthened through spaced recall, and naturally decay over time.
One hosted MCP connector reaches every major agent and chat app — Claude Code, OpenAI Codex CLI, OpenCode, GitHub Copilot CLI, Kilo, the Claude.ai apps, ChatGPT, Google Antigravity (Gemini CLI's successor), OpenClaw / NVIDIA NemoClaw, Hermes Agent, and Goose. Prefer a free, local-first install? The native plugin runs entirely from ~/.brain/ on Claude Code, Codex, OpenCode, Copilot CLI, Kilo, and Antigravity — and dedicated native integrations plug the same brain into OpenClaw and Hermes as their memory engine.
~/.brain/
├── professional/
│ └── companies/
│ └── acme-corp/
│ └── projects/
│ └── alpha-launch.md ⚡ 0.88
├── personal/
│ └── education/
│ └── typescript-generics.md ⚡ 0.72
├── social/
│ └── communities/
│ └── open-source-contrib.md ⚡ 0.65
└── family/
└── events/
└── annual-reunion-planning.md ⚡ 0.55
Why Brain Memory?
Existing AI memory solutions use flat databases with tag-based retrieval. Brain Memory is different:
- The directory tree IS the semantic structure —
professional/companies/acme/projects/tells the agent everything about context without vector search - Human-inspectable — Browse your "brain" in any file explorer
- Git-friendly — Full version history of how memories evolve
- Strength + decay — Recalled memories get stronger, forgotten ones fade. Just like your brain
- Recall receipts — Memory that visibly fires: every answer shaped by a memory ends with a one-line attributable receipt (
◉ memory: "<title>" (<type>, <age>)), minted by the engine so it can't be hallucinated - Provenance-bounded trust — Every memory records where it came from (
user,agent-inferred,tool-output,external), and recall weighs it: a fact planted by a web page or tool output is down-ranked, flaggedlow_trust, marked⚠on its receipt, and can never outrank what you said directly — no matter how many copies of it get written. And because memories are plain files, Brain records a SHA-256 baseline of each one at write time — sobrain auditalso catches a memory edited outside any write path, the one poisoning route every write-path defense is blind to - Bitemporal — it knows when a fact was true — Every memory separates record time (when the brain learned it) from valid time (
valid_from/valid_until, when it was actually true). So "we deploy to Fly.io" and "we deploy to Render" aren't a contradiction to guess between — they're one fact with a boundary.brain recall "deploy target" --as-of 2026-03-01answers what was true in March;--as-known-ofanswers what the brain knew then. Facts that stopped being true are demoted and marked⌛ expired, never silently served as current - Deterministic recall — every agent ranks identically — Scoring is arithmetic over files, not a model call: TF-IDF/BM25 relevance, decayed strength, spreading activation, context match, salience. Claude, Codex, and Gemini asking the same question of the same brain get the same ranking, in the same order, offline. No embedding-model version can silently reshuffle what your agent remembers
- Associative network — Memories link to each other with weighted connections. Recalling one activates related ones automatically
- Context-dependent recall — Memories encoded in a similar context to the current session are scored higher
- Spaced reinforcement — Memories recalled after longer intervals get bigger boosts, cramming produces diminishing returns
- Cognitive types — Episodic, semantic, and procedural memories each decay differently, just like in the brain
- Always-present knowledge — Pin critical conventions and preferences so they load every session, bypassing recall and never decaying — the facts your agent must never miss
- Procedural skills — Reusable how-to workflows with progressive disclosure, learned automatically from repeated experience and exportable to your agent's native skills
- On-demand depth — Subcategories are created as needed, not pre-defined
- Consolidation — Weak related memories merge into stronger combined knowledge
- Zero dependencies — and measured, not assumed — Pure file I/O: no database, no server, no embedding model. That is a deliberate result, not a shortcut. On our hardest retrieval scenario (1,021 memories, 1,000 plausible distractors) a real embedding model ranked the target memories worse than BM25 — see the retrieval-only pilot
Install
There are two ways to give an agent its brain. They are complementary — most people end up with both:
| Path | Reaches | Storage | Cost | Best for |
|---|---|---|---|---|
| Hosted MCP connector | Every MCP-capable host (Claude Code, Codex CLI, OpenCode, Copilot CLI, Kilo, Claude.ai apps, ChatGPT, Antigravity, OpenClaw, Hermes, Goose) | Brain Cloud (hosted) | account | One connector, everywhere — including web & mobile chat |
| Local-first native plugin | The current CLIs (Claude Code, Codex CLI, OpenCode, Copilot CLI, Kilo, Antigravity) | ~/.brain/ on your machine | free | Zero-config ambient memory, no account, files you own |
| Assistant integrations | OpenClaw / NVIDIA NemoClaw (memory-slot plugin), Hermes Agent (memory provider) | ~/.brain/ on your machine | free | Your always-on personal assistant sharing one brain with your coding agents |
1. Universal path — the hosted MCP connector
Brain Cloud exposes a single remote MCP server (streamable-HTTP + OAuth) at https://mcp.brainmemory.ai/mcp. Add it once per host and that host can recall, memorize, pin, and check status — no local install, no per-project setup. It works everywhere MCP does, including the chat apps that can't run a native plugin.
# Claude Code
claude mcp add --transport http brain https://mcp.brainmemory.ai/mcp
# OpenAI Codex CLI
codex mcp add brain --url https://mcp.brainmemory.ai/mcp
Per-host setup for every other connector
- Codex CLI (config file) — add to
~/.codex/config.toml:[mcp_servers.brain] url = "https://mcp.brainmemory.ai/mcp" - OpenCode — add to
opencode.json:{ "mcp": { "brain": { "type": "remote", "url": "https://mcp.brainmemory.ai/mcp" } } } - Claude.ai / ChatGPT — Settings → Connectors → Add custom connector, paste
https://mcp.brainmemory.ai/mcp, and complete the OAuth sign-in. (ChatGPT requires a paid plan or Developer Mode.) - Google Antigravity — add to
mcp_config.jsonunder theserverUrlkey. (Legacy Gemini CLI used thehttpUrlkey insettings.json.) - GitHub Copilot CLI — add to
~/.copilot/mcp-config.json(OAuth via/mcp auth brainin-session):{ "mcpServers": { "brain-memory": { "type": "http", "url": "https://mcp.brainmemory.ai/mcp", "tools": ["*"] } } } - OpenClaw —
openclaw mcp add brain-memory --url https://mcp.brainmemory.ai/mcp --auth oauth, thenopenclaw mcp login brain-memory. (Inside NVIDIA NemoClaw, allowlist the endpoint first — see integrations/openclaw.) - Hermes Agent — add to
~/.hermes/config.yaml:mcp_servers: brain: { url: "https://mcp.brainmemory.ai/mcp", auth: oauth } - Goose — add a remote extension (streamable-HTTP) pointing at
https://mcp.brainmemory.ai/mcp. - Kilo — add to
kilo.jsonc(OAuth starts automatically):{ "mcp": { "brain-memory": { "type": "remote", "url": "https://mcp.brainmemory.ai/mcp", "enabled": true } } }
The first time a host connects you'll complete an OAuth sign-in with the Google account that holds your cloud brain; the connector then syncs to every client on that account. See Use Brain in Claude apps for the full walkthrough.
2. Local-first path — the native plugin
npm install -g brain-memory
brain
The first command installs the package globally — this gives you both the interactive setup wizard and the brain CLI (brain recall, brain memorize, brain reinforce, …) that agents rely on for deterministic scoring.
The second command runs the setup wizard, which asks which runtime(s) to configure and whether to install globally or for the current project. Each runtime gets its instructions file plus the brain commands/skills:
| Runtime | Instructions file | Commands land at |
|---|---|---|
| Claude Code | CLAUDE.md | ~/.claude/commands/brain/ (plugin slash commands) |
| OpenAI Codex CLI | AGENTS.md (~/.codex/) + hooks in ~/.codex/hooks.json (SessionStart, UserPromptSubmit, SessionEnd — trust once via /hooks) | ~/.agents/skills/<name>/SKILL.md |
| OpenCode | AGENTS.md | ~/.config/opencode/commands/ |
| GitHub Copilot CLI | copilot-instructions.md (~/.copilot/), repo-local AGENTS.md | ~/.agents/skills/<name>/SKILL.md (shared with Codex) |
| Kilo | rules/brain-memory.md + kilo.jsonc instructions entry (~/.config/kilo/), repo-local AGENTS.md | ~/.config/kilo/commands/ |
| Google Antigravity | GEMINI.md | ~/.gemini/skills/ (experimental — verify paths against a live install) |
Plugin install — Claude Code, Codex, ChatGPT workspaces
This repository is also a plugin marketplace. Installing the brain plugin gives Claude Code and Codex the same /brain:* commands plus deterministic hooks: SessionStart injects the budget-bounded brain session-start payload as context (no prompt file to edit, nothing for the model to remember to run) and SessionEnd records the session boundary in ~/.brain/contexts.json. The plugin bundles the CLI, so no npm install is required for the hooks.
# Claude Code
claude plugin marketplace add omelas-tech/brain
claude plugin install brain@brain-memory # local-first: hooks + /brain:* commands
claude plugin install brain-cloud@brain-memory # optional: the hosted MCP connector
# Codex CLI — same repo, same two plugins (Codex reads the Claude manifests)
codex /plugins # then add marketplace omelas-tech/brain
ChatGPT Business / Enterprise / Edu: a workspace admin imports the marketplace once (Admin → Plugins → Add → Import marketplace → https://github.com/omelas-tech/brain) and the workspace picks up new versions daily. brain (skills + hooks) serves Codex users in the workspace; brain-cloud (the MCP connector) serves ChatGPT desktop. Import does not grant access by itself — each user completes the connector's OAuth sign-in on first use.
Non-interactive
brain --claude --global # Claude Code, global
brain --codex --global # OpenAI Codex CLI, global
brain --opencode --global # OpenCode, global
brain --copilot --global # GitHub Copilot CLI, global
brain --kilo --global # Kilo, global
brain --antigravity --global # Google Antigravity, global (experimental)
brain --all --global # All runtimes, global
These run without a terminal, so an agent or a CI job can install brain itself. With no terminal to ask on, the installer initializes ~/.brain/ if it doesn't exist yet (it never overwrites an existing brain) — add --yes to skip that question outright. Leave out the runtime and it stops with an error rather than guessing.
For the deepest Copilot CLI integration — deterministic session-start context injection via its sessionStart hook — install the Copilot plugin from the brain marketplace:
copilot plugin marketplace add omelas-tech/brain
copilot plugin install brain-memory@brain
Kilo gets the same treatment via its runtime plugin — deterministic session-start injection, session tracking, and BRAIN_AGENT labeling (details):
mkdir -p ~/.config/kilo/plugin
cp integrations/kilo/plugin/brain-memory.js ~/.config/kilo/plugin/
3. Personal-assistant integrations — OpenClaw, NemoClaw, Hermes
Always-on personal assistants get deeper, first-class integrations that make ~/.brain/ their actual memory engine — the same brain your coding agents read and write:
- OpenClaw / NVIDIA NemoClaw — a native memory-slot plugin (
openclaw plugins install openclaw-brain-memory+plugins.slots.memory: "brain-memory") that replacesmemory-corewith deterministic brain recall, session-start context injection, and model-driven capture. Also ships a slot-neutral hook pack, a ClawHub skill, and a NemoClaw egress-policy preset. - Hermes Agent — a native memory provider (
plugins/memory/brain/) implementing the fullMemoryProviderlifecycle: session-start prompt block, pre-turn prefetch,brain_recall/brain_memorize/brain_reinforcetools, and session-context logging. Plus lightweight hook-script glue if you keep another provider active.
Both are backed by the same brain CLI the coding-agent installs use — one memory, every agent.
Update
npm install -g brain-memory
brain update
The first command updates the package and the brain CLI. The second command refreshes the slash command prompts for your installed runtimes. Target specific runtimes with --claude, --codex, --opencode, --antigravity, or --all.
Upgrading from an older version? The separate binaries (
brain-recall,brain-memorize,brain-reinforce,brain-cloud,brain-memory) were unified into a singlebraindispatcher — usebrain recall,brain memorize,brain reinforce,brain cloud <…>instead. Runbrain updateto refresh your runtime prompts to the new command surface.
Why not
npx?npxruns the setup wizard in a temporary directory that is discarded after execution. ThebrainCLI (brain recall,brain memorize,brain reinforce) won't be available in your PATH, which means agents will fall back to less reliable manual file operations. Always usenpm install -gto ensure everything works correctly.
Using nvm, fnm, asdf, mise or nodenv?
npm install -gputsbraininside whichever Node version is active, and only there. The command then disappears when your default version moves — a22alias drifting to a newer 22.x is enough — and shells that never load the version manager (agent hooks, GUI-launched agents, non-interactive shells) can't see it at all. Nothing errors: agents quietly fall back to editing memory files by hand, and it looks like brain works "sometimes". Install brain-memory with a system Node instead (Homebrew, apt, the nodejs.org installer) sobrainlives in one stable place. npm takes its global prefix from thenodethat runs it, so put the system Node first onPATHfor that one command — on macOS with Homebrew:PATH="/opt/homebrew/bin:$PATH" npm install -g brain-memory. Check withwhich -a brain; it should print exactly one path, outside your version manager's directory. The installer warns when it detects this. Volta is fine as-is — it keeps global packages available across versions.
Uninstall
brain uninstall
npm uninstall -g brain-memory
The first command removes slash commands and prompt sections from your agent configs. The second removes the package and CLI tools. Your ~/.brain/ directory (memories) is preserved by default. Add --delete-data to the uninstall command to remove it too. Use --yes to skip confirmation prompts.
Manual Install
If you'd rather wire up the native plugin by hand, copy the brain commands into your agent's folder, then append the matching prompt file to its instructions file.
# Claude Code — flat slash commands
cp -r commands/brain/ ~/.claude/commands/brain/
# OpenCode — flat slash commands
mkdir -p ~/.config/opencode/commands/brain
cp -r commands/brain/. ~/.config/opencode/commands/brain/
# OpenAI Codex CLI — each command becomes a skill under the cross-tool skills dir
for f in commands/brain/*.md; do
name=$(basename "$f" .md)
mkdir -p ~/.agents/skills/brain-"$name"
cp "$f" ~/.agents/skills/brain-"$name"/SKILL.md
done
# Google Antigravity (experimental — verify paths) — skills under ~/.gemini/skills/
for f in commands/brain/*.md; do
name=$(basename "$f" .md)
mkdir -p ~/.gemini/skills/brain-"$name"
cp "$f" ~/.gemini/skills/brain-"$name"/SKILL.md
done
Then append the contents of the corresponding prompt file to your agent's instructions file:
prompts/claude.md→CLAUDE.mdprompts/openai.md→AGENTS.md(Codex, in~/.codex/)prompts/opencode.md→AGENTS.md(OpenCode)prompts/antigravity.md→GEMINI.md(experimental)
AGENTS.mdcollision (local scope): Codex and OpenCode both read a project-localAGENTS.md. If you install both for the same project, point only one at the local file (or install one globally) so their brain sections don't conflict. Globally they're separate (~/.codex/AGENTS.mdvs OpenCode's own config dir).
Commands
The everyday loop is ambient — remember and memorize run automatically at session start/end, so you rarely type a command. The surface is a small core plus a background maintenance job:
| Command | Description |
|---|---|
/brain:remember [query] | Recall relevant memories with spreading activation and context matching |
/brain:memorize [topic] [--sync] | Store memories from current session context (add --sync to auto-push) |
/brain:status | Dashboard with brain health metrics and recommendations |
/brain:pin [id|query] | Pin a memory to the always-present tier — loads every session, never decays. Toggles: also unpins (--off) |
/brain:forget [target] | Decay, archive, or remove memories. --deep performs forensic erasure — traces and removes every reference |
/brain:import [--project P] [--since 30d] | Cold-start a new brain from transcripts your agents already wrote. Incremental — safe to re-run |
/brain:sync [subcommand] | Sync via Brain Cloud, Git remote, or export/import (auto-initializes the brain on first run) |
/brain:skills [list|show|add|use|remove|export] | Manage procedural skills — reusable how-to workflows with progressive disclosure |
/brain:sleep [scope] | Full maintenance cycle — 9 neuroscience-inspired phases (replay, consolidation, review reinforcement, pruning, dreaming, …). Usually runs automatically/in the background |
Cold Start
A new brain is empty, and an empty brain is worth nothing until something fills it. But your agents have been keeping local transcripts for months — decisions, preferences, corrections, conventions. /brain:import reads them.
brain import --sources # what history exists on this machine
brain import --project my-app # digest that project's past sessions
brain import --since 30d
Sourced from the repository README.
More in AI & Agents
- PonytailMakes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.109,599
- AgentsMulti-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, and Google Antigravity39,079
- Frontend SlidesCreate beautiful slides on the web using a coding agent's frontend skills28,060
- Agent Skills Search ServerSearch and discover Agent Skills from the skills.sh registry. Powered by HAPI MCP server.27,534
- Agency Agents Zh🎭 267 个即插即用的 AI 专家角色 — 支持 Hermes Agent/Claude Code/Cursor/Copilot 等 18 种工具,覆盖工程/设计/营销/金融等 20 个部门。含 52 个中国市场原创智能体(小红书/抖音/微信/飞书/钉钉等)。搭配编排器 agency-orchestrator,一句话即可让多位专家按 DAG 自动协作。19,868
- Watermarks RemoverStrip multi-vendor AI provenance marks: Unicode text hygiene, statistical rewrite hooks, and C2PA/metadata from PNG/JPEG/SVG/PDF/DOCX/HTML/MD17,822