--resume "name" fails: sessions-index.json does not index custom-title/agent-name fields from .jsonl
Bug Description
--resume "name" cannot find sessions that were named via Plan mode, because sessions-index.json does not index the custom-title / agent-name records stored in .jsonl files.
Root Cause
When a session is named (e.g. via Plan mode completion), the name is written directly into the session's .jsonl file as event records:
{"type": "custom-title", "customTitle": "discount-rate-limit-preset", "sessionId": "bfc3d699-..."}
{"type": "agent-name", "agentName": "discount-rate-limit-preset", "sessionId": "bfc3d699-..."}
These records appear repeatedly throughout the session file. However, sessions-index.json stores "firstPrompt": "No prompt" for all such sessions — the customTitle/agentName fields are never indexed.
As a result, --resume "discount-rate-limit-preset" returns no results even though the session file clearly contains the name.
Steps to Reproduce
- Start a session, enter Plan mode, let it complete and generate a session name (e.g.
discount-rate-limit-preset) - End the session
- After ~7+ days, try:
claude --resume "discount-rate-limit-preset" - Result: session not found
Expected Behavior
--resume "name" should search customTitle / agentName fields in .jsonl files (or have sessions-index.json index them), so named sessions remain findable by name regardless of age.
Actual Behavior
sessions-index.jsonhas"firstPrompt": "No prompt"— name lookup fails- Sessions also disappear from the interactive picker after ~7–11 days
- Workaround:
claude --resume <uuid>(requires knowing the UUID viagreponhistory.jsonl)
Environment
- Claude Code version: 2.1.104
- OS: WSL2 (Ubuntu on Windows)
Workaround
# Find UUID from history
grep -i "keyword" ~/.claude/history.jsonl
# Or search session files for the custom-title
find ~/.claude/projects/ -name "*.jsonl" \
| xargs grep -l '"customTitle":"discount-rate-limit-preset"' 2>/dev/null
# Resume by UUID
claude --resume bfc3d699-499a-4085-947f-5166105e42b3This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗