Feature: Allow commands/skills to rename the current session
Problem
Custom commands and skills (defined in .claude/commands/) have no way to programmatically rename the current session. The /name REPL command exists for interactive use, but it's not exposed as a tool that commands can invoke during execution.
This limits the usefulness of commands that establish a clear working context. For example, a /fix-issue 42 command that reads a GitHub issue and implements it would benefit from automatically naming the session #42 Fix widget overflow — making it instantly identifiable in the session list. Today, the user has to manually run /name afterwards, which breaks the flow.
Proposed Solution
Expose a SessionRename tool (or similar) that commands, skills, and agents can call to set the session name:
SessionRename(name: "#42 Fix widget overflow")
Alternatively, this could be a lighter-weight mechanism like a special output directive that the harness interprets, but a proper tool would be the most consistent approach.
Use Cases
- Issue workflows: A
/fix-issue <number>command fetches the issue title and renames the session to#42 <title>, so the session list becomes a natural task board - Feature branches: A command that creates a worktree could name the session after the branch
- Long-running tasks: A
/deploy stagingcommand could name the sessiondeploy → stagingfor easy identification - Any custom workflow where the command knows a better name than the default timestamp
Current Workaround
None — /name is only available interactively and cannot be called from within a tool/command execution context. The best approximation is printing "Run /name #42 to rename this session" as output, which requires manual user action.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗