claude-code - 💡(How to fix) Fix Session JSONL files are silently deleted, causing --continue to fail and context loss

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…

Error Message

  • --continue should warn when no previous session is found instead of silently starting fresh
RAW_BUFFERClick to expand / collapse

Problem

Session JSONL files are automatically deleted after a few weeks, causing claude --continue to silently start a new session instead of resuming the previous one. This leads to complete loss of conversation context.

Impact

When a user returns to a project after a few weeks:

  1. claude --continue finds no JSONL file → starts a fresh session without warning
  2. All context learned during previous sessions is lost (coding patterns, file encoding quirks, project-specific decisions)
  3. The AI repeats mistakes that were already resolved in prior conversations, wasting tokens
  4. Users have no way to know their session was lost until they notice the AI behaving as if it has no prior context

Real-world example: A VBA file (SP_API_MultiMallModule.bas) required SJIS (CP932) encoding. This was well-established in previous sessions. After the session file was deleted, the AI used the standard Edit tool (UTF-8), corrupting the entire file. Recovery required git checkout + re-editing with Node.js binary operations — all wasted tokens that wouldn't have been spent if the conversation context had survived.

Current behavior

  • Session JSONL files in ~/.claude/projects/<project>/ are deleted after an unknown retention period (appears to be a few weeks)
  • sessions-index.json entries become empty ([])
  • No warning is shown to the user when --continue falls back to a new session
  • Memory files (MEMORY.md) persist but don't capture the full operational context of conversations

Expected behavior

  • Users should be able to configure session retention period (or disable auto-deletion)
  • Important sessions should be pinnable/persistable
  • --continue should warn when no previous session is found instead of silently starting fresh
  • At minimum, display a clear message: "No previous session found for this directory. Starting new session."

Environment

  • OS: Windows 11
  • Claude Code CLI
  • Multiple projects with varying session frequencies

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…

FAQ

Expected behavior

  • Users should be able to configure session retention period (or disable auto-deletion)
  • Important sessions should be pinnable/persistable
  • --continue should warn when no previous session is found instead of silently starting fresh
  • At minimum, display a clear message: "No previous session found for this directory. Starting new session."

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 Session JSONL files are silently deleted, causing --continue to fail and context loss