Feature request: Include parent sub-agent context in hook stdin
Feature Request
Include sub-agent context in hook stdin so that tool calls from background sub-agents can be attributed to their parent.
Current Behavior
When a background sub-agent (launched via the Agent tool with run_in_background: true) executes tools like Grep, Read, or Glob, the PreToolUse hook fires with:
{
"tool_name": "Grep",
"tool_input": { "pattern": "..." }
}
No field identifies which sub-agent triggered this tool call.
Requested Behavior
Include the parent sub-agent's tool_call_id (or an equivalent session/sub-agent identifier) in the hook stdin:
{
"tool_name": "Grep",
"tool_input": { "pattern": "..." },
"parent_tool_call_id": "toolu_01G4DRTnHw4vqwHcSddaHn4u"
}
Use Case
Hooks that need to track or log sub-agent activity cannot distinguish which concurrent background sub-agent triggered a given tool call. With a single background sub-agent this is unambiguous, but with multiple concurrent background sub-agents there is no way to attribute tool calls to the correct parent.
Context
- Background sub-agent tool calls don't appear on the ACP wire — only the parent Agent/Task tool call does
- The hook system is the only visibility path for background sub-agent tool activity
- The
SubagentStophook already fires per sub-agent — this request extends that attribution toPreToolUseandPostToolUse
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗