feat: Include parent_session_id in hook payloads for subagent contexts
Feature Request[/+]
[+]When a subagent (spawned via Task tool) triggers hooks, include the parent session's ID in the hook payload so plugins can properly track the parent-child relationship.[/+]
[+]## Current Behavior[/+]
[+]When hooks fire for subagents, they receive:[/+]
[+]``json[/+]`
[+]{[/+]
[+]"session_id": "subagent-session-id",[/+]
[+]"cwd": "/path/to/project",[/+]
[+]"message": "...",[/+]
[+]// No reference to parent session[/+]
[+]}[/+]
[+][/+]parent_session_id
[+]Plugins have no way to know:[/+]
[+]1. Whether this is a subagent or a root session[/+]
[+]2. Which parent session spawned this subagent[/+]
[+]3. How to bubble state (like "needs input") up to the parent[/+]
[+]## Proposed Behavior[/+]
[+]Include when hooks fire in subagent context:[/+]`
[+]json[/+]``
[+]{[/+]
[+]"session_id": "subagent-session-id",[/+]
[+]"parent_session_id": "root-session-id", // ← New field[/+]
[+]"cwd": "/path/to/project",[/+]
[+]"message": "..."[/+]
[+]}[/+]
[+]
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗