@mmerterden/multi-agent-pipeline 10.0.6 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +1 -0
  3. package/package.json +1 -1
  4. package/pipeline/agents/android-architect.md +3 -3
  5. package/pipeline/agents/backend-architect.md +3 -3
  6. package/pipeline/agents/code-reviewer.md +4 -4
  7. package/pipeline/agents/ios-architect.md +3 -3
  8. package/pipeline/agents/security-auditor.md +3 -3
  9. package/pipeline/commands/multi-agent/dev-autopilot.md +3 -3
  10. package/pipeline/commands/multi-agent/dev-local-autopilot.md +2 -2
  11. package/pipeline/commands/multi-agent/dev-local.md +3 -3
  12. package/pipeline/commands/multi-agent/dev.md +9 -9
  13. package/pipeline/commands/multi-agent/help.md +10 -10
  14. package/pipeline/commands/multi-agent/refs/channels/jira.md +1 -0
  15. package/pipeline/commands/multi-agent/refs/cross-cli-contract.md +7 -3
  16. package/pipeline/commands/multi-agent/refs/features/model-fallback.md +36 -18
  17. package/pipeline/commands/multi-agent/refs/phases/operations.md +15 -5
  18. package/pipeline/commands/multi-agent/refs/phases/phase-0-init.md +16 -2
  19. package/pipeline/commands/multi-agent/refs/phases/phase-1-analysis.md +8 -3
  20. package/pipeline/commands/multi-agent/refs/phases/phase-2-planning.md +1 -1
  21. package/pipeline/commands/multi-agent/refs/phases/phase-4-review.md +30 -8
  22. package/pipeline/commands/multi-agent/resume.md +4 -1
  23. package/pipeline/commands/multi-agent.md +5 -5
  24. package/pipeline/lib/fetch-confluence.sh +2 -2
  25. package/pipeline/lib/fetch-crashlytics.sh +2 -2
  26. package/pipeline/lib/fetch-fortify.sh +1 -1
  27. package/pipeline/lib/fetch-swagger.sh +1 -1
  28. package/pipeline/lib/figma-screenshot.sh +2 -2
  29. package/pipeline/preferences-template.json +8 -1
  30. package/pipeline/schemas/agent-state.schema.json +8 -0
  31. package/pipeline/schemas/figma-project-config.schema.json +39 -0
  32. package/pipeline/schemas/prefs.schema.json +3 -3
  33. package/pipeline/scripts/cost-table.json +0 -6
  34. package/pipeline/scripts/fixtures/install-layout.tsv +2 -2
  35. package/pipeline/scripts/phase-tracker.sh +7 -0
  36. package/pipeline/scripts/smoke-model-fallback.sh +20 -12
  37. package/pipeline/scripts/validate-state.mjs +108 -0
  38. package/pipeline/scripts/write-state.mjs +15 -4
  39. package/pipeline/skills/figma-common/README.md +8 -1
  40. package/pipeline/skills/figma-common/figma-bottom-sheets/SKILL.md +137 -0
  41. package/pipeline/skills/figma-common/figma-evolve-component/SKILL.md +61 -0
  42. package/pipeline/skills/figma-common/figma-navigation/SKILL.md +142 -0
  43. package/pipeline/skills/figma-common/figma-overlays/SKILL.md +128 -0
  44. package/pipeline/skills/figma-common/figma-ui-patterns/SKILL.md +1 -0
  45. package/pipeline/skills/figma-common/figma-ui-patterns/patterns/animated-gradient-border.md +112 -0
  46. package/pipeline/skills/figma-ios/figma-to-component/SKILL.md +15 -0
  47. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-3d-patterns.md +31 -0
  48. package/pipeline/skills/figma-ios/figma-to-component/phases/phase-4b-view.md +10 -0
  49. package/pipeline/skills/figma-ios/figma-to-component/reference/accessibility.md +55 -1
  50. package/pipeline/skills/figma-ios/figma-to-component/reference/orchestrator-discipline.md +1 -1
package/CHANGELOG.md CHANGED
@@ -14,6 +14,123 @@ Internal file-layout changes that don't affect the slash-command surface are sti
14
14
 
15
15
  ---
16
16
 
17
+ ## [10.2.0] - 2026-07-02
18
+
19
+ Generic SwiftUI interaction coverage for the figma-to-swiftui pipeline. Three
20
+ new cross-cutting integration skills (navigation, overlays, bottom sheets) plus
21
+ a reconcile-and-extend workflow, all native-SwiftUI-first with an optional
22
+ per-project `ui.*` config hook so the same capabilities work on any SwiftUI
23
+ codebase - no app-specific coupling. Phase 3D dev detection and Phase 4 review
24
+ both consume them.
25
+
26
+ ### Added
27
+
28
+ - **`figma-navigation` / `figma-overlays` / `figma-bottom-sheets` skills**
29
+ (`pipeline/skills/figma-common/`). Cross-cutting integration adapters, same
30
+ shape as `figma-form-integration` / `figma-price-integration`: a component
31
+ emits a typed intent / takes a caller-owned binding and never routes, presents
32
+ an app-level overlay, or owns the sheet surface. Native SwiftUI by default
33
+ (`NavigationStack`/`navigationDestination`, `.alert`/`.confirmationDialog`/
34
+ `.sheet(item:)` + ref-counted loading, `.sheet`+`presentationDetents`); a
35
+ project's own system is used only when `figma-config` declares
36
+ `ui.navigationSystem` / `ui.overlaySystem` / `ui.sheetSystem`.
37
+ - **`figma-evolve-component` workflow.** Reconcile an already-implemented
38
+ component against current Figma (drift-heal) + additively extend it for a
39
+ need, behind a mandatory human gate; distinct from `figma-to-swiftui`
40
+ (build new), `figma-mend` (rebuild), and `figma-fix` (review bug).
41
+ - **`animated-gradient-border` UI pattern** (`figma-ui-patterns/patterns/`) -
42
+ self-contained native-SwiftUI recipe (angular-gradient stroke + Reduce-Motion
43
+ gate), no external dependency.
44
+ - **`ui` block in `figma-project-config.schema.json`** - optional
45
+ `navigationSystem` / `overlaySystem` / `sheetSystem` (`mode: native | custom`
46
+ + type names). Absent → native SwiftUI.
47
+
48
+ ### Changed
49
+
50
+ - **Phase 3D pattern detection (§1.5.4).** Detects navigation / overlay /
51
+ bottom-sheet affordances and dispatches the matching integration skill
52
+ (gate-driven, per `orchestrator-discipline` Rule 4).
53
+ - **Phase 4B view (§4.7.4)** references the new skills; **`figma-to-swiftui`
54
+ accessibility reference** enriched with the VoiceOver-minimalism decision tree
55
+ (annotate only what a vision-impaired user needs; state-necessity tree;
56
+ anti-patterns).
57
+ - **Phase 4 review** (`phase-4-review.md`): Step 1.5 gains iOS interaction +
58
+ accessibility-minimalism checks (self-routing/self-presenting components,
59
+ `AnyView` through an overlay center, un-ref-counted loading, magic-number
60
+ detents, a11y over-annotation), and the new skills are injected as reviewer
61
+ reference context for SwiftUI UI diffs. Generic across SwiftUI projects.
62
+ - **`figma-to-component` SKILL.md** documents the complementary integration
63
+ skills; **`orchestrator-discipline` Rule 4** and **`cross-cli-contract`**
64
+ updated (figma-common 27 → 31, total figma skills 37 → 41).
65
+
66
+ ## [10.1.0] - 2026-06-25
67
+
68
+ Fable 5 retired (no longer available): the pipeline's top intelligence tier is
69
+ now Opus. Plus per-task cost visibility on by default, four Phase 1/4 token
70
+ economy measures, and a stability pass that bounds dispatch timeouts, heals
71
+ stale worktrees, and validates state before resume.
72
+
73
+ ### Changed
74
+
75
+ - **Fable 5 -> Opus across all routing.** The five heavy agent personas
76
+ (`code-reviewer`, `security-auditor`, `ios/android/backend-architect`) now
77
+ declare `preferredModel: opus` instead of `fable`; Phase 1 Analysis, Phase 2
78
+ Planning, Phase 4 Reviewer 1 + triage, and the `--dev` dev model all run on
79
+ Opus. This also resolves the prior CLAUDE.md-vs-phase-doc inconsistency
80
+ (CLAUDE.md already documented Opus for these stages).
81
+ - **Model fallback ladder is now `opus -> sonnet`** (was `fable -> opus ->
82
+ sonnet`). `modelFallback.fallbackModel` default is `sonnet`. The
83
+ `premiumTierUntil` date gate is kept as a generic mechanism for any future
84
+ plan-window-limited premium tier. `model-fallback.md` bumped to v10.1.0 and
85
+ `smoke-model-fallback.sh` updated to assert the new ladder + Opus personas.
86
+ - **`costBudget` defaults on in warn mode.** The proactive per-task cost ceiling
87
+ (`cost-budget-check.mjs`) now ships enabled (`onExceed: "warn"`, `maxUsd: 5`,
88
+ priced at the conservative opus rate) so runaway spend is visible live. Warn
89
+ never halts; set `onExceed: "halt"` to make the ceiling blocking, or
90
+ `enabled: false` to opt out.
91
+
92
+ ### Added
93
+
94
+ - **Phase 4 context economy (Step 1.9).** Reviewer and triage prompts now build
95
+ a byte-identical shared prefix (full diff + analysis summary + plan) so, when
96
+ the host supports prompt caching, reviewer 2/3 and triage read it at the
97
+ discounted cache-read rate instead of re-billing the diff as fresh input.
98
+ - **Single-repo diff cap.** Diffs exceeding the Phase 4 token allowance are
99
+ truncated with a `file://...review-diff.txt` pointer and a
100
+ `review.diff_truncated` metric - the single-repo equivalent of the existing
101
+ multi-repo 80% cap.
102
+ - **Phase 1 light Explore tier.** Small `bugfix`/`chore` tasks (single named
103
+ file or a referenced crash/stack frame) scan only the named area + direct
104
+ callers instead of a full-repo "very thorough" pass.
105
+ - **Triage prior-art injection cap.** Merged prior-art is capped at the 8
106
+ highest-similarity hits so a many-finding review does not inflate the triage
107
+ prompt.
108
+
109
+ ### Fixed
110
+
111
+ - **Parallel dispatch timeouts.** Phase 1 Explore and Phase 4 reviewer dispatches
112
+ are now bounded by a wall-clock budget (`EXPLORE_TIMEOUT_SECONDS` /
113
+ `REVIEWER_TIMEOUT_SECONDS`, default 180). A stalled or dead agent is dropped and
114
+ the phase proceeds with the dispatches that returned, instead of hanging
115
+ indefinitely waiting on the slowest one.
116
+ - **Worktree stale-lock heal.** Phase 0 runs `worktree prune` + `unlock` before
117
+ every `worktree add`, ending the `already exists` wedge a run killed mid-add
118
+ left behind.
119
+ - **Resume safety validation.** New `validate-state.mjs` checks `agent-state.json`
120
+ is safe to re-enter (parseable + `currentPhase` in range + well-formed
121
+ `phases`, tolerant of legacy shapes) before resume picks a phase, instead of
122
+ silently re-entering on stale state.
123
+ - **Model fallback floor.** The ladder now walks `opus -> sonnet -> haiku`
124
+ (`floorModel`, absent defaults to `haiku`) so two simultaneously-unavailable
125
+ tiers degrade instead of hard-halting the phase.
126
+ - **Visible halts + lock tuning.** Hard halts surface to stderr + tracker even in
127
+ autopilot (no more silent stops); `write-state` lock acquire window is
128
+ env-tunable (default 15s) with the stale window cut 60s -> 30s; external curls
129
+ gain `--connect-timeout 5`; `phase-tracker` gains a concurrent-safe
130
+ `MULTI_AGENT_STRICT_TASK_ID` mode; the retired `fable` price entry is removed.
131
+
132
+ ---
133
+
17
134
  ## [10.0.6] - 2026-06-23
18
135
 
19
136
  Release-plumbing patch so the stable line reaches npmjs. No behavior change to
package/README.md CHANGED
@@ -154,6 +154,7 @@ slows down the install.
154
154
 
155
155
  ## What's new
156
156
 
157
+ - **v10.1.0** (2026-06-20) - Fable 5 retired (no longer available): the five heavy agent personas plus Phase 1 / Phase 2 / Phase 4 reviewer-1 + triage and `--dev` fast mode now route to Opus (top available tier); fallback ladder is `opus -> sonnet`. Per-task cost guard (`costBudget`) now defaults on in warn mode. Token economy: Phase 4 shared cache prefix + single-repo diff cap, Phase 1 light Explore tier for small bugfixes, triage prior-art injection capped.
157
158
  - **v10.0.0** (2026-06-12) - quality major driven by a 10-category self-audit + competitive sweep: validator gates wired into phases 1/2/4 (fails closed), Phase 3 code-simplifier diff-shrink pass, Phase 4 lesson memory loop, Phase 2 cross-artifact consistency gate, skill frontmatter linter (repaired 31 SKILL.md), installer `--dry-run` + unknown-flag rejection, timeout-guarded smoke runner, adapter family deduplicated (~490 lines), CI hardening (blocking lint, npm audit, shellcheck), tag-driven npm release automation, CHANGELOG split (310KB -> 40KB).
158
159
  - **v9.10.2** (2026-06-11) - live per-phase token narration on completion; tracker mandates per-phase cost lines in the final report.
159
160
  - **v9.10.1** (2026-06-11) - Claude Fable 5 fallback contract: date gate, dispatch retry, and budget guard when the Fable tier is unavailable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmerterden/multi-agent-pipeline",
3
- "version": "10.0.6",
3
+ "version": "10.2.0",
4
4
  "description": "8-phase AI development pipeline with full orchestration on Claude Code, Copilot CLI, Cursor, Antigravity, and VS Code Copilot Chat. Analysis, planning, TDD, CLI-aware parallel review with consensus surfacing + Opus triage, default-FAIL evidence gates, secret + intent guards, per-phase cost ledger, persistent learnings memory, wiki generation, commit automation. Token-preserving uninstall.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  description: Android architect - evaluates design decisions, patterns, and module structure
3
- model: fable
4
- preferredModel: fable
5
- modelRationale: "Architecture decisions across Gradle modules, Compose stability, Hilt graphs, and migration paths run on fable (top tier, above opus). No downgrade recommended."
3
+ model: opus
4
+ preferredModel: opus
5
+ modelRationale: "Architecture decisions across Gradle modules, Compose stability, Hilt graphs, and migration paths run on opus (top available tier). No downgrade recommended."
6
6
  ---
7
7
 
8
8
  You are a senior Android architect with deep expertise in large-scale modular Android applications.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  description: Backend architect - evaluates API design, data modeling, and system architecture
3
- model: fable
4
- preferredModel: fable
5
- modelRationale: "API design + migration safety + scaling analysis are top-tier concerns; fable improves reasoning on concurrent-write / rollback edge cases in database migration reviews."
3
+ model: opus
4
+ preferredModel: opus
5
+ modelRationale: "API design + migration safety + scaling analysis are top-tier concerns; opus is the top available tier and handles concurrent-write / rollback edge cases in database migration reviews."
6
6
  ---
7
7
 
8
8
  You are a senior backend architect with expertise in API design, distributed systems, and data modeling.
@@ -1,8 +1,8 @@
1
1
  ---
2
- description: "Code reviewer for multi-agent Phase 4 - security, architecture, quality, performance. Default model is fable; Phase 4 orchestrator overrides to sonnet for Reviewer 3."
3
- model: fable
4
- preferredModel: fable
5
- modelRationale: "Reviewer 1 tier - deep security + architecture review runs on fable (top intelligence tier, above opus). Phase 4 orchestrator overrides to sonnet for Reviewer 3 (quality/correctness focus) via CLAUDE_CODE_SUBAGENT_MODEL before dispatch. Copilot CLI adds Reviewer 2 on gpt-5.4 for cross-model diversity."
2
+ description: "Code reviewer for multi-agent Phase 4 - security, architecture, quality, performance. Default model is opus; Phase 4 orchestrator overrides to sonnet for Reviewer 3."
3
+ model: opus
4
+ preferredModel: opus
5
+ modelRationale: "Reviewer 1 tier - deep security + architecture review runs on opus (top available intelligence tier). Phase 4 orchestrator overrides to sonnet for Reviewer 3 (quality/correctness focus) via CLAUDE_CODE_SUBAGENT_MODEL before dispatch. Copilot CLI adds Reviewer 2 on gpt-5.4 for cross-model diversity."
6
6
  ---
7
7
 
8
8
  # Code Reviewer Agent
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  description: iOS architect - evaluates design decisions, patterns, and module structure
3
- model: fable
4
- preferredModel: fable
5
- modelRationale: "Architecture decisions require deep reasoning across modules, protocols, and migration paths - fable is the top intelligence tier. No downgrade recommended; if cost is a concern, skip the architect consultation entirely."
3
+ model: opus
4
+ preferredModel: opus
5
+ modelRationale: "Architecture decisions require deep reasoning across modules, protocols, and migration paths - opus is the top available intelligence tier. No downgrade recommended; if cost is a concern, skip the architect consultation entirely."
6
6
  ---
7
7
 
8
8
  You are a senior iOS architect with deep expertise in large-scale modular iOS applications.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  description: Security specialist - analyzes code for vulnerabilities and compliance issues
3
- model: fable
4
- preferredModel: fable
5
- modelRationale: "Security reasoning + compliance catalog cross-reference (Apple ITMS, Google Play policy, OWASP) - false negatives are expensive; fable (top tier, above opus) further reduces miss rate on subtle vulnerabilities (auth-flow gaps, cert-pinning bypass, sensitive-data leaks)."
3
+ model: opus
4
+ preferredModel: opus
5
+ modelRationale: "Security reasoning + compliance catalog cross-reference (Apple ITMS, Google Play policy, OWASP) - false negatives are expensive; opus (top available tier) keeps the miss rate low on subtle vulnerabilities (auth-flow gaps, cert-pinning bypass, sensitive-data leaks)."
6
6
  ---
7
7
 
8
8
  You are a mobile security auditor specializing in application security.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Fastest mode: Dev (Fable) plus Autopilot. Init → Dev → Commit → Report with zero confirmations."
2
+ description: "Fastest mode: Dev (Opus) plus Autopilot. Init → Dev → Commit → Report with zero confirmations."
3
3
  ---
4
4
 
5
5
  # multi-agent dev autopilot - Fastest Path
@@ -19,7 +19,7 @@ Dev mode + Autopilot combined: a 4-phase pipeline with no confirmations, end-to-
19
19
 
20
20
  ```
21
21
  Phase 0: Init → project detection, worktree, branch, identity
22
- Phase 3: Dev → direct development on Fable
22
+ Phase 3: Dev → direct development on Opus
23
23
  Phase 6: Commit → auto commit + push + PR (no confirmations)
24
24
  Phase 7: Report → short terminal summary
25
25
  ```
@@ -47,7 +47,7 @@ Phase 7: Report → short terminal summary
47
47
  | | Full | Dev | Autopilot | **Dev+Autopilot** |
48
48
  |--|------|-----|-----------|-------------------|
49
49
  | Phases | 8 | 4 | 8 | **4** |
50
- | Model | Sonnet | Fable | Sonnet | **Fable** |
50
+ | Model | Sonnet | Opus | Sonnet | **Opus** |
51
51
  | Plan Approval Gate | ✅ (clarification + approval) | ❌ | ❌ | **❌** |
52
52
  | Confirmations (test / commit / PR) | Yes | Yes | No | **No** |
53
53
  | Review | Parallel + triage (CLI-aware) | None | Parallel + triage (CLI-aware) | **None** |
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Fastest + local - Dev(Fable) + autopilot, no worktree, zero interaction."
2
+ description: "Fastest + local - Dev(Opus) + autopilot, no worktree, zero interaction."
3
3
  allowed-tools: Agent, Bash, Read, Write, Edit, Glob, Grep, TaskCreate, TaskUpdate, TaskList, TaskGet, WebFetch, Skill
4
4
  ---
5
5
 
@@ -13,7 +13,7 @@ The triple `--dev` + `--local` + `autopilot` - the fastest form available. Zer
13
13
 
14
14
  ```
15
15
  Phase 0: Init → project detection, branch check, state (NO worktree, NO confirmation)
16
- Phase 3: Dev → direct development on Fable (automatic)
16
+ Phase 3: Dev → direct development on Opus (automatic)
17
17
  Phase 6: Commit → auto commit + push + PR (no local checkout prompt)
18
18
  Phase 7: Report → Jira / Wiki + log + knowledge/memory
19
19
  ```
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Fast mode + local - Init → Dev(Fable) → Commit → Report, no worktree."
2
+ description: "Fast mode + local - Init → Dev(Opus) → Commit → Report, no worktree."
3
3
  allowed-tools: Agent, Bash, Read, Write, Edit, Glob, Grep, TaskCreate, TaskUpdate, TaskList, TaskGet, AskUserQuestion, WebFetch, Skill
4
4
  ---
5
5
 
@@ -13,7 +13,7 @@ Dedicated form of the `--dev` + `--local` combination. A 4-phase fast pipeline (
13
13
 
14
14
  ```
15
15
  Phase 0: Init → project detection, branch check, state (NO worktree)
16
- Phase 3: Dev → direct development on Fable (Analysis + Planning + Review skipped)
16
+ Phase 3: Dev → direct development on Opus (Analysis + Planning + Review skipped)
17
17
  Phase 6: Commit → pre-commit checkout prompt, commit + push + PR
18
18
  Phase 7: Report → Jira / Wiki + log + knowledge/memory
19
19
  ```
@@ -96,7 +96,7 @@ Do NOT call TaskCreate on these CLIs - the tool does not exist and the call fa
96
96
  Routes to the orchestrator with `--dev --local` flags. Apply the `$HOME/.claude/commands/multi-agent/dev.md` pipeline in local mode:
97
97
  - Phase 0: skip worktree creation, continue on the current branch
98
98
  - Phase 1 (Analysis), Phase 2 (Planning + Approval Gate), Phase 4 (Review), and Phase 5 (User Test) are skipped (`--dev` + local/autopilot drop the interactive test gate)
99
- - Phase 3: develop on Fable (instead of the Sonnet TDD cycle)
99
+ - Phase 3: develop on Opus (instead of the Sonnet TDD cycle)
100
100
  - Phase 6: commit + push + PR (the local checkout prompt is natural in local mode - you're already there; no worktree removal needed, code is already in `$PROJECT_ROOT`)
101
101
  - Phase 7: report + channels (same as `--dev`)
102
102
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Fast development mode: Init → Dev (Fable) → Test → Commit → Report. Analysis, planning, and review phases are skipped."
2
+ description: "Fast development mode: Init → Dev (Opus) → Test → Commit → Report. Analysis, planning, and review phases are skipped."
3
3
  ---
4
4
 
5
5
  # multi-agent dev - Fast Development Mode (--dev)
@@ -20,7 +20,7 @@ description: "Fast development mode: Init → Dev (Fable) → Test → Commit
20
20
  >
21
21
  > Full contract: `refs/rules.md` "Language Application".
22
22
 
23
- A 5-phase fast pipeline: Init → Dev → Test → Commit → Report. Development runs on the Fable model (top intelligence tier).
23
+ A 5-phase fast pipeline: Init → Dev → Test → Commit → Report. Development runs on the Opus model (top intelligence tier).
24
24
 
25
25
  ## When to use it
26
26
  - Small changes, bug fixes, quick features
@@ -31,17 +31,17 @@ A 5-phase fast pipeline: Init → Dev → Test → Commit → Report. Developmen
31
31
 
32
32
  ```
33
33
  Phase 0: Init → project detection, worktree, branch, identity (full picker)
34
- Phase 3: Dev → direct development on Fable (TDD optional)
34
+ Phase 3: Dev → direct development on Opus (TDD optional)
35
35
  Phase 5: Test → User Test (interactive simulator)
36
36
  Phase 6: Commit → commit + push + PR
37
37
  Phase 7: Report → channels (Jira / Confluence / PR / Wiki)
38
38
  ```
39
39
 
40
- `--dev` skips Phase 1 (Analysis), Phase 2 (Planning + Approval Gate), and Phase 4 (Review). Phase 3 Dev runs on **Fable**. Phase 0 picker, Phase 5 test, Phase 6 commit, and Phase 7 channels are identical to the full pipeline.
40
+ `--dev` skips Phase 1 (Analysis), Phase 2 (Planning + Approval Gate), and Phase 4 (Review). Phase 3 Dev runs on **Opus**. Phase 0 picker, Phase 5 test, Phase 6 commit, and Phase 7 channels are identical to the full pipeline.
41
41
 
42
42
  ## What `--dev` does NOT skip (required)
43
43
 
44
- `--dev` skips the LLM-heavy phases (Phase 1 Analysis, Phase 2 Planning + Approval, Phase 4 Review) and runs Phase 3 Dev on Fable. Phase 0 (Init), Phase 5 (Test), Phase 6 (Commit), and Phase 7 (Report + channels) are byte-for-byte the same as the full pipeline. User-facing prompts **always run** - they exist for audit, not speed.
44
+ `--dev` skips the LLM-heavy phases (Phase 1 Analysis, Phase 2 Planning + Approval, Phase 4 Review) and runs Phase 3 Dev on Opus. Phase 0 (Init), Phase 5 (Test), Phase 6 (Commit), and Phase 7 (Report + channels) are byte-for-byte the same as the full pipeline. User-facing prompts **always run** - they exist for audit, not speed.
45
45
 
46
46
  ### Required user prompts (Phase 0)
47
47
 
@@ -127,11 +127,11 @@ No "pre-existing" claim is allowed without a baseline reproduce.
127
127
 
128
128
  ## Skipped phases (definitive list)
129
129
 
130
- - Phase 1 (Analysis → Fable deep-think + explore agents)
130
+ - Phase 1 (Analysis → Opus deep-think + explore agents)
131
131
  - Phase 2 → Plan Approval Gate including clarification + approval
132
132
  - Phase 4 (Review → parallel + triage)
133
133
 
134
- Phase 0 (Init full picker), Phase 5 (User Test), Phase 6 (Commit), and Phase 7 (Report + channels) run exactly as in the full pipeline. Phase 3 Dev model is **Fable**.
134
+ Phase 0 (Init full picker), Phase 5 (User Test), Phase 6 (Commit), and Phase 7 (Report + channels) run exactly as in the full pipeline. Phase 3 Dev model is **Opus**.
135
135
 
136
136
  ## Steps
137
137
 
@@ -140,7 +140,7 @@ Phase 0 (Init full picker), Phase 5 (User Test), Phase 6 (Commit), and Phase 7 (
140
140
  2. **Phase 0: Init** - same as the full pipeline (full picker: account, project, dev-context, base branch, branch name, maturity check, identity, worktree, state)
141
141
  - Add `"mode": "dev"` to `agent-state.json`
142
142
 
143
- 3. **Phase 3: Dev** - on the **Fable model**, with `taskType`-based dispatch:
143
+ 3. **Phase 3: Dev** - on the **Opus model**, with `taskType`-based dispatch:
144
144
 
145
145
  **3a. If `state.taskType === "component"` (figma URL detected at Phase 0 Step 7):**
146
146
  - Run the **full figma 17-substep orchestrator** - the same one the full pipeline uses. `--dev` does NOT shrink this. Sub-phases:
@@ -172,7 +172,7 @@ Phase 0 (Init full picker), Phase 5 (User Test), Phase 6 (Commit), and Phase 7 (
172
172
  | Aspect | Full (`/multi-agent`) | Dev (`/multi-agent:dev`) |
173
173
  |---------|---------------------|------------------------|
174
174
  | Phases | 8 (0-7) | 5 (0, 3, 5, 6, 7) - 1, 2, 4 skipped |
175
- | Phase 3 Dev model | Sonnet | **Fable** |
175
+ | Phase 3 Dev model | Sonnet | **Opus** |
176
176
  | Phase 1 Analysis (explore agents) | ✅ | ❌ |
177
177
  | Phase 2 Planning + Approval Gate | ✅ | ❌ |
178
178
  | Phase 4 Review (parallel + triage) | ✅ | ❌ |
@@ -52,13 +52,13 @@ How It Works (Phase 0 - Interactive Flow):
52
52
  Pipeline (after Phase 0) - shown as visual cards in terminal:
53
53
 
54
54
  Phase 0: Init -> The 8 steps above
55
- Phase 1: Analysis -> Stack detection + codebase scan (Fable)
55
+ Phase 1: Analysis -> Stack detection + codebase scan (Opus)
56
56
  Phase 2: Planning -> Task breakdown + architecture review + Plan Approval Gate
57
57
  (clarification max 2 rounds + approval loop - normal mode only;
58
58
  skipped for --dev, autopilot, --dev autopilot)
59
59
  Phase 3: Dev -> TDD: test -> code -> build (Sonnet) + build queue
60
- Phase 4: Review -> Deterministic gates + parallel AI review + Fable triage
61
- (Claude Code: Fable + Sonnet · Copilot CLI: GPT-5.4 + Opus + Sonnet)
60
+ Phase 4: Review -> Deterministic gates + parallel AI review + Opus triage
61
+ (Claude Code: Opus + Sonnet · Copilot CLI: GPT-5.4 + Opus + Sonnet)
62
62
  Phase 5: Test -> Optional: switch to branch, test in Xcode
63
63
  (runs in dev + full; skipped in every autopilot and local variant)
64
64
  Phase 6: Commit -> Commit -> push -> PR + issue body update (never auto-closes)
@@ -73,8 +73,8 @@ Pipeline (after Phase 0) - shown as visual cards in terminal:
73
73
 
74
74
  Modes:
75
75
 
76
- (normal) Full 8 phases, Sonnet dev, Plan Approval Gate active, parallel review + Fable triage
77
- --dev Fast: Init -> Dev(Fable) -> Commit -> Report (no plan gate)
76
+ (normal) Full 8 phases, Sonnet dev, Plan Approval Gate active, parallel review + Opus triage
77
+ --dev Fast: Init -> Dev(Opus) -> Commit -> Report (no plan gate)
78
78
  --local No worktree - works directly on local branch
79
79
  autopilot Skip all confirmations INCLUDING plan gate, auto commit/PR
80
80
  (EXCEPT Phase 7 channels menu - always pauses)
@@ -259,13 +259,13 @@ Nasıl Çalışır (Phase 0 - İnteraktif Akış):
259
259
  Pipeline (Phase 0'dan sonra) - terminalde görsel kart olarak görünür:
260
260
 
261
261
  Phase 0: Init -> Yukarıdaki 8 adım
262
- Phase 1: Analysis -> Stack tespiti + codebase taraması (Fable)
262
+ Phase 1: Analysis -> Stack tespiti + codebase taraması (Opus)
263
263
  Phase 2: Planning -> Task kırılımı + mimari inceleme + Plan Onay Kapısı
264
264
  (clarification max 2 tur + onay döngüsü - sadece normal mode;
265
265
  --dev, autopilot, --dev autopilot'ta skip)
266
266
  Phase 3: Dev -> TDD: test -> kod -> build (Sonnet) + build queue
267
- Phase 4: Review -> Deterministik kapılar + paralel AI review + Fable triage
268
- (Claude Code: Fable + Sonnet · Copilot CLI: GPT-5.4 + Opus + Sonnet)
267
+ Phase 4: Review -> Deterministik kapılar + paralel AI review + Opus triage
268
+ (Claude Code: Opus + Sonnet · Copilot CLI: GPT-5.4 + Opus + Sonnet)
269
269
  Phase 5: Test -> Opsiyonel: branch'e geç, Xcode'da test (--dev / autopilot'ta skip)
270
270
  Phase 6: Commit -> Commit -> push -> PR + issue body güncelleme (hiç auto-close yok)
271
271
  Phase 7: Report -> Channels dispatcher (PR · Jira · Confluence · Wiki, multi-select)
@@ -279,8 +279,8 @@ Pipeline (Phase 0'dan sonra) - terminalde görsel kart olarak görünür:
279
279
 
280
280
  Modlar:
281
281
 
282
- (normal) Tam 8 faz, Sonnet dev, Plan Onay Kapısı aktif, paralel review + Fable triage
283
- --dev Hızlı: Init -> Dev(Fable) -> Commit -> Report (plan gate yok)
282
+ (normal) Tam 8 faz, Sonnet dev, Plan Onay Kapısı aktif, paralel review + Opus triage
283
+ --dev Hızlı: Init -> Dev(Opus) -> Commit -> Report (plan gate yok)
284
284
  --local Worktree yok - doğrudan local branch'te çalışır
285
285
  autopilot Plan gate dahil tüm onayları atla, otomatik commit/PR
286
286
  (İSTİSNA: Phase 7 channels menüsü - her zaman durur)
@@ -121,6 +121,7 @@ When the **Wiki** adapter writes pages on the same run AND `prefs.global.wikiToJ
121
121
  ## Hard rules (must not regress)
122
122
 
123
123
  - Real newlines, no HTML entities - heredoc + `jq --rawfile` + `curl --data-binary @file`.
124
+ - UTF-8 in, UTF-8 out - the body file is UTF-8 and `--data-binary` ships its bytes verbatim. Never round-trip the body through `unicode_escape`, `latin-1`, or any re-encode step, and never hand-roll a Python/curl helper that re-decodes it: that mangles Turkish chars (ç ş ı ö ü ğ) into mojibake (`Çözüm` → `Ãözüm`). Use the `jq --rawfile` + `--data-binary @file` path above as-is. Same rule for the PR / Confluence / Wiki adapters.
124
125
  - Section order is fixed: `summary` → `test_scenarios` → `context_refs`. Never insert sections between them; never reorder.
125
126
  - Humanizer pass runs **after** body assembly and **before** wiki-markup conversion. Tone target: informal but technical. No marketing voice, no "we are excited", no "I have...".
126
127
  - Body content language follows `prefs.global.outputLanguage`. Code identifiers, file paths, type names, branch names, and the wiki-markup syntax stay verbatim. The `promptLanguage="en"` lock means any LLM prompt that produces the body is in English; the body itself is then rendered in the user's language.
@@ -34,7 +34,7 @@ In addition to the 34 top-level multi-agent commands, the figma-to-component pip
34
34
  |---|---|---|
35
35
  | `pipeline/skills/figma-ios/` | 5 | iOS-only Phase 3 sub-skills (SwiftUI-specific) |
36
36
  | `pipeline/skills/figma-android/` | 5 | Android-only Phase 3 sub-skills (Jetpack Compose-specific) |
37
- | `pipeline/skills/figma-common/` | 27 | Platform-agnostic helpers (iterate / commit / wiki setup / MCP auth / performance harness / etc.) |
37
+ | `pipeline/skills/figma-common/` | 31 | Platform-agnostic helpers (iterate / commit / wiki setup / MCP auth / performance harness / cross-cutting integration adapters / etc.) |
38
38
 
39
39
  Both Claude Code and Copilot CLI MUST expose every skill with identical argument shape, identical progress-line emission, and identical state writes. Inventory divergence (skill exists on one side but not the other) is a contract violation and blocks merge.
40
40
 
@@ -48,7 +48,7 @@ Both Claude Code and Copilot CLI MUST expose every skill with identical argument
48
48
  | `figma-component-code-connect` | 3.6 mapping publish | `pipeline/skills/figma-ios/figma-component-code-connect/` | `pipeline/skills/figma-android/figma-component-code-connect/` |
49
49
  | `figma-component-wiki` | 3.7 wiki (4 adapters) | `pipeline/skills/figma-ios/figma-component-wiki/` | `pipeline/skills/figma-android/figma-component-wiki/` |
50
50
 
51
- **Common pool** (all 27 skills under `pipeline/skills/figma-common/` - platform-agnostic, dispatched regardless of iOS/Android):
51
+ **Common pool** (all 31 skills under `pipeline/skills/figma-common/` - platform-agnostic, dispatched regardless of iOS/Android):
52
52
 
53
53
  | Skill | Scope |
54
54
  |---|---|
@@ -74,13 +74,17 @@ Both Claude Code and Copilot CLI MUST expose every skill with identical argument
74
74
  | `figma-skip` | Skip + update Confluence |
75
75
  | `figma-form-integration` | Form protocol adapter |
76
76
  | `figma-price-integration` | Price protocol adapter |
77
+ | `figma-navigation` | Navigation pattern adapter (native-first / `ui.navigationSystem`) |
78
+ | `figma-overlays` | Overlay pattern adapter (native-first / `ui.overlaySystem`) |
79
+ | `figma-bottom-sheets` | Bottom-sheet/detent adapter (native-first / `ui.sheetSystem`) |
80
+ | `figma-evolve-component` | Reconcile drift + additive extend (human-gated) |
77
81
  | `performance-start` | Perf-tracked component start |
78
82
  | `performance-swiftui` | Perf-optimized pipeline |
79
83
  | `performance-tour` | Batch produce components |
80
84
  | `performance-review-next` | Interactive batch review |
81
85
  | `performance-iteration-commit-all` | Batch validate + push all |
82
86
 
83
- Total figma skill count: **37** (5 iOS + 5 Android + 27 Common).
87
+ Total figma skill count: **41** (5 iOS + 5 Android + 31 Common).
84
88
 
85
89
  ### 1.2 Store-compliance skills
86
90
 
@@ -1,17 +1,28 @@
1
- # Model Fallback Contract (v9.10.1)
1
+ # Model Fallback Contract (v10.1.0)
2
2
 
3
- Personas that declare `preferredModel: fable` route to the top intelligence tier
4
- (`claude-fable-5`). Fable access can be plan-window-limited, quota-limited, or
3
+ Personas that declare `preferredModel: opus` route to the top available
4
+ intelligence tier (`claude-opus-4-8`). Opus access can be quota-limited or
5
5
  temporarily unavailable. This contract defines when and how the orchestrator
6
6
  falls back, deterministically, without ever editing persona files at runtime.
7
7
 
8
+ > **Fable retired (2026-06).** Earlier versions routed architect / Reviewer-1 /
9
+ > triage personas to `claude-fable-5` as the top tier. Fable 5 is no longer
10
+ > available, so opus is now the top tier and the persona frontmatter declares
11
+ > `preferredModel: opus`. The `premiumTierUntil` date gate stays in the contract
12
+ > as a generic mechanism for any future plan-window-limited premium tier.
13
+
8
14
  ## Tier ladder
9
15
 
10
16
  ```
11
- fable -> opus -> sonnet
17
+ opus -> sonnet -> haiku
12
18
  ```
13
19
 
14
- One step down per trigger. The mechanism is the existing per-dispatch override:
20
+ One step down per trigger, walking the ladder until a tier dispatches or the
21
+ floor (`haiku`) is reached. `haiku` is the last-resort floor: a run that reaches
22
+ it is heavily degraded but still makes progress instead of hard-halting because
23
+ two tiers happened to be unavailable at once. A dispatch error at the floor is a
24
+ genuine outage - it falls through to the normal phase-error path (pause ->
25
+ resume), since there is nothing left to step down to. The mechanism is the existing per-dispatch override:
15
26
  set `PHASE_MODEL_OVERRIDE=<fallback>` before dispatch (the orchestrator exports
16
27
  `CLAUDE_CODE_SUBAGENT_MODEL` on Claude Code, or passes `--model` on Copilot
17
28
  CLI). Persona frontmatter stays the source of truth for the *preferred* model;
@@ -20,13 +31,15 @@ the override is per-dispatch and leaves files untouched.
20
31
  ## Prefs knob
21
32
 
22
33
  `prefs.global.modelFallback` (template default below; absent knob = `enabled: true`
23
- with no date gate):
34
+ with no date gate; an absent `floorModel` defaults to `haiku`, so installs that
35
+ predate this field still get the second downgrade step):
24
36
 
25
37
  ```json
26
38
  "modelFallback": {
27
39
  "enabled": true,
28
40
  "premiumTierUntil": null,
29
- "fallbackModel": "opus",
41
+ "fallbackModel": "sonnet",
42
+ "floorModel": "haiku",
30
43
  "onDispatchError": true
31
44
  }
32
45
  ```
@@ -34,25 +47,30 @@ with no date gate):
34
47
  | Field | Meaning |
35
48
  |---|---|
36
49
  | `enabled` | Master switch. `false` = always dispatch the persona's `preferredModel`, fail loudly on error. |
37
- | `premiumTierUntil` | ISO date (`YYYY-MM-DD`) or `null`. When set and today is **after** this date, every `preferredModel: fable` dispatch is downgraded to `fallbackModel` unless the user re-confirms (see Date gate). Use when fable is included in a plan only until a known date. |
38
- | `fallbackModel` | Target of the first downgrade step. Default `opus`. |
39
- | `onDispatchError` | When `true`, a failed fable dispatch (model unavailable / quota / 4xx on model id) retries once on `fallbackModel` instead of aborting the phase. |
50
+ | `premiumTierUntil` | ISO date (`YYYY-MM-DD`) or `null`. When set and today is **after** this date, every `preferredModel` dispatch is downgraded to `fallbackModel` unless the user re-confirms (see Date gate). Use when the top tier is included in a plan only until a known date. |
51
+ | `fallbackModel` | Target of the first downgrade step. Default `sonnet` (the next tier below opus). |
52
+ | `floorModel` | Last-resort tier when `fallbackModel` also fails to dispatch. Default `haiku`. Set to the same value as `fallbackModel` (or `null`) to disable the second step and halt after one downgrade. |
53
+ | `onDispatchError` | When `true`, a failed top-tier dispatch (model unavailable / quota / 4xx on model id) retries once on `fallbackModel`, and a failed `fallbackModel` dispatch retries once on `floorModel`, instead of aborting the phase. |
40
54
 
41
55
  ## Triggers (checked in this order)
42
56
 
43
57
  1. **Date gate (Phase 0 Step 0, once per run).** If `premiumTierUntil` is set and
44
58
  in the past, print one line:
45
- `WARN: fable plan window ended <date>; fable personas will dispatch on <fallbackModel>. Set prefs.global.modelFallback.premiumTierUntil to null to keep fable on usage credits.`
46
- Then export the override for every fable persona this run. Interactive modes
47
- may instead ask once (`Keep fable (usage credits) / Fall back to <model>`);
59
+ `WARN: premium tier plan window ended <date>; preferredModel personas will dispatch on <fallbackModel>. Set prefs.global.modelFallback.premiumTierUntil to null to keep the top tier on usage credits.`
60
+ Then export the override for every `preferredModel` persona this run. Interactive modes
61
+ may instead ask once (`Keep top tier (usage credits) / Fall back to <model>`);
48
62
  autopilot never asks - it falls back and logs.
49
63
  2. **Dispatch error (per dispatch).** On a model-unavailable / quota error from a
50
- fable dispatch and `onDispatchError: true`: retry the same persona once with
51
- `PHASE_MODEL_OVERRIDE=<fallbackModel>`. A second failure falls through to the
52
- normal phase-error path (pause -> resume). Never silent-skip the persona.
64
+ top-tier dispatch and `onDispatchError: true`: retry the same persona once with
65
+ `PHASE_MODEL_OVERRIDE=<fallbackModel>`. If that retry also fails with a dispatch
66
+ error and `floorModel` is set and differs from `fallbackModel`, retry once more
67
+ with `PHASE_MODEL_OVERRIDE=<floorModel>`. A failure at the floor (or when no
68
+ floor is configured) falls through to the normal phase-error path (pause ->
69
+ resume). Never silent-skip the persona. Each downgrade emits its own
70
+ `model_fallback` metric line so a two-step degrade is visible in Phase 7.
53
71
  3. **Cost budget ceiling (existing gate).** When `cost-budget-check.mjs` exits 11
54
72
  (exceeded) mid-run, the run already pauses per the cost-budget contract; on
55
- user-approved continue, fable personas downgrade to `fallbackModel` for the
73
+ user-approved continue, `preferredModel` personas downgrade to `fallbackModel` for the
56
74
  remainder of the run.
57
75
 
58
76
  ## Logging
@@ -70,4 +88,4 @@ per-phase `model` field already carries the override).
70
88
  - No edits to `pipeline/agents/*.md` at runtime; frontmatter is install-time
71
89
  configuration only.
72
90
  - Copilot CLI reviewer set and adapter-platform model pins are out of scope
73
- (they do not dispatch fable).
91
+ (they pin their own models and do not use this persona ladder).
@@ -51,10 +51,13 @@ Every task gets an auto-incremented short ID. Counter stored at `$HOME/.claude/l
51
51
  ## Resume Logic
52
52
 
53
53
  1. Find state file: `$HOME/.claude/logs/multi-agent/{project}/{task-id}/agent-state.json`
54
- 2. Read `agent-log.md` for previous findings
55
- 3. Resume from `currentPhase + 1`
56
- 4. **Always run Phase 7** on resume completion - ensures knowledge capture even if task was paused mid-pipeline
57
- 5. Log: "Resumed {jiraId} from Phase {N}"
54
+ 2. **Validate before re-entry** (required - a half-written or corrupt state silently resumes at the wrong phase):
55
+ - `node $HOME/.claude/scripts/validate-state.mjs <state-file>` (resume-safety check: parseable JSON + `currentPhase` in 0..7 + well-formed `phases`; tolerant of legacy shapes, not a strict schema match). On non-zero exit, do NOT guess a phase: surface the error and stop with `ERR: agent-state.json is unsafe to resume; inspect it or 'kill #N' and restart.`
56
+ - Confirm the worktree path on `state.worktreePath` / `state.projects[].worktreePath` exists and `git -C <wt> status` is clean-or-known. If the worktree is missing or locked, run the Phase 0 "Worktree stale-lock heal" before continuing.
57
+ 3. Read `agent-log.md` for previous findings
58
+ 4. Resume from `currentPhase + 1`. If `state.phases[currentPhase+1].subStep` is set, re-enter that phase and skip already-recorded sub-steps (see "Sub-step checkpoints").
59
+ 5. **Always run Phase 7** on resume completion - ensures knowledge capture even if task was paused mid-pipeline
60
+ 6. Log: "Resumed {jiraId} from Phase {N}"
58
61
 
59
62
  ---
60
63
 
@@ -64,6 +67,8 @@ Run phases sequentially. Log every step to `agent-log.md`.
64
67
  If any phase fails, mark task as `paused` and stop - user can `resume` later.
65
68
  Update `agent-state.json` at EVERY phase transition.
66
69
 
70
+ **Halt visibility (required, autopilot included).** A halt is never silent. Whenever a phase halts on a hard error (validator failed twice, no subagent returned, dispatch error past fallback, lock irrecoverable), in addition to the `agent-log.md` line: (a) write `state.status = "paused"` and `state.haltReason = "<phase>:<cause>"`; (b) record the cause on the tracker via `phase-tracker.sh meta <phase> halt "<cause>"` and `phase-tracker.sh update <phase> failed`; (c) emit one `>&2` alert line `HALT phase <N>: <cause> - resume with /multi-agent:resume #<id>`. Autopilot suppresses *confirmations*, not *halts* - the user must always be able to see why an unattended run stopped without reading the log.
71
+
67
72
  ### Pipeline Best Practices
68
73
 
69
74
  **Subagent return format**: Instruct every subagent to return structured JSON, not prose:
@@ -86,6 +91,11 @@ This keeps orchestrator context lean and enables programmatic routing.
86
91
  }
87
92
  ```
88
93
 
89
- **Proactive compaction**: If conversation context exceeds ~60%, dump progress to `agent-log.md` and summarize state before continuing. Don't wait for auto-compaction at 83% - it's lossy.
94
+ **Proactive compaction + phase-boundary checkpoint**: the orchestrator follows ~2,500 lines of phase prose in one session; once context fills, it starts dropping steps - the single biggest cause of "it got stuck / skipped a step." Two defenses, both required on full-pipeline runs:
95
+
96
+ - *Phase-boundary checkpoint.* At every phase transition, before loading the next phase doc, write the durable state (`agent-state.json` phase status + `files[]` + `retryCount`) and append a one-line progress summary to `agent-log.md`. The next phase reads state + log, not the back-conversation - so a transition is a clean re-entry point even if context is later compacted.
97
+ - *Compaction trigger.* If conversation context exceeds ~50%, run `/compact` preserving "modified files, plan, open review findings, current phase + sub-step" before continuing. Don't wait for auto-compaction near the limit - it triggers exactly when context is worst and is lossy. After compaction, re-read `agent-state.json` to re-ground.
98
+
99
+ **Sub-step checkpoints (long phases)**: Phase 3 (dev/TDD cycles) and Phase 7 (report/channels) can run many minutes; a crash mid-phase loses everything since the last phase boundary and forces a full phase re-run on resume. For these phases, also record `state.phases[<n>].subStep` (a short token: `red`, `green`, `build`, `pr-opened`, `confluence-synced`, ...) and the `files[]` written so far after each meaningful unit of work. On resume, re-enter the phase but skip units whose `subStep` is already recorded and whose `files[]` exist in the worktree - re-do only the unfinished tail, never the whole phase.
90
100
 
91
101
  **3-iteration hard kill**: Any retry loop (build fix, review fix) MUST stop after 3 attempts. On 4th failure -> pause, ask user. No exceptions.