Bug: automatic cleanup deleted 6 active sessions without warning — token loss
Summary
Claude Code's automatic cleanup routine deleted 6 active session files on 2026-05-31 without any warning or user consent. The sessions were not archived — they were permanently destroyed. This caused loss of conversation transcripts and wasted tokens.
Environment
- Platform: macOS Darwin 25.5.0
- Claude Code version: 2.1.121 (from session JSONL metadata)
- Date of incident: 2026-05-31T08:00:25.755Z (confirmed from
~/.claude/.last-cleanup)
What happened
At 2026-05-31T08:00:25.755Z, the automatic cleanup routine ran and deleted all session JSONL files in ~/.claude/projects/-Users-rachidhamrarras-Desktop/ except the currently active one.
The 6 deleted sessions were:
- Set up agent shop website
- Audit Monster
- Analyze files for revolutionary architecture
- Birth Certificate Contract Setup
- Complete App Factory Ecosystem project
- Site InnovAct
These sessions were not old/abandoned — they were recent working sessions that the user planned to resume.
Evidence
# Proof of cleanup timestamp
$ cat ~/.claude/.last-cleanup
2026-05-31T08:00:25.755Z
# Only 1 session remains in the project directory (the current one)
$ ls ~/.claude/projects/-Users-rachidhamrarras-Desktop/
dedb0464-050c-4bd3-abca-8ce27e203e5f.jsonl
The UI shows "Session introuvable sur le disque" for all 6 sessions, confirming the JSONL files were deleted while their references still existed in the session list.
Impact
- Permanent loss of 6 conversation transcripts
- Token waste — tokens paid for those sessions, work irretrievably lost
- No warning — no UI prompt, no "are you sure?", no archive before delete
- No recovery path — backups in
~/.claude/backups/contain.claude.jsonconfig but NOT session JSONL files
Expected behavior
The cleanup routine should:
- Never delete sessions without explicit user confirmation
- OR archive sessions before deletion
- OR provide a configurable retention policy (e.g.
"cleanupEnabled": false) - OR at minimum warn the user before running
Requested action
- Fix the cleanup to not silently delete sessions
- Provide a way to configure/disable the cleanup:
"cleanupEnabled": falseinsettings.json - Reimburse the tokens lost due to this system-side bug
---
User: rachidHamrarras — hamrarrasr@gmail.com
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗