Back to all articles
TutorialDecember 1, 2026·11 min read

Claude Code vs Codex - How Each One Remembers Your Project Between Sessions (2026)

You use Claude Code for most of your work and Codex for a second opinion, or the other way around. On Monday you tell Claude Code that the integration tests need a local database running. On Tuesday Codex starts a task in the same repository and runs the tests without it. You wonder what each tool actually keeps between sessions, where it keeps it, and whether anything you teach one ever reaches the other.

The short answer: both tools read instruction files you write, and both can keep notes of their own, but they handle the notes differently. Claude Code's auto memory is on by default in local sessions, and Anthropic says Claude saves notes "based on your corrections and preferences". Codex's local memories are off by default; OpenAI says that once you turn them on, "Codex can turn useful context from eligible prior chats into local memory files." Neither tool's notes move into the other on their own.

This guide covers how each tool remembers, a side-by-side table, where they differ, where they work the same way, which setup fits which kind of work, and how to keep one set of project context when you use both.

Claude Code vs Codex at a glance

DimensionClaude CodeCodex
Project instructions fileCLAUDE.md, or AGENTS.md when the repository has no CLAUDE.mdAGENTS.md, with AGENTS.override.md read first in each directory
Personal instructions for every project~/.claude/CLAUDE.md~/.codex/AGENTS.md
Automatic notes, default settingAuto memory is on by default in local sessionsLocal memories are off by default
Who writes the automatic notes, and whenClaude writes notes during the sessionCodex generates memory files in the background after a chat has been idle
Where the automatic notes live~/.claude/projects/<project>/memory/, one folder per repositoryUnder the Codex home directory, ~/.codex by default
What loads at the start of a sessionCLAUDE.md files above the working directory, plus the start of the MEMORY.md indexAGENTS.md files from the project root down, up to a size limit, plus memories when enabled
Per-session control/memory toggle and the autoMemoryEnabled setting/memories per chat, plus memory settings in config.toml
Editing the automatic notesPlain markdown files you can edit or deleteGenerated state you can inspect, not meant as the main way to edit

Checked against each vendor's documentation on December 1, 2026.

How Claude Code remembers your project

Anthropic's memory page opens with the basic fact: "Each Claude Code session begins with a fresh context window." Two things carry knowledge across sessions: CLAUDE.md files you write, and auto memory Claude writes.

CLAUDE.md files

CLAUDE.md files can live at several levels: a managed file for the whole organization, ~/.claude/CLAUDE.md for your personal preferences, ./CLAUDE.md or ./.claude/CLAUDE.md for the project, and ./CLAUDE.local.md for personal notes about one project. Anthropic says the files don't override each other: "All discovered files are concatenated into context rather than overriding each other."

Claude Code also reads AGENTS.md. By default, it does so only when there's no CLAUDE.md in your working directory or above it. You can change that with the Project instructions setting in /config, for example to read both files together.

Auto memory

Auto memory is the part Claude writes. Anthropic's page lists four kinds of notes: who you are and how you work, corrections and confirmed approaches, ongoing project work, and where to find outside information. It also says what Claude leaves out: "Claude skips anything it can derive from the codebase, such as architecture, file paths, or debugging fixes."

The notes live in one folder per repository, shared by all worktrees. Anthropic is clear about scope: "Auto memory is machine-local." The folder has an index file, MEMORY.md, and one file per memory. Only the start of the index loads at session start, and Claude reads topic files when it needs them.

You can open the folder, toggle auto memory, and edit any CLAUDE.md file with /memory.

How Codex remembers your project

OpenAI's documentation separates the same two layers: AGENTS.md files you write, and local memories Codex generates.

AGENTS.md files

OpenAI's AGENTS.md guide says: "Codex reads AGENTS.md files before doing any work." It checks your Codex home directory first, then walks from the project root down to your working directory. In each directory it looks for AGENTS.override.md, then AGENTS.md, then any fallback names you configure, and it includes at most one file per directory. Files closer to your working directory appear later and take precedence.

There's a size limit. The guide says Codex stops adding files once the combined size reaches the limit set by project_doc_max_bytes, and suggests raising it or splitting instructions across nested directories.

Local memories

Codex's memory feature is off until you turn it on. The memories page says: "Local Codex memories are off by default." In the ChatGPT desktop app, you turn it on in Settings, under Personalization, with Enable Codex memories. In config, it's a feature flag in config.toml.

Once it's on, Codex works in the background. The page explains that Codex skips active or short-lived sessions, redacts secrets from generated memory fields, and waits until a chat has been idle before summarizing it.

OpenAI treats the files differently from Claude's notes: "Treat these files as generated state." The page also says to keep required guidance in AGENTS.md and to "Treat memories as a helpful recall layer, not as the only source for rules that must always apply."

Where they differ

Default setting for automatic notes

Claude Code's auto memory is on by default in local sessions, and Anthropic notes that sessions in a self-hosted environment start with it off. Codex's local memories are off by default until you enable them for a machine.

When the notes get written

Claude Code writes notes during the session. Anthropic says that when you see messages like Saved 2 memories in the interface, Claude is updating the memory folder. Codex writes later. OpenAI says memories "may not update right away when a chat ends", because Codex waits until a chat has been idle.

How you edit the notes

Claude Code's notes are plain markdown, and Anthropic says you can edit or delete them at any time. Codex's memory files are generated state; OpenAI suggests inspecting them when troubleshooting, and using /memories and config settings as the controls.

Which instruction file comes first

Claude Code reads CLAUDE.md by default and falls back to AGENTS.md only when no CLAUDE.md exists. Codex reads AGENTS.md by default, with AGENTS.override.md taking priority in each directory, and can read other file names you list as fallbacks.

How instructions combine

Claude Code concatenates every CLAUDE.md it finds above your working directory and loads subdirectory files on demand. Codex includes at most one file per directory from the root down, and stops at a combined size limit.

Where they work the same way

Both start each session without the last one's conversation. Instruction files and notes are what carry over, not the chat itself.

Both read AGENTS.md. Codex reads it by default. Claude Code reads it when there's no CLAUDE.md, or always if you change the Project instructions setting.

Both keep automatic notes on your machine. Claude Code's notes are machine-local. Codex's notes live under the Codex home directory on the machine where memories are enabled.

Both let you control notes per session. Claude Code has the /memory toggle, and Codex has /memories for the current chat.

Both put required rules in files you write. Anthropic calls CLAUDE.md and auto memory context rather than enforced configuration, and OpenAI says to keep required guidance in AGENTS.md rather than relying on memories.

Which one fits which job

If you want notes to start building without setup, Claude Code's auto memory is already on in local sessions.

If you want nothing remembered unless you choose it, Codex's local memories stay off until you enable them for a machine.

If you want to read and edit every note by hand, Claude Code's memory folder is plain markdown you can change directly.

If your repository already standardizes on AGENTS.md, both tools can read it, though Claude Code reads it only when no CLAUDE.md is present unless you change the setting.

If you work in a large repository with many instruction files, check Codex's size limit and Claude Code's on-demand loading of subdirectory files.

Using both

When you use both tools on the same repository, your project context ends up in four places: CLAUDE.md, Claude Code's memory folder, AGENTS.md, and Codex's memory files.

The instruction files can be shared. Anthropic's documentation describes a CLAUDE.md that imports AGENTS.md, and the Project instructions setting can make Claude Code read both. With either approach, one AGENTS.md can hold the rules both tools follow.

The automatic notes can't be shared. Claude Code's notes stay in its memory folder on your machine, and Codex's notes stay in its home directory. A correction you give Claude Code on Monday isn't in Codex's memory on Tuesday, and the reverse is also true. We covered the Codex side in our guide to whether Codex has memory.

What people try first

Assuming Codex remembers by default. Local memories are off until you enable them.

Assuming Claude Code reads AGENTS.md alongside CLAUDE.md. By default it reads AGENTS.md only when no CLAUDE.md exists.

Editing Codex memory files to fix a rule. OpenAI calls them generated state; put the rule in AGENTS.md.

Expecting a correction in one tool to reach the other. Each tool's notes stay in its own folder.

Putting required rules in automatic notes. Both vendors point to instruction files for rules that must apply.

The Fix: Give both tools the same project context

Step 1: Pick one shared instruction file

Use AGENTS.md for rules both tools should follow, and have CLAUDE.md import it or change Claude Code's Project instructions setting.

Step 2: Decide on automatic notes per tool

Leave Claude Code's auto memory on or turn it off, and decide whether to enable Codex's local memories on each machine.

Step 3: Review the notes each tool kept

Open Claude Code's memory folder with /memory, and inspect Codex's memory files under its home directory.

Step 4: Write down what both should know

Note the decisions and corrections that matter in your own words, so they don't depend on which tool heard them first.

Setting this up in MemoryLake

Instruction files can be shared between Claude Code and Codex, but the notes each tool keeps for itself can't. That follows from where each tool keeps them: both keep their notes on your machine, in their own folders. The context you'd like both to have, such as why a test needs a local database, is worth keeping in one place you control.

MemoryLake is a memory layer for that kind of context, kept in one place you maintain and available to the assistants you connect, such as ChatGPT, Claude Code, and Codex.

You write the entries yourself, in your own words. Nothing is read out of, written to, or deleted from your CLAUDE.md files, Claude Code's memory folder, your AGENTS.md files, Codex's memory files, or any vendor's store. Claude Code and Codex each work the way their own documentation describes.

Step 1: Create an API key

Sign in and generate a key from the dashboard. Keep it somewhere private.

The MemoryLake console showing the API keys screen, where a new key is created and copied for use in an agent
The MemoryLake console showing the API keys screen, where a new key is created and copied for use in an agent

Step 2: Upload your first memories

Start with what you wrote in Step 4 of the fix: decisions and corrections both tools should know. One topic per entry.

The MemoryLake workspace with the first documents uploaded, listing each file as it becomes searchable memory
The MemoryLake workspace with the first documents uploaded, listing each file as it becomes searchable memory

Step 3: Connect your AI & agents

Connect ChatGPT, Claude Code, Codex, and the other assistants you use, so the same context is there in each.

The MemoryLake integrations screen listing the AI clients and agent frameworks that can be connected to the memory layer
The MemoryLake integrations screen listing the AI clients and agent frameworks that can be connected to the memory layer

What this changes in practice

The first difference is one record for two tools. A correction you write down is available to both.

The second is less repetition. You don't explain the same project quirk to each tool separately.

The third is control. You decide what each entry says, whatever each tool's automatic notes contain.

Best practices for using Claude Code and Codex together

Share instructions through AGENTS.md. Both tools can read it.

Check Claude Code's instruction setting. It reads AGENTS.md alongside CLAUDE.md only if you set it to.

Decide on Codex memories per machine. They're off until you turn them on.

Review automatic notes regularly. Both tools keep them on your machine.

Keep required rules in instruction files. Both vendors recommend it.

Keep your own record. It works across both tools.

Conclusion

Claude Code and Codex both start each session with a fresh conversation and rely on files to carry knowledge forward. Claude Code reads CLAUDE.md, falls back to AGENTS.md, and keeps auto memory on by default in a plain-markdown folder per repository. Codex reads AGENTS.md from your home directory and project, and keeps local memories off until you enable them, then generates them in the background as files it treats as generated state.

Both read AGENTS.md, which makes it the natural place for shared rules. Their automatic notes stay separate, on your machine, in each tool's own folder. Writing down the context that both should know, in your own words, gives you one record that doesn't depend on which tool you told first.

Frequently asked questions

Does Claude Code share memory with Codex?

No. Claude Code's auto memory stays in its own folder, and Codex's local memories stay under the Codex home directory. Neither reads the other's notes.

Is Claude Code or Codex the right choice for remembering project context?

It depends on how you work. Claude Code builds notes by default; Codex keeps memories off until you enable them. Both read AGENTS.md.

Does Claude Code read AGENTS.md?

Yes, when there's no CLAUDE.md in your working directory or above it, or always if you change the Project instructions setting.

Is Codex memory on by default?

No. OpenAI says local Codex memories are off by default.

Where does Claude Code store auto memory?

In ~/.claude/projects/<project>/memory/, one folder per repository, on your machine.

Can I edit what each tool remembers?

Claude Code's memory files are plain markdown you can edit. Codex's are generated state; use /memories and config settings to control them.