Feature Request: Include session title in hook input JSON
Feature Request
Summary: Include the auto-generated session title in the JSON input provided to hooks (especially Stop, PreCompact, Compact).
Current Behavior
Claude Code automatically generates descriptive session titles based on conversation content and displays them in the terminal tab (e.g., "Building Location-Aware Auto-Save System" or "Windows Naming Issue"). These titles are incredibly useful for identifying sessions.
However, this title is NOT included in the hook input JSON. The Stop hook receives:
{
"session_id": "cf8d4b35-...",
"transcript_path": "/home/alex/.claude/projects/.../session.jsonl",
"cwd": "/home/alex",
"hook_event_name": "Stop",
...
}
The title exists only in the terminal's state and is not stored anywhere accessible to hooks or external scripts.
Requested Behavior
Include the session title in hook input:
{
"session_id": "cf8d4b35-...",
"session_title": "Windows Naming Issue", // <-- ADD THIS
"transcript_path": "...",
...
}
Use Case
I'm building Slack notifications that fire when Claude needs input (via Stop hook). With multiple Claude sessions running in parallel, I need to identify WHICH session needs attention.
Currently the notification shows "unnamed" or falls back to the working directory, which isn't helpful when multiple sessions run from the same directory.
The auto-generated title that Claude Code already computes would be perfect for this - it just needs to be exposed in the hook input.
Workaround Attempted
- Checked
session-memory/summary.md- only created after compaction - Checked
.active-sessions.json- only has project path, not title - Checked
session-env/folder - empty - Checked transcript jsonl - no title field
- Had Claude output "✓ Session: NAME" pattern - requires manual naming
Environment
- Claude Code version: 2.1.1
- OS: WSL2 (Ubuntu) on Windows 11
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗