Tutorial 11 min read | November 20, 2026

How to add memory to Claude Code, Cursor and Codex (and share one plan across all three)

None of the three coding agents remembers your last session by itself. Here is what each one loads at startup, how to set up one shared AGENTS.md, Claude Code auto memory and Codex memories, a handoff file for the plan, and when a shared MCP task store helps.

One plan your Claude Code, Cursor and Codex sessions can all pick up

Leave your email and we'll send the setup tutorial for the agents you use. You can tell us which ones before any price is shown. The free file-based setup in this article works either way.

Step 1 of 4

This needs to be a real email — we'll email you in a few minutes.

No spam. Unsubscribe anytime.

You plan a feature with Claude Code in the morning, fix a bug in Cursor after lunch, and hand a refactor to Codex in the evening. Each one starts the session knowing nothing about the other two, and often nothing about yesterday either.

That is not a bug in any of them. A coding agent's "memory" is whatever gets loaded into its context window when a session starts. So adding memory means deciding what to put on disk, in which file, so that each tool loads it. This guide covers four layers, from free and simple to shared across tools.

What each tool loads when a session starts

Claude CodeCursorCodex
Instructions you writeCLAUDE.md (user, project, nested); reads AGENTS.md only when there is no CLAUDE.mdUser rules, .cursor/rules/*.mdc, AGENTS.md~/.codex/AGENTS.md, then each AGENTS.md from the repo root down
Memory the tool writesAuto memory, on by default locally (~/.claude/projects/<project>/memory/)Saved past chats, only when you attach one with @Past ChatsLocal memories, off by default ([features] memories = true)
Previous conversationNot loaded in a new sessionNot loaded in a new chatNot loaded in a new session
MCP servers~/.claude.json or project .mcp.json~/.cursor/mcp.json or .cursor/mcp.json~/.codex/config.toml ([mcp_servers.*])

Sources: Claude Code's memory documentation, a Cursor staff answer on the Cursor forum ("every new chat is a fresh instance"; what carries over is rules, skills, AGENTS.md and past chats you attach), and OpenAI's Codex memories documentation. Details change between versions, so check your tool's docs if something does not match.

Layer 1: one shared instructions file

This is the part most people already half-have. Put the stable facts in one file all three tools read: build and test commands, conventions, what never to touch.

Use AGENTS.md at the repo root as the shared file. Codex and Cursor read it directly. Claude Code reads it only if there is no CLAUDE.md in the working directory or above. If you want Claude-specific notes too, keep a short CLAUDE.md that imports the shared file:

# CLAUDE.md
@AGENTS.md

## Claude Code only
- Use plan mode for changes under src/billing/.

Claude Code expands @path imports when it loads the file. Its docs suggest keeping each CLAUDE.md under about 200 lines, because a long file costs context and lowers adherence. The same advice is sensible for AGENTS.md.

For Cursor, add a project rule only if you need something beyond AGENTS.md, such as a rule that applies to certain files. Project rules are .mdc files in .cursor/rules/; alwaysApply: true includes one in every chat.

What this layer does not hold: what you decided today and which step you are on. Rewriting your conventions file every session is how it turns into a diary nobody reads.

Layer 2: memory the tool writes for itself

Claude Code auto memory

On by default in local sessions. Claude saves notes from your corrections and preferences into ~/.claude/projects/<project>/memory/, with a MEMORY.md index. The first 200 lines or 25KB of that index load at the start of every session. Run /memory to browse the files or toggle auto memory. If you want something kept as a rule rather than a note, say "add this to CLAUDE.md".

Codex local memories

Off by default. Turn them on in ~/.codex/config.toml:

[features]
memories = true

Or use Settings, Personalization, Enable Codex memories in the ChatGPT desktop app. Codex writes memories in the background after a chat has been idle for a while, skips short sessions, and redacts secrets. /memories in an interactive session controls the current chat. If you set memories.disable_on_external_context = true, chats that used MCP tools or web search are kept out of memory generation. OpenAI's own docs say to keep required guidance in AGENTS.md and treat memories as a recall layer. For the timing, storage and settings in detail, see Does OpenAI Codex remember across sessions?

Cursor

Cursor carries your rules and AGENTS.md into every chat. Past chats are saved, and you can attach one to a new chat with @Past Chats. That brings back a transcript, not a short list of decisions. We cover the Cursor side in detail in Cursor forgot your earlier requests?

The catch with this layer: each tool's memory is private to that tool. Claude Code's notes are invisible to Codex and Cursor, and the reverse. And none of it is a plan. It is preferences and learnings, chosen by the model.

Layer 3: a handoff file for the plan

The thing you actually lose between sessions is task state: the goal, what is decided, what is done, what is next. Put it in a file in the repo, where all three tools can read it, and tell them to use it.

# PROGRESS.md

## Goal
Add CSV export to the reports page.

## Decided (do not revisit)
- Keep the /api/reports response shape.
- Use lib/dates.ts for formatting.

## Done
- Export button and handler.

## Next
- Stream large exports.

## Open questions
- Header-only file for empty reports?

Then add one instruction to the shared AGENTS.md, so every tool picks it up:

## Session handoff
At the start of a session, read PROGRESS.md before proposing changes.
Treat "Decided" as fixed unless I say otherwise.
Before you finish a task, update Done, Next and Open questions.

For Claude Code you can also re-inject the file after compaction with a SessionStart hook that uses the compact matcher. Its output is added to the compacted context. In .claude/settings.json:

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "compact",
        "hooks": [{ "type": "command", "command": "cat PROGRESS.md" }]
      }
    ]
  }
}

The Claude Code /compact guide explains what survives compaction and why this hook matters there.

This is free and it works. It gets strained when the plan becomes many tasks with dependencies, when you want progress saved mid-task rather than only at the end, or when two tools edit the same file and one overwrites the other's update.

Layer 4: one MCP server all three tools use

All three tools are MCP clients, so a single MCP server can be the shared memory. The pattern is the same whatever server you pick: register it in each tool's config, then tell the agents (in AGENTS.md) when to read and write it.

There are two kinds. A hosted server is one URL you sign in to from every tool, and your data lives with that provider. A local stdio server is a program each tool launches on your machine, and the data stays in a file on that machine. Local servers do not follow you to another computer or a cloud workspace unless you install them there too.

Where Todo-MCP fits, honestly

Todo-MCP is the local kind, built for the plan rather than general notes: tasks with permanent IDs and dependencies, plus a key-value context store for decisions and in-progress breadcrumbs, in a SQLite file on your machine. It is a paid download. To see plans, leave your email in the form on this page first; it sends the setup tutorial and then shows the options.

You register the same binary in each tool as a stdio server with the arguments --mode stdio. Use the absolute path if todo-mcp is not on your PATH (on macOS and Linux it installs to ~/.local/share/todo-mcp/bin/todo-mcp):

# Claude Code
claude mcp add --transport stdio --scope user todo-mcp -- ~/.local/share/todo-mcp/bin/todo-mcp --mode stdio

# Codex
codex mcp add todo-mcp -- ~/.local/share/todo-mcp/bin/todo-mcp --mode stdio

# Cursor: add to ~/.cursor/mcp.json (use your full home path)
{
  "mcpServers": {
    "todo-mcp": {
      "command": "/Users/YOUR_USER/.local/share/todo-mcp/bin/todo-mcp",
      "args": ["--mode", "stdio"]
    }
  }
}

Per-tool details, including project-level config, are in the setup guides for Claude Code, Cursor and Codex CLI; if you also use the Claude Desktop app, this Claude Desktop memory guide compares its built-in memory, the official memory MCP server and Todo-MCP. Then replace "read PROGRESS.md" in your AGENTS.md with an instruction to call context_resume at the start of a session, todo_create for new tasks, and context_set for decisions and progress.

What it does not do: it does not make any tool remember by itself, it does not read your old chats, and it can only return what an agent saved. In ChatGPT it runs from the desktop app (Work or Codex), not from the website; for browser-only ChatGPT see when a long ChatGPT chat forgets your file. If PROGRESS.md already covers your work, keep using it.

Which layers you actually need

  • One tool, short tasks: layer 1, plus the tool's own memory if you like it.
  • One tool, multi-day work: layers 1 and 3. Add the compact hook if you use Claude Code.
  • Two or three tools on the same repo: one AGENTS.md and one handoff file, and a shared MCP server once the handoff file gets crowded.

The six ways a context window forgets covers the other resets (crashes, /clear, model switches) that the same setup protects against.

A short rule

None of these agents remembers a conversation. They remember files. Put rules in AGENTS.md, let each tool keep its own notes if you want, and keep the plan in one place every tool reads.

One plan your Claude Code, Cursor and Codex sessions can all pick up

Leave your email and we'll send the setup tutorial for the agents you use. You can tell us which ones before any price is shown. The free file-based setup in this article works either way.

Step 1 of 4

This needs to be a real email — we'll email you in a few minutes.

No spam. Unsubscribe anytime.

Frequently asked questions

Do Claude Code, Cursor and Codex remember previous sessions by default?
Not the conversation. Each new session starts with a fresh context window. What comes back is what each tool loads from disk at the start: instruction files such as CLAUDE.md or AGENTS.md, Cursor rules, and any memory the tool writes for itself. Claude Code auto memory is on by default in local sessions. Codex local memories are off by default. Cursor carries over your rules and AGENTS.md, and you can attach an old chat with @Past Chats.
Can one AGENTS.md file work for all three tools?
Yes, with one detail for Claude Code. Codex and Cursor read AGENTS.md. Claude Code reads AGENTS.md only when there is no CLAUDE.md in your working directory or above it, so if you keep a CLAUDE.md, put the line @AGENTS.md at the top of it to import the shared file.
How do I turn on memory in Codex?
Local Codex memories are off by default. Add memories = true under [features] in ~/.codex/config.toml, or turn on Enable Codex memories in the ChatGPT desktop app settings. In an interactive Codex session, /memories controls whether the current chat uses or contributes to memories. OpenAI says to keep rules that must always apply in AGENTS.md, not in memories.
Is built-in memory shared between the three tools?
No. Claude Code auto memory lives under ~/.claude/projects/, Codex memories live under your Codex home directory, and Cursor has its own rules and chat history. None of them reads the others. To share, use files in the repo that all three read (AGENTS.md and a handoff file), or one MCP server configured in all three.
Does Todo-MCP work in all three, and in ChatGPT on the web?
It is a local stdio MCP server, so it works in clients that can launch a local process: Claude Code, Codex CLI and Cursor on your machine. You register the same binary in each one. In ChatGPT, add it in the desktop app under Settings → MCP servers (STDIO) and use it from Work or Codex; the ChatGPT website connects only to remote MCP servers. It does not make any tool remember on its own; the agent has to call it, usually starting with context_resume.

Continue Reading

Back to all articles