Allow `sessionTitle` in `SessionStart` hook output (currently only `UserPromptSubmit` supports it)

Resolved 💬 3 comments Opened May 14, 2026 by Mabuti Closed May 18, 2026

Summary

UserPromptSubmit hooks can set sessionTitle via hookSpecificOutput. SessionStart hooks cannot. Please add sessionTitle support to SessionStart hook output.

Use case

Auto-rename each session to the basename of the launch folder, so the session picker / tab title / agent panel reflects which project the session belongs to without any manual /title step.

Current workaround (suboptimal)

A UserPromptSubmit hook can emit:

{"hookSpecificOutput":{"hookEventName":"UserPromptSubmit","sessionTitle":"<folder>"}}

This works, but the title only appears after the first prompt is sent — not at session launch. Sessions sitting on the welcome screen, or sessions that are spawned and immediately backgrounded, never get titled.

Proposed behavior

Honor hookSpecificOutput.sessionTitle when emitted from a SessionStart hook:

{"hookSpecificOutput":{"hookEventName":"SessionStart","sessionTitle":"my-project"}}

…and apply it before the first user prompt.

Why not just default sessionTitle to cwd basename?

That'd also be welcome, but exposing it via the hook is more flexible — users can derive titles from git branch, worktree name, env var, etc.

Environment

  • Claude Code on Windows 11 / PowerShell
  • Affects all platforms (the hook contract is OS-agnostic)

View original on GitHub ↗

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