Describe the feature or problem you'd like to solve
The subagentStart hook provides the parent session’s sessionId, but does not expose the agentId of the subagent being started.
Subsequent hooks triggered by that subagent, such as preToolUse, use the subagent’s agentId as their sessionId. This means there is currently no deterministic way to associate a subagent’s tool calls with the parent session before those tool calls occur.
This becomes a problem when implementing security or policy enforcement around hooks. For example, a parent session may establish a policy context containing its working directory, repository, branch, and allowed operations. Subagents should inherit that context, but without knowing their agentId at subagentStart, their later preToolUse calls cannot be safely mapped back to the parent.
This is especially important in Fleet mode, where multiple subagents may execute concurrently and heuristic correlation based on working directory, timing, or agent name would not be reliable.
Proposed solution
Example prompts or workflows
No response
Additional context
No response
Describe the feature or problem you'd like to solve
The subagentStart hook provides the parent session’s sessionId, but does not expose the agentId of the subagent being started.
Subsequent hooks triggered by that subagent, such as preToolUse, use the subagent’s agentId as their sessionId. This means there is currently no deterministic way to associate a subagent’s tool calls with the parent session before those tool calls occur.
This becomes a problem when implementing security or policy enforcement around hooks. For example, a parent session may establish a policy context containing its working directory, repository, branch, and allowed operations. Subagents should inherit that context, but without knowing their agentId at subagentStart, their later preToolUse calls cannot be safely mapped back to the parent.
This is especially important in Fleet mode, where multiple subagents may execute concurrently and heuristic correlation based on working directory, timing, or agent name would not be reliable.
Proposed solution
Example prompts or workflows
No response
Additional context
No response