Session JSONL files are silently deleted, causing --continue to fail and context loss
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:
claude --continuefinds no JSONL file → starts a fresh session without warning- All context learned during previous sessions is lost (coding patterns, file encoding quirks, project-specific decisions)
- The AI repeats mistakes that were already resolved in prior conversations, wasting tokens
- 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.jsonentries become empty ([])- No warning is shown to the user when
--continuefalls 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
--continueshould 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
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗