Control Transcript Retention with cleanupPeriodDays
Claude Code keeps session transcripts for 30 days by default, deleting old ones at startup. The cleanupPeriodDays setting lets you shorten that window, or set it to 0 to disable session persistence entirely.
// ~/.claude/settings.json
{
"cleanupPeriodDays": 7
}
A shorter period (7 or 14 days) keeps your ~/.claude/ directory from growing large over time, which matters on machines that run many sessions or in long-running CI environments.
Setting it to 0 is the most aggressive option: all existing transcripts are deleted at startup, no new .jsonl files are written, and /resume shows nothing. This is ideal for CI runners or shared machines where sessions should never be persisted at all:
{
"cleanupPeriodDays": 0
}
For comparison, the --no-session-persistence CLI flag does the same thing for a single run, while cleanupPeriodDays: 0 applies permanently to every session on that machine.
Note: this setting is not accepted in shared project settings (.claude/settings.json) to prevent a repo from silently wiping a collaborator's history. Place it in user settings (~/.claude/settings.json) or your local settings file instead.
A short cleanup period keeps disk usage predictable without losing anything you actually need.
Log in to leave a comment.
The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.
The language setting makes Claude respond in your preferred language by default, across every session and project.
The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.