Where did my Claude Code sessions disappear to? It turns out there is a default setting that quietly deletes your conversation history after 30 days, with no warning and no way to recover. You may have already lost things. Let us dive in.
This is part 3 of a series on hidden Claude Code settings. Part 1: the terminal flicker fix. Part 2: the skills listing budget. Part 4: remote control at startup. Part 5: disabling forced worktrees.
What exactly gets deleted?
The setting is called cleanupPeriodDays, default 30. To be precise: this is about your local transcript files (.jsonl) under ~/.claude/projects/, not cloud conversations and not claude.ai. On every launch of Claude Code, a cleanup pass runs and deletes any transcript older than 30 days. No recycle bin, no restore.
Your code and git are obviously safe, and CLAUDE.md files survive. What disappears is the entire reasoning trail: the discussions, the directions that were rejected, the debugging, the context behind the decisions. And /resume stops finding old sessions. For long-running work, or things you do once a month, that is exactly the most important artifact.
Why does this even exist?
According to Anthropic it is a security mechanism from day one: transcripts are plaintext on disk and can contain code, secrets, and keys. Keeping them forever is, from their perspective, a privacy risk. It is a real trade-off, not carelessness. The problem is that it happens without disclosure and without consent, so it is a surprise instead of a choice.
The nastiest trap: do not set 0
The docs say 0 disables cleanup, meaning keep forever. In practice there is a bug: the value 0 prevents transcripts from being written at all. Whoever set 0 to keep everything loses everything, silently.
Set a large number instead. Many people use 3650, roughly ten years.
Two more traps for power users
- Deletion is based on the file's mtime, not real activity time. Anything that touches mtime (iCloud or Dropbox sync, a restore) can make an active session look old and get it deleted.
- If you run
claude -p --setting-sources local, it ignores your setting and runs a global cleanup with the 30 day default.
What to do right now
Open ~/.claude/settings.json and raise the value:
{
"cleanupPeriodDays": 3650
}
And remember: the cleanup is global, across all projects together. If you spent the last month working on something, check now, before the next pass. Session transcripts are part of a project's institutional memory, the same category as the decisions.md log I wrote about; protecting that memory is a habit I push in every AI consulting engagement.
FAQ
What exactly does Claude Code delete after 30 days?
The local transcript files, the .jsonl files under ~/.claude/projects. Your code, git history, and CLAUDE.md files are safe, and cloud conversations are unaffected. What disappears is the reasoning trail: discussions, rejected directions, debugging context, and /resume stops finding old sessions.
Should I set cleanupPeriodDays to 0 to keep everything?
No. The docs say 0 disables cleanup, but in practice there is a bug where 0 prevents transcripts from being written at all, so you lose everything silently. Set a large number instead; many people use 3650, roughly ten years.