Claude Code, Codex and Cursor
Can Claude Code, Codex and Cursor share one memory?
Alexandru Lupascu, CTO & Co-founder · Updated
Claude Code, OpenAI Codex and Cursor do not share a built-in memory: Claude Code's auto memory sits in ~/.claude/projects/<project>/memory/ on one machine, Codex's local memories sit in ~/.codex/memories/ and are off by default, and Cursor keeps rules in .cursor/rules/ and on your Cursor account. What all three do share is support for two open standards: AGENTS.md for instructions and the Model Context Protocol (MCP) for tools. So one memory across the three is possible, but you assemble it from those shared parts, or connect a runtime such as elephant.broker that plugs into all three.
What does each tool keep, and where?
Each tool stores what persists between sessions in its own place. According to each vendor's docs:
| Tool | Instruction files it reads | What else persists between sessions | MCP config |
|---|---|---|---|
| Claude Code | CLAUDE.md; AGENTS.md when no CLAUDE.md exists (v2.1.277 or later) | Auto memory, on by default in local sessions, machine-local | .mcp.json (project), ~/.claude.json |
| OpenAI Codex | AGENTS.md, AGENTS.override.md | Local memories, off by default; saved chats via codex resume | .codex/config.toml (trusted projects), ~/.codex/config.toml |
| Cursor | .cursor/rules/*.mdc, AGENTS.md, CLAUDE.md | User rules synced to your Cursor account; Team Rules on Cursor's servers | .cursor/mcp.json, ~/.cursor/mcp.json |
Claude Code's docs state that auto memory files "are not shared across machines or cloud environments."
How do you set up one shared memory for all three?
You combine one instruction file with one MCP memory server registered in every tool:
- Put shared instructions in
AGENTS.mdat the repository root. Codex and Cursor read it; Claude Code reads it when noCLAUDE.mdexists, or through an@AGENTS.mdimport. Details: What is the difference between CLAUDE.md and AGENTS.md? - Register the same MCP memory server in each tool's MCP config from the table above. Commands: What is an MCP memory server?
- On one machine, a local server with one memory file works; the reference server's README says writes from separate clients take turns through a lock file.
- For a team, run a memory server that supports Streamable HTTP; the reference server's README describes stdio only. The MCP architecture overview says remote Streamable HTTP servers "will typically serve many MCP clients".
- Tell agents in
AGENTS.mdwhen to search and save, because the model decides when to call MCP tools.
What goes wrong with a shared memory?
The built-in memories keep running next to the shared one. Claude Code's auto memory and Codex's local memories can hold an older version of a fact that the shared server has already corrected. To keep one source of learned facts, you can turn off Claude Code's auto memory per project with "autoMemoryEnabled": false and leave Codex memories off.
Recall depends on the model. A memory server waits to be called, so an agent that skips the search works from its own context.
Conflicts need an owner. When two agents save contradicting facts, a basic memory server stores both, and deciding which one is current is left to the model or to you.
Instructions load at session start. Codex builds its instruction chain once per run, and Claude Code loads the CLAUDE.md files above your working directory at launch, whatever task comes next.
Where does elephant.broker fit?
elephant.broker is a pluggable runtime for AI agents built for several harnesses working from one source of context. It connects through an MCP server, native plugins or a REST API to Claude Code, Codex, Cursor, OpenClaw, Hermes or your own harness, and every turn recalls from, and writes back to, one graph and vector store, gateway-isolated per tenant. Before the model sees a turn, elephant.broker assembles task-relevant context from tools, teammates and past sessions, drops what is stale and flags sources that disagree; after the turn, it captures decisions, corrections and outcomes. Your model and harness stay unchanged. For one developer using one tool, the built-in memory is usually enough; for team setups, see How can a team share one memory in Claude Code?
Sources
- Anthropic, Claude Code: How Claude remembers your project, Connect Claude Code to tools via MCP
- OpenAI, Codex: Memories, Custom instructions with AGENTS.md, Model Context Protocol, Codex commands
- Cursor: Rules help, Model Context Protocol (MCP)
- Model Context Protocol: Architecture overview, Knowledge Graph Memory Server
- elephant.broker: overview, how a turn flows, comparison
Product details come from each vendor's public documentation as viewed on 2026-10-28 and may have changed. Product names are trademarks of their respective owners; elephant.broker is not affiliated with them.