[FEATURE] Explicit and callable consolidation subagent/join pattern
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
I have been fussing with this for months now, but as the underlying claude code toolset changes, it's no longer possible for me to reliably simulate it myself.
What is desperately needed to make parallel subagents work context-efficiently is an explicit way for claude to launch a subagent to wait on them all, and return a single distilled message with their results.
There are some people (me) who run a large swarm of haiku agents in parallel to leverage the speed and cost savings of haiku while still catching the majority of bugs. Especially since there's overlap in some of the bugs the agents find, this can dump 10-20k tokens in the context window as they all finish and emit the <task-notification> blocks.
Since they now emit the <task-notification> directly into the main context, I can't direct a subagent to just wait AgentOutput or TaskOutput to keep the context clean.
It kinda seems like the task notification blocks stack up across compaction too? I've been seeing weird "leakage" of some kind that progressively uses more and more context as compaction events recur, which leads to intense thrashing as claude tries to finish a workflow with progressively smaller and smaller available context.
Proposed Solution
The high level:
Claude code needs the ability to spawn parallel tasks that can then be intelligently joined later without spamming <task-notification> blocks in the main context window.
I am going to propose you add some kind of Join tool that a subagent can use to intelligently wait on the results. It can have prompt-based hooks to be intelligent instead of risking a permanent hang.
I am opinionated as to whether this should be merely a tool provided to subagents or a built in subagent that can be used natively for this purpose.
Alternative Solutions
I have tried like a dozen iterations of subagents using TaskOutput and AgentOutput and reading the raw .output files. The latest iterations do work, but they don't keep the main context clean.
Priority
High - Significant impact on productivity
Feature Category
Performance and speed
Use Case Example
- Begin a "review loop"
- Launch 19 parallel (haiku) review subagents
- Wait for all 19 to finish, get a distilled response containing all 19 subagent findings (deduplicated and distilled)
- Launch (opus) subagent to examine them for validity and attempt to fix
- Return to 1 until all 19 review agents return zero critical, high, or medium issues
(this is the workflow that quickly thrashes for me)
Additional Context
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗