From 11d86423bac52c11d32977e306269fa814e7d7d7 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 28 Dec 2025 16:16:00 -0800 Subject: [PATCH] witness patrol: nuke command already correct for MERGED handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../formulas/mol-witness-patrol.formula.toml | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.beads/formulas/mol-witness-patrol.formula.toml b/.beads/formulas/mol-witness-patrol.formula.toml index ad30b862..0e638fe2 100644 --- a/.beads/formulas/mol-witness-patrol.formula.toml +++ b/.beads/formulas/mol-witness-patrol.formula.toml @@ -21,7 +21,7 @@ inbox-check ─► process-cleanups ─► check-refinery ─► survey-workers │ ┌──────────────────────────────────────────────────┘ ▼ - ping-deacon ─► context-check ─► loop-or-exit + check-swarm ─► ping-deacon ─► context-check ─► loop-or-exit ``` No dynamic arms. No fanout gates. No persistent nudge counters. @@ -266,10 +266,40 @@ gt mail send mayor/ -s "Escalation: stuck" \\ **ZFC Principle**: Trust agent_state from beads. Don't infer state from PID/tmux.""" +[[steps]] +id = "check-swarm-completion" +title = "Check if active swarm is complete" +needs = ["survey-workers"] +description = """ +If Mayor started a batch (SWARM_START), check if all polecats have completed. + +**Step 1: Find active swarm tracking wisps** +```bash +bd list --wisp --labels=swarm --status=open +``` +If no active swarm, skip this step. + +**Step 2: Count completed polecats for this swarm** + +Extract from wisp labels: swarm_id, total, completed, start timestamp. +Check how many cleanup wisps have been closed for this swarm's polecats. + +**Step 3: If all complete, notify Mayor** +```bash +gt mail send mayor/ -s "SWARM_COMPLETE: " -m "All polecats merged. +Duration: minutes +Swarm: " + +# Close the swarm tracking wisp +bd close --reason "All polecats merged" +``` + +Note: Runs every patrol cycle. Notification sent exactly once when all complete.""" + [[steps]] id = "ping-deacon" title = "Ping Deacon for health check" -needs = ["survey-workers"] +needs = ["check-swarm-completion"] description = """ Send WITNESS_PING to Deacon for second-order monitoring.