Crayon drawing of a stick-figure robot sitting at a small table reading one sheet of paper, with a big locked yellow box in the corner.

Yes, Codex has memory, in two forms: AGENTS.md files you write, which Codex reads at the start of every run, and Memories, an official feature that turns useful context from past chats into local files and is off by default. Both live on the machine where Codex runs, and ChatGPT on the web keeps a separate memory of its own. We ran Codex next to Claude Code until recently and left Memories off the whole time, for the same reason we keep Claude Code's auto memory off; that's below, after the mechanics. Docs checked 2026-10-21.

Does Codex have memory?

Yes, but only what you set up. You'll see it said that Codex has no persistent memory by default, and that's half right: Memories stay off until you enable them, while AGENTS.md loads on every run. What Codex keeps between sessions comes in three parts:

  • AGENTS.md, the instruction file you write. Codex builds the chain of instruction files once per run (OpenAI: AGENTS.md).
  • Codex memories, files Codex generates so useful context from earlier work carries into future work (OpenAI: Memories).
  • Past chats, reopened with codex resume, which picks a recent chat from the current repository or searches your local chats (OpenAI: Codex CLI).

OpenAI's own advice is to treat memories as a recall layer, not the only source for rules that must always apply. Rules belong in AGENTS.md. That split, rules you write versus notes the tool generates, is the core of context engineering for coding agents.

How does Codex read AGENTS.md?

One global file, then one file per directory from the project root down to where you're working, and later files win because they appear later in the prompt (OpenAI's AGENTS.md page):

  1. Global: in ~/.codex (or CODEX_HOME), AGENTS.override.md if present, otherwise AGENTS.md.
  2. Project: from the Git root down to your current directory, AGENTS.override.md, then AGENTS.md, then any names in project_doc_fallback_filenames, at most one file per directory.
  3. Merge: joined root first, so files closer to your current directory override earlier guidance.

Two limits catch people out. Loading stops at project_doc_max_bytes, 32 KiB by default for all files combined, and Codex ignores other file names unless you list them as fallbacks, so it doesn't read a CLAUDE.md by default. The per-directory walk is the useful part: it's the same nesting Claude Code does with CLAUDE.md, which is why our AGENTS.md files are symlinks to the CLAUDE.md beside them and both tools read one set of rules. To check what loaded, run codex --ask-for-approval never "Summarize the current instructions." from the repo root.

What are Codex memories and how do I turn them on?

Local files Codex writes from eligible past chats, and "Local Codex memories are off by default" (OpenAI: Memories). Turn them on in the ChatGPT desktop app (Settings > Personalization > Enable Codex memories, per machine) or, for the CLI, in ~/.codex/config.toml:

[features]
memories = true

Before you rely on them:

  • Files live under ~/.codex/memories/ as summaries, durable entries, recent inputs and supporting evidence. OpenAI calls them generated state: inspect them when troubleshooting, don't plan on hand-editing them.
  • Generation runs in two stages, per-chat extraction and then a global consolidation pass, and Codex waits until a chat is idle, skips short-lived sessions, redacts secrets, and skips a pass when your remaining rate limit is low. A new memory may not show up right away.
  • To keep chats that used MCP tools or web search out of memory, turn off Allow memories from tool-assisted chats, or set memories.disable_on_external_context = true.
  • OpenAI's pricing page marks Memories "Available with regional limits" on every plan it lists (OpenAI pricing).

To stop without deleting: turn off Enable Codex memories, or set memories.generate_memories = false so new chats stop feeding it, or memories.use_memories = false so existing memories aren't injected. /memories in a chat changes only that chat.

Why we left Memories off

We tried generated memory in both Codex and Claude Code, and the problem was the same in each: it remembered too well and forgot nothing. A decision from months ago would get applied to whatever we were working through today, with no sense of whether it still held, so old calls kept turning up in new work. There's no decay. And every memory that loads is context-window space we'd rather spend on the task. So Memories stayed off, every rule that has to hold went into AGENTS.md (which we keep short, around 150 lines, pointing at task-specific files), and anything more than one agent or machine needs went somewhere every agent could load, which is the last section. From what we've read, most people doing serious work with these tools have landed in the same place.

Does Codex memory sync across machines, or with ChatGPT?

No and no. Codex memories are a local store, and both the on/off setting and Delete Codex memories apply to one machine (OpenAI: Memories); each laptop builds its own from its own chats. ChatGPT on the web uses ChatGPT memory, a separate store with separate controls, so what you told ChatGPT in the browser doesn't appear in a Codex session, and the reverse. What travels is what you put in files: a checked-in AGENTS.md reaches every clone through Git.

Can Codex share memory with Claude Code or a teammate?

Partly. AGENTS.md travels with the repo, and Claude Code (v2.1.277 or later) reads it when there's no CLAUDE.md above it, or through @AGENTS.md at the top of a CLAUDE.md (Claude Code docs). Codex memories don't travel: they sit in one person's ~/.codex on one machine, and Claude Code's auto memory is "machine-local" too. The one bridge is a copy: Codex's /import lists Claude Code project memories among what it can bring over (OpenAI: Import), once. That's the gap in the thread everyone quotes: "tired of keeping project context in two places" (openai/codex #26397).

What you need What Codex does natively What it doesn't do
Rules every session follows AGENTS.md, global and per directory, 32 KiB default Reach tools that don't read AGENTS.md
Preferences and past decisions recalled Codex memories, opt-in, local Share them across machines or people
Pick up an earlier chat codex resume on local chats Hand that chat to another tool
Same context in Claude Code Claude Code reads AGENTS.md Share memories or session notes
Teammates see what your agent decided AGENTS.md and commits Track decisions, tasks and handoffs outside the code

"Memory bank" is a community pattern, not an OpenAI feature: a folder of markdown files plus a line in AGENTS.md to read them first and update them last. It works in Codex because AGENTS.md loads every run, and it breaks where files break: one repo, two agents overwriting the same note, no record of who changed what. OpenClaw memory builds on the same idea and is the longer story on where it leads.

Where our shared context lives instead

A Tokenrip workspace, which every agent we run loads first: the pinned decisions, the files, the open tasks and the last handoff. Codex connected the same way the others do, through MCP. By hand, add this to ~/.codex/config.toml and run codex mcp login tokenrip; Codex picks Client ID Metadata Documents automatically when a server advertises them, and Tokenrip's does (OpenAI: MCP).

[mcp_servers.tokenrip]
url = "https://api.tokenrip.com/mcp"

Tokenrip doesn't read Codex's memories; Codex reads and writes the workspace when it's connected and asked to, and a task it starts is held under a lease so no other agent works the same one. Or let the agent do the setup: paste this into it, and you give an email address and a six-digit code.

Connect me to Tokenrip. Fetch https://tokenrip.com/setup?ref=codex-memory and follow it.

Related reading

Questions

Where is Codex memory stored?

Codex memories live under ~/.codex/memories/ on the machine where Codex runs, as summaries, durable entries, recent inputs and supporting evidence. AGENTS.md files live in ~/.codex and in your repo.

How do I clear Codex memory?

Select Delete Codex memories in the ChatGPT desktop app and confirm. That resets the store on that machine only. AGENTS.md files are separate and are not touched.

Does Codex read CLAUDE.md?

Not by default. Add CLAUDE.md to project_doc_fallback_filenames in config.toml and Codex reads it in directories that have no AGENTS.md.

How large can AGENTS.md be in Codex?

Loading stops at project_doc_max_bytes, which defaults to 32 KiB for all instruction files combined. Raise it in config.toml or split instructions across nested directories.

Is Codex memory the same as ChatGPT memory?

No. ChatGPT on the web uses ChatGPT memory, and local Codex clients use a separate local store with its own Enable Codex memories toggle. Neither sees the other.