diff --git a/internal/formula/formulas/mol-deacon-patrol.formula.toml b/internal/formula/formulas/mol-deacon-patrol.formula.toml index f07b42e9..7cb54263 100644 --- a/internal/formula/formulas/mol-deacon-patrol.formula.toml +++ b/internal/formula/formulas/mol-deacon-patrol.formula.toml @@ -23,7 +23,7 @@ Witnesses detect it and escalate to the Mayor. The Deacon's agent bead last_activity timestamp is updated during each patrol cycle. Witnesses check this timestamp to verify health.""" formula = "mol-deacon-patrol" -version = 5 +version = 6 [[steps]] id = "inbox-check" @@ -148,6 +148,49 @@ bd gate list --json After closing a gate, the Waiters field contains mail addresses to notify. Send a brief notification to each waiter that the gate has cleared.""" +[[steps]] +id = "dispatch-gated-molecules" +title = "Dispatch molecules with resolved gates" +needs = ["gate-evaluation"] +description = """ +Find molecules blocked on gates that have now closed and dispatch them. + +This completes the async resume cycle without explicit waiter tracking. +The molecule state IS the waiter - patrol discovers reality each cycle. + +**Step 1: Find gate-ready molecules** +```bash +bd mol ready --gated --json +``` + +This returns molecules where: +- Status is in_progress +- Current step has a gate dependency +- The gate bead is now closed +- No polecat currently has it hooked + +**Step 2: For each ready molecule, dispatch to the appropriate rig** +```bash +# Determine target rig from molecule metadata +bd mol show --json +# Look for rig field or infer from prefix + +# Dispatch to that rig's polecat pool +gt sling /polecats +``` + +**Step 3: Log dispatch** +Note which molecules were dispatched for observability: +```bash +# Molecule dispatched to /polecats (gate cleared) +``` + +**If no gate-ready molecules:** +Skip - nothing to dispatch. Gates haven't closed yet or molecules +already have active polecats working on them. + +**Exit criteria:** All gate-ready molecules dispatched to polecats.""" + [[steps]] id = "check-convoy-completion" title = "Check convoy completion" @@ -258,7 +301,7 @@ Keep notifications brief and actionable. The recipient can run bd show for detai [[steps]] id = "health-scan" title = "Check Witness and Refinery health" -needs = ["trigger-pending-spawns", "gate-evaluation", "fire-notifications"] +needs = ["trigger-pending-spawns", "dispatch-gated-molecules", "fire-notifications"] description = """ Check Witness and Refinery health for each rig.