Each Agent Its Own Brief and Toolbox
Why This Matters
A subagent starts with nothing but what you give it. Give it too little and it guesses. Give it everything and it drowns in the coordinator’s history. Give it a write tool it does not need and you have a risk you did not have to take.
Writing a brief
A good brief for a subagent answers five questions:
- The task: one sentence. “Decide whether test t-004 is failing intermittently.”
- The evidence it gets: the failure data, already trimmed. Not the whole run.
- What it may use: its tools, and what each is for.
- What to return: the exact result schema (lesson 38).
- What is out of scope: “Do not suggest fixes. Do not file bugs.”
Task: decide whether test t-004 fails intermittently.
Evidence: <test>…</test> <error>…</error>
You may use get_test_history and read_log.
Return: { verdict: "flaky" | "not_flaky" | "unknown", confidence, evidence[], openQuestions[] }
Out of scope: fixes, bug reports, other tests.
Facts, not the conversation
A subagent does not inherit the coordinator’s conversation. It starts with its own system prompt, the prompt the coordinator passes in the Agent tool call, its tool definitions and the project’s CLAUDE.md (if the settings load it). It does not get the coordinator’s history, not the logs it read, not earlier tool results. If a specialist needs a fact, the brief must contain it. Exam scenarios often hide this: “the investigator ignored the commit the coordinator had already found” usually means the commit was never put in the brief.
(Claude Code also has fork subagents, which do start from a copy of the conversation. The subagents you define with agents, as TestPilot does, do not.)
The coordinator may have read twelve logs and discussed three plans. None of that belongs in a specialist’s brief. Pass the facts the specialist needs, in a structured block, and nothing else. A small context is cheaper, faster and less confusing, and it makes the specialist’s behaviour easier to test.
Tool scoping per role
| Agent | Allowed tools | Explicitly not |
|---|---|---|
| Flaky analyst | get_test_history, read_log | commit diff, issue tracker |
| Root-cause investigator | read_log, get_commit_diff | issue tracker |
| Bug writer | search_issues, create_issue (proposal) | logs, diffs (it gets findings, not raw data) |
| Coordinator | starting subagents | any external system |
Only one agent can touch the issue tracker. If anything goes wrong elsewhere, it cannot turn into a wrong ticket.
Test a brief in isolation
A specialist is a unit you can test on its own:
- run the flaky analyst alone on the golden cases that are about flakiness
- check its result schema and its verdicts
- only then put it in the team
If a specialist fails on its own, the team will not fix it.
Exercise
Write the briefs for the three specialists using the five questions. Run the flaky analyst alone on t-004 (flaky) and t-002 (not flaky) and check both results.
Compare with solution/lesson-40-triage-team, which covers lessons 34–40 (see docs/exercises.md, module 5).