[FEATURE] Name the parent and display name in the SubagentStart hook

Status Open
Reported on v2.1.292
Maintainer reply None cached
Activity 0 comments · opened Oct 7, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Tools that show a session's subagents from hooks can't rebuild the tree Claude Code draws. When a subagent launches its own, as /code-review does with its review angles, every hook payload looks like a flat sibling:

{"hook_event_name":"SubagentStart","agent_id":"a1cf865b805f072c4","agent_type":"general-purpose", ...}

Nothing says which subagent launched a1cf865b805f072c4, and agent_type is general-purpose for every row. Claude Code's own UI shows code-review with its workers under it, so it has both facts. They just aren't in the payload.

Proposed Solution

Add two fields to the SubagentStart hook input, and to every hook that fires inside a subagent:

  • parent_agent_id: the agent_id of the subagent that launched this one. Absent when the main thread launched it.
  • agent_name: what Claude Code shows for the subagent in its own UI. That is the skill's name for a forked skill, such as code-review, and otherwise the task's description.

SubagentStart already runs inside the launching context, which knows both values. The runner already records parentAgentId and the display name in the metadata it writes:

{
  "hook_event_name": "SubagentStart",
  "agent_id": "a1cf865b805f072c4",
  "agent_type": "general-purpose",
  "parent_agent_id": "ac15f9fedbcaa9669",
  "agent_name": "Simplification angle"
}

Adding the same two fields to the shared hook input fields means any hook inside a subagent can place it without having seen its start, for example a hook installed mid-session.

Both fields are additive, so existing hooks are unaffected.

Alternative Solutions

  • The base hook input (session_id, transcript_path, cwd, permission_mode, agent_id, agent_type) has no parent field. Checked against 2.1.292.
  • subagents/agent-<id>.meta.json beside the transcript has parentAgentId, name and description. But it's undocumented, so a hook reading it breaks silently on any format change. It's also written after the SubagentStart hooks run, so the start hook can't read it. In a real /code-review run the file appeared 30 to 65 ms after the subagent's first transcript line, and 5 to 11 seconds before its first tool call.
  • The Agent tool's PostToolUse names the child (tool_response.agentId) and the parent (the payload's agent_id). For a foreground subagent, though, it fires only when the child finishes, too late to show it running.

Priority

Medium - Would be very helpful

Feature Category

Developer tools/SDK

Use Case Example

I'm working on https://github.com/KieranP/multishell , which integrates with claude code to show agents and their subagent structure.

Additional Context

_No response_

View original on GitHub ↗