docs: parent must NEVER actively wait for subagent results

This commit is contained in:
Levi Neely 2026-05-17 10:38:38 +02:00
parent 3eb5152ded
commit 5633af2d29
1 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,9 @@ Remaining args: the task prompt (immediate task only — coordination lives in t
## Returning results to the parent
Subagents signal completion by writing directly to `s/{parent_session_id}/prompt`. This wakes the parent's idle session and delivers the result as its next turn input — no polling required.
Subagents signal completion by writing directly to `s/{parent_session_id}/prompt`. This delivers the result as the parent's next queued turn — no polling, no blocking, no active waiting.
**Critical**: The parent must NEVER actively wait for subagent results. No `statewait`, no polling loops, no blocking reads. After spawning, the parent either continues its own work or ends its turn. When a child writes to the parent's prompt, the message queues and drains automatically when the parent next idles. This avoids wasting expensive coordinator tokens on idle waiting and eliminates coordination deadlocks.
The result written to the parent's prompt should be compact and unambiguous. Use this format: