Blog
Share memory and rules across Claude Code, Codex and Cursor
Published: November 8, 2026
You told Claude Code the refund window is 60 days on annual plans. Cursor did not hear you. Codex will invent 30. Each agent reads its own files, and none of them reads the others' memory.
The short answer: inside one repo, write the rules once in AGENTS.md. Codex and Cursor read it, and Claude Code reads it when there is no CLAUDE.md, or through an @AGENTS.md line in one. Across repos, no single file is read by all three. Each tool has its own place for rules that apply everywhere, and each covers only you. For a team, it is an admin setting in each tool, or one source all your agents reach. For what each one stores on its own, see what each agent remembers.
In one repo: one AGENTS.md
- Codex reads
AGENTS.mdfrom the repo root down to the folder you started in. Our note on why Codex ignores AGENTS.md covers the 32 KiB limit and the other ways it gets skipped. - Cursor reads
AGENTS.mdin the project root and in subfolders, and reads aCLAUDE.mdthe same way. - Claude Code reads
AGENTS.mdin a project with noCLAUDE.md. If you keep aCLAUDE.mdfor Claude-only notes, Anthropic's docs suggest an@AGENTS.mdline at its top. A symlink,ln -s AGENTS.md CLAUDE.md, also works, but Claude will not edit through it, and on Windows the import is the safer choice.
To check, run /context in Claude Code and look under Memory files, or run codex debug prompt-input to see what Codex sends. More in AGENTS.md vs CLAUDE.md and does Claude Code read AGENTS.md.
Across your repos: one place per tool
Each tool has rules that apply to every project on your machine, and each keeps them somewhere different:
| Tool | Rules for every repo | Worth knowing |
|---|---|---|
| Claude Code | ~/.claude/CLAUDE.md and ~/.claude/rules/ | Both load alongside a project's files. ~/.claude/CLAUDE.md can import a file kept anywhere with @~/path, with no approval prompt. |
| Codex | ~/.codex/AGENTS.md, or AGENTS.override.md beside it | Read before the project files. Only the first non-empty file there counts, and the override wins. |
| Cursor | User Rules in Customize, then Rules, and files in ~/.cursor/rules | User Rules live on your account and sync, and Inline Edit ignores them. The files stay on the machine. |
| Copilot CLI | ~/.copilot/copilot-instructions.md | COPILOT_CUSTOM_INSTRUCTIONS_DIRS can point it at a folder that holds an AGENTS.md. |
None of these is read by the other tools, so the same rule still lives in three places: a file Claude imports, a file Codex reads, and a setting in Cursor. And every one of them is yours alone. Each teammate sets up their own, and they drift the day someone edits one.
Sharing what the agents learn: one memory server in all three
Rules files hold what you wrote down. What each agent learns on its own stays in that agent: Claude Code's auto memory, Codex memories and Copilot Memory are each read by one tool, and Cursor removed its Memories in 2.1. To share what was learned, point all three at the same MCP memory server. Each tool has a project file for it, so the setup can be committed with the repo. The server URL below is a placeholder; use your server's, and keep tokens in environment variables, never in the file.
Claude Code writes .mcp.json at the repo root:
claude mcp add --transport http memory --scope project https://memory.example.com/mcp
# .mcp.json
{
"mcpServers": {
"memory": { "type": "http", "url": "https://memory.example.com/mcp" }
}
}Cursor reads .cursor/mcp.json in the project (or ~/.cursor/mcp.json for every project):
{
"mcpServers": {
"memory": {
"url": "https://memory.example.com/mcp",
"headers": { "Authorization": "Bearer ${env:MEMORY_TOKEN}" }
}
}
}Codex reads .codex/config.toml in a trusted project (or ~/.codex/config.toml):
[mcp_servers.memory] url = "https://memory.example.com/mcp" bearer_token_env_var = "MEMORY_TOKEN"
Three things decide whether this works in practice:
- The agent has to call it. An MCP tool is pulled, not pushed: the agent searches memory only when it decides to. Add one line to
AGENTS.md, such as “Search the memory server before starting a task, and save any decision we settle,” and expect it to be skipped on some tasks. - Each tool asks first. Claude Code asks before it uses a server from
.mcp.json, and Codex reads a project.codex/config.tomlonly in a project you have trusted. Each teammate approves once. - Three files, one server. The files differ in format, so a change of URL or name is three edits. Keep them in the same pull request.
Which servers are built for a team, and what each stores, is in the best MCP memory servers for teams. For a single developer on Claude Code only, claude-mem is the common choice.
Across a team's repos
Three ways, each with a cost:
- An admin setting in each tool. Claude Code reads a managed
CLAUDE.mdplaced on every machine, or set from the claude.ai admin console on Team and Enterprise plans. More on what Claude Code shares. Codex takes managed developer instructions inrequirements.toml. Cursor has Team Rules on Teams and Enterprise, which an admin can enforce. Copilot has organization instructions on Business and Enterprise, for Copilot Chat on GitHub.com, code review and the cloud agent. That is four consoles, four formats and the right plan in each. - A shared rules repo, synced into each tool. A script copies one source into every file above. It works, but you are back to copies, kept in step by a script.
- One source all your agents reach. An MCP server or hooks that hand each session the rules from one place. This is what Harbor does.
Where Harbor fits
Harbor keeps one set of rules for the team, learned from where you already decide: Slack threads, pull request reviews and docs, plus what agent sessions record. Sign up, name your workspace, then run npx harborloop init: it installs hooks that Claude Code, Cursor, Codex and Copilot already know how to run, and each session then starts with the rules that apply to this repo and this task, not the whole file. Any MCP client can reach the same rules through Harbor's MCP server, and harbor doctor checks that they are reaching the agents you think they are.
You set the gate on what gets in: Manual holds everything for a person, Hybrid (the default) puts routine rules live on trial and holds the rest, and in every mode a secret, an install step or a clash Harbor cannot settle waits for a person. For each rule, Harbor counts how often it was served and how often an answer cited it. A cite is evidence a rule was used, not proof it was followed. Setup is self-serve, and the quickstart shows the steps.
Questions
How do I share memory between Claude Code and Cursor?
Point both at the same MCP memory server. Claude Code reads it from .mcp.json (claude mcp add --transport http memory --scope project <url>), Cursor from .cursor/mcp.json, and Codex from .codex/config.toml in a trusted project. Each agent still decides when to search it, so add a line to AGENTS.md asking it to.
Is there one file Claude Code, Codex and Cursor all read?
Inside a repo, AGENTS.md: Codex and Cursor read it, and Claude Code reads it when there is no CLAUDE.md, or through an @AGENTS.md line in one. For rules across all your repos, no: Claude Code reads ~/.claude/CLAUDE.md, Codex reads ~/.codex/AGENTS.md, and Cursor keeps User Rules in its settings.
How do I share rules across repos in Claude Code?
Put them in ~/.claude/CLAUDE.md or ~/.claude/rules/, which load in every project on your machine. ~/.claude/CLAUDE.md can import a file kept anywhere with @~/path, without an approval prompt.
Where do global rules go in Codex?
In ~/.codex/AGENTS.md, or ~/.codex/AGENTS.override.md, which wins when it exists. Codex reads it before the project files and uses only the first non-empty file at that level.
How does a team share the same rules across Claude Code, Codex and Cursor?
Either an admin setting in each tool (a managed CLAUDE.md, Codex requirements.toml, Cursor Team Rules, Copilot organization instructions), each on its own plan, or one source every agent reaches through hooks or an MCP server, such as Harbor.