Edit: to be clear, this is about Claude Code in the terminal (CLI), and as far as I can tell the VS Code extension too. Claude Desktop and Cowork keep your sessions at any age by default, so if that's all you use, you're not affected
TL;DR: Claude Code silently deletes local transcripts older than 30 days (`cleanupPeriodDays`, default 30). It is documented, but only in reference pages, and nothing warns you when it happens. Set `"cleanupPeriodDays": 3650` in ~/.claude/settings.json now if you ever want to /resume an old session.
I found out the usual way: back from holiday, opened /resume to pick up where I'd left off, and the list was empty.
I get that disk space is a thing. I get that some people want old transcripts gone for privacy. Fine. Make it an option. But making silent deletion the *default* is a choice I really can't wrap my head around.
How it works: after a session starts, Claude Code runs a background sweep and deletes everything older than `cleanupPeriodDays`. And it's not just the chat log. Per the docs, the same sweep takes subagent transcripts, tool results, file-history (the snapshots checkpoint restore uses), plans and paste cache.
The docs literally say: "The sweep deletes transcripts without showing a message." So this isn't a bug. Silent deletion is the intended behaviour.
And before anyone says "just use git": I do. The code, the commits, the READMEs, the decisions that made it into docs, all fine. But git has the *what*, not the conversation that got there. Sometimes you want to go back to that one session where you worked through a nasty bug, or the back-and-forth where you ruled out three approaches, and just pick it up where you left off. That's exactly what /resume is for. Except it isn't there any more.
Things that make it worse:
- There's no "never" value: 0 is a validation error, minimum is 1. A big number like 3650 is the closest you get.
- Sessions from Claude Desktop/Cowork have their own setting (`desktopSessionCleanupPeriodDays`), and by default those transcripts are kept at any age. So the GUI gets permanent history, and the terminal, where people run long technical sessions they actually want to come back to, gets a 30-day shredder.
- 30 days is nothing. A holiday plus a quiet week before it, and every conversation about that project is gone.
Is it documented? Yes, to be fair: the settings reference, the data usage page, the sessions page and the ~/.claude directory page all mention it. But that's reference material you read after something goes wrong. In my experience nothing in the CLI itself tells you, and the deletion itself is silent by design.
Anthropic, please: make the default "keep" like you already do for Desktop, or at the very least tell people once, before the first sweep runs.
Everyone else: add "cleanupPeriodDays": 3650 to ~/.claude/settings.json before your next session starts, because that's when the sweep runs. And back up ~/.claude/projects if anything in there matters to you.
Is there a good reason for 30 days as the default that I'm missing? Has anyone else lost sessions this way?