Session names from /rename are lost after resuming and continuing work
Description
Session names set via /rename are lost after resuming the session and doing additional work. The custom title only persists if it remains near the end of the .jsonl session file.
Steps to Reproduce
- Start a new session
- Do some work
- Run
/rename my-project-name - Exit the session
/resume my-project-name— works fine- Do more work in the resumed session
- Exit the session
/resume my-project-name— "Session my-project-name was not found"
Root Cause
/rename appends a {"type":"custom-title","customTitle":"..."} JSON line to the session .jsonl file. When the session is resumed and more work is done, additional lines are written after the custom-title entry. On the next /resume, Claude Code appears to only scan near the end of the file for the custom-title entry, so it can no longer find the name.
Expected Behavior
A session name set via /rename should persist permanently, regardless of how much additional content is written to the session file after renaming. The name should survive multiple resume/work/exit cycles without needing to re-rename.
Current Workaround
Run /rename with the same name again right before every /exit, so the custom-title entry stays at the end of the file.
Environment
- Claude Code version: 2.1.42 / 2.1.44
- OS: Ubuntu 24.04.3 LTS
- Shell: bash
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗