sessions-index.json not updated, causing `claude --resume` to show stale/missing sessions
Bug Description
claude --resume only shows a random smattering of old sessions (from ~2 weeks ago), despite having run many sessions recently. The session data itself is being saved correctly — the .jsonl files are all present on disk — but they don't appear in the resume picker.
Root Cause (identified with Claude's help)
The sessions-index.json files in ~/.claude/projects/ are either:
- Missing entirely for many active project directories
- Stale — not being updated when new sessions are created
For example, on my system (v2.1.39, macOS):
- 11 out of 18 project directories have no
sessions-index.jsonat all, including directories with very recent session activity - The index files that do exist haven't been updated since late January, despite session
.jsonlfiles being written as recently as today
HAS INDEX: -Users-...-dev-ozzydb (Feb 4) ← stale, sessions exist from Feb 10
NO INDEX: -Users-...-dev-rileyviewer ← no index, 20MB+ session from Feb 10
NO INDEX: -Users-...-dev ← no index, sessions from Feb 10
NO INDEX: -Users-...-hard-saptest1 ← no index, sessions from Feb 10
The session .jsonl files are all intact — data is not being lost. But since --resume appears to read from sessions-index.json, these sessions are invisible to the resume picker (both CLI and VS Code extension).
Steps to Reproduce
- Run several Claude Code sessions across different project directories
- Close them (I typically just close the terminal)
- Run
claude --resume— only old sessions appear - Check
~/.claude/projects/*/sessions-index.json— many are missing or stale - Check for
.jsonlfiles — they exist and are recent
Expected Behavior
claude --resume should list all recent sessions, and sessions-index.json should be updated whenever a session is created or modified.
Environment
- Claude Code version: 2.1.39
- OS: macOS (Darwin 25.1.0)
- Sessions are closed by closing the terminal (no explicit exit command)
Notes
I found this bug myself; Claude helped identify the specific root cause (the stale/missing index files) by examining the session storage on disk.
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗