[FEATURE] Transcript auto-cleanup should warn, confirm, or archive instead of silently hard-deleting
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
cleanupPeriodDays (default 30) silently and permanently deletes session transcripts whose last activity is older than the window. There is no startup warning, no confirmation prompt, no trash/archive step, and no recovery path.
I lost a 239-prompt session spanning 3+ weeks of continuous work (the primary build log of a live project) because I came back to resume it 34 days after its last message. claude --resume just said the session couldn't be found. Forensics showed the sweep had removed every transcript in the project folder; nothing was in the macOS Trash and no backup existed. Only my own prompts survived (in history.jsonl) — the assistant side of the conversation was unrecoverable.
The core problem: the tool cannot know which sessions are valuable — only the user can. An irreversible deletion decision is being made automatically, silently, on data whose worth the deleting party cannot assess.
Proposed Solution
In order of preference:
- Soft-delete / archive: move expired transcripts to an archive location (e.g.
~/.claude/archive/) kept for a further N days (or indefinitely until size pressure) before permanent removal. Resume could offer to restore from archive. - Warn + confirm: at startup, surface transcripts nearing expiry ("3 sessions from project X will be deleted in 4 days") and require an explicit confirmation — or at least an opt-out — before hard-deleting.
- Minimum: write deletions to a visible log and mention the retention policy in the resume-failure message ("session not found — it may have been removed by the 30-day cleanup; see cleanupPeriodDays"), so users discover the setting before losing data rather than after.
Alternative Solutions
After the loss I set "cleanupPeriodDays": 99999 in ~/.claude/settings.json and added a SessionEnd hook that rsyncs ~/.claude/projects/ and history.jsonl to a local append-only backup directory. This works, but it's a workaround discovered only after irreversible data loss — the setting is effectively undiscoverable until it has already cost you something.
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
- Build a project over several weeks in one long-running session (registration web app; the session held all design decisions and debugging context).
- Project goes quiet for a month (event-driven work; the reunion it supports has phases).
- Return, run
claude --resume <session-id>to continue where we left off. - Session is gone — purged on day 31+ with no warning, no archive, no recovery.
- With this feature: either the transcript is in the archive and restorable, or I was warned at startup during the quiet month and could have opted out.
Additional Context
_No response_