A subagent compresses research
When you need to review many modules, tests, configurations, or logs, a subagent can move the search into a separate context and return only a concise, verifiable result to the main session.
A subagent is a research tool, not a replacement for the final decision. The main session is responsible for checking the conclusions and making changes in the repository.
| Good candidates for delegation | Do not delegate |
|---|---|
| Find all integrations with the payment service | Read one short file |
| Trace the complete refund flow | Investigate one trace line |
| Collect related tests | Make a small edit |
| Summarize a large diff or logs | Hold a long interactive conversation |
A mini-task spec for a subagent
Investigate the refund operation path.
Check controllers, services, payment client, config, and tests.
Return a concise conclusion, file:line evidence,
assumptions, open questions, and next steps.
Do not change files; do not copy large code fragments.Expected result
- **Conclusion** — a few sentences about the flow you found;
- **Evidence** — specific references to files and lines;
- **Assumptions** — what follows from indirect signals;
- **Open questions** — what remains unverified;
- **Next actions** — what the main session should check.
After the conclusion is returned
- Manually check two or three key locations.
- Compare the conclusion with a test or command.
- Separate confirmed information from assumptions.
- Update the inventory, API map, or investigation note through a normal diff.
- Do not transfer an unverified summary into documentation as fact.
Delegation boundaries
Do not use a subagent for every small task or build a complex multi-agent system during a simple investigation. Delegation should reduce noise while preserving human control over the evidence and the final result.
Canonical lesson source · JavaRush
Open JavaRush material