Feature request: programmatic way to rename running session (and Remote Control session) from a skill/hook
Summary
Today, renaming the running interactive session's display name (and, if active, its Remote Control session name) is only possible via the /rename <name> slash command, which is parsed exclusively from literal user keystrokes at the prompt. There is no supported way for a skill's instructions, a hook, or any tool call to trigger this programmatically from within the session itself.
Motivation
I have project skills (e.g. a custom dev-nextupdate skill) that already rename the terminal/tab via an external tool's CLI (cmux's rename-workspace/rename-tab, which works because cmux exposes a Unix-socket API any process can call). I'd like the Claude Code session name — and its Remote Control session name — to stay in sync with that same title, updated automatically as part of the skill's execution, without requiring the human to manually type /rename afterward.
What I looked for (and didn't find)
- No generic
SlashCommand-style tool that lets the model invoke built-in slash commands like/rename. - No CLI subcommand to rename a running session by PID/session ID (checked
claude --help,claude agents --help). - No documented IPC/socket/file the CLI watches for an external or in-session rename request.
- The Agent SDK docs mention
renameSession()/rename_session(), but these appear to be SDK-harness-only methods, not something available to a running interactive CLI session or its skills. ~/.claude/sessions/<pid>.jsonholds a livenamefield, but it's a snapshot the running process writes for external readers (e.g. FleetView) — editing it externally doesn't rename the actual session, since the process overwrites it on its next heartbeat.
Request
Add one of:
- A tool (available to the model within a session) that can call the equivalent of
/rename <name>and, if Remote Control is active, update that session's name too. - Or, an IPC mechanism (socket/file) similar to cmux's, so an external script invoked from a skill could request a rename of a specific running session by PID/session ID.
This would let automation (skills, hooks) keep a session's display name/terminal title/Remote Control name in sync with other renamed context (e.g. a paired terminal multiplexer workspace) without manual /rename steps.