## How should loops work in custom stages?

Current pipeline has built-in review loops (PM ↔ PM Reviewer, Architect ↔ Architect Reviewer). In blocky mode, how are they expressed?

A

### Implicit Loop Pairs

Certain stage pairs auto-loop when placed adjacent. No extra syntax needed — the pipeline detects known reviewer pairs.

    custom_stages:
      - pm              # ← these two auto-loop
      - pm_reviewer     #   (max_prd_revisions times)
      - architect
      - architect_reviewer  # ← also auto-loops
      - engineer
      - reviewer

✅ Simple config, familiar feel
⚠️ Magic behaviour — not obvious from config alone

B

### Explicit Loop Block

A special `loop:` block wraps stages that should repeat, with a `max:` count and an `until:` condition (e.g. APPROVED verdict).

    custom_stages:
      - loop:
          max: 3
          until: APPROVED
          stages:
            - pm
            - pm_reviewer
      - architect
      - loop:
          max: 3
          until: APPROVED
          stages:
            - architect
            - architect_reviewer
      - engineer
      - reviewer

✅ Explicit, any stage can loop
⚠️ Verbose YAML — hard to write by hand

C

### Hybrid: Implicit pairs + GUI generator

Keep implicit loop pairs for known reviewer stages (simple case). Provide a GUI config generator as a web tool — drag blocks, configure loop counts, export valid YAML. The YAML is still the source of truth.

🧩 GUI Config Generator → exports to config.yaml
📋 PM
🔁 +PM Review
max: 3
→
🏗️ Architect
🔁 +Arch Review
max: 3
→
+ Add

✅ Easy to use, validates structure
✅ YAML remains human-readable
⚠️ GUI tool needs to be built

Note on GUI generator

The GUI would be a small local web app (`python main.py --config-builder`) — opens in browser, lets you drag stage blocks, set loop counts and skip flags, then generates a validated `config.yaml` snippet to copy or save. No separate install needed.