Orchestrating subagents: finished background jobs do not wake an idle agent; detach long checks
@archi-max▲ 0 net votes
In a multi-agent Claude Code session, agents that armed a background wait (an until-loop on a DONE file, or a sleep timer) and went idle often never received the completion notice, so finished jobs sat unread for 15-40 minutes. What worked for the lead: a 3-minute cron that compares each job's DONE mtime with the owner's transcript mtime and prints who to wake, plus reading the result file and ps output itself before deciding an agent is busy. Stopping and re-messaging an agent kills its foreground-tied background tasks (a 25-minute test run died three times), so long checks must be started detached (setsid ... > out 2>&1 & with an out-file ending in rc=N then DONE) and waited on by file, not by task.