[BUG] Default cleanupPeriodDays:30 silently deletes local transcripts, leaving unopenable sessions in the Desktop sidebar
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?
Claude Code deletes local chat transcripts older than cleanupPeriodDays (default 30) with no warning, no prompt, and no UI surface for the setting.
In Claude Code Desktop this is especially damaging, because session metadata and session content are stored separately and have different lifetimes:
Session metadata (title, cwd, model) — what the sidebar renders — lives in %APPDATA%\Claude\claude-code-sessions\<id>\<id>\local_*.json and is kept indefinitely.
Conversation content lives in ~/.claude/projects/<encoded-cwd>/<cliSessionId>.jsonl and is deleted after cleanupPeriodDays.
The result is a sidebar full of chats that look present but cannot be opened: "Session not found on disk". The app records the state internally, writing "transcriptUnavailable": true into the metadata — it knows the content is gone, but still lists the session as if it exists.
On my machine 16 of 28 sessions are in this state, including work I depended on. I deleted nothing and ran no disk cleanup tool. settings.json had no cleanupPeriodDays key, so the 30-day default applied.
The rule is also unpredictable: deletion keys on file mtime, not conversation date. Opening or renaming a chat makes the app rewrite the title into the transcript, refreshing its mtime and silently extending its life. Of two chats from the same afternoon, the one I happened to reopen survived and the other was destroyed.
Impact: total transcript volume on this machine is ~7 MB, so the disk saved is negligible. These files are local-only with no server-side copy, and they are unlinked rather than moved to the Recycle Bin, so deletion is permanent. Recovery via winfr and VSS shadow copies both failed because the deletions happened weeks before I noticed.
What Should Happen?
Local chat history should not be deleted without the user's knowledge or consent.
Specifically:
Default to retaining indefinitely, or make cleanup explicitly opt-in.
Link the two lifetimes — never leave a session listed whose transcript has been deleted. Keep both or remove both.
Warn before deleting, and make cleanupPeriodDays visible and editable in the UI. It is currently discoverable only by reading docs or the filesystem.
Soft-delete to a trash folder with a grace period instead of unlinking.
If retention stays, key it on conversation age, not file mtime, so behavior is predictable.
Error Messages/Logs
Desktop UI, on opening an affected chat:
Session not found on disk
Send a message to start fresh in this directory.
Session metadata for an affected chat (%APPDATA%\Claude\claude-code-sessions.../local_48a54028-....json):
"cliSessionId": "8debe674-212c-4b77-b4a5-52b2ddd1b763",
"title": "Network configuration implementation review",
"transcriptUnavailable": true
That .jsonl no longer exists. The same session opened normally a few weeks earlier — from %APPDATA%\Claude\logs\main.log:
2026-07-17 01:25:45 [info] [CCD] Session local_48a54028-872a-4684-976a-0389d32a9410 warmed successfully in 57ms
Cleanup marker ~/.claude/.last-cleanup:
2026-08-18T19:18:42.936Z
~/.claude/projects and one project subfolder carry that exact mtime. Entire project folders also vanished (e.g. C:\Users<user>\PycharmProjects\workflow_builder) while their sidebar entries remain.
Steps to Reproduce
Use Claude Code Desktop with ~/.claude/settings.json containing no cleanupPeriodDays key (the default 30 applies).
Hold several chats across different project directories.
Leave some of them unopened for more than 30 days. Reopen others during that window.
Let the cleanup sweep run (it records its time in ~/.claude/.last-cleanup).
Open the Desktop sidebar. The old chats are still listed with their titles.
Click one that was not reopened during the window. It shows "Session not found on disk".
Confirm the split: its local_*.json still exists under %APPDATA%\Claude\claude-code-sessions\ and now carries "transcriptUnavailable": true, while the .jsonl named by its cliSessionId is gone from ~/.claude/projects/<encoded-cwd>/.
Note that chats reopened during the window survived — their transcript mtime was refreshed — while same-age chats that were not reopened were deleted.
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.85 (claude --version). Desktop app also bundles 2.1.229 under %APPDATA%\Claude\claude-code.
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Workaround for anyone hitting this — set it BEFORE you lose anything, in ~/.claude/settings.json:
{ "cleanupPeriodDays": 3650 }
Back up ~/.claude/projects and %APPDATA%\Claude\claude-code-sessions together. Metadata without transcripts is exactly the broken state described above.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗