[BUG] Claude Code silently deletes session transcripts after 30 days with no consent, warning, or UI
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
Claude Code runs a retention sweep (cleanupPeriodDays, default 30) that permanently deletes session transcripts from the user's own disk based on file modification time. The user never opted in, is never warned before or after, and the setting is exposed nowhere in the desktop app. The desktop app keeps the deleted sessions in its sidebar and reveals the loss only when one is clicked ("Session not found on disk").
On this machine the sweep has destroyed 76 of 97 recorded sessions, spanning roughly eight months of work across three projects.
Impact
I retain every transcript as a professional record. I have kept every email for 30 years for the same reason. These transcripts document design decisions, requirements analysis, and the provenance of work product for a federal grant application (NIH/NSF SBIR) and for a second commercial product. Being unable to show that work has direct financial consequences. The loss is not recoverable: the files were deleted from local disk, no backup had been configured, and nothing in the product suggested one was needed.
There is no storage or cost rationale for the deletion. The data lives on the user's own disk. Total size of all surviving transcripts is 159 MB.
Audit (performed 2026-10-05)
Method: every session record in the desktop app's store (~/Library/Application Support/Claude/claude-code-sessions/**/local_*.json, 97 records) was matched to transcript files in ~/.claude/projects/*/*.jsonl (20 files) by working directory and start time.
| | Count |
|---|---|
| Sessions recorded by the desktop app | 97 |
| Sessions with a transcript still on disk | 21 |
| Sessions whose transcript has been deleted | 76 |
| Sessions the user deliberately deleted (recorded as deleted_* markers) | 4 |
Lost sessions by project:
| Project | Lost | Last activity of the lost sessions |
|---|---|---|
| Shiretown | 58 | 2026-03-10 to 2026-04-22 |
| next-thought-ai | 18 | 2026-02-16 to 2026-05-11 |
Of the 18 lost next-thought-ai sessions, 6 ran in worktrees created by the desktop app's "worktree" option. Their transcripts were stored under a separate project directory keyed to the worktree path and were removed with it.
Surviving transcripts: 18 of the 21 had their modification time reset on 2026-10-05 between 15:40 and 15:58 local time by an unidentified process, which is the only reason they survived today's sweep. The two oldest untouched transcripts (modified 2026-09-27 and 2026-09-28) would have been deleted on or about 2026-10-27.
Evidence on the machine:
~/.claude/.last-cleanupcontains2026-10-05T22:52:18.583Z, confirming the sweep ran today.- No
cleanupPeriodDayskey existed in any settings file (user, project, or local), so the built-in default of 30 days applied. - 41 of the 76 lost sessions carry
"transcriptUnavailable": truein the desktop app's own record, so the app had detected the loss for more than half of them and did not tell the user. No session with a surviving transcript carries the flag. - Memory files (
~/.claude/projects/<project>/memory/) survived, confirming the sweep targets transcripts specifically.
Behavior that constitutes the defect
- Deletion by default. The 30-day sweep is active on a fresh install. Documentation: https://code.claude.com/docs/en/claude-directory.md and https://code.claude.com/docs/en/settings-reference.md.
- Cannot be turned off. The documented minimum is 1 day; a value of 0 fails validation. The only mitigation is a very large number.
- No consent. No first-run prompt, no onboarding mention, no confirmation.
- No warning. No notice before deletion, no log entry surfaced to the user, no notice after.
- No UI. The desktop app has no setting for retention, and nothing in the sidebar distinguishes a session with a transcript from one without.
- Misleading sidebar. Deleted sessions remain listed with their titles. Clicking one shows "Session not found on disk" with "Import CLI sessions / Archive / Delete", none of which recovers anything.
- Deletion keyed on file mtime. Any process that touches a file extends its life; any that does not lets it die. The user has no visibility into either.
- Worktree sessions are more exposed. Their transcripts live under a path tied to a temporary directory and vanish with it.
Steps to reproduce
- Fresh Claude Code install, no
cleanupPeriodDaysin any settings file. - Run a session in the desktop app. Note the transcript at
~/.claude/projects/<encoded-cwd>/<uuid>.jsonl. - Do not open that session for 31 days. Start any other session.
- The transcript file is gone. The desktop app sidebar still lists the session. Clicking it shows "Session not found on disk".
Requested changes
- Ship with retention off. Deleting user data must be opt-in.
- If a retention window exists, require explicit consent on first run and show the current setting in the desktop app's settings.
- Warn before any deletion, listing the sessions affected, with a one-click keep.
- Mark sessions in the sidebar whose transcript is missing, rather than listing them as if intact.
- Provide a documented export or backup command for all transcripts.
- Store worktree session transcripts under the parent repository's project directory, not the worktree path.
- For users already affected: tell them. A one-time notice listing deleted sessions would at least establish the record.
Workaround applied
~/.claude/settings.json now contains { "cleanupPeriodDays": 3650 }. This should not have been necessary, and most users will never find it.
What Should Happen?
CLAUDE SHOULD NO DELETE CONTENT WITHOUT EXPLICIT PERMISSION.
Error Messages/Logs
Steps to Reproduce
Start coding and then Wait...
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude 2.19675.1 (861368) 2026-10-05T16:14:31.000Z
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Completely unacceptable. No warning. Deleted active chat sessions part of a Claude Code project. Claude Model Fable 5.1 (High) says no way to recover. WHY ARE YOU DELETING CONTENT THAT IS MAINTAINED ON MY LAPTOP? WHY WITHOUT WARNING? WHY DO I HAVE TO PAY TO DISCOVER THIS? WHAT IS A USER TO DO?
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗