Feature: Allow AI to programmatically update session name (sync UI display)
Summary
Currently, the session name displayed in Claude Code's input area (top-right UI element) can only be updated via the /rename slash command, which must be typed by the user. There is no way for the AI assistant to trigger a session rename programmatically.
Problem
When a user asks the AI to rename the current session, the AI can update file-based workarounds (e.g. a session-name-override file used by custom status line scripts), but cannot update the session name shown in Claude Code's own UI — the top-right label in the input area.
The user must still manually type /rename <name> to update the UI, even after the AI has already determined an appropriate name.
Proposed Solution
One or more of the following:
- Expose a tool or hook that allows the AI to call
/renameprogrammatically (e.g. aRenameSessiontool similar to existing tools likeTaskCreate). - Have Claude Code watch the sessions JSON file (
~/.claude/sessions/<pid>.json) for changes to thenamefield and reflect them in the UI without requiring an in-memory update via/rename. - Provide a documented IPC mechanism (e.g. via
hs.ipcor a named pipe) so external scripts or the AI can signal Claude Code to refresh the session name from disk.
Use Case
Users who want the AI to auto-name sessions based on conversation content (e.g. via a UserPromptSubmit hook) currently need a two-step workaround:
- AI updates a custom override file → status line reflects new name
- User must still manually run
/rename→ Claude Code UI reflects new name
A unified mechanism would allow full automation of session naming without user intervention.
Environment
- Claude Code: 2.1.107
- macOS: 15.7.4 (Sequoia, Apple Silicon)
- Terminal: iTerm2 3.6.9
🤖 Generated with Claude Code
4 Comments
Additional Context: Continuous Auto-Rename Use Case
The core use case I want to clarify:
The user has a
UserPromptSubmithook that triggers every 5% of context usage. At each trigger, the hook asks the AI to suggest a new session name based on the current conversation content. The intent is that the session title evolves automatically as the conversation progresses — reflecting the latest topic at each 5% milestone.Current flow (broken):
/renamecommand/renameto update the UI titleDesired flow (fully automatic):
This is a continuous, evolving rename throughout the session lifetime, not a one-time operation. The manual step breaks the entire automation. A programmatic rename API would make this fully hands-free.
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Closing as duplicate. Similar requests already tracked in #43700, #29355, #37592. The specific use case (continuous auto-rename every 5% context based on conversation content) has been added as a comment to #43700.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.