concepts

Coordination loops — review and ideation across multiple agents

Multi-turn delegation patterns: how brainclaw drives review-and-fix cycles between two agents and runs ideation loops where one agent critiques another. Built on bclaw_coordinate + bclaw_loop.

Most coordination is one-shot: assign a scope, agent works, agent releases. But two patterns need multi-turn delegation — where the work bounces back and forth until it converges:

  • Review loop — author writes, reviewer critiques, author fixes, reviewer re-checks. Either round can apply edits (symmetric mode) or only the author can (asymmetric mode).
  • Ideation loop — champion proposes, critic challenges, champion responds. Iterates until exit condition is hit (consensus, max-iterations, runtime gate).

Both run on the same machinery: bclaw_coordinate(intent=…) opens the loop and dispatches the first turn; bclaw_loop(intent=…) drives subsequent turns from the assigned slot.

Review loop

The shape — claude-code is the author, codex is the reviewer:

# Author opens the review (creates a candidate + opens a loop)
bclaw_coordinate intent=review \
  open_loop=true \
  review_mode=symmetric \
  targetAgents=[codex] \
  task="Review the JWT refactor in src/auth/" \
  scope="src/auth/"
# → candidate cnd_abc, loop lop_xyz, turn assigned to codex (slot=reviewer)

Codex’s session sees a review_request in its inbox. After reading the diff:

# Reviewer turn — submit findings
bclaw_loop intent=complete_turn \
  loop_id=lop_xyz \
  artifacts=[{kind: "review_findings", body: "..."}]
# → turn closed, next turn assigned to claude-code (slot=author) for fixes

Claude-code applies the fixes on the same branch, then drives the next turn:

bclaw_loop intent=turn loop_id=lop_xyz
# → turn assigned: read findings, apply fixes
bclaw_loop intent=complete_turn loop_id=lop_xyz \
  artifacts=[{kind: "fix_summary", body: "..."}]
# → loop converges or routes back to reviewer

When the reviewer says LGTM:

bclaw_loop intent=close loop_id=lop_xyz verdict=approved
# → candidate accepted, loop closed, change ready to merge

review_mode — symmetric vs asymmetric

ModeReviewer turnAuthor turnUse case
asymmetric (default)reads diff, writes findingsapplies all fixesclassic PR review
symmetricreads diff, writes findings AND applies symmetric fixes itselfonly handles non-symmetric fixesspec / doc reviews where the reviewer can edit cheaply

Symmetric halves the round-trips on docs and config changes — the reviewer fixes typos and small inaccuracies inline rather than handing them back.

Ideation loop

bclaw_coordinate intent=ideate \
  targetAgents=[gemini, codex] \
  task="Should we ship the federation phase 1 in v1.6 or wait for v2?" \
  scope="federation"
# → ideation loop with proposal seed, dispatches one critique turn per critic

Each critic gets a context-filtered brief assembled from project memory. Critics’ filter is asymmetric on purpose: they read adversarial categories only (traps, feedback memos, runtime notes, prior critique history, related decisions) — not the supportive design docs the champion wrote. This produces useful adversarial pressure even from a single model.

Critics return critique artifacts. Phase advance from critiquesynthesis is gated: ≥3 critique artifacts required before the loop can proceed (phase_advance_blocked event when the gate fails). Iteration block:

cycle: 1
max_iterations: 3
exit_when:
  - consensus     # ≥(N-1)/N critics aligned
  - timeout       # 24h since last turn
  - max_iter      # cycle == max_iterations

Which intent to use

IntentUse
bclaw_coordinate intent=assignone-shot work assignment, no loop
bclaw_coordinate intent=consultasync question, no claim
bclaw_coordinate intent=review (open_loop=true)review-and-fix multi-turn
bclaw_coordinate intent=ideateproposal critique multi-turn
bclaw_loop intent=turn / complete_turn / advance / closedrive YOUR slot’s turn in an open loop
bclaw_loop intent=openanti-pattern — opens a loop without dispatching, nothing runs

Anti-pattern: never call bclaw_loop intent=open directly. It creates the loop structure with no dispatch, so the reviewer/critic never gets a turn. Always open via bclaw_coordinate(intent=review|ideate, open_loop=true) so the dispatch fires together.

See parallel feature work for review loops in production, and the agent autonomy contract section that binds protocol-defined transitions as MUST-execute (so the reviewer doesn’t pause to ask the human “should I send this reply?”).