anthropics / anthropics/claude-code
[BUG] Session history silently deleted with no warning when app is reopened after 30+ days
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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?
What happened
I use both Claude and Claude Code in the Claude desktop app. I stopped using it in early May 2026 and opened it again on September 17, 2026. All of my earlier Chat sessions and Code sessions were gone from the sidebar, including archived ones. They were months of work on one project.
The cause was the automatic cleanup that deletes sessions older than cleanupPeriodDays (30 days by default). It ran when I started a new session (~/.claude/.last-cleanup shows that time) and deleted every old conversation file in ~/.claude/projects/. Nothing warned me, asked me to confirm, or told me afterward. I only found out when my history was missing.
My sessions from the separate Cowork mode were not deleted.
Why this is a problem
People don't expect it. Chat apps keep history. Nothing in the app says Code sessions expire after 30 days.
It hits hardest after a break. Someone away for over a month loses everything the moment they come back, before they can do anything about it.
It can't be undone. The files are deleted outright, not moved to the Trash, so only a full Mac backup can bring them back.
The setting is hard to find. You have to already know cleanupPeriodDays exists and edit a settings file by hand.
Code and Cowork behave differently. Only Code sessions were deleted, which makes the behavior hard to predict.
Suggested fixes (any of these would help)
Warn before deleting: "X sessions older than 30 days will be deleted. Keep them / Delete / Change retention."
Don't run cleanup right at launch after a long absence. Give the user a grace period to notice and respond.
Move expired sessions to the macOS Trash, or a recoverable archive, instead of deleting them permanently.
Show retention in the app's settings and in the sidebar, e.g. "Sessions are kept for 30 days."
Consider a longer default, or no deletion by default in the desktop app, where users expect chat history to last.
Environment
macOS 27.0
Claude desktop app 2.110.1 (Code tab)
Claude Code 2.1.271 (bundled with the app); 2.1.136 CLI also installed
cleanupPeriodDays not set, so the default applied
### What Should Happen?
Suggested fixes (any of these would help)
Warn before deleting: "X sessions older than 30 days will be deleted. Keep them / Delete / Change retention."
Don't run cleanup right at launch after a long absence. Give the user a grace period to notice and respond.
Move expired sessions to the macOS Trash, or a recoverable archive, instead of deleting them permanently.
Show retention in the app's settings and in the sidebar, e.g. "Sessions are kept for 30 days."
Consider a longer default, or no deletion by default in the desktop app, where users expect chat history to last.
### Error Messages/Logs
```shell
No error log.
```
### Steps to Reproduce
I don't know how to reproduce. I opened Claude and the history disappeared as soon as it opened.
### Claude Model
Opus
### Is this a regression?
Yes, this worked in a previous version
### Last Working Version
_No response_
### Claude Code Version
Claude desktop app 2.110.1 (Code tab) Claude Code 2.1.271 (bundled with the app); 2.1.136 CLI also installed
### Platform
Anthropic API
### Operating System
macOS
### Terminal/Shell
Terminal.app (macOS)
### Additional Information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the cleanup behavior around ~/.claude/.last-cleanup, ~/.claude/projects/, and the cleanupPeriodDays setting. Reproduce or inspect what happens when an app is reopened after sessions exceed the retention period, then determine which user-visible safeguard is selected. Done should include preventing silent, irreversible deletion and verifying the behavior after a long absence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100