Feature Request: Allow hooks to control terminal/tab title
Resolved 💬 3 comments Opened Mar 16, 2026 by derekrprice Closed Mar 20, 2026
Problem
Claude Code sets the terminal title to a static label with an activity spinner, but there's no way for hooks to influence this. Users with custom hook systems (like PAI) want dynamic titles that reflect the current task context (e.g., "Fixing auth bug" instead of "Claude Code").
Current Limitations
- Hooks run as external subprocesses with no API back into Claude Code
- Writing OSC escape sequences from hooks conflicts with Claude Code's own title management
/renameworks manually but cannot be invoked programmatically from hooks- The
sessions-index.jsonsummary field is not watched by the running process
Proposed Solution (any of these would work)
- Hook output field — Allow hooks (especially
UserPromptSubmitandStop) to return aterminalTitleorsessionNamefield in their JSON output that Claude Code picks up and uses for the terminal title, prepended to or replacing "Claude Code" — while preserving the activity status indicator (the animated asterisk/dot spinner is valuable feedback).
- Programmatic
/renameAPI — Expose a way for hooks to trigger a rename, e.g. writing to a watched file like~/.claude/session-titleor a local socket.
- Title template in settings — A
terminalTitlesetting insettings.jsonthat supports a shell command (likestatusline-command), whose output is used as the terminal title alongside the existing activity indicator.
Use Case
PAI (Personal AI Infrastructure) already generates 3-4 word task summaries via Haiku inference on every UserPromptSubmit. It just has no way to deliver them to the terminal title without conflicting with Claude Code's built-in title management.
Ideal result: ✳ Fixing auth bug instead of ✳ Claude Code
Environment
- WSL2 (Windows Terminal)
- Claude Code latest
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗