[Feature Request] Add `TeammateSpawning` hook to inspect spawn prompts before agent instantiation
Bug Description
Here's clean feedback ready to paste into /feedback:
---
Feature Request: TeammateSpawning hook for agent teams
Summary
When using agent teams, there's currently no way to inspect or intercept the spawn prompt the lead writes for each teammate before the agent is instantiated. The only hooks available (TeammateIdle, TaskCreated, TaskCompleted) fire after the agent is already running. This is a meaningful gap.
The problem
The lead synthesizes teammate personas dynamically from your natural language prompt. The role label ("security reviewer," "UI specialist") does most of the work, and the actual capability profile — scope, constraints, definition of quality output, lane boundaries relative to other teammates — is implicit. By the time you can observe a teammate's quality (its first output, its first idle state), it has already been operating under a potentially miscalibrated persona. In a parallel team, multiple teammates may have compounded that miscalibration simultaneously, burning tokens across all of them before any quality signal surfaces.
What's missing
A TeammateSpawning hook that fires before a teammate is instantiated, with the proposed system prompt as the payload. Exiting with code 2 would block the spawn and return feedback to the lead, allowing it to revise the spawn prompt and resubmit — the same pattern as TaskCreated blocking a task until it meets spec.
What this would enable
An LLM-as-judge quality gate on spawn prompts, evaluating things like:
- Does this agent have a clearly scoped capability profile, not just a role label?
- Is there meaningful lane separation from the other teammates already spawned?
- Does the agent definition include a standard for what "done well" looks like for its outputs?
- Is the scope appropriate for the task complexity?
Current workarounds
The closest approximation is instructing the lead via CLAUDE.md to write each proposed spawn prompt to a file before spawning, then using a TeammateIdle hook to evaluate the agent's first output as a proxy for persona quality. Both are imperfect — the first requires prompt discipline in CLAUDE.md, the second evaluates the artifact rather than the source, and neither actually prevents a miscalibrated agent from being instantiated.
Why this matters
The cost of a bad spawn isn't just the bad output — it's all downstream tasks that teammate claims and executes under a flawed identity, plus the coordination overhead of the lead arbitrating conflicting or redundant outputs. For parallel teams, this risk is multiplicative. A pre-spawn hook would make the quality gate cheap relative to the cost it prevents.
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 2.1.177
- Feedback ID: 17efc3fc-c9d4-42b4-b2e5-01d805af0b17
Errors
[]This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗