Drive concurrent soloterm subagents as one eager wake/reap loop. A child's completion wakes you the instant it lands — nothing goes stale, leaks, or waits on a barrier.
- Learn tools on demand, never from memory:
help(topic="timers"),help(topic="spawning"),help(topic="inspection"). - First call:
whoamimust return yourprocess_id. No soloterm → stop and say so. - Keep a private map of each task ↔ its
process_id.
The loop
1. Dispatch
spawn_agent(agent_tool_id=N, extra_args=["--ax-screen-reader"])per task;send_input(process_id=pid, input=<prompt>)with the returnedagent_instructionsprepended. Record task ↔ pid.- Arm one wake over the live pids:
timer_fire_when_idle_any([pid…], guard_ms, body)._any, never_all. - Pack
bodywith the live pids, the map, and "run the wake step".
2. Wake
Idle ≠ done — idle only means look.
get_process_output(process_id=pid). From its output decide:- finished → step 3.
- still working →
send_inputthe reply or nudge; re-arm (step 4). - stuck / errored → reap; surface to the human.
3. Reap + advance
close_process(process_id=pid).- Dispatch whatever this completion unblocks — back through step 1. Don't wait for siblings.
- Report the live children and what just finished. Never pause for approval.
4. Re-arm
timer_fire_when_idle_any over the still-live pids. Repeat until none are live.
Exit
Sweep: close_process every pid in your map, timer_cancel every pending timer. Leave zero live children.