/resume command missing most sessions - sessions-index.json not syncing with session files on disk

Resolved 💬 3 comments Opened Jan 31, 2026 by ThinkAI-SuperDevv Closed Feb 3, 2026

Summary

Sir, we've identified a critical desynchronization in the session persistence layer. The sessions-index.json file -- which governs what /resume presents to the operator -- is failing to register the majority of session files that exist on disk.

In our case: only 6 out of 38 sessions were indexed. That's 84% of conversation history rendered invisible. The data is not lost -- the .jsonl files remain intact -- but the index simply does not acknowledge them.

The Problem

The sessions-index.json located under ~/.claude/projects/<project-path>/ should maintain a registry of all session files. Instead, it falls dramatically out of sync. The operator experiences this as conversations "disappearing" from /resume, which naturally leads to the conclusion that data has been erased.

Additionally, the metadata for sessions that are indexed is stale. We observed session files exceeding 30MB with messageCount: 6 in the index -- a clear impossibility. The index appears to capture an initial snapshot at session creation and never update it.

How We Identified It

  1. Noticed that long, substantive sessions were vanishing from /resume while short trivial ones persisted
  2. Inspected ~/.claude/projects/<project-path>/sessions-index.json -- found only 6 entries
  3. Listed .jsonl files in the same directory -- found 38
  4. Cross-referenced: 32 sessions existed on disk but were absent from the index
  5. Verified the .jsonl content was intact -- full conversation data, summaries, all present

Impact

  • Operators believe their data is gone. This is the most damaging consequence -- it breaks trust in the tool
  • Session continuity is severed. /resume becomes unreliable for picking up previous work
  • No indication anything is wrong. The failure is completely silent -- no warnings, no errors

Suspected Cause

  • The index may only be written at session creation and never updated on subsequent saves
  • On WSL2 environments, cross-boundary filesystem operations may cause silent write failures
  • Concurrent Claude Code instances or rapid session switches could produce race conditions on the index file

Workaround

Operators can rebuild the index by scanning the .jsonl files on disk and reconstructing the entries programmatically. We wrote a Python script that re-parses all session files and regenerates a correct sessions-index.json. This restored all 38 sessions to /resume immediately.

Suggested Fix

  1. Atomic index updates on every session save -- write to a temp file, then rename
  2. Self-healing reconciliation on startup -- scan .jsonl files and re-index any that are missing from the registry
  3. Filesystem fallback -- if the index count diverges significantly from the file count on disk, scan directly
  4. Accurate metadata -- recount messages from actual .jsonl content rather than caching stale values

---

Reported by Amyd Caballero & JARVIS Think AI

View original on GitHub ↗

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