GuidesHosting choices

Codex memory: AGENTS.md, memories and where they're stored

How Codex remembers between sessions in 0.172: AGENTS.md files, the opt-in memories feature, where ~/.codex keeps them, /memories, clearing, and resume.

December 1, 2026The Everpod team
The short answer

Codex remembers things between sessions in three ways. AGENTS.md files are instructions you write, read at the start of every session: ~/.codex/AGENTS.md for you, and one per directory from the repository root down to where you started. Memories are notes Codex writes itself from your past chats, kept under ~/.codex/memories_v2/ (or memories/ on an older setup) and fed into later sessions; they are off by default, and codex features enable memories turns them on. Saved sessions are the third: codex resume reopens a whole conversation. As of December 1, 2026, with Codex 0.172.0.

The three kinds, side by side

AGENTS.mdMemoriesSaved sessions
Who writes it
You (or Codex, when you ask it to edit the file)Codex, in the backgroundCodex, as you work
Where
~/.codex/AGENTS.md and the repository’s own files~/.codex/memories_v2/ or ~/.codex/memories/Under ~/.codex
On by default
YesNoYes
What a new session gets
The whole file, every timeWhat Codex judged worth keeping from earlier chatsNothing, unless you resume that session
Shared with your team
Yes, if committedNo, it stays on the machineNo

OpenAI’s memories page draws the line between the first two plainly: “Keep required team guidance in AGENTS.md or checked-in documentation. Treat memories as a helpful recall layer, not as the only source for rules that must always apply.” A rule Codex must follow goes in a file you control; memories catch what you never got round to writing down.

AGENTS.md: what you tell it to remember

Codex builds its instructions once when a session starts. From the AGENTS.md docs:

/init inside a session writes a starter AGENTS.md in the current directory. To check what actually loaded:

codex --ask-for-approval never "Summarize the current instructions."
Copied

The full discovery rules, the fallback filenames and how other agents read the same file are in what AGENTS.md is and which agents read it. Claude Code’s equivalent is CLAUDE.md, which it reads instead of AGENTS.md when both are present.

Memories: what Codex remembers on its own

With memories on, “Codex can turn useful context from eligible prior chats into local memory files” and inject them into later sessions. It does this in the background, not at the end of each chat. Per the docs and the configuration reference:

The docs name no plan that memories need, and the ChatGPT website keeps a memory of its own that is separate from Codex’s.

Turn memories on or off

In the CLI, codex features enable memories writes the flag to your config.toml, and codex features disable memories turns it off there. The same setting by hand:

[features]
memories = true
Copied

Two settings split it into halves, both true by default once the feature is on: use_memories decides whether existing memories are fed into new sessions, and generate_memories whether new chats become material for them. Setting generate_memories = false keeps what Codex already knows and stops it learning more:

[memories]
use_memories = true
generate_memories = false
Copied

For one chat only, type /memories in the CLI (between tasks, not while one is running) and choose whether this chat can use existing memories and whether it can feed future ones. “Chat-level choices don’t change your global memory settings.” In the ChatGPT desktop app the switch is Settings > Personalization > Enable Codex memories, with Allow memories from tool-assisted chats beside it. Where config.toml lives and how a project’s file stacks on yours is in the Codex config.toml guide.

Where memories are stored

Under your Codex home, ~/.codex unless CODEX_HOME says otherwise. There are two stores, because a new format is being rolled in:

The docs describe the contents as “generated summaries and supporting evidence from prior chats.” In the older memories/ folder the repository’s own memories README names the files: MEMORY.md, memory_summary.md, raw_memories.md, a rollout_summaries/ folder with one summary per chat used, and skills/. They are plain Markdown, so you can read them to see what Codex has kept. Editing them is another matter: the docs say to “treat these files as generated state” and not to rely on hand edits “as your primary control surface,” since they are Codex’s own output and a later background pass can rewrite them. To correct something Codex has wrongly learned, put the right rule in AGENTS.md.

There is one store per Codex home, not one per repository: the same memory folder serves every project you open as that user.

Clear or delete memories

The documented reset is in the ChatGPT desktop app: Settings > Personalization > Delete Codex memories, which resets “the selected machine’s memory store.” On a Mac where Computer History is available, the same button clears that too. The CLI has no listed command for it. Codex 0.172.0 does ship a hidden one, described in its source as “Internal: reset local memory state for a fresh start.” It empties the memories, memories_v2 and memories_extensions folders under your Codex home and clears the memory records in Codex’s local database. It cannot be undone, and because it is hidden and marked internal it may change or disappear in a later release:

codex debug clear-memories
Copied

Deleting only the folders by hand leaves that database behind. The repository’s README says the per-chat extractions are stored there and the background pass rebuilds raw_memories.md and rollout_summaries/ from them, so some of what you deleted can come back. To stop new memories afterwards, disable the feature as above.

Saved sessions: the other kind of memory

Neither AGENTS.md nor memories brings back a conversation. For that, codex resume --last reopens the latest session in the current folder and codex resume opens a picker; /resume does the same from inside one. A resume reloads the full transcript, while memories carry only a summary of what mattered across many chats. Why a session is missing from the list, and what a resume restores, is in getting a Codex or Claude Code session back.

Codex also keeps a history file, ~/.codex/history.jsonl, on by default. Its config docs turn that off with persistence = "none" under [history], or cap its size with max_bytes.

On a server or a shared machine

Run Codex on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.