v0.6.1 · on npm

Long-term memory
for AI agents.

Agents remember decisions, conventions and preferences across sessions. Memories are Markdown files in ~/.brain/, shared by every agent you use.

Get started
npmv0.6.1licenseMIT
01 How it works

Three steps.

01

Remember

The agent saves decisions, conventions and preferences as Markdown files.

02

Recall

At session start and on request, the most relevant memories are loaded into context.

03

Maintain

Memories fade unless used. Recall strengthens them. A sleep cycle consolidates and prunes.

Forgetting curvestrength(t) = e^(−λt)
strengthfull timelinerecall event
02 Specification

What every brain includes.

StorageOne Markdown file per memory in ~/.brain/, with YAML frontmatter. No database.
RecallKeyword relevance, strength after decay, links between memories and project context. No model calls; the same ranking in every agent.
Memory typesEight types, from decision to observation, each with its own strength and decay rate.
TimeA newer fact can supersede an older one. Past states stay queryable by date.
SkillsProcedures stored as SKILL.md files and loaded only when a task needs them.
SafetyEvery memory records its origin. Content from tools or the web waits for your approval before recall.
SyncGit remote, encrypted export, any synced folder via BRAIN_DIR, or Brain Cloud.
RequirementsNode.js 18 or later. No runtime dependencies.
LicenseMIT
03 Benchmarks

Tested against keyword search, vector search and full-context prompts.

Claude Sonnet 5.5, 10 runs per arm, graded by a three-judge panel from other model families. Wins, ties and nulls are all published. Results → Methodology →

9/10
passed with 1,000 distractor memories. BM25 and vector search: 0/10.
−28%
tokens when only the needed skill is loaded, at the same pass rate.
10/10
completed with a poisoned memory present. Without quarantine: 0/10.
Runs passed out of 10, per scenario
Claude Sonnet 5.5, single-shot, N=10 per arm. Each row has four lanes: floor, best baseline, brain, oracle.
No memory (floor)Best baselineBrainOracle (ceiling)
0510
ANoisy folder
Winretrievers fail under 1000 distractors
BThree sessions
TieBM25 ~800 tokens leaner
CContradiction
TieBM25 ~250 tokens leaner
DSkills
Winsame pass rate, 28% fewer tokens
FAbstention
Nullthe model abstains without memory
GPoisoned memory
Winquarantine off: 0/10, all refused
runs passed (of 10)
D’s baseline is loading every skill body; G’s is the whole haystack dumped into the prompt. In G, brain with quarantine switched off passed 0/10 because Claude’s API refused every run.

Judge agreement with human grading has not been measured yet. Raw data: JSON.

04 Mechanisms

Each mechanism follows a published model.

MechanismIn Brain Memory
Ebbinghaus decayStrength falls exponentially, at a rate set by memory type.
Spacing effectLonger gaps between recalls give larger, longer-lasting boosts.
Spreading activationRecalling a memory also surfaces its linked memories.
Hebbian learningMemories recalled together become more strongly linked.
Context-dependent recallMemories from the current project rank higher.
Synaptic homeostasisSleep scales all strengths down to prevent inflation.
05 Compatibility

One store. Every agent.

Add the hosted MCP connector to any agent below. Sign-in is OAuth.

MCPhttps://mcp.brainmemory.ai/mcp
Claude Code
Anthropic
claude mcp add --transport http brain …/mcp
Codex CLI
OpenAI
codex mcp add brain --url …/mcp
OpenCode
Any model
opencode.json → mcp remote url
Copilot CLI
GitHub
mcp-config.json → type http + url
Kilo
Any model
kilo.jsonc → mcp remote url
Claude apps
Anthropic
Settings → Connectors → Add (URL + OAuth)
ChatGPT
OpenAI
Settings → Connectors → custom (paid / Dev Mode)
Antigravity
Google
mcp_config.json → serverUrl

Or run it locally.

The npm plugin writes to ~/.brain/ on your machine. No account needed.

Claude Code
Anthropic
brain --claude --global
Codex CLI
OpenAI
brain --codex --global
OpenCode
Any model
brain --opencode --global
Copilot CLI
GitHub
brain --copilot --global
Kilo
Any model
brain --kilo --global
Antigravity *
Google
brain --antigravity --global

* Experimental.

06 Quick start

Install, then connect your agent.

$npm install -g brain-memory

Then run brain --claude, --codex, --opencode or --all. For the Claude and ChatGPT apps, add the MCP connector.

07 FAQ

Questions.

What is Brain Memory?Long-term memory for AI agents. Agents store decisions, conventions and preferences as Markdown files and recall them in later sessions.
Which agents does it work with?Through the hosted MCP connector: Claude Code, Codex CLI, OpenCode, Copilot CLI, Kilo, Antigravity, the Claude apps and ChatGPT. The local plugin supports the same CLIs. OpenClaw and Hermes use it as their memory engine.
Where are memories stored?In ~/.brain/ on your machine, one Markdown file per memory. There is no database. Set BRAIN_DIR to keep the folder elsewhere.
How is it different from a vector database?Recall is computed from the files, without embeddings or model calls: keyword relevance, strength after decay, links between memories and the current project. Every agent gets the same ranking.
Is it free?Yes. The plugin is MIT-licensed and published on npm as brain-memory. Brain Cloud sync is optional.
08 References

Sources.