Bug: automatic cleanup deleted 6 active sessions without warning — token loss

Resolved 💬 2 comments Opened May 31, 2026 by rachidHamrarras Closed Jun 2, 2026

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:

  1. Set up agent shop website
  2. Audit Monster
  3. Analyze files for revolutionary architecture
  4. Birth Certificate Contract Setup
  5. Complete App Factory Ecosystem project
  6. 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

  1. Permanent loss of 6 conversation transcripts
  2. Token waste — tokens paid for those sessions, work irretrievably lost
  3. No warning — no UI prompt, no "are you sure?", no archive before delete
  4. No recovery path — backups in ~/.claude/backups/ contain .claude.json config 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

  1. Fix the cleanup to not silently delete sessions
  2. Provide a way to configure/disable the cleanup: "cleanupEnabled": false in settings.json
  3. Reimburse the tokens lost due to this system-side bug

---

User: rachidHamrarras — hamrarrasr@gmail.com

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗