SubagentStart hook can't see subagent_type — impossible to customize context injection per agent
Problem
I run 77 custom agents and use a SubagentStart hook to inject project context into every spawned sub-agent. The hook fires reliably, but the metadata it receives doesn't include the subagent_type being spawned.
This means I can't differentiate between agent types at spawn time. I want to inject different context for an Explore agent (read-only research) vs a general-purpose agent (full implementation) vs my custom agents defined in .claude/agents/. Right now they all get the same blob of context because the hook has no way to know what it's talking to.
Current workaround
I inject everything into every agent and rely on the agent's own instructions to ignore irrelevant context. This wastes tokens and pollutes the KV cache prefix — the exact opposite of what you want when spawning 5+ agents in parallel.
What I'd want
The SubagentStart hook should receive:
subagent_type(e.g.,"explore","general","custom")agent_nameif it's a custom agent from.claude/agents/team_nameif part of a team
This would let power users build proper context routing:
case "$SUBAGENT_TYPE" in
"explore") echo "Read-only. Here are the key file paths: ..." ;;
"general") echo "Full context with conventions: ..." ;;
"custom:qa-agent") echo "Test commands and coverage targets: ..." ;;
esac
Impact
Anyone running multiple agent types with hooks is flying blind on which agent they're configuring. This is a small metadata addition that unlocks a lot for hook authors.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗