All answers

Claude Code, Codex and Cursor

Does OpenAI Codex remember context between sessions?

Alexandru Lupascu, CTO & Co-founder · Updated

OpenAI Codex carries context between sessions in three ways, and only one is automatic: it rereads your AGENTS.md instruction files at the start of every run, it reopens a saved chat when you run codex resume, and it can learn from past chats through local Codex memories, which are off by default. According to OpenAI's Memories page, local Codex clients (the ChatGPT desktop app, Codex CLI and IDE extension) keep memories in a local store under your Codex home directory, separate from ChatGPT web memory. OpenAI's advice is to keep rules that must always apply in AGENTS.md and to treat memories as "a helpful recall layer".

How do you turn on Codex memories?

You turn on Codex memories with one setting, then control them per chat. The steps below follow OpenAI's Memories and command docs:

  1. In the ChatGPT desktop app, open Settings > Personalization and turn on Enable Codex memories. For Codex CLI, add this to ~/.codex/config.toml:
[features]
memories = true
  1. In an interactive session, type /memories to choose whether the current chat can use existing memories and whether it may feed future ones. Chat-level choices do not change your global settings.
  2. Adjust the keys you need: memories.use_memories controls whether existing memories are injected into future sessions, memories.generate_memories controls whether new chats become inputs, and memories.disable_on_external_context keeps chats that used MCP tool calls, web search or tool search out of memory generation.
  3. Review the files under ~/.codex/memories/ before you share your Codex home directory, and do not store secrets in memories.

What does Codex remember, and when?

Codex writes memories in the background, not at the moment a chat ends. OpenAI's Memories page says Codex skips active or short-lived sessions, waits until a chat has been idle long enough, and redacts secrets from generated memory fields. It can also skip a pass when your remaining Codex rate-limit percentage is below memories.min_rate_limit_remaining_percent. The stored files include summaries, durable entries, recent inputs and supporting evidence from prior chats. OpenAI describes them as generated state and advises against hand-editing them as your main control. In practice, a correction from a chat that just ended may not be in memory yet. Anything that must hold in the next session belongs in AGENTS.md, which Codex reads from ~/.codex/AGENTS.md and then from each directory between the project root and your working directory, up to 32 KiB by default.

What is the difference between resuming a session and memory?

Resuming continues one conversation; memory carries knowledge across many. codex resume continues a saved interactive session by ID: --last picks the most recent session in the current working directory, and --all widens the search to every session. Inside the TUI, /resume lets you choose a saved session and reloads its transcript with the original history intact. codex fork copies a session into a new chat so you can try another approach. /compact works within a single chat: it replaces earlier turns with a summary to free context. None of these merge what you learned in separate sessions. For that, Codex offers memories and AGENTS.md, compared with Claude Code's files in What is the difference between CLAUDE.md and AGENTS.md?

Is Codex memory enough for a team?

Codex memory fits one developer on one machine: the store sits in that machine's Codex home directory, and each teammate builds their own. If your team also runs Claude Code or Cursor, each tool keeps separate memory, so the same fact can be current in one tool and outdated in another. One option is a shared MCP memory server, explained in What is an MCP memory server?

elephant.broker is a pluggable runtime for AI agents that connects to Codex, Claude Code, Cursor or your own harness through an MCP server, native plugins or a REST API. On every turn, elephant.broker assembles task-relevant context from tools, teammates and past sessions, drops stale or duplicate facts, and writes decisions and corrections back for the next turn. Your model and harness stay unchanged.

Sources

Product details come from each vendor's public documentation as viewed on 2026-10-23 and may have changed. Product names are trademarks of their respective owners; elephant.broker is not affiliated with them.