[FEATURE] Include session_name in Notification hook JSON
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When running multiple Claude Code sessions concurrently (e.g. one for dbt work, one for frontend, one for debugging), macOS notifications from Notification hooks all show generic "Claude is waiting for your
input" or "Claude needs your permission to use Bash". There's no way to tell which session needs attention without switching to each tab/window individually.
The session name (set via /rename) is the natural identifier users already create to distinguish their sessions, but it's not included in the Notification hook JSON payload.
Proposed Solution
Add a session_name field (string, nullable) to the Notification hook JSON sent on stdin:
{
"session_id": "7a58c788-...",
"session_name": "debug-auth-flow",
"transcript_path": "...",
"cwd": "...",
"hook_event_name": "Notification",
"message": "Claude is waiting for your input",
"notification_type": "idle_prompt"
}
This would allow notification scripts to display the session name, e.g.:
osascript -e "display notification \"$message\" with title \"$session_name\""
Secondary ask: also persist session_name in sessions-index.json entries for tooling that reads session history.
Alternative Solutions
- tmux pane title — Claude Code sets the terminal title on /rename, so wrapping the shell in tmux lets a hook script read it back via
tmux display-message -p '#{pane_title}'. Works but adds a full tmux layer
just to read a string back, introduces scroll latency, and breaks if tmux isn't running.
- Parsing the transcript JSONL — /rename events are not written to the transcript, so this doesn't work.
- sessions-index.json lookup — the index doesn't include session name, and active sessions aren't indexed until closed.
- First user prompt as label — extracting the first user message from the transcript JSONL. Functional but often not descriptive (e.g. "[Request interrupted by user for tool use]") and doesn't reflect what the
user actually named the session.
Priority
Low - Nice to have
Feature Category
CLI commands and flags
Use Case Example
- I have three Claude Code sessions open: "dbt-pipeline-fix", "webapp-pr-review", "connector-debug"
- I switch to my browser to check a PR while Claude works
- Two notifications arrive: "Claude is waiting for your input" and "Claude needs your permission to use Bash"
- I can't tell which session needs me without switching to each Ghostty tab
- With session_name in the hook JSON, my notification script shows: "🔐 dbt-pipeline-fix — Claude needs your permission to use Bash"
- I go directly to the right tab
Additional Context
- The session name is already known internally to Claude Code (it renders in the UI and sets the terminal title)
- The hook subprocess runs detached from the terminal, so it can't read the terminal title back
- This is a one-field addition to an existing JSON payload — minimal implementation surface
- Would also benefit notification integrations beyond macOS (Slack webhooks, ntfy, etc.)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗