Session JSONL files are silently deleted, causing --continue to fail and context loss

Resolved 💬 3 comments Opened May 8, 2026 by logimania Closed May 12, 2026

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

View original on GitHub ↗

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