BlogCoding agentsclaude code ยท cursor ยท codex ยท agents
Where Claude Code saves your plans, and when it deletes them
Claude Code writes plans to ~/.claude/plans and deletes them after 30 days by default. Where Cursor and Codex keep theirs, and the two settings that fix it.
Prashant Shaw
Founder, Sumibako
6 min read
Plan mode writes the most useful document of the day and then files it in a folder you have never opened. That would be fine, except the folder has a cleaner, and the cleaner keeps a schedule nobody mentioned.
This post is where Claude Code, Cursor and Codex each put the plans they write, how long those plans last, and the two lines of settings that stop the good ones from disappearing. Everything in it comes from each tool's own documentation, linked as it comes up and checked on 27 September 2026. The last section is about the thing I build, and it says so.
๐ Where Claude Code puts a plan
You enter plan mode with Shift+Tab, by starting a prompt with /plan, or by launching with claude --permission-mode plan. Claude reads the code, writes a plan and asks what to do with it. While the plan is on screen, Ctrl+G opens it in your editor. The plan mode docs cover the approval flow.
The plan is a Markdown file, and unless you have said otherwise it is written to ~/.claude/plans. That is your home directory, outside every project. The settings reference puts it in one line: the default is unset, "so Claude Code uses ~/.claude/plans".
So the plan for your auth rewrite is not in the repository with the auth code. It is in a shared drawer with the plan for every other project you have, under a file name you did not choose.
๐งน When it deletes them
The docs have a page about the .claude directory, and that page has a section called Cleaned up automatically. It lists the paths Claude Code deletes files from "once they're older than cleanupPeriodDays". The default is 30 days. plans/ is on the list, described as "Plan files written during plan mode", between the file snapshots and the debug logs.
The deletion runs "as a background sweep after a session starts". Nothing in the docs mentions a prompt first, or a trash folder to look in afterwards.
Further down the same page is a table of what you lose by emptying each folder yourself. For ~/.claude/plans/ the answer given is "Nothing user-facing". I would like to register a mild objection, on behalf of everyone who has written a plan worth reading twice.
To be fair to the design, most plans are scaffolding. They are approved at four, built by six, and never opened again, and a folder that kept every one of them forever would be its own kind of problem. The default is right for that plan. It is wrong for the one your team is still arguing about in week five.
WARNING
๐ง Two settings that fix it
1๏ธโฃ Keep plans in the project. In .claude/settings.json:
{
"plansDirectory": "./plans"
}The path is relative to the project root, and Claude Code "keeps the default when the path resolves outside it", so this setting is for putting plans inside the project and nowhere else. The cleanup list in the docs is a list of paths under ~/.claude, and a folder in your repository is not on it. Commit the plan and the question stops mattering, because git forgets nothing. That is usually its problem and here it is the point.
2๏ธโฃ Keep everything longer. In ~/.claude/settings.json:
{
"cleanupPeriodDays": 365
}The minimum is 1. Zero "fails validation", and the docs suggest "a large value such as 3650" for long retention, which is ten years and a touching amount of faith in one laptop.
NOTE
๐๏ธ Cursor and Codex
Cursor has the same shape. Its plan mode docs say: "Plans are saved by default in your home directory. Click 'Save to workspace' to move it to your workspace for future reference, team sharing, and documentation." One click instead of one setting. The docs do not say how long a plan left in the home directory is kept, and I could not find a statement either way, so I would treat that copy as temporary and save the ones that matter.
Codex has /plan, which its slash command reference describes as "Toggle plan mode for multi-step planning". What I could not find in its docs is a plan file. The plan is part of the conversation. Two open requests on the Codex repository ask for one: a setting for where plans are saved, opened in February, and a live plan file, opened in April. Both were still open when I checked. Until one lands, the way to keep a Codex plan is to leave plan mode and ask it to write the plan to a file.
| Agent | Where the plan goes | How long it lasts | How to keep it |
|---|---|---|---|
| Claude Code | ~/.claude/plans | 30 days by default | plansDirectory, or raise cleanupPeriodDays |
| Cursor | Your home directory | Not documented | Save to workspace |
| Codex | The conversation | As long as the conversation is kept | Ask for a file |
๐ฆ The plan somebody else has to read
This is the part I build, so adjust your trust accordingly.
Everything above keeps a plan on your machine or in your repository. None of it puts the plan in front of a person who has neither. For that you need an address.
Claude Code can now make one itself, on a paid Claude plan, by publishing an artifact. I compare that with Cursor's and Codex's versions in a separate post. The route I use works the same from all three agents, because it is a command:
npx sumibako publish plans/auth-rewrite.md --publicIt files the plan as a page in your notes and prints a link. Publish the same file again after a revision and it updates the same page, so the link you sent on Monday shows Thursday's plan. The first run on a machine asks you to approve the connection in a browser. The free plan holds a thousand pages, and nothing sweeps them. The details are on the agents page, and the longer argument is in Share the plan Claude Code wrote as a link. For a plan only one person should open, --passcode puts it behind a six-character code, and the password-protected link tool does the same from a browser tab.
๐งญ Which plans to keep
| The plan | What to do |
|---|---|
| You will build it today and never read it again | Nothing. Let the sweep have it |
| You will come back to it, or review it with the code | plansDirectory, and commit it |
| Someone without the repository has to read it | Give it a link |
The general rule is older than any of these tools: a document is only as permanent as the folder it lives in. Plan mode chose a folder with a thirty-day memory. It is a fine default for a tool and a poor one for a decision, and the difference is two lines of JSON.
More on coding agents
All 19 posts โ- Share the plan Claude Code wrote as a linkPlan mode writes a good plan and leaves it in a terminal. Three ways to hand it to someone, from a draft pull request to one command that returns a link.6 min read
- How to password-protect a Claude Code plan before you send it to a clientWhere Claude Code keeps plans, what a secret gist, a Claude Code artifact and a PDF actually protect, and how to send a plan behind a passcode that expires.6 min read
- Handing work from Claude Code to Codex without losing the planCodex cannot see Claude Code's session or its plans folder. Three steps put the plan where both read it, and the same steps bring the work back.4 min read

