Critical data loss: startup GC silently deletes all session transcripts

Resolved 💬 4 comments Opened May 24, 2026 by ghh1111 Closed Jul 16, 2026

Summary

Claude Code's built-in garbage collection ran on application startup and silently deleted every session transcript (.jsonl file) across all projects. ~2,300 sessions of work wiped with no warning, no confirmation, no opt-out, and no recovery path.

The core issue

You should not delete user data. Ever. Under any circumstances. Without explicit user consent.

Session transcripts are not cache. They are not temporary files. They are the primary record of work — architectural decisions, debugging sessions, code context, product thinking. For users who build with Claude Code daily, these transcripts ARE the work product.

Claude Code deleted all of them on startup. Silently. No prompt. No warning. No trash can. No undo.

The only reason any session content survived at all is because the user built her own export tool (Chat Press) and manually exported sessions one by one. Claude Code itself provided zero data protection. And then it destroyed what it wasn't protecting.

Environment

  • Claude Code version: 2.1.149
  • Platform: macOS (Darwin 24.6.0) — Claude Code Desktop app
  • Date: 2026-05-24

What happened

  1. Opened Claude Code Desktop app (v2.1.149)
  2. On startup, a GC process ran and wrote ~/.claude/.last-cleanup with timestamp 2026-05-24T15:56:02.054Z
  3. Every .jsonl session transcript file in ~/.claude/projects/ was deleted — across all project directories
  4. Session subdirectories (containing subagent data) were left behind, as was the history.jsonl index
  5. Result: the sidebar shows recent sessions but clicking any of them returns "session not found on disk"

Additional damage: orphaned worktree

In a separate failure, Claude Code Desktop also left a 1 GB orphaned agent worktree (3,671 files) inside the project directory from a May 12 agent run. This worktree was never cleaned up and has been syncing across Dropbox, eating bandwidth and polluting the git status with 3,676 untracked changes.

The irony: the temporary data that should have been cleaned up (the worktree) wasn't. The permanent data that should never have been deleted (2,300 session transcripts) was.

Verified details

  • history.jsonl references 133 unique session IDs for one project alone — the full count across all projects is ~2,300 sessions
  • Zero old transcripts remain on disk — only today's new sessions survived
  • 70+ session directories with subagent data still exist across multiple projects but have no matching .jsonl transcripts
  • .last-cleanup file timestamp matches the exact moment Claude Code launched

Impact

  • ~2,300 sessions of critical development conversation permanently lost from this machine
  • This was the user's primary development machine — 90% of all Claude Code work happened here
  • No Time Machine backup of ~/.claude (it's outside standard user data paths users think to protect)
  • ~/.claude is not synced via Dropbox or any cloud service — it's per-machine with no redundancy
  • Sessions from April–May 2026 that had not been manually exported are completely unrecoverable
  • This represents months of detailed technical conversations, architectural decisions, debugging sessions, and context that informed ongoing product development
  • The user had built a custom export tool (Chat Press) to back up sessions — the 946 sessions that survived only survived because of that user-built tool, not because of anything Claude Code did to protect them

What should happen

  1. Never delete session transcripts without explicit user action. Not on startup. Not on a schedule. Not ever. They are user data, not disposable cache.
  2. If storage is a concern, give users a setting to manage retention — don't decide for them.
  3. At absolute minimum: warn before deletion, provide a trash/recovery stage, and make the policy visible and configurable.
  4. ~/.claude contains irreplaceable data stored outside normal backup paths — users should be clearly informed of this.

Requested resolution

  • Fix the GC immediately to stop deleting session transcripts
  • The user is requesting a billing credit/refund for the destroyed sessions — months of paid usage whose work product was wiped by the tool itself
  • Anthropic support (support@anthropic.com) has not been responsive to prior inquiries — this user needs a real response

🤖 Generated with Claude Code

View original on GitHub ↗

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