You open claude --resume to pick up something from last month, and it isn't there. You didn't delete it. Claude Code did, on purpose, because of a setting most people never see.
The short answer
Claude Code deletes files in its data folder once they are older than cleanupPeriodDays. The default is 30 days. That includes the full transcript of every session, so a session you last touched 31 days ago can no longer be resumed.
What gets deleted, and what doesn't
The cleanup sweep removes these once they pass the age limit, all under ~/.claude:
| Deleted | What it is |
|---|---|
projects/<project>/<session>.jsonl | The full transcript: every message, tool call and result |
projects/<project>/<session>/subagents/ | Subagent transcripts |
file-history/<session>/ | Snapshots of files before Claude edited them |
plans/ | Plans written in plan mode |
paste-cache/, debug/, tasks/ and a few others | Per-session working files |
One file is not cleaned up: ~/.claude/history.jsonl. It holds every prompt you have typed, with a timestamp and the project it belonged to. It's what powers the up arrow and Ctrl+R history search. So even after a transcript is gone, a record of what you asked survives.
How to keep sessions longer
Raise the limit in your user settings file, ~/.claude/settings.json:
{
"cleanupPeriodDays": 365
}A few things to know:
- The minimum is 1. Setting it to 0 fails validation, so there is no "never delete" value. Use a large number if you want to keep everything.
- Transcripts can get big. Sessions with long tool output or pasted images run to tens of megabytes each, so a year of heavy use can take a few gigabytes.
- The same setting also controls when Claude Code cleans up old worktrees it created for background sessions and subagents.
How to keep every session, no matter the setting
Claude Code documents a supported way to save transcripts yourself: a SessionEnd hook. Hooks receive a transcript_path field in their input, so a hook that runs when a session ends can copy that file somewhere safe. This is the approach I'd recommend over scanning ~/.claude/projects yourself, because the transcript format is internal to Claude Code and changes between versions. The hook gives you the exact file for each session as it closes.
To bring an archived session back, put the .jsonl file back in its project folder under ~/.claude/projects and run claude --resume <session-id>. You can also pass the full path to a transcript file directly: claude --resume /path/to/<session-id>.jsonl.
Deleting sessions on purpose
If you want the opposite, claude project purge deletes everything Claude Code holds for one project: its transcripts, memory, per-session files, and the matching lines in history.jsonl.
Why this matters more than it used to
When a session was a quick question, losing it after a month didn't matter. Now a session is often days of work on a feature, with every decision and dead end in it. The transcript is the only record of why the code looks the way it does. Keeping it is cheap, and losing it is the kind of thing you only notice when you need it.
That's part of why I built Shabash: it keeps a compressed copy of every session you typed in, organizes them into threads of work per project, and can put a deleted transcript back so a thread from last spring resumes with its full history.