--- name: workflow-design description: Use when designing custom orchestration workflows -- choosing which archetypes run in each PDCA phase, setting exit conditions, and configuring PDCA cycles. --- # Workflow Design -- PDCA Cycles PDCA cycles spiral upward: each cycle incorporates feedback from the previous one. ## Built-in Workflows | Workflow | Plan | Do | Check | Exit | Max Cycles | |----------|------|----|-------|------|------------| | `fast` | Creator | Maker | Guardian | approve/reject | 1 | | `standard` | Explorer + Creator | Maker | Guardian + Skeptic + Sage | all_approved | 2 | | `thorough` | Explorer + Creator | Maker | Guardian + Skeptic + Sage + Trickster | all_approved | 3 | ## Designing Custom Workflows **Step 1: Identify the concern** | Risk | Emphasize in Check | |------|-------------------| | Security | Guardian + Trickster | | Correctness | Skeptic + Sage | | Performance | Custom `perf-tester` | | Compliance | Custom `compliance-auditor` | | Data integrity | Custom `db-specialist` | **Step 2: Phase assignment rules** - Plan always includes Creator - Do always includes Maker - Check needs at least one reviewer - Max 3 archetypes per phase - Explorer goes in Plan only; Maker goes in Do only **Step 3: Exit conditions** | Condition | Cycle ends when | |-----------|----------------| | `all_approved` | Every reviewer says APPROVED | | `no_critical` | No CRITICAL findings | | `convergence` | No new issues vs previous cycle | | `always` | Runs all maxCycles unconditionally | **Step 4: Max cycles** -- 1 (fast), 2 (balanced), 3 (thorough). 4+ rarely useful. ## Hook Points Define in `.archeflow/hooks.yaml`: | Hook | When | Typical use | |------|------|-------------| | `pre-plan` | Before Explorer/Creator | Lint, clean baseline | | `post-plan` | After Creator's proposal | Validate constraints | | `pre-do` | Before Maker | Check worktree | | `post-do` | After Maker commits | Smoke test | | `post-check` | After reviewers | Run test suite | | `pre-merge` | Before merge | Migration safety | | `post-merge` | After merge | Integration tests | Each hook has `command`, `description`, and `fail_action` (abort / warn / ignore / cycle_back / revert). ## Anti-Patterns - All 7 archetypes in Check (diminishing returns) - maxCycles > 4 (burns tokens without convergence) - Skipping Check phase - Maker in Plan phase - One archetype in every phase (just a single agent with overhead)