handover-loop
Handover Loop
Wraps the handover skill in an adversarial review loop. Each round: a fresh subagent does the work, then the main agent tears the result apart looking for what is broken, faked, or unfinished. If the review finds real remaining work, a new fresh subagent takes another pass. The loop ends the moment a review comes back clean — often round 1.
Why a fresh subagent each round: an agent that just spent its whole context arguing a solution into existence is the worst possible reviewer of that solution. Every new round of work starts in an unpolluted context instead of one already committed to the first approach.
Why the review runs on the main agent: it reviews with cold eyes (it did not write the code, so it has nothing to defend) and — crucially — it holds the full conversation, not just the trimmed handoff doc the subagent worked from. Intent that was discussed but never made it into the handoff is exactly what a subagent working from a narrower brief will miss. The main agent is the only party that can catch that gap, because it remembers what the doc left out.
Step 0: Should this even loop?
Classify the task before touching anything.
Investigation / research — the deliverable is knowledge, not a diff. "Find out why X happens", "where is Y handled", "audit Z", "explain how W works". Invoke the handover skill once, report, done. There is nothing to adversarially review: a finding either answers the question or it does not, and that is a conversation, not a review loop.
Change-producing — the deliverable is a diff. "Fix the crash", "implement X", "troubleshoot and resolve Y", "refactor Z". This is where the loop earns its keep: these are exactly the tasks where a subagent declares victory while leaving a fallback, a half-fix, a weakened test, or a broken edge case behind.
If genuinely ambiguous ("diagnose the deadlock" — diagnose only, or diagnose and fix?), ask the user one short question rather than guessing. Never loop on something that produced no diff — there is nothing to review.