You gave your coding agent a ten-step job. It made a tidy checklist, ticked off four items, and then the context filled up and the chat compacted. Now it either asks what you would like to work on, or it starts step two again as if steps one to four never happened.
Whether that happens depends on where the agent keeps its task list. Some lists live outside the conversation and survive compaction. Others are just tool calls inside the conversation, and they survive only if the summary happens to keep them. This page compares Claude Code, OpenAI Codex and Cursor, based on their official docs and public GitHub issues, and gives you a test to check your own setup instead of trusting anyone's claim, including ours.
The short comparison
| Agent | Built-in task list | Survives compaction? | Shared with a new session? |
|---|---|---|---|
| Claude Code | Task tools (TaskCreate, TaskList…), Ctrl+T to view | Yes, per the docs, on models that have the task tools | Only with CLAUDE_CODE_TASK_LIST_ID |
| Codex | Plan via the update_plan tool | Only what the compaction summary keeps | No, unless you resume or fork that chat |
| Cursor | Agent to-dos in the chat; Plan Mode plans as markdown files | To-dos: only what summarization keeps. Plan file: yes | The plan file, if you point the new chat at it |
| A file or MCP task store | Whatever you put there | Yes, it is outside the chat | Yes, if the agent reads it at the start |
Claude Code: survives, with two catches
Claude Code's task list is backed by built-in tools: TaskCreate, TaskGet, TaskList and TaskUpdate (the older TodoWrite is off by default in favor of them). The interactive mode docs say plainly: "Tasks persist across context compactions." Press Ctrl+T to see the list, or ask "show me all tasks".
The catches:
- Model. The tools reference says the task tools are on by default only on Opus 4.7, Sonnet 4.6, Haiku 4.5 and earlier models. On newer models Claude keeps track of the work without a written checklist, so there is no list to survive anything. To get the list back, start with
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude. - Session. The list belongs to the session. To share one list across sessions, start Claude Code with
CLAUDE_CODE_TASK_LIST_ID=my-project claude, which keeps it in a named directory under~/.claude/tasks/.
Older versions behaved differently: a Claude Code issue from April 2026 (#47533) reported TaskList returning "No tasks found" after compaction. If you are on an old build, update, then run the test below. Also note that the task list holds task titles and status, not the reasoning behind them. Decisions and the plan itself can still be summarized away; our guide to keeping Claude Code's plan after compaction covers that part.
Codex: the plan lives in the conversation
Codex tracks multi-step work with a tool called update_plan. In the open-source tool definition, each plan item is a step with a status of pending, in_progress or completed, and at most one step can be in progress. The plan is a tool call in the chat history. There is no separate plan file that Codex reloads.
So after compaction, the plan is only as good as the summary. Two public reports show what can go wrong:
- openai/codex #38931 (open): the summary kept the wording of an earlier plan but not which steps were done, so Codex re-ran an investigation it had already finished.
- openai/codex #31822: with the experimental
token_budgetfeature on, compaction starts a fresh context window with no summary, and the task disappears entirely.codex features disable token_budgetrestores normal compaction.
codex resume reopens a saved chat, but as saved: if it compacted, you get the compacted version. The full recovery steps are in Codex CLI compaction lost your context?
Cursor: to-dos in the chat, plans in a file
Cursor's agent makes structured to-do lists for longer tasks and updates them as it works (introduced in Cursor 1.2). Those to-dos are part of the chat. When a long chat fills up, older turns are summarized, and Cursor staff on the Cursor forum describe that summarization as lossy. Their advice: start a new chat for each separate task, and keep durable instructions in rules files.
Plan Mode is the exception. According to the Plan Mode docs, plans are saved as files, in your home directory by default, or in the workspace if you click "Save to workspace". That file survives summarization and new chats. Save it to the workspace, keep its checkboxes current, and start the next chat with "read the plan file and continue from the first open item". More on this in Cursor agent forgot earlier requests?
The 2-minute test
Docs change and versions differ, so check your own setup. In a throwaway repo:
- Ask: "Make a three-step task list for adding a README, a LICENSE and a .gitignore. Do step one only, then mark it done."
- Compact: run
/compactin Claude Code or Codex. In Cursor, keep working in the same chat until it summarizes. - Ask: "List every task with its status. Do not do any work."
Pass: step one is done and steps two and three are open. Fail: the list is empty, step one is open again, or the agent starts step one over. Run it once on the model you actually use; in Claude Code the model decides whether the task tools exist at all.
A task list compaction cannot touch (free)
Compaction rewrites the chat, never your files. So the most reliable list is a file in the repo. Create TASKS.md:
# Tasks
Goal: add project docs
- [x] 1. README.md
- [ ] 2. LICENSE (MIT)
- [ ] 3. .gitignore for Node
Decisions: MIT chosen by owner. Do not add CI yet.
Next: 2 Then add a rule to AGENTS.md (Codex and Cursor read it; for Claude Code, put the same lines in CLAUDE.md or import @AGENTS.md from it):
## Tasks
- Read TASKS.md before starting work and after any compaction.
- After each finished step, tick it in TASKS.md and update "Next".
- Never redo a ticked item. To put the list back automatically after a compact, both Claude Code and Codex support a SessionStart hook with a compact matcher that prints a file into context. Tested examples are in the Claude Code guide and the Codex guide.
Where the file runs out: nothing forces the agent to update it, a checkbox has no "in progress" or "blocked by", and two agents editing the same file at once can overwrite each other's ticks.
Where Todo-MCP fits, honestly
Todo-MCP is a local MCP server that runs over stdio on your machine. Tasks, their status and dependencies, and named context notes are stored in a SQLite file, outside any chat, so compaction cannot drop them. Claude Code, Codex and Cursor on the same machine can all be connected to it and read the same list. After a compaction or in a new session, the agent calls context_resume and gets the current task, saved context and a suggested next step. It is a paid download, and the data stays on your machine. To see the options, leave your email in the form on this page first: it sends the setup tutorial and then shows plans.
What it will not do:
- It does not change how any agent compacts. It keeps the list somewhere compaction does not reach.
- It does not load itself. Add a line such as "after compaction or at the start of a session, call context_resume" to
AGENTS.mdorCLAUDE.md; the agent still has to make the call. - In ChatGPT it runs from the desktop app (Work or Codex, Settings → MCP servers), not from the ChatGPT website, which connects only to remote MCP servers.
Setup guides: Claude Code, Codex CLI, Cursor. For the bigger picture of rules files, memories and handoff notes across all three tools, see How to add memory to Claude Code, Cursor and Codex.
Whatever you choose, run the 2-minute test. If the list does not come back with step one ticked, it is not a list you can leave a long job to.