Codex memory, and how to share it with Claude Code
How Codex memory works: AGENTS.md discovery, the 32 KiB limit, and local Memories. Then how to share instructions and memory between Codex and Claude Code.
A developer uses Claude Code in the morning and Codex in the afternoon. In the morning, Claude Code learns that the team uses pnpm, that integration tests need a local Redis, and that the billing module is frozen. In the afternoon, Codex knows none of it.
Both tools have memory. Neither shares it with the other. This guide explains how Codex memory works, how it compares with Claude Code's, and how to share what matters between them. Facts come from OpenAI's and Anthropic's documentation, checked on 5 November 2026.
How Codex memory works
Codex has two memory layers. AGENTS.md files are instructions you write, read on every run. Memories are notes Codex generates from past chats, stored on your machine, and off until you turn them on.
| AGENTS.md | Memories | |
|---|---|---|
| Who writes it | You | Codex, in the background |
| Where it lives | ~/.codex/ and your repository | ~/.codex/memories/ (or memories_v2/) on your machine |
| Shared with teammates | Yes, if committed to the repo | No. Machine-local |
| On by default | Yes | No |
| Size limit | 32 KiB by default (project_doc_max_bytes) | Not a fixed instruction budget |
AGENTS.md: what Codex reads on every run
Codex builds an instruction chain each time it runs. Per OpenAI's AGENTS.md guide, it looks in two places:
- Global:
~/.codex/AGENTS.override.mdif it exists, otherwise~/.codex/AGENTS.md. - Project: every directory from the git root down to where you are working. In each one, it checks
AGENTS.override.md, thenAGENTS.md, then any fallback names you configured.
The files are concatenated from the root downward, so files closer to your current directory come later and override earlier guidance. The whole chain is capped by project_doc_max_bytes, 32 KiB by default. Codex rebuilds the chain on every run, so edits take effect immediately.
To check what Codex actually loaded, the guide suggests asking it directly:
codex --ask-for-approval never "Summarize the current instructions."
Memories: what Codex learns from past chats
Codex Memories turns useful context from previous chats into local memory files that later sessions can use. It is off by default. Turn it on in the desktop app under Settings > Personalization > Enable Codex memories, or in config.toml:
[features]
memories = true
Memories are stored under your Codex home directory, by default ~/.codex/memories/ or ~/.codex/memories_v2/. OpenAI's documentation is clear that they are machine-local: not synced across devices and not shared with teammates.
Two settings control what goes in and out. memories.use_memories decides whether existing memories are injected into new sessions. memories.disable_on_external_context keeps chats that used external context, such as MCP tools or web search, out of memory generation. In a chat, /memories controls whether that chat uses memories or contributes to future ones.
Codex memory vs Claude Code memory
The two tools are built on the same idea: an instruction file you write, plus notes the agent writes for itself.
| Codex | Claude Code | |
|---|---|---|
| Instruction file | AGENTS.md | CLAUDE.md, or AGENTS.md when no CLAUDE.md exists |
| Global instructions | ~/.codex/AGENTS.md | ~/.claude/CLAUDE.md |
| Personal override | AGENTS.override.md | CLAUDE.local.md |
| Instruction size | 32 KiB chain by default | Recommended under 200 lines per file |
| Self-written memory | Memories, off by default | Auto memory, on by default |
| Memory location | ~/.codex/memories/ | ~/.claude/projects/<project>/memory/ |
| Shared with teammates | No | No |
Claude Code's side is covered in detail in how Claude Code memory works.
How to share memory between Codex and Claude Code
Neither tool reads the other's self-written memory. Share in layers instead.
1. One AGENTS.md for shared instructions. Codex reads AGENTS.md natively. Claude Code reads it too, since v2.1.277, but only when no CLAUDE.md exists. If you need Claude-specific instructions, keep a CLAUDE.md that starts with @AGENTS.md, so both tools read the same shared file. The details are in AGENTS.md vs CLAUDE.md.
If your repo has a CLAUDE.md and you want Codex to read it too, add it as a fallback in ~/.codex/config.toml:
project_doc_fallback_filenames = ["CLAUDE.md"]
Codex only falls back to it in directories without an AGENTS.md.
2. An MCP memory server both tools connect to. For knowledge that should follow you between tools, connect both to the same memory server. Mem0's hosted MCP server documents setup for Claude Code, Codex, and other clients. Codex adds remote servers with codex mcp add <name> --url <url>, or under [mcp_servers] in config.toml. For other options, see the best MCP memory server for Claude Code, and for a fuller comparison, Mem0 vs Zep vs Letta vs Supermemory.
3. A handoff file for unfinished work. When you switch tools mid-task, ask the first agent to write what was tried, what failed, and the next step to a short file on the branch, and ask the second to read it first. Delete it when the branch merges.
4. A shared record for team decisions. Personal memory in either tool stays personal. Decisions the whole team must follow need a home both tools, and every teammate's tools, can reach.
Keep personal preferences in each tool's own memory. Don't try to sync ~/.codex/memories/ and ~/.claude/projects/: they are generated state in different formats.
Where Lockstep fits
Lockstep keeps the team decisions in step 4: captured from PRDs, Slack, and pull requests, binding when their owner approves them, and marked replaced when a newer version is approved. Claude Code is briefed on the decisions that apply at the start of each session.
Codex is not supported yet. There is no Codex adapter, so Codex gets no automatic briefing, no hooks, and no managed skills. Lockstep's MCP server is a standard stdio server, so you can add it to Codex like any other, but we haven't verified that setup end to end. If your team runs mostly on Codex today, Lockstep is not the right fit yet. See how it works.
Sources checked 5 November 2026
- https://learn.chatgpt.com/docs/agent-configuration/agents-md
- https://learn.chatgpt.com/docs/customization/memories
- https://code.claude.com/docs/en/memory
- https://docs.mem0.ai/platform/mem0-mcp
- https://docs.stripe.com/mcp (Codex MCP command and config format)
- https://github.com/lockstep-team-agent/lockstep
Related reading
For Claude Code's side, read how Claude Code memory works. For the shared instruction file, see AGENTS.md vs CLAUDE.md. For moving between Cursor and Claude Code, see how to share memory between Cursor and Claude Code.
Frequently asked questions
- Does Codex have memory?
- Yes, in two layers. AGENTS.md files hold instructions Codex reads on every run. Memories, a separate feature, turns useful context from past chats into local memory files. Memories is off by default; turn it on with memories = true under [features] in config.toml, or in the desktop app's settings.
- Where does Codex store memories?
- On your machine, under the Codex home directory, by default ~/.codex/memories/ or memories_v2/, controlled by $CODEX_HOME. OpenAI's documentation says memories are machine-local: not synced across devices and not shared with teammates.
- Can Codex read CLAUDE.md?
- Yes, if you add it as a fallback filename. Set project_doc_fallback_filenames in ~/.codex/config.toml to include CLAUDE.md. Codex checks AGENTS.override.md, then AGENTS.md, then fallback names in each directory, so a CLAUDE.md is only read where no AGENTS.md exists.
- Can Codex and Claude Code share memory?
- Not natively. Each keeps its own machine-local memory. To share, put common instructions in one AGENTS.md that both read, and connect both to the same MCP memory server, such as Mem0, which documents setup for both. Personal memories stay separate.
- How much of AGENTS.md does Codex read?
- Up to project_doc_max_bytes, which defaults to 32 KiB across the instruction chain. Codex concatenates files from the git root down to your current directory, so files closer to where you work come later and take precedence.
Keep reading