Allow assistant to programmatically rename sessions via tool call

Resolved 💬 3 comments Opened Apr 17, 2026 by TBSammy Closed Apr 21, 2026

Summary

Currently, /rename is a built-in CLI command that can only be invoked by the user typing it manually. There is no way for the assistant (Claude) to trigger a session rename programmatically from within a conversation — not via tools, hooks, or escape sequences.

Use Case

Skills/commands (custom .claude/commands/*.md files) often load context for a specific project or domain. When the work subject changes mid-session, it's useful to update the terminal tab title to reflect the current focus. Today this requires the assistant to ask the user to manually type /rename <title>, which is friction that could be eliminated.

Example: a project operations skill loads and sets the title to MSQ: db migration. Later the conversation shifts to edge function deployment — the assistant should be able to update the title to MSQ: ef deploy without prompting the user.

Current Behavior

  • /rename only works when typed by the user in the prompt
  • Terminal title escape sequences (\033]0;...\007) get overwritten by Claude Code on the next render cycle
  • Hooks (PreToolUse, PostToolUse, SessionStart) cannot invoke built-in CLI commands
  • The assistant has no tool or mechanism to trigger a rename

Proposed Solution

Any of these would work:

  1. Expose /rename as an assistant-callable tool — e.g. RenameSession tool that accepts a title string
  2. Allow hooks to emit CLI command directives — e.g. a hook stdout payload like {"command": "/rename", "args": "new title"} that the harness executes
  3. Add a SessionRename hook event — let hooks fire when the assistant requests a rename, with the harness applying it

Option 1 is the simplest and most useful.

Environment

  • Claude Code on Windows 11 (also relevant to Mac/Linux)
  • Using custom skills (.claude/commands/) that would benefit from auto-renaming

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗