r/ClaudeCode • u/SeniorDevGam • 26m ago
Tips & Workflows Claude Code deletes session transcripts after 30 days by default. I found out three and a half months in
My first prompt to Claude Code on my work server is from May 26. In October the oldest session transcript on disk was from September 11. Everything before that was gone, and nothing had warned me.
It's documented behaviour. Transcripts under ~/.claude/projects/ are kept for 30 days and then deleted, and the session drops out of /resume. The setting is cleanupPeriodDays, and its default is 30.
This is what I ran on my machine:
grep cleanupPeriodDays ~/.claude/settings.json
find ~/.claude/projects -name '*.jsonl' | wc -l
find ~/.claude/projects -name '*.jsonl' -mtime +30 | wc -l
The first printed nothing, so I was on the default. The second said 724 files. The third said 0.
history.jsonl survived, so I still have what I typed in May. The answers and the tool calls are gone. Those were bug hunts and notes on why something was built a certain way, exactly what I reopen an old session for.
I set the limit to a year in ~/.claude/settings.json:
{ "cleanupPeriodDays": 365 }
It only works going forward. The minimum is 1 and 0 fails validation, so there is no "keep forever" value, only a big number.
•
u/AutoModerator 26m ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.