From 5eefa309cbbd7c023023b3393c08c5f6b3c783dd Mon Sep 17 00:00:00 2001 From: Christian Nennemann Date: Fri, 3 Apr 2026 06:25:27 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20redesign=20adaptation=20rules=20per=20Gu?= =?UTF-8?q?ardian=20review=20=E2=80=94=20resolve=20race=20conditions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guardian review (Sprint 1) found critical issues in adaptation rules: - A2 couldn't skip already-spawned parallel reviewers (race condition) - A1 escalated then A2 skipped the escalated reviewers (self-defeating) - A3 "Pause" conflicted with parallel agent execution - A1's "thorough" override was unreachable dead code Fixes: - Reorder rules: A3 (after Plan) → A2 (after Guardian) → A1 (after Check) - Guardian now runs first in Check phase, A2 evaluated before spawning others - A2 doesn't apply to escalated workflows or first cycle of thorough - A3 task-understanding pause runs before Do phase (no cancellation needed) - Added explicit evaluation order diagram --- skills/orchestration/SKILL.md | 57 +++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/skills/orchestration/SKILL.md b/skills/orchestration/SKILL.md index c16a28a..eb680df 100644 --- a/skills/orchestration/SKILL.md +++ b/skills/orchestration/SKILL.md @@ -21,35 +21,46 @@ Otherwise, assess the task and pick: ## Workflow Adaptation Rules -The initial workflow choice is a starting point, not a commitment. These rules adapt the workflow at runtime based on signals from Creator and Guardian. Evaluate in order after each relevant phase. +The initial workflow choice is a starting point, not a commitment. These rules adapt the workflow at runtime. Each rule specifies when it evaluates (which phase boundary). -### A1: Conditional Escalation (fast → standard) - -**When:** Guardian rejects with 2+ CRITICAL findings in a `fast` workflow. -**Action:** Escalate to `standard` for the next cycle — add Skeptic + Sage to the reviewer roster. -**Why:** If Guardian found serious issues, more perspectives help find root causes. -**Override:** If A3 already escalated to `thorough`, do nothing (already higher). - -### A2: Guardian Fast-Path (skip remaining reviewers) - -**When:** Guardian finds 0 CRITICAL and 0 WARNING in a `standard` or `thorough` workflow. -**Action:** Skip Skeptic, Sage, and Trickster. Proceed directly to Act phase (merge). -**Why:** Guardian's security review is the strictest gate. Clean pass = safe to merge without additional review cost. -**Override:** Suppressed if A1 just triggered in the same cycle. Do not fast-path an escalated workflow. -**Log:** Note "Guardian fast-path taken — remaining reviewers skipped" in orchestration report. - -### A3: Confidence-Triggered Escalation +### A3: Confidence Gate (evaluates: after Plan, before Do) **When:** Creator's confidence table has any axis below 0.5. **Action by axis:** | Axis | Score < 0.5 Action | |------|-------------------| -| Task understanding | **Pause.** Ask user to clarify. Do not proceed until >0.5 or user overrides. | -| Solution completeness | **Upgrade to standard.** Add Explorer before proceeding. | -| Risk coverage | **Spawn mini-Explorer** for the specific risky area (parallel, 5 min max). Don't block other phases. | +| Task understanding | **Pause.** Ask user to clarify before proceeding. Do not spawn Maker. | +| Solution completeness | **Upgrade to standard.** Add Explorer before Maker starts. | +| Risk coverage | **Spawn mini-Explorer** for the specific risky area (parallel, 5 min max). Maker can proceed. | -Multiple axes can trigger simultaneously — handle in parallel. +A3 runs before any Do/Check agents spawn, so there are no cancellation issues. + +### A1: Conditional Escalation (evaluates: after Check, before next cycle) + +**When:** Guardian rejects with 2+ CRITICAL findings in a `fast` workflow. +**Action:** Escalate to `standard` for the **next cycle** — add Skeptic + Sage to the reviewer roster. +**Why:** If Guardian found serious issues, more perspectives help find root causes. +**Sticky:** Once escalated, the workflow stays escalated for all remaining cycles. A2 does not apply to escalated workflows. + +### A2: Guardian Fast-Path (evaluates: after Guardian, before spawning other reviewers) + +**When:** Guardian finds 0 CRITICAL and 0 WARNING in a non-escalated `standard` or `thorough` workflow. +**Action:** Do not spawn Skeptic, Sage, or Trickster. Proceed directly to Act phase. +**Why:** Guardian's security review is the strictest gate. Clean pass = safe to skip additional reviewers. +**Critical:** Evaluate A2 **after Guardian completes but before other reviewers are spawned.** Do not spawn reviewers in parallel with Guardian — spawn Guardian first, check A2, then spawn remaining reviewers only if A2 doesn't trigger. +**Does not apply to:** Escalated workflows (A1 triggered), or first cycle of `thorough` workflows (Trickster is mandatory on first pass). +**Log:** Note "Guardian fast-path taken" in orchestration report. + +### Evaluation Order + +``` +Plan phase completes → A3 (confidence gate) + ↓ +Guardian completes → A2 (fast-path check) → if clean, skip other reviewers + ↓ if not, spawn other reviewers +Check phase done → A1 (escalation check) → if 2+ CRITICALs in fast, next cycle is standard +``` ## Step 1: Plan Phase @@ -148,9 +159,9 @@ Agent( ## Step 3: Check Phase -Spawn reviewers **in parallel** — they read the Maker's changes independently. +Spawn Guardian **first**. After Guardian completes, check adaptation rule A2 (fast-path). If A2 triggers (0 CRITICAL, 0 WARNING, non-escalated workflow), skip remaining reviewers and proceed to Act. Otherwise, spawn remaining reviewers **in parallel**. -### Guardian +### Guardian (always runs first) **Context to include:** Maker's git diff, proposal risk section only. **Context to exclude:** Explorer's research, full proposal, other reviewer outputs.