[FEATURE] Hook output to set session title from git/PR context at SessionStart

Resolved 💬 3 comments Opened Apr 23, 2026 by greg-oscilar Closed Apr 23, 2026

Summary

When starting a session on a ticket branch or reviewing a PR, I want the session to be automatically named with a meaningful prefix (e.g. BAC-711: AI usage schema or PR #1234: auth refactor). Right now there's no way to do this without manually renaming each session.

Desired behavior

Add support for a sessionTitle output from SessionStart hooks (similar to how UserPromptSubmit hooks can return hookSpecificOutput), so a shell script can inspect the git branch or PR context and set a title automatically.

Example hook script:

#!/bin/bash
branch=$(git branch --show-current 2>/dev/null)
if [[ "$branch" =~ bac-([0-9]+) ]]; then
  echo '{"sessionTitle": "BAC-'"${BASH_REMATCH[1]}"': '"$branch"'"}'
fi

Why this matters

Session lists become hard to navigate when every session is named generically. Ticket- and PR-prefixed names make it trivial to resume the right context. This is especially useful in monorepos where many branches/tickets are active simultaneously.

Related issues

  • #40496 — Allow skills/hooks to set session title programmatically
  • #29355 — Allow Claude to programmatically rename sessions
  • #44902 — Docs mention hookSpecificOutput.sessionTitle for UserPromptSubmit (but not SessionStart)

Workaround

Currently: save a memory/instruction telling Claude to suggest the session name in its first response, then rename manually.

View original on GitHub ↗

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