[BUG] Session name set via /rename does not persist across /clear
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
### Problem
When you rename a session using /rename, the name is lost after
running /clear. The session reverts to its auto-generated name.
Why it matters
Users who organize sessions by name (e.g., naming after a feature
branch or task) lose that context after /clear. This makes /resume
harder to navigate — the meaningful name is gone, replaced by a
random slug.
This also makes it impossible to auto-name sessions via hooks. A
SessionStart hook can inject context suggesting a name, but since
/rename doesn't stick across /clear, the name is effectively
ephemeral.
Workaround
Starting the session with claude --name "My Feature" does persist
across /clear, but this requires knowing the name at launch time and
can't be used for mid-session renames.
Suggested fix
/clear should preserve the session name. The name is a session-level
property, not a conversation-level one.
What Should Happen?
The session name set via /rename should persist across /clear, since
/clear resets the conversation context but stays in the same
session.
Error Messages/Logs
Steps to Reproduce
- Start a Claude Code session
- Run /rename My Feature
- Confirm the name shows in the terminal title / session list
- Run /clear
- The session name reverts to the auto-generated slug
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.86
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗