Harness Notes

Memories

Updated 2026-11-22,

On this page

Memory here means notes the harness saves from your sessions and brings back in later ones. Instruction files you write yourself, such as AGENTS.md or CLAUDE.md, are on the Instructions page.

Built-in memory

QuestionCodex CLIOff until you turn it on, checked at 0.162.1
Is it on, and how do I switch it?

Codex has built-in local memories, off by default. Turn them on with [features] memories = true in ~/.codex/config.toml, codex features enable memories, or by typing /memories in the TUI and choosing "Yes, enable" (applies to new threads). Once enabled, memories.use_memories = false stops injecting memories and memories.generate_memories = false stops new threads from becoming memory inputs; codex features disable memories turns the whole feature off.

The feature is marked stable but still defaults to off; the old key memory_tool is accepted as an alias.

Admins can force it on or off for managed users with features.memories in requirements.toml.

In the ChatGPT desktop app the switch is Settings > Personalization > Enable Codex memories.

Who writes memories, and when

A background job writes memories, not the chat you're in. Each time you start a turn in an interactive root session, Codex looks at your other threads that have been idle for at least 6 hours and are at most 10 days old. It summarizes up to 2 of them per pass with a low-effort model. At most every 6 hours, a sandboxed consolidation agent with no network access merges those summaries into the memory files. The agent in your chat only adds a note when you explicitly ask it to.

Only CLI/TUI, IDE extension and ChatGPT desktop threads feed memories. codex exec runs, ephemeral sessions and subagent threads do not.

Generation is skipped while less than 25% of your Codex rate limit remains (memories.min_rate_limit_remaining_percent). New memories can therefore take hours or days to appear.

Tunable with memories.min_rollout_idle_hours (1-48), memories.max_rollout_age_days (0-90), memories.max_rollouts_per_startup (1-128), memories.extract_model and memories.consolidation_model.

Set memories.disable_on_external_context = true to keep threads that used MCP tools, web search or tool search out of memory generation.

Secrets are redacted from the generated memory fields.

Where they are kept

Memories are stored under $CODEX_HOME/memories (default ~/.codex/memories). Setting memories.version = "v2" uses ~/.codex/memories_v2 instead. There is one global store per Codex home, shared by every project, repo and worktree on that machine. The index of memory files is kept in the local state database.

Files include memory_summary.md, MEMORY.md, raw_memories.md, rollout_summaries/, skills/ and extensions/. The folder is also a local git repository that Codex uses to track changes between consolidation runs.

0.165.0: with memories turned on and no memories.version set, a Codex home that has no existing memories folder now uses the v2 store in memories_v2. Homes with v1 memories, an explicit memories.version, or memories.dual_write = false keep their current store. Memories themselves are still off by default.

0.165.0 App Server can import Claude Code project memory (~/.claude/projects/<project>/memory/*.md) when the user selects it during external-agent import. Files are copied as read-only reference resources under the memory folder and merged by the next background consolidation, into v2 and also v1 when a v1 store exists or v1 is selected. This needs the under-development external_agent_memory_import feature, which is off by default; otherwise memory import requests are rejected.

What a new session loads

At the start of each thread, Codex injects memory_summary.md as developer instructions, truncated to 2,500 tokens, together with guidance on how to use the memory folder. MEMORY.md (the searchable index), rollout_summaries/ and memory skills/ are not loaded. The agent searches or opens them on demand when a task looks related, usually in 4-6 search steps or fewer. A change to use_memories takes effect from the next thread.

When the agent uses a memory file, its reply ends with a memory citation block.

memories.dedicated_tools = true (off by default) gives the agent dedicated memory list/search/read/add_ad_hoc_note tools, instead of having it read the files with shell commands.

See and edit them

Partly

There's no memory browser. To see what Codex remembers, open the Markdown files in ~/.codex/memories (start with memory_summary.md and MEMORY.md). /memories in the TUI only toggles "Use memories" and "Generate memories" and offers "Reset all memories". OpenAI calls these files generated state: you can read them, but don't edit them by hand to control behaviour, because the next consolidation rewrites them.

In 0.162.1 the /memories toggles are written to config.toml as memories.use_memories and memories.generate_memories, so they apply globally rather than per chat. The 'Generate' toggle also updates the current thread.

0.165.0 adds an experimental App Server request, thread/memory/read, that returns the loaded thread's memory_summary.md from its selected memory version. It returns null when memories or memory use are off, or the summary is missing or blank. There is still no memory browser in the CLI.

Make it remember something

Partly

Ask the agent directly, for example "remember that we deploy with make ship". When you explicitly ask, it writes a small note to ~/.codex/memories/extensions/ad_hoc/notes/<timestamp>-<slug>.md. The next background consolidation merges the note into the memory files, so it is not available immediately. Rules that must always apply belong in AGENTS.md instead.

Notes are treated as information only, never as instructions, and remembered facts are tagged "[ad-hoc note]".

Correct or forget something

To correct or remove one fact, ask the agent to forget or update it. It records your request as an ad-hoc note, and the next consolidation applies it. To wipe everything, run /memories > Reset all memories in the TUI, or the hidden codex debug clear-memories command. Both delete the memory folders under ~/.codex and the memory records in the local state database, but leave your threads untouched.

Memories that haven't been used for 30 days drop out of consolidation (memories.max_unused_days).

The ChatGPT desktop app offers the same wipe as Settings > Personalization > Delete Codex memories.

Share with a team or another machine

Not supported

No. Memories stay local to one machine's Codex home and don't sync, and there's no project-level memory file to commit. Put shared team knowledge in AGENTS.md or checked-in docs, which the official docs recommend.

The IDE extension uses the memory store of the Codex host it is connected to.

Review the memory files before you share your ~/.codex directory.

Memory for subagents

Partly

Subagents have no memory of their own. They inherit the parent's config, so they read the same global memory summary, but their threads never feed memory generation. A custom agent role can turn memory off for itself with [features] memories = false in its role config file.

Notes and sources

Codex CLI, 33 sources
  • Generated state is not a documented external write contract.
  • Background generation can lag idle chats and skip active or short-lived chats.
  • Local filenames and layouts remain observations until version-bounded evidence establishes their contract.
Is it on, and how do I switch it?, 5
Who writes memories, and when, 7
Where they are kept, 13
What a new session loads, 4
See and edit them, 4
Make it remember something, 3
Correct or forget something, 4
Share with a team or another machine, 1
Memory for subagents, 3