Cross-Agent Memory Sharing

Brain Memory uses a single global directory — ~/.brain/ — that is shared across all supported AI agents. A decision stored by Claude Code in one project is immediately available to Gemini CLI or OpenAI Codex CLI in any other project, with no configuration, no export, and no per-project setup.

How It Works

All three supported agents read and write to the same ~/.brain/ directory:

~/.brain/                          ← Single shared directory
├── index.json                     ← Shared index
├── associations.json              ← Shared associative network
├── contexts.json                  ← Session contexts from all agents
├── professional/
│   └── decisions/
│       └── chose-kafka.md         ← Created by Claude Code
├── personal/
│   └── education/
│       └── rust-ownership.md      ← Created by Gemini CLI
└── ...

The format is agent-agnostic: plain Markdown files with YAML frontmatter. Any tool that can read Markdown can read your brain.

Agent-Agnostic Format

Brain Memory deliberately avoids any agent-specific constructs:

ComponentFormatWhy
Memory filesMarkdown with YAML frontmatterUniversal, human-readable
IndexJSONSupported by every language and tool
AssociationsJSONSimple weighted edge graph
ConfigurationJSON (in index.json)No proprietary config format
Directory structurePlain filesystemWorks on macOS, Linux, Windows

No vendor lock-in. No proprietary binary formats. Your memories are yours.

What Gets Shared

Everything in ~/.brain/ is automatically shared:

  • Memories — All memory files, regardless of which agent created them
  • Associations — The full associative network, including links created by different agents
  • Index — The central registry with all memory metadata
  • Configuration — Brain settings apply to all agents uniformly
  • Review queue — Spaced repetition schedule works across agents
  • Contexts — Session context history from all agents (labeled by source)

What Does Not Get Shared

  • Agent configuration — Each agent's command prompts and prompt sections are installed separately in their own config directories (~/.claude/, ~/.gemini/, ~/.codex/)
  • Session state — Each agent maintains its own session context during active use
  • Sync state — The ~/.brain/.sync/ directory is local and agent-independent

Cross-Agent Scenarios

Scenario 1: Claude Code creates, Gemini CLI recalls

  1. You work on a project with Claude Code and run /brain:memorize
  2. Claude Code stores a decision memory in ~/.brain/professional/
  3. Later, you open a different project with Gemini CLI
  4. Gemini CLI loads the brain at session start and sees the memory
  5. When the topic comes up, Gemini CLI references it naturally

Scenario 2: Multiple agents in the same session

  1. You use Claude Code to analyze a codebase and memorize findings
  2. You switch to Gemini CLI for a different task in the same project
  3. Both agents share the same brain — Gemini sees what Claude stored
  4. Gemini CLI adds its own memories, which Claude Code will see next time

Scenario 3: Review queue across agents

  1. /brain:sleep is run from Claude Code, populating the review queue
  2. You open Gemini CLI and run /brain:review
  3. The review session uses the same queue generated by Claude Code
  4. Recalled memories are reinforced regardless of which agent does the review

No Configuration Needed

Cross-agent sharing requires no setup beyond installing Brain Memory for each agent. Since all agents read from and write to ~/.brain/, sharing is automatic.

The only requirement is that each agent has its own command prompts installed. During installation, you can choose to install for multiple agents at once:

npx brain-memory@beta --all --global

This installs command prompts for Claude Code, Gemini CLI, and OpenAI Codex CLI simultaneously, all pointing to the same ~/.brain/ directory.

Info

Each agent has slightly different command syntax (slash commands for Claude/Gemini, skills for Codex), but they all operate on the same underlying brain structure and data format.

Tip

If you primarily use one agent but occasionally switch to another, your brain context follows you seamlessly. There is no migration or export step — just start using the other agent.

Human Access

Because the format is plain Markdown, you can also browse and edit your brain directly:

  • Open ~/.brain/ in VS Code, Obsidian, or any file explorer
  • Read memory files with any text editor
  • Search across memories with grep or your editor's search
  • Edit memories manually if needed (be careful with frontmatter format)
  • Use Git to track changes: cd ~/.brain && git init && git add -A && git commit -m "snapshot"

Your brain is not locked inside any tool — it is always accessible.