Feature: Allow hooks to set session name/title
Problem
There's no way to programmatically set or rename a session's title via the hooks system. The SessionStart hook fires at exactly the right time (startup, resume, clear, compact), but hook output can only inject context text -- it can't modify session metadata.
Use Case
In multi-agent setups where a root CLAUDE.md routes to different agent personas based on user input, it would be useful to prefix session names with the active agent. For example:
Morgan: weekly brief triageSloane: hook system researchNate: pipeline review
This makes it much easier to find and resume sessions when you have dozens of them across different agent contexts.
Proposed Solution
Allow SessionStart hook output to include a session_name field (or similar) that sets or prefixes the session title:
{
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"sessionName": "Sloane: hook system research"
}
}
Alternatively, a sessionNamePrefix field that prepends to whatever name the user provides or is auto-generated would also work well.
Alternatives Considered
- Manually renaming sessions -- doesn't scale when switching agents frequently
- Injecting context via hook stdout -- helps Claude know the agent, but doesn't help the human scanning a session list
- Scripting against session storage directly -- fragile, undocumented internals
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗