Claude Code deletes your transcripts after 30 days

Guide · August 2026 · ~3 min read

Sessions vanish from --resume not because they were closed badly but because Claude Code prunes them. The setting is cleanupPeriodDays, defaulting to 30 days. On startup, transcripts older than that are removed from disk without asking.

Check your current value

cleanupPeriodDays lives in ~/.claude/settings.json. If it isn't there, you're on the 30-day default. To keep everything:

{ "cleanupPeriodDays": 365 }

(Any positive integer works. There is no documented "keep forever" sentinel — pick a large number.)

What deletion actually removes

The .jsonl transcripts under ~/.claude/projects/<project-dir>/ — which for heavy users are months of work product: every prompt, decision, and code change the agent made. Once pruned, they're gone unless you backed them up.

Archiving sessions worth keeping

Before an important session ages out, copy it somewhere durable. A session is one self-contained plaintext file, so a folder of dated copies is enough:

# PowerShell — copy all sessions modified this year to an archive folder
Get-ChildItem "$env:USERPROFILE\.claude\projects" -Recurse -Filter *.jsonl |
  Where-Object LastWriteTime -gt (Get-Date -Year 2026 -Month 1 -Day 1) |
  Copy-Item -Destination D:\claude-archive\

Archived files open fine in SessionPatch later — reading an old session back is often faster than remembering what happened.

Recovering a session about to expire

You can't extend a specific file's life; the prune is age-based across the board. Raise cleanupPeriodDays now, before something you need hits day 30. And note the pruning runs at startup — if you haven't launched Claude Code in weeks, the deletion may already have happened on today's launch.

Related: --resume not working · stuck on compacting