Codex Memory: What It Remembers and How to Share Context With Your Team
Codex memories are off by default, built from your own past sessions, and stored in your Codex home on one machine. Here is what they hold, why Codex does not share them with teammates, and where shared project context belongs instead.
Codex memory is a personal feature. When you turn it on, Codex sends your own recent sessions to a model in the background to summarize them, keeps the results as files in your Codex home directory, and feeds a short summary of those files into your later sessions. Nothing in that pipeline sends a memory to a teammate. So a team that wants every engineer's Codex to know the same conventions and decisions has to put them somewhere shared: committed AGENTS.md files for standing rules, checked-in docs for the longer explanations, and a team knowledge layer for what people learn in sessions and nobody writes down.
This guide describes the open source Codex CLI as of November 2026, checked against the openai/codex repository. Codex changes quickly, so confirm a setting in your own version before you build a team process on it.
What Codex memory does when you turn it on
Memories are opt-in. The memories feature ships as stable but disabled by default, and the /memories command in the terminal UI opens its settings. If the feature is off, the command first offers to turn it on. The settings panel then has two switches and a reset:
- Use memories injects memory into new threads, starting with the next one.
- Generate memories lets Codex build memories from this thread and future ones.
- Reset all memories deletes the local memory files and session summaries for the current Codex home, without changing existing threads.
Generation runs in the background when a top-level session starts, in two phases. Ephemeral sessions and sub-agent sessions never start it.
Phase 1 summarizes past sessions. Codex picks a small batch of your earlier sessions that are recent enough and have sat idle long enough to be finished. The defaults are sessions no older than 10 days, idle for at least 6 hours, and 2 sessions per startup, and each is configurable under [memories] in config.toml. Codex also skips a pass when less than 25% of your rate limit remains, so a busy week can leave memories behind. A model turns each session into a detailed raw memory and a compact summary. Codex redacts secrets from what the model generates and stores the result in its local state database.
Phase 2 consolidates. Codex writes the selected memories into a memory folder inside your Codex home, which is ~/.codex unless CODEX_HOME points elsewhere. A fresh Codex home uses memories_v2/, and an older one may still use memories/. The folder holds per-session summaries plus consolidated files, including a memory_summary.md, and a consolidation sub-agent updates them. The sub-agent's commands run with no network access and can write only locally, but its prompts, including the selected memories, still go to the model that runs it. Selection favors memories that later sessions used. A memory that has gone 30 days without use, the default max_unused_days, is left out of the next consolidation.
On the read side, Codex adds memory_summary.md to the session's instructions and tells the agent where to look up the rest of the folder when a task looks related to earlier work. One more setting matters for teams that use MCP servers or web search. With disable_on_external_context turned on (it is off by default), a thread that pulls in external context, such as an MCP tool result or a web search, is excluded from memory generation, and memories built from it are dropped at the next consolidation.
Codex memories belong to one Codex home, not to the team
The memory artifacts described here are stored in your Codex home and are not automatically shared with teammates. They are built from your own sessions. The raw memories sit in Codex's local state database, and the consolidated files are a folder on your disk, which the reset clears for the current Codex home only. Generating them still uses model inference, so local storage is not a promise that session content stays on your machine. A teammate running Codex on the same repository has a different Codex home, with its own sessions and its own memory folder.
Say a teammate spends a session working out that one package's tests pass only after a seed script loads a currency table the default fixtures leave out. If they have memories on, their Codex may recall that next week. Yours will not, and neither will the new hire's. The finding exists in one person's memory folder and in no file anyone reviews.
Per-user memory suits personal context, such as how you like plans laid out or which shell aliases you use. Anything another engineer's agent needs belongs somewhere else. Team memory for coding agents covers the layers a team can share instead.
AGENTS.md is the context every teammate's Codex reads
The team-wide layer for Codex is the committed AGENTS.md. Codex walks up from your working directory to the project root, which is the nearest directory containing .git by default, then reads every AGENTS.md from the root down to where you started it and joins them root first. In each directory an AGENTS.override.md takes priority over AGENTS.md, and teams can configure fallback filenames such as CLAUDE.md. The combined text is capped by project_doc_max_bytes, and Codex warns you to trim your instructions when they exceed it.
Two details catch teams out:
- Untrusted projects get no project instructions. Codex skips project
AGENTS.mdfiles in a project marked untrusted in its config, so a teammate whose checkout carries that mark is running without your conventions. - Override files are easy to leave behind. An
AGENTS.override.mdin a directory replaces that directory'sAGENTS.md, so one stray local override can hide a shared rule.
Keep AGENTS.md to what an agent cannot infer from the code: the test command for each package, generated files it must not edit, the boundary between two services. Put the reasoning behind a decision in a checked-in doc and link to it. For how Codex, Claude Code, and Cursor each load these files, and a setup that keeps one copy across all three, see AGENTS.md vs CLAUDE.md vs .cursorrules.
Set up shared context for a Codex team
Decide where each kind of context goes before anyone turns memories on, so personal memory does not become the only record of something the team depends on.
- Commit
AGENTS.mdat the repository root, with nested files only in packages whose commands or rules differ. Give it an owner and review changes to it like code. - Move explanations into docs. Architecture decisions, migration notes, and troubleshooting steps go in checked-in documentation, linked from
AGENTS.mdwhere an agent needs them. - Check trust and overrides on each machine. Ask each engineer to confirm their Codex config does not mark the repository untrusted and that no
AGENTS.override.mdis hiding a shared file. Then ask Codex to summarize its current instructions and compare the answer with the committed file. - Agree what personal memory is for. Preferences and short-lived notes can stay there. When someone's Codex recalls a project fact a teammate would need, that fact belongs in a shared file or knowledge base.
- Promote findings in the pull request that proves them. When a session uncovers a requirement, such as the seed step in the earlier example, add the instruction or doc change in the same pull request so a reviewer checks it against the code.
Keep shared context current
A committed instruction stays in context after the code it describes has changed. Revisit the shared files at three points: when a pull request changes a command, path, or convention that AGENTS.md mentions, when Codex repeats a mistake an instruction should have prevented, and after a refactor that moves code an instruction names. In each case, read the instruction Codex loaded before you add another one, because the fix is often to correct or delete a stale rule.
Codex memory has its own clock. Raw memories come only from sessions in the configured age window, and consolidated memories that go unused fall out of selection. Neither process checks a memory against the current repository, so treat a recalled fact as a lead to verify.
When a team needs a knowledge layer beyond files
Files work for rules someone sat down and wrote. They miss most of what engineers learn mid-session, because promoting each finding into AGENTS.md by hand is a chore that loses to the next task. A shared knowledge layer gives every engineer's agent one place to read from and write to, whichever coding agent they run.
Dosu is one. Its MCP server gives Codex and other MCP clients two tools for this:
read_knowledgesearches the Library's curated knowledge, its Documents, approved answers, and Topics, and when the agent passes its repository and branch, it also lists the notes written on that branch.write_knowledgerecords something durable the agent learned, such as a decision and its reason or a non-obvious constraint. A note tied to a connected repository and branch is visible to Library members working on that branch right away, and becomes a candidate Topic when the branch's pull request merges into the default branch. Dosu checks each candidate against your existing Topics before adding it.
Know what skips review. Notes from write_knowledge are saved directly and do not pass through Dosu's Review queue, which holds proposed Document changes and draft replies. If your team needs approval before anything reaches shared context, keep that step in the pull request or keep the approved rule in AGENTS.md.
FAQ
Are Codex memories shared with my teammates?
No. Codex builds memories from your own sessions and stores them in your Codex home on your machine. A teammate's Codex reads its own memory folder. Shared context has to live in committed files or a shared knowledge base.
Are Codex memories on by default?
No. The memories feature is disabled by default. Turn it on with memories = true under [features] in config.toml, or run /memories, which offers to enable it. The /memories panel then lets you choose whether Codex uses memories, generates them, or both.
How do I clear Codex memories?
Open /memories and choose Reset all memories. The reset deletes the local memory files and session summaries for the current Codex home and leaves your existing threads unchanged.
Should I rely on memory or on AGENTS.md?
Use AGENTS.md for anything another engineer's Codex needs, because every teammate's Codex loads the same committed file unless the project is marked untrusted. Use memory for personal working context. If a memory turns out to matter to the team, move it into a shared file.
Give every Codex session the same team context
Start with the checklist: commit a short AGENTS.md, confirm no teammate's Codex marks the repository untrusted, and move one finding from someone's memory into a shared file this week. Then connect Codex to a shared Library so findings stop depending on someone remembering to write them up. Connect your repository to Dosu, run npx @dosu/cli setup to add the Dosu MCP server to Codex, and check that a note your agent writes with write_knowledge comes back from read_knowledge in a new session on the same branch. The free plan covers public repositories and one member, so sharing notes across teammates or connecting a private repository needs a paid plan such as Pro.
