claude-code - 💡(How to fix) Fix Local CLI conversations silently disappear from disk — multiple chats lost, JSONL files gone [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54092Fetched 2026-04-28 06:39:26
View on GitHub
Comments
2
Participants
3
Timeline
9
Reactions
0
Timeline (top)
labeled ×5commented ×2mentioned ×1subscribed ×1

Three local Claude Code CLI conversations have vanished from disk over the last few days. They are not on web (I never use claude.ai/code), and they were not compacted away — the session JSONL files appear to have been deleted entirely. claude --resume no longer lists them.

Root Cause

Three local Claude Code CLI conversations have vanished from disk over the last few days. They are not on web (I never use claude.ai/code), and they were not compacted away — the session JSONL files appear to have been deleted entirely. claude --resume no longer lists them.

RAW_BUFFERClick to expand / collapse

Summary

Three local Claude Code CLI conversations have vanished from disk over the last few days. They are not on web (I never use claude.ai/code), and they were not compacted away — the session JSONL files appear to have been deleted entirely. claude --resume no longer lists them.

Lost chats

  • ARCH: no SIP
  • ARCH: (COM) alert state
  • A third chat noticed earlier today (the trigger for asking what "no message yet" means)

All three were in worktree-based project sessions under ~/.claude/projects/-Users-<me>-<repo>--claude-worktrees-*/.

What I verified

Searched the entire local Claude Code state for content from these chats:

LocationResult
All ~/.claude/projects/*/*.jsonl (471 project dirs)No first-user-message starts with ARCH:; no JSONL line contains "ARCH: no SIP" or "ARCH: (COM) alert state"
Compaction summary lines ("type":"summary")None present
~/.claude.json + all 5 rotating backupsNo chat-title registry; titles are derived from JSONL only
~/.claude/history.jsonlNo matches
~/.Trash/Empty
Time MachineNot configured

So the JSONL files have been removed from disk, not just the worktrees.

For context: 471 worktree project dirs are tracked in ~/.claude.json, but only 24 worktrees remain on disk — that part is normal; orphan project dirs persist for deleted worktrees. The bug is that for these specific chats, the project dir / JSONL itself was also removed.

Suspected cause

Some lifecycle event is deleting ~/.claude/projects/<slug>/ (and its .jsonl) for active conversations. Candidates:

  • ExitWorktree cleanup over-deletes session state instead of leaving the JSONL behind
  • A recent CLI upgrade ran a migration / pruning step that removed sessions
  • A hook or auto-cleanup tied to git worktree removal

Impact

Loss of conversation history, including chapter-marked architectural discussions I expected to be able to resume. No way to recover without backups. This has now happened at least 3 times.

Asks

  1. Investigate which code path can delete a populated ~/.claude/projects/<slug>/ directory
  2. Soft-delete (move to trash / archive) instead of unlinking, so users can recover
  3. Surface a warning when claude --resume notices a project dir referenced by ~/.claude.json is missing on disk
  4. Confirm whether there is any internal log/telemetry that could pinpoint when/why each session was removed (session IDs available on request)

Environment

  • Local CLI only (no web sessions involved)
  • macOS, ~/.claude/ layout includes projects/, sessions/, backups/, history.jsonl
  • Heavy worktree user (471 worktree project dirs ever created; 24 currently on disk)

extent analysis

TL;DR

Investigate the code path responsible for deleting populated ~/.claude/projects/<slug>/ directories to prevent loss of conversation history.

Guidance

  • Review the ExitWorktree cleanup process to ensure it doesn't over-delete session state.
  • Check for any recent CLI upgrades that may have introduced a migration or pruning step causing session removal.
  • Examine hooks or auto-cleanup mechanisms tied to git worktree removal that could be deleting session directories.
  • Consider implementing soft-deletion (moving to trash/archive) instead of unlinking to allow user recovery.

Example

No code snippet is provided as the issue lacks specific code references.

Notes

The issue may be related to the interaction between the CLI, worktree management, and session state. Further investigation is needed to pinpoint the exact cause.

Recommendation

Apply a workaround by regularly backing up the ~/.claude/projects/ directory to prevent data loss until the root cause is identified and fixed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Local CLI conversations silently disappear from disk — multiple chats lost, JSONL files gone [2 comments, 3 participants]