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
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗