--- name: workflow-design description: Use when designing custom orchestration workflows — choosing which archetypes run in each PDCA phase, setting exit conditions, and configuring the ArcheHelix cycle. --- # Workflow Design — The ArcheHelix ArcheFlow's PDCA cycles spiral upward through iterations — each cycle incorporates feedback from the previous one, producing progressively better results. We call this the **ArcheHelix**: a rising spiral of Plan → Do → Check → Act, where each turn is informed by all previous turns. ``` ╱ Act ──────────── Done ✓ ╱ ↑ ╱ Check (review) ╱ ↑ ╱ Do (implement) ╱ ↑ ╱ Plan (design) ← Cycle 2 (with feedback from Cycle 1) ╱ ↑ ╱ Act ─┘ (issues found → feed back) │ ↑ │ Check (review) │ ↑ │ Do (implement) │ ↑ │ Plan (design) ← Cycle 1 (initial) ``` ## Built-in Workflows ### `fast` — Single Turn ``` Plan: Creator designs Do: Maker implements (worktree) Check: Guardian reviews Act: Approve or reject (1 cycle max) ``` **Use for:** Bug fixes, small changes, low-risk tasks. ### `standard` — Double Helix ``` Plan: Explorer researches → Creator designs Do: Maker implements (worktree) Check: Guardian + Skeptic + Sage review (parallel) Act: Approve or cycle (2 cycles max) ``` **Use for:** Features, refactors, moderate-risk changes. ### `thorough` — Triple Helix ``` Plan: Explorer researches → Creator designs Do: Maker implements (worktree) Check: Guardian + Skeptic + Sage + Trickster (parallel) Act: Approve or cycle (3 cycles max) ``` **Use for:** Security-critical, public APIs, infrastructure changes. ## Designing Custom Workflows ### Step 1: Identify the Concern What's the primary risk? | Primary Risk | Emphasize | |-------------|-----------| | Security | Guardian + Trickster in Check | | Correctness | Skeptic + Sage in Check | | Performance | Custom `perf-tester` archetype | | Compliance | Custom `compliance-auditor` archetype | | Data integrity | Custom `db-specialist` archetype | | User experience | Custom `ux-reviewer` archetype | ### Step 2: Assign Phases Rules: - **Plan** always includes Creator (someone must propose) - **Do** always includes Maker (someone must build) - **Check** needs at least one reviewer - Max 3 archetypes per phase (diminishing returns beyond that) - Explorer goes in Plan only (research before design) - Maker goes in Do only (build from plan, not from scratch) ### Step 3: Set Exit Conditions | Condition | When Cycle Ends | Best For | |-----------|----------------|----------| | `all_approved` | Every Check reviewer says APPROVED | Consensus-driven (default) | | `no_critical` | No CRITICAL findings in Check output | Speed with safety net | | `convergence` | No new issues vs. previous cycle | Diminishing returns detection | | `always` | Runs all maxCycles unconditionally | Research, exploration | ### Step 4: Set Max Cycles - **1 cycle:** Fast, low-risk (fast workflow) - **2 cycles:** Balanced — one shot + one fix (standard workflow) - **3 cycles:** Thorough — usually converges by cycle 3 - **4+ cycles:** Rarely useful. If 3 cycles don't converge, the task needs human input. ## Example Custom Workflows ### Security-First ``` Plan: Explorer (threat modeling) → Creator Do: Maker Check: Guardian + Trickster (parallel) Exit: all_approved, max 3 cycles ``` ### Research-Heavy ``` Plan: Explorer (deep research) → Creator Do: Maker Check: Skeptic + Sage (parallel) Exit: all_approved, max 2 cycles ``` ### Domain-Specific (with custom archetypes) ``` Plan: Explorer → Creator Do: Maker Check: Guardian + db-specialist + compliance-auditor (parallel) Exit: all_approved, max 2 cycles ``` ### Minimal Validation ``` Plan: Creator (no research) Do: Maker Check: Guardian Exit: no_critical, max 1 cycle ``` ## Anti-Patterns - **Kitchen sink:** Putting all 7 archetypes in Check. Most can't add value simultaneously. - **Infinite helix:** maxCycles > 4 burns tokens without convergence. - **Reviewerless Do:** Skipping Check phase "to save time." You'll pay in bugs. - **Maker in Plan:** Maker should implement from a proposal, not design on the fly. - **Solo orchestration:** One archetype in every phase. That's just a single agent with extra steps.