[FEATURE] prompt for `cleanupPeriodDays` during initial setup
Status Open
Reported on v2.1.198
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 0 comments · opened Jul 20, 2026
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Summary
The cleanupPeriodDays setting auto-deletes session history after 30 days by default, but most users never learn it exists until they lose work. Since deletion is irreversible and there's no interactive way to recover a swept session, the initial setup flow should surface this setting and let the user choose a retention value up front. This affects the CLI/console as well as the VS Code extension (see related #79122).
Motivation
- The 30-day default is too small for long-lived projects or sessions set aside for a while, and it's applied silently.
- Deletion is irreversible — once the
.jsonlis gone there's no trace it ever existed, and the--resumepicker offers no recovery. - Today the only way to discover
cleanupPeriodDaysis to already know it exists and hand-editsettings.json. By the time a user goes looking, they've usually already lost something. Presenting it during setup removes the need for any separate warning later.
Proposed Solution
During initial Claude Code setup (first run / onboarding), ask the user to choose how long sessions are kept, e.g.:
Session history is auto-deleted after a period of inactivity.
How long should sessions be kept?
[1] 30 days (default)
[2] 90 days
[3] 1 year
[4] Keep forever (never auto-delete)
[5] Custom (enter number of days)
- "Keep forever" writes a very large value (JSON has no infinity), e.g.
999999999. - The chosen value is written to
~/.claude/settings.json.
Alternative Solutions
Workaround (today)
Set a large retention manually in ~/.claude/settings.json:
{
"permissions": {
"allow": [
"Bash"
]
},
"theme": "dark",
- "autoCompactEnabled": true
+ "autoCompactEnabled": true,
+ "cleanupPeriodDays": 999999999
}
Takes effect on the next claude startup.
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
Environment
- Claude Code version: 2.1.198
- Platform: Linux (CLI / console); also affects VS Code extension
Related
- #79122 — silent 30-day cleanup deletes content of still-open sessions (framed around VS Code; same
cleanupPeriodDaysbehavior, also affects the CLI).