Resume picker ignores custom session title after /clear
Bug Description
The resume session picker (/resume) displays "/clear" as the session label instead of the custom title set via /rename, when the session contains a /clear command earlier in the JSONL transcript.
Sessions that were renamed but never had /clear used display their custom titles correctly.
Steps to Reproduce
- Start a new Claude Code session
- Have a conversation (send at least one message)
- Run
/clearto clear the conversation - Run
/rename my-session-name - Continue working in the session
- Exit the session
- Run
/resumeto open the session picker
Expected: The session appears as "my-session-name" in the picker
Actual: The session appears as "/clear" in the picker
Root Cause Analysis
The session JSONL file correctly contains a custom-title entry:
{"type": "custom-title", "customTitle": "my-session-name", "sessionId": "..."}
However, the resume picker appears to use the first user message text as the display label when /clear appears early in the session file, ignoring the custom-title entry that comes later.
In affected sessions, the /clear command is typically at line 1-2 of the JSONL, while the custom-title entry comes later. Sessions without /clear display their custom titles correctly.
Impact
In my case, 18 out of 29 named sessions (62%) are affected — they all show as "/clear" in the resume picker, making them indistinguishable from each other and effectively unfindable by name.
Environment
- Claude Code version: 2.1.37
- Platform: macOS (Darwin 24.6.0, arm64)
- Shell: zsh
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗