1 minute read

tldr; Claude Code purges local session transcripts older than 30 days on startup. Set cleanupPeriodDays to a huge value to effectively opt out.

By default Claude Code deletes session files (and other application data) older than 30 days, silently, at startup. That surprised me: these transcripts live in my own home directory under ~/.claude/, and they are a useful archive of what I asked and what the model actually did.

Disabling is not possible - the documented minimum is 1 day. But a large value has practically the same effect, e.g. ~5 years:

{
  "cleanupPeriodDays": 1800
}

Put this in ~/.claude/settings.json for user scope; .claude/settings.json (shared) and .claude/settings.local.json (personal) work per project.

Amusing detail: Claude can edit this config for you. Just ask it to set your session retention to 1800 days and it will find the right file and show you the diff.