Memory for
AI Agents
Hierarchical, file-system-based memory inspired by human neuroscience. Agents remember decisions, learn from experience, and build expertise across sessions.
Features
Hierarchical Memory
The directory tree is the semantic structure. Browsable in any file explorer.
Strength & Decay
Memories fade over time. Recalled memories strengthen. Ebbinghaus forgetting curve.
Associative Network
Weighted connections between memories. Recalling one activates related ones.
Spaced Reinforcement
Longer recall intervals produce larger boosts. Diminishing returns on cramming.
Cognitive Types
Episodic, semantic, and procedural memories each decay differently.
Cross-Agent
Claude Code, Gemini CLI, and Codex CLI. One brain, all agents.
Sleep & Consolidation
9-phase maintenance cycle: replay, consolidation, pruning, reorganization.
Portable Sync
Git remote or encrypted export/import across devices.
How it works
Memories are Markdown files with YAML frontmatter. They decay following Ebbinghaus's forgetting curve, strengthen through spaced recall, and consolidate during sleep cycles. Weak memories are archived automatically.
Benchmark results
Tested across Claude Code, Gemini CLI, and Codex CLI. Full methodology
| Scenario | Consistency | Success |
|---|---|---|
Preference Retention Preferences applied without re-stating | +34.7% | +33.3% |
Multi-Session Continuity Decisions carry across sessions | +26.2% | — |
Accumulated Knowledge 5 sessions of learning improve output | +7.3% | — |
Error Pattern Learning Past debugging helps fix similar bugs | +4.8% | — |
Cross-Agent Consistency All agents follow the same memorized style | inconclusive | — |
Per-Agent Results
| Scenario | +Brain | -Brain | Change | Tokens (+/-) | Time (+/-) | Notes |
|---|---|---|---|---|---|---|
| Continuity | 0.944 | 0.645 | +46.4% | 223K / 211K | 108s / 98s | — |
| Consistency | 0.400 | 0.400 | — | 133K / 125K | 103s / 89s | — |
| Knowledge | 1.000 | 0.891 | +12.2% | 511K / 312K | 159s / 130s | — |
| Error Learning | 0.570 | 0.570 | — | 248K / 141K | 228s / 203s | 100% vs 67% |
| Preferences | 0.866 | 0.359 | +141.2% | 134K / 125K | 106s / 93s | PASS vs FAIL |
Each scenario ran 3 times with median values reported. Default cloud models used for all agents.
Neuroscience foundations
| Brain Mechanism | Implementation |
|---|---|
| Spreading activation | Recalling memory A automatically surfaces linked memories B and C |
| Hebbian learning | Memories recalled together strengthen mutual links |
| Context-dependent recall | Memories encoded in similar context score higher |
| Spacing effect | Longer recall intervals produce larger strength boosts |
| Ebbinghaus decay | Exponential forgetting with per-memory decay rates |
| Synaptic homeostasis | Global strength downscaling during sleep prevents inflation |
Compatibility
Claude Code
Anthropic
npx brain-memory --claude --globalGemini CLI
npx brain-memory --gemini --globalOpenAI Codex CLI
OpenAI
npx brain-memory --codex --globalQuick start
npx brain-memory@betaInteractive installer. Configures the selected runtime(s) globally or per-project.