Guide
cleanupPeriodDays explained
cleanupPeriodDays sets how long Claude Code keeps its local files. If a file is older than this number of days, Claude Code deletes it. The default is 30 days.
What gets deleted
According to Anthropic’s documentation, this includes:
- the history of your sessions:
~/.claude/projects/<project>/<session>.jsonl - the history of subagents
- file snapshots under
file-history/, plans underplans/and pasted content underpaste-cache/
Allowed values
- The smallest value is
1. - According to the current documentation,
0is an error; older instructions saying that0turns off the cleanup no longer apply. - You can’t turn the cleanup off completely. If you want to keep everything, set a very large value; Simon Willison recommends
99999.
How to change the period
In ~/.claude/settings.json (for all projects):
{
"cleanupPeriodDays": 365
}
A longer period doesn’t bring back what has already been deleted.
Sessions from the Claude desktop app
According to the documentation, Claude Code keeps sessions that were started or last resumed in Claude Desktop or Cowork regardless of their age. Since version 2.1.248 there is a separate period for them: desktopSessionCleanupPeriodDays.
Long period or your own archive?
A long period keeps the files on disk, but to find things again you only have claude --resume and its list. Recallnor reads the sessions as they are written, searches them in full text, keeps them even with a short period and gives them to Claude Code via MCP to look things up. Recallnor only reads the setting and never changes it.
Recallnor saves every Claude Code session on your Mac before Claude Code deletes it, makes it searchable and lets Claude Code look things up in it via MCP. Free for the last 30 days; Pro is a one-time $29, or $19 until 31 January 2027. Same amounts in euros.
As of December 2026. Sources: Anthropic: Explore the .claude directory, Anthropic: Data usage, Simon Willison: Don’t let Claude Code delete your session logs.