maestro-flow 0.3.47 → 0.3.49

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 (94) hide show
  1. package/.claude/agents/impeccable-agent.md +99 -0
  2. package/.claude/commands/maestro-analyze.md +2 -2
  3. package/.claude/commands/maestro-brainstorm.md +116 -112
  4. package/.claude/commands/maestro-composer.md +5 -0
  5. package/.claude/commands/maestro-impeccable.md +46 -9
  6. package/.claude/commands/maestro-merge.md +3 -0
  7. package/.claude/commands/maestro-roadmap.md +5 -1
  8. package/.claude/commands/maestro-ui-craft.md +56 -4
  9. package/.claude/commands/maestro.md +1 -1
  10. package/.claude/commands/manage-issue-discover.md +4 -0
  11. package/.claude/commands/quality-refactor.md +3 -0
  12. package/.claude/skills/maestro-help/index/catalog.json +1 -1
  13. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  14. package/.claude/skills/maestro-impeccable/SKILL.md +3 -1
  15. package/.codex/skills/maestro/SKILL.md +167 -25
  16. package/.codex/skills/maestro-brainstorm/SKILL.md +19 -2
  17. package/.codex/skills/maestro-composer/SKILL.md +5 -0
  18. package/.codex/skills/maestro-help/catalog.json +1 -1
  19. package/.codex/skills/maestro-impeccable/SKILL.md +24 -5
  20. package/.codex/skills/maestro-merge/SKILL.md +3 -0
  21. package/.codex/skills/maestro-milestone-audit/SKILL.md +64 -7
  22. package/.codex/skills/maestro-quick/SKILL.md +1 -1
  23. package/.codex/skills/maestro-ralph/SKILL.md +45 -25
  24. package/.codex/skills/maestro-roadmap/SKILL.md +1 -1
  25. package/.codex/skills/maestro-tools-execute/SKILL.md +1 -1
  26. package/.codex/skills/maestro-tools-register/SKILL.md +1 -1
  27. package/.codex/skills/maestro-ui-craft/SKILL.md +51 -6
  28. package/.codex/skills/quality-refactor/SKILL.md +114 -22
  29. package/chains/_intent-map.json +1 -1
  30. package/chains/singles/ui-design.json +4 -4
  31. package/chains/{ui-design-driven.json → ui-craft-build.json} +8 -8
  32. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  33. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  34. package/dist/src/commands/delegate.d.ts.map +1 -1
  35. package/dist/src/commands/delegate.js +12 -7
  36. package/dist/src/commands/delegate.js.map +1 -1
  37. package/dist/src/commands/impeccable.d.ts +2 -1
  38. package/dist/src/commands/impeccable.d.ts.map +1 -1
  39. package/dist/src/commands/impeccable.js +80 -1
  40. package/dist/src/commands/impeccable.js.map +1 -1
  41. package/package.json +1 -1
  42. package/templates/planning-roles/ui-designer.md +86 -99
  43. package/templates/workflows/specs/node-catalog.md +1 -1
  44. package/workflows/brainstorm.md +26 -0
  45. package/workflows/cli-tools-usage.md +9 -26
  46. package/workflows/delegate-usage.md +301 -343
  47. package/workflows/impeccable/design.md +462 -0
  48. package/workflows/impeccable/explore.md +157 -0
  49. package/workflows/impeccable/shape.md +4 -0
  50. package/workflows/impeccable/ui-search/__pycache__/core.cpython-313.pyc +0 -0
  51. package/workflows/impeccable/ui-search/__pycache__/design_system.cpython-313.pyc +0 -0
  52. package/workflows/impeccable/ui-search/core.py +262 -0
  53. package/workflows/impeccable/ui-search/data/app-interface.csv +31 -0
  54. package/workflows/impeccable/ui-search/data/charts.csv +26 -0
  55. package/workflows/impeccable/ui-search/data/colors.csv +162 -0
  56. package/workflows/impeccable/ui-search/data/design.csv +1776 -0
  57. package/workflows/impeccable/ui-search/data/draft.csv +1779 -0
  58. package/workflows/impeccable/ui-search/data/google-fonts.csv +1924 -0
  59. package/workflows/impeccable/ui-search/data/icons.csv +106 -0
  60. package/workflows/impeccable/ui-search/data/landing.csv +35 -0
  61. package/workflows/impeccable/ui-search/data/products.csv +162 -0
  62. package/workflows/impeccable/ui-search/data/react-performance.csv +45 -0
  63. package/workflows/impeccable/ui-search/data/stacks/angular.csv +51 -0
  64. package/workflows/impeccable/ui-search/data/stacks/astro.csv +54 -0
  65. package/workflows/impeccable/ui-search/data/stacks/flutter.csv +53 -0
  66. package/workflows/impeccable/ui-search/data/stacks/html-tailwind.csv +56 -0
  67. package/workflows/impeccable/ui-search/data/stacks/jetpack-compose.csv +53 -0
  68. package/workflows/impeccable/ui-search/data/stacks/laravel.csv +51 -0
  69. package/workflows/impeccable/ui-search/data/stacks/nextjs.csv +53 -0
  70. package/workflows/impeccable/ui-search/data/stacks/nuxt-ui.csv +51 -0
  71. package/workflows/impeccable/ui-search/data/stacks/nuxtjs.csv +59 -0
  72. package/workflows/impeccable/ui-search/data/stacks/react-native.csv +52 -0
  73. package/workflows/impeccable/ui-search/data/stacks/react.csv +54 -0
  74. package/workflows/impeccable/ui-search/data/stacks/shadcn.csv +61 -0
  75. package/workflows/impeccable/ui-search/data/stacks/svelte.csv +54 -0
  76. package/workflows/impeccable/ui-search/data/stacks/swiftui.csv +51 -0
  77. package/workflows/impeccable/ui-search/data/stacks/threejs.csv +54 -0
  78. package/workflows/impeccable/ui-search/data/stacks/vue.csv +50 -0
  79. package/workflows/impeccable/ui-search/data/styles.csv +85 -0
  80. package/workflows/impeccable/ui-search/data/typography.csv +74 -0
  81. package/workflows/impeccable/ui-search/data/ui-reasoning.csv +162 -0
  82. package/workflows/impeccable/ui-search/data/ux-guidelines.csv +100 -0
  83. package/workflows/impeccable/ui-search/design_system.py +1148 -0
  84. package/workflows/impeccable/ui-search/prototype-template.html +511 -0
  85. package/workflows/impeccable/ui-search/render-prototype.js +208 -0
  86. package/workflows/impeccable/ui-search/search.py +114 -0
  87. package/workflows/maestro-chain-execute.md +2 -2
  88. package/workflows/maestro.codex.md +3 -3
  89. package/workflows/maestro.md +5 -5
  90. package/workflows/plan.md +1 -1
  91. package/workflows/ui-design.md +1 -1
  92. package/workflows/ui-style.md +1 -1
  93. package/.claude/commands/maestro-ui-design.md +0 -104
  94. package/.codex/skills/maestro-ui-design/SKILL.md +0 -242
@@ -2,11 +2,13 @@
2
2
  name: maestro-milestone-audit
3
3
  description: Audit current milestone for cross-phase integration gaps
4
4
  argument-hint: "[milestone, e.g., 'M1']"
5
- allowed-tools: Read, Write, Bash, Glob, Grep, Agent
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Bash, Glob, Grep
6
6
  ---
7
7
 
8
8
  <purpose>
9
- Sequential audit based on artifact registry in state.json. Checks phase coverage (ANL->PLN->EXC chains), ad-hoc completeness, execution completeness, and cross-artifact integration. Produces PASS/FAIL verdict report.
9
+ Sequential audit based on artifact registry in state.json. Checks phase coverage (ANL->PLN->EXC chains), ad-hoc completeness, execution completeness, and cross-artifact integration via `spawn_agents_on_csv`. Produces PASS/FAIL verdict report.
10
+
11
+ **Core workflow**: Load Artifacts -> Coverage Check -> Completeness Check -> CSV Wave (Integration Check) -> Verdict
10
12
  </purpose>
11
13
 
12
14
  <context>
@@ -16,14 +18,52 @@ $maestro-milestone-audit ""
16
18
  $maestro-milestone-audit "M1"
17
19
  ```
18
20
 
19
- **Output**: Audit report with artifact chain verification, integration analysis, and PASS/FAIL verdict
21
+ **Output**: `.workflow/milestones/{milestone}/audit-report.md` with artifact chain verification, integration analysis, and PASS/FAIL verdict
20
22
 
23
+ **Session**: `.workflow/.csv-wave/{YYYYMMDD}-audit-{milestone}/`
21
24
  </context>
22
25
 
26
+ <csv_schema>
27
+
28
+ ### tasks.csv (Master State)
29
+
30
+ ```csv
31
+ id,title,description,scope,check_targets,deps,wave,status,findings,gaps_found,severity,error
32
+ "integ-1","Interface & dependency chains","Verify shared interfaces are consistent across phases: re-exports match, dependency chains unbroken, no circular imports between phase outputs","cross-phase imports, shared types, re-exports","grep for shared type names across phase output dirs; verify export/import consistency","","1","","","","",""
33
+ "integ-2","Data contracts & API consistency","Verify request/response schemas match across phases: API signatures consistent, error codes aligned, no contract drift","request/response schemas, API signatures, error codes","diff API type definitions across phases; check error code enum consistency","","1","","","","",""
34
+ ```
35
+
36
+ **Columns**:
37
+
38
+ | Column | Phase | Description |
39
+ |--------|-------|-------------|
40
+ | `id` | Input | Worker identifier: `integ-{N}` |
41
+ | `title` | Input | Integration dimension name |
42
+ | `description` | Input | Detailed check instructions |
43
+ | `scope` | Input | What to examine |
44
+ | `check_targets` | Input | Specific verification commands/grep patterns |
45
+ | `deps` | Input | Dependencies (empty — all wave 1) |
46
+ | `wave` | Computed | Wave number (always 1 — single parallel wave) |
47
+ | `status` | Output | `pending` -> `pass` / `fail` / `warning` |
48
+ | `findings` | Output | Detailed findings per dimension (max 500 chars) |
49
+ | `gaps_found` | Output | Semicolon-separated list of integration gaps |
50
+ | `severity` | Output | `critical` / `warning` / `info` per gap |
51
+ | `error` | Output | Error message if check failed |
52
+
53
+ ### Session Structure
54
+
55
+ ```
56
+ .workflow/.csv-wave/{YYYYMMDD}-audit-{milestone}/
57
+ +-- tasks.csv
58
+ +-- wave-1.csv (temporary)
59
+ +-- wave-1-results.csv
60
+ ```
61
+ </csv_schema>
62
+
23
63
  <invariants>
24
64
  1. **Artifact registry is source of truth** — don't scan directories, read state.json
25
65
  2. **Non-blocking warnings** — missing analyze is warning, missing execute is error
26
- 3. **Integration check is required** — always spawn checker agent
66
+ 3. **Integration check is required** — always spawn checker via CSV wave
27
67
  4. **Clear verdict** — PASS or FAIL with specific reasons
28
68
  </invariants>
29
69
 
@@ -45,9 +85,26 @@ For each phase: check for completed analyze (optional), plan (required), execute
45
85
 
46
86
  Verify all adhoc-scoped artifacts completed. For each execute artifact, verify all tasks in plan dir completed.
47
87
 
48
- ### Step 5: Integration Check
88
+ ### Step 5: Integration Check via CSV Wave
89
+
90
+ 1. Create session folder: `.workflow/.csv-wave/{dateStr}-audit-{milestone}/`
91
+ 2. Build `tasks.csv` from csv_schema — populate `scope` and `check_targets` columns using phase artifacts discovered in Step 2
92
+ 3. Write `wave-1.csv` from pending rows, then execute:
93
+
94
+ ```javascript
95
+ spawn_agents_on_csv({
96
+ csv_path: `${sessionFolder}/wave-1.csv`,
97
+ id_column: "id",
98
+ instruction: `You are an integration checker for milestone ${milestone}. For each row, examine the scope and check_targets. Search the codebase for inconsistencies, contract drift, and broken dependencies across phase outputs. Report findings with file:line references. Set status to pass/fail/warning. List specific gaps in gaps_found (semicolon-separated).`,
99
+ max_concurrency: 2, max_runtime_seconds: 600,
100
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
101
+ output_schema: { id, status: [pass|fail|warning], findings, gaps_found, severity, error }
102
+ })
103
+ ```
49
104
 
50
- Spawn Agent for cross-phase validation: shared interfaces, dependency chains, data contracts, API consistency. Write report to `.workflow/milestones/{milestone}/audit-report.md`.
105
+ 4. Merge results into master `tasks.csv`
106
+ 5. Parse `gaps_found` from all workers — aggregate into `.workflow/milestones/{milestone}/audit-report.md`
107
+ 6. Any worker with `status == fail` and `severity == critical` → milestone verdict = FAIL
51
108
 
52
109
  ### Step 6: Verdict
53
110
 
@@ -81,7 +138,7 @@ Display structured audit report.
81
138
  - [ ] Artifact registry loaded and filtered by milestone
82
139
  - [ ] Phase coverage matrix generated
83
140
  - [ ] Ad-hoc and execution completeness verified
84
- - [ ] Integration check performed via agent
141
+ - [ ] Integration check performed via spawn_agents_on_csv (2 parallel workers)
85
142
  - [ ] Audit report written to milestones/ directory
86
143
  - [ ] Clear PASS/FAIL verdict with specific reasons
87
144
  </success_criteria>
@@ -2,7 +2,7 @@
2
2
  name: maestro-quick
3
3
  description: Quick task execution, skip optional agents
4
4
  argument-hint: "\"task description\" [--discuss] [--full]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
8
8
  <purpose>
@@ -156,17 +156,28 @@ S_FALLBACK -> S_PARSE_ROUTE WHEN: user input | -> END WHEN: cancel
156
156
  | Has .workflow/ but no state.json | init |
157
157
  | Has state.json | artifact-based inference |
158
158
 
159
- **Artifact-based**: filter by current_milestone + target phase. Latest artifact type: none->analyze, analyze->plan, plan->execute, execute->verify, verify->refine from result files:
159
+ **Artifact-based inference:** Filter by current_milestone + target phase:
160
160
 
161
161
  | Condition | Position |
162
162
  |-----------|----------|
163
- | verification.json: passed==false or gaps[] non-empty | verify-failed |
164
- | passed==true, no review.json, has auto-test report | review |
165
- | passed==true, no review.json, no auto-test report | business-test (full) / review (standard/quick) |
166
- | review.json: verdict=="BLOCK" | review-failed |
167
- | review.json: verdict!="BLOCK" | test |
168
- | uat.md: all passed | milestone-audit |
169
- | uat.md: has failures | test-failed |
163
+ | no milestones defined or no roadmap.md | `roadmap` |
164
+ | no artifacts for target phase | `analyze` |
165
+ | latest artifact = analyze | `plan` |
166
+ | latest artifact = plan | `execute` |
167
+ | latest artifact = execute | `verify` |
168
+ | latest artifact = verify | refine from result files |
169
+
170
+ **Refine from verify results:**
171
+
172
+ | Condition | Position |
173
+ |-----------|----------|
174
+ | verification.json: passed==false or gaps[] non-empty | `verify-failed` |
175
+ | passed==true, no review.json, has auto-test report | `review` |
176
+ | passed==true, no review.json, no auto-test report | `business-test` (full) / `review` (standard/quick) |
177
+ | review.json: verdict=="BLOCK" | `review-failed` |
178
+ | review.json: verdict!="BLOCK" | `test` |
179
+ | uat.md: all passed | `milestone-audit` |
180
+ | uat.md: has failures | `test-failed` |
170
181
 
171
182
  ### A_RESOLVE_PHASE
172
183
 
@@ -182,23 +193,32 @@ Priority: regex from intent `phase\s*(\d+)` -> latest in-progress artifact's pha
182
193
 
183
194
  ### A_BUILD_STEPS
184
195
 
185
- Lifecycle stages (start from position, skip completed, filter by quality_mode):
186
-
187
- | Stage | Skill | Barrier | Decision after |
188
- |-------|-------|---------|----------------|
189
- | brainstorm | maestro-brainstorm | yes | -- |
190
- | init | maestro-init | no | -- |
191
- | roadmap | maestro-roadmap | yes | -- |
192
- | analyze | maestro-analyze | yes | -- |
193
- | plan | maestro-plan | yes | -- |
194
- | execute | maestro-execute | yes | -- |
195
- | verify | maestro-verify | no | post-verify |
196
- | business-test | quality-auto-test | no | post-business-test (full) |
197
- | review | quality-review | no | post-review |
198
- | test-gen | quality-auto-test | no | -- (full; standard if coverage<80%) |
199
- | test | quality-test | no | post-test |
200
- | milestone-audit | maestro-milestone-audit | no | -- |
201
- | milestone-complete | maestro-milestone-complete | no | post-milestone |
196
+ **Lifecycle stages:**
197
+
198
+ | Stage | Skill | Barrier | Quality Mode | Decision after |
199
+ |-------|-------|---------|-------------|----------------|
200
+ | brainstorm | maestro-brainstorm "{intent}" | yes | all | — |
201
+ | init | maestro-init | no | all | — |
202
+ | roadmap | maestro-roadmap "{intent}" | yes | all | — |
203
+ | analyze | maestro-analyze {phase} | yes | all | — |
204
+ | plan | maestro-plan {phase} | yes | all | — |
205
+ | execute | maestro-execute {phase} | yes | all | — |
206
+ | verify | maestro-verify {phase} | no | all | post-verify |
207
+ | business-test | quality-auto-test {phase} | no | full only | post-business-test |
208
+ | review | quality-review {phase} | no | all (quick: --tier quick) | post-review |
209
+ | test-gen | quality-auto-test {phase} | no | full; standard if coverage<80% | — |
210
+ | test | quality-test {phase} | no | full, standard | post-test |
211
+ | milestone-audit | maestro-milestone-audit | no | all | — |
212
+ | milestone-complete | maestro-milestone-complete | no | all | post-milestone |
213
+
214
+ **Build rules:**
215
+ 1. Start from `lifecycle_position`, end at `milestone-complete`
216
+ 2. Skip stages with existing completed artifacts (check state.json)
217
+ 3. Filter stages by `quality_mode` — skip non-applicable stages (see Quality Mode column)
218
+ 4. Quick mode: `review` appends `--tier quick`; skips `business-test`, `test-gen`, `test`
219
+ 5. Insert decision node after each stage with non-empty Decision column: `{ type: "decision", decision: "<gate>", retry_count: 0, max_retries: 2 }`
220
+ 6. Args use placeholders `{phase}`, `{intent}`, `{dirs}` — resolved at wave execution time
221
+ 7. Append `-y` to all skill args when `auto_mode` is true (see -y propagation table in context)
202
222
 
203
223
  ### A_BUILD_AND_SPAWN_WAVE
204
224
 
@@ -158,7 +158,7 @@ Build prev_context from wave 1. Inject strategy + --phases constraint (light mod
158
158
  +-- readiness-report.md
159
159
  ```
160
160
  7. Update state.json milestones + current_milestone
161
- 8. Next-step routing: need analysis -> maestro-analyze; ready to plan -> maestro-plan; UI first -> maestro-ui-design; full mode setup -> maestro-init
161
+ 8. Next-step routing: need analysis -> maestro-analyze; ready to plan -> maestro-plan; UI first -> maestro-ui-craft --chain build; full mode setup -> maestro-init
162
162
 
163
163
  </actions>
164
164
 
@@ -2,7 +2,7 @@
2
2
  name: maestro-tools-execute
3
3
  description: Load and execute tool specs by role or name
4
4
  argument-hint: "[tool-name | --category <category>]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
8
8
  <purpose>
@@ -2,7 +2,7 @@
2
2
  name: maestro-tools-register
3
3
  description: Register tool specs - extract, generate, or optimize reusable process definitions
4
4
  argument-hint: "[description or intent]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, Agent
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
8
8
  <purpose>
@@ -1,17 +1,20 @@
1
1
  ---
2
2
  name: maestro-ui-craft
3
3
  description: Chain maestro-impeccable commands with intelligent routing and quality gate loops for automated UI production
4
- argument-hint: "<intent|target> [--chain build|improve|enhance|harden|live] [--enhance <cmd>] [--threshold <score>] [--max-loops <n>] [-y] [-c]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, request_user_input
4
+ argument-hint: "<intent|target> [--chain build|improve|enhance|harden|live] [--enhance <cmd>] [--threshold <score>] [--max-loops <n>] [--skip-design-explore] [--skip-design] [--styles <N>] [--stack <stack>] [-y] [-c]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
  <purpose>
8
8
  Orchestrate maestro-impeccable skill commands via intelligent intent routing + quality gate auto-iteration.
9
9
  Chain: Build → Evaluate → Auto-Refine → Re-evaluate → Verify.
10
10
 
11
11
  Core innovation: critique/audit scores drive automatic command selection and iteration loops.
12
- maestro-impeccable has 23 commands across 6 categories -- this command chains them into automated pipelines
12
+ maestro-impeccable has 24 commands across 6 categories -- this command chains them into automated pipelines
13
13
  with quality gates that loop until design quality meets the threshold.
14
14
 
15
+ Includes integrated design-explore: delegates to `impeccable explore` for multi-variant design system generation,
16
+ HTML prototype rendering for visual comparison, and automatic bridge to DESIGN.md format.
17
+
15
18
  Prerequisite: maestro-impeccable skill available (auto-discovered by harness).
16
19
 
17
20
  Session: `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`
@@ -47,6 +50,9 @@ $maestro-ui-craft -y "create pricing page --chain build"
47
50
  - `--max-loops <n>` -- Maximum quality gate iterations (default: 3)
48
51
  - `-c` / `--continue` -- Resume previous ui-craft session
49
52
  - `-y` -- Auto mode: auto-select at ambiguous routing, skip confirmations where maestro-impeccable allows
53
+ - `--skip-design-explore` / `--skip-design` -- Skip design-explore (prototype comparison) and bridge (use existing DESIGN.md or full shape interview)
54
+ - `--styles <N>` -- Number of design system variants to generate (2-5, default 3). Only used in build chain design step
55
+ - `--stack <stack>` -- Tech stack for supplementary guidelines (default: html-tailwind). Passed to ui-search
50
56
  </context>
51
57
 
52
58
  <chains>
@@ -55,13 +61,14 @@ $maestro-ui-craft -y "create pricing page --chain build"
55
61
 
56
62
  | Chain | Sequence | Gate Condition |
57
63
  |-------|----------|----------------|
58
- | **build** | teach? → shape → craft → **critique** → [refine loop] → audit → polish | critique >= threshold AND P0 == 0 |
64
+ | **build** | teach? → **design_explore?** → shape → craft → **critique** → [refine loop] → audit → polish | critique >= threshold AND P0 == 0 |
59
65
  | **improve** | **critique** → [refine loop] → polish → audit | critique >= threshold AND P0 == 0 |
60
66
  | **enhance** | {cmd} → **critique** → polish (if needed) | critique >= threshold |
61
67
  | **harden** | harden → **audit** → polish | audit >= threshold*0.5 |
62
68
  | **live** | live | -- (interactive, no gate) |
63
69
 
64
70
  - `teach?` -- conditional: only if PRODUCT.md missing/placeholder
71
+ - `design_explore?` -- conditional: only if DESIGN.md missing AND `--skip-design-explore` not set. Delegates to `impeccable explore` which handles variant generation, prototype rendering, visual comparison, user selection/mix, AND bridge to DESIGN.md internally
65
72
  - `[refine loop]` -- quality gate loop: extract suggested commands from critique → execute → re-critique
66
73
 
67
74
  ### Intent → Chain Routing
@@ -69,6 +76,7 @@ $maestro-ui-craft -y "create pricing page --chain build"
69
76
  | Intent Pattern | Chain |
70
77
  |---------------|-------|
71
78
  | create, build, new, landing, feature, page | build |
79
+ | design, style, theme, visual, design system | build |
72
80
  | improve, fix, iterate, better, optimize | improve |
73
81
  | animate, color, type, bold, delight, enhance | enhance |
74
82
  | production, harden, ship, edge case, i18n | harden |
@@ -85,6 +93,7 @@ S_PARSE -- parse args, intent classification, chain selection PERSIST
85
93
  S_RESUME -- scan existing ui-craft sessions, resume execution PERSIST: --
86
94
  S_SETUP -- load context, check PRODUCT.md PERSIST: --
87
95
  S_CREATE -- create session + status.json PERSIST: session (full)
96
+ S_DESIGN_EXPLORE -- delegate to impeccable explore: multi-variant generation, prototype comparison, selection/mix, auto bridge to DESIGN.md PERSIST: explore_completed, design_md_path
88
97
  S_CHAIN -- execute chain steps in sequence PERSIST: step progress, executed commands
89
98
  S_GATE -- quality gate: parse scores, decide PERSIST: scores, loop count
90
99
  S_REFINE -- execute auto-selected refine commands PERSIST: refine commands, loop state
@@ -110,10 +119,16 @@ S_CREATE:
110
119
  → S_CHAIN DO: A_CREATE_SESSION
111
120
 
112
121
  S_CHAIN:
122
+ → S_DESIGN_EXPLORE WHEN: current step is 'design_explore' AND DESIGN.md missing AND --skip-design-explore not set AND --skip-design not set
113
123
  → S_GATE WHEN: current step is gate command (critique/audit)
124
+ → S_CHAIN WHEN: step is design_explore but skip conditions met → advance
114
125
  → S_CHAIN WHEN: step is normal command → execute → advance
115
126
  → S_REPORT WHEN: all steps complete
116
127
 
128
+ S_DESIGN_EXPLORE:
129
+ → S_CHAIN WHEN: explore completed (DESIGN.md produced) → advance to shape
130
+ → S_CHAIN WHEN: explore failed → W004 → advance to shape (full interview fallback)
131
+
117
132
  S_GATE:
118
133
  → S_CHAIN WHEN: PASS (score >= threshold AND P0 == 0) → advance
119
134
  → S_REFINE WHEN: FAIL (score < threshold OR P0 > 0)
@@ -161,6 +176,15 @@ S_REPORT:
161
176
  ```
162
177
  3. Write status.json before executing any step
163
178
 
179
+ ### A_DESIGN_EXPLORE
180
+
181
+ Delegate to impeccable explore as a black-box command. The explore command internally handles:
182
+ variant generation, prototype rendering, visual comparison, user review, mix protocol, rejected variant harvest, bridge to DESIGN.md, and spec registration.
183
+
184
+ 1. Execute: `$maestro-impeccable explore --styles {styles_count}`
185
+ 2. On completion: verify `.workflow/impeccable/DESIGN.md` exists
186
+ 3. Update status.json: `explore_completed: true`, `design_md_path`
187
+
164
188
  ### A_FINAL_REPORT
165
189
 
166
190
  1. Read critique trend if available (impeccable's critique persists snapshots automatically)
@@ -210,11 +234,26 @@ Step {n}/{total}: $maestro-impeccable {command} {target}
210
234
 
211
235
  After each step: update status.json `current_step` and step `status`.
212
236
 
213
- **Rules:**
237
+ **Step-specific logic:**
238
+
239
+ ### 4a. Design-explore step (build chain only)
240
+
241
+ When current step is `design_explore`:
242
+
243
+ 1. Check if `.workflow/impeccable/DESIGN.md` already exists → skip, advance to shape
244
+ 2. Check if `--skip-design-explore` or `--skip-design` is set → skip, advance to shape
245
+ 3. Otherwise → execute A_DESIGN_EXPLORE:
246
+ - `$maestro-impeccable explore --styles {styles_count}`
247
+ - explore handles everything internally: variant generation, prototype rendering, visual comparison, user selection/mix, bridge to DESIGN.md, spec registration
248
+ 4. On completion → verify DESIGN.md exists, advance to shape
249
+ 5. On failure → W004, advance to shape (full interview fallback, no DESIGN.md)
250
+
251
+ ### 4c. Normal steps
252
+
214
253
  - `teach`, `shape`, `craft` are interactive -- do NOT suppress their user gates
215
254
  - After `teach` completes → re-run context loader for fresh PRODUCT.md
216
255
  - After `craft` completes → the build exists, ready for evaluation
217
- - Gate steps (critique/audit) → transition to quality gate logic
256
+ - Gate steps (critique/audit) → transition to quality gate logic (Section 5)
218
257
 
219
258
  ## 5. Quality Gate
220
259
 
@@ -313,6 +352,7 @@ When critique/audit findings lack explicit "Suggested command", map by category:
313
352
  | overdrive | Requires explicit user vision |
314
353
  | critique | Gate command, not a fix |
315
354
  | audit | Gate command, not a fix |
355
+ | explore | Design system exploration (setup, has own user interaction) |
316
356
 
317
357
  </quality_gate_routing>
318
358
 
@@ -327,6 +367,11 @@ When critique/audit findings lack explicit "Suggested command", map by category:
327
367
  | W001 | warning | PRODUCT.md missing, prepending teach to chain |
328
368
  | W002 | warning | Max quality gate loops exceeded, forcing continue |
329
369
  | W003 | warning | Could not parse score from critique/audit output |
370
+ | E006 | error | Python 3 not available for design system generation |
371
+ | E007 | error | ui-search scripts not found at expected path |
372
+ | W004 | warning | Design system generation failed, skipping design+bridge |
373
+ | W005 | warning | Bridge transformation failed, continuing without DESIGN.md |
374
+ | W008 | warning | Node.js not available for prototype rendering, falling back to text-only variant comparison |
330
375
  </error_codes>
331
376
 
332
377
  <success_criteria>
@@ -2,11 +2,13 @@
2
2
  name: quality-refactor
3
3
  description: Reduce tech debt with reflection-driven iteration
4
4
  argument-hint: "<phase|--dir path> [--max-iterations N]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
8
8
  <purpose>
9
- Iterative refactoring cycle: analyze scope for tech debt -> plan refactoring tasks -> execute each with test verification -> reflect on strategy per round -> repeat if needed. Every change is verified against existing tests. Failed changes are reverted and retried with adjusted strategy.
9
+ Iterative refactoring cycle via `spawn_agents_on_csv`: analyze scope for tech debt -> plan refactoring tasks -> execute each as single-row CSV wave with test verification -> reflect on strategy per round -> repeat if needed. Every change is verified against existing tests. Failed changes are reverted and retried with adjusted strategy.
10
+
11
+ **Core workflow**: Parse Scope -> Analyze -> Plan -> CSV Wave-by-Wave Execution -> Reflect -> Verdict
10
12
  </purpose>
11
13
 
12
14
  <context>
@@ -28,8 +30,61 @@ $quality-refactor "--dir .workflow/scratch/refactor-auth-2026-03-18" # resume e
28
30
  - `--max-iterations N`: Max refactoring rounds (default: 3)
29
31
 
30
32
  **Output**: `.workflow/scratch/refactor-{slug}-{date}/` with index.json, plan.json, reflection-log.md, .task/, .summaries/
33
+
34
+ **Session**: `.workflow/.csv-wave/{YYYYMMDD}-refactor-{slug}/`
31
35
  </context>
32
36
 
37
+ <csv_schema>
38
+
39
+ ### tasks.csv (Master State)
40
+
41
+ ```csv
42
+ id,title,description,category,scope,convergence_criteria,read_first,verification_cmd,risk,deps,wave,status,findings,files_modified,tests_passed,retry_count,strategy_adjustment,error
43
+ "TASK-001","Extract shared validation","Extract duplicated email/phone validation logic into shared utils module","duplication","src/auth/login.ts;src/auth/register.ts","src/utils/validation.ts contains export function validateEmail(; grep -r 'validateEmail' shows single import source","src/auth/login.ts;src/auth/register.ts;src/utils/","npm test","low","","1","","","","","0","",""
44
+ "TASK-002","Simplify token refresh","Reduce cyclomatic complexity in token refresh handler from 12 to <6","complexity","src/auth/token.ts","src/auth/token.ts function refreshToken has no more than 2 levels of nesting","src/auth/token.ts;src/auth/types.ts","npm test -- --grep token","medium","","2","","","","","0","",""
45
+ "TASK-003","Remove dead session code","Remove unused session cleanup functions identified in analysis","dead_code","src/session/","grep -r 'cleanupExpired' returns 0 matches outside test files","src/session/cleanup.ts","npm test","low","","1","","","","","0","",""
46
+ ```
47
+
48
+ **Columns**:
49
+
50
+ | Column | Phase | Description |
51
+ |--------|-------|-------------|
52
+ | `id` | Input | Task ID (TASK-NNN, from plan.json) |
53
+ | `title` | Input | Short refactoring task title |
54
+ | `description` | Input | What to refactor and why |
55
+ | `category` | Input | Tech debt category: duplication / complexity / naming / dependencies / dead_code / pattern_violations |
56
+ | `scope` | Input | Semicolon-separated target files/directories |
57
+ | `convergence_criteria` | Input | Grep-verifiable completion criteria (semicolon-separated) |
58
+ | `read_first` | Input | Files to read before implementing (context) |
59
+ | `verification_cmd` | Input | Test command to run after change |
60
+ | `risk` | Input | `low` / `medium` / `high` |
61
+ | `deps` | Input | Semicolon-separated dependency task IDs |
62
+ | `wave` | Computed | Wave number — same-risk independent tasks can share a wave |
63
+ | `status` | Output | `pending` -> `completed` / `failed` / `blocked` / `skipped` |
64
+ | `findings` | Output | Implementation notes (max 500 chars) |
65
+ | `files_modified` | Output | Semicolon-separated list of changed files |
66
+ | `tests_passed` | Output | `true` / `false` — verification result |
67
+ | `retry_count` | State | Current retry count (max 2) |
68
+ | `strategy_adjustment` | State | Strategy change note for retry |
69
+ | `error` | Output | Error message if failed |
70
+
71
+ ### Per-Wave CSV (Temporary)
72
+
73
+ Each wave generates `wave-{N}.csv` with extra `prev_context` column populated from predecessor task findings.
74
+
75
+ ### Session Structure
76
+
77
+ ```
78
+ .workflow/.csv-wave/{YYYYMMDD}-refactor-{slug}/
79
+ +-- tasks.csv
80
+ +-- results.csv
81
+ +-- discoveries.ndjson
82
+ +-- reflection-log.md
83
+ +-- wave-{N}.csv (temporary)
84
+ +-- wave-{N}-results.csv
85
+ ```
86
+ </csv_schema>
87
+
33
88
  <invariants>
34
89
  1. **Test after every change** -- zero regressions tolerated
35
90
  2. **Revert on failure** -- never leave broken state
@@ -37,7 +92,7 @@ $quality-refactor "--dir .workflow/scratch/refactor-auth-2026-03-18" # resume e
37
92
  4. **Reflection-driven** -- every round records strategy, outcome, adjustment
38
93
  5. **User approval required** before execution (Step 4)
39
94
  6. **Quick wins first** -- order by risk (low first) and dependency
40
- 7. **Agent calls use `run_in_background: false`** for synchronous execution
95
+ 7. **CSV waves execute synchronously** each refactoring task dispatched as single-row wave, wait for completion before next
41
96
  8. **Incremental safety** -- each task is independently safe to apply or revert
42
97
  </invariants>
43
98
 
@@ -88,28 +143,62 @@ Confirm with user before proceeding.
88
143
  4. Update `index.json` plan fields
89
144
  5. Present plan to user via AskUserQuestion -- show affected files, risk areas, ask for approval
90
145
 
91
- ### Step 5: Execute with Reflection
92
-
93
- Initialize `reflection-log.md` if not exists.
146
+ ### Step 5: Execute with Reflection via CSV Waves
147
+
148
+ Initialize session folder `.workflow/.csv-wave/{dateStr}-refactor-{slug}/`.
149
+ Initialize `reflection-log.md` and `discoveries.ndjson` in session folder.
150
+ Build `tasks.csv` from plan.json tasks using csv_schema columns.
151
+
152
+ **Wave computation**: Group independent same-risk tasks into shared waves. Dependent tasks go to later waves. Low-risk tasks wave first, high-risk last.
153
+
154
+ For each wave N in ascending order:
155
+
156
+ **5a. Build and spawn wave:**
157
+
158
+ 1. Extract wave N pending rows from master `tasks.csv`
159
+ 2. Build `prev_context` per task from completed predecessor findings
160
+ 3. Write `wave-{N}.csv`, then execute:
161
+
162
+ ```javascript
163
+ spawn_agents_on_csv({
164
+ csv_path: `${sessionFolder}/wave-${N}.csv`,
165
+ id_column: "id",
166
+ instruction: `You are a refactoring executor. For each task:
167
+ 1. Read files listed in read_first to understand context
168
+ 2. Apply refactoring described in description targeting scope files
169
+ 3. Verify convergence_criteria via grep (all criteria must pass)
170
+ 4. Run verification_cmd and report test result
171
+ 5. If tests fail: revert ALL changes for this task, set status=failed
172
+ 6. Append discoveries to ${sessionFolder}/discoveries.ndjson
173
+ Report: files_modified (semicolon-separated), tests_passed (true/false), findings (what was changed and why)`,
174
+ max_concurrency: 1, max_runtime_seconds: 1800,
175
+ output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
176
+ output_schema: { id, status: [completed|failed|blocked], findings, files_modified, tests_passed, error }
177
+ })
178
+ ```
94
179
 
95
- For each task in order:
180
+ 4. Merge results into master `tasks.csv`, delete `wave-{N}.csv`
96
181
 
97
- **5a. Execute refactoring:** Spawn Agent to implement the refactoring — read `read_first` files, apply changes to targets, follow convergence criteria exactly.
182
+ **5b. Reflect per wave:**
98
183
 
99
- **5b. Run test suite** (npm test / pytest / go test as appropriate).
184
+ Append to `reflection-log.md`:
185
+ - Wave number, tasks attempted, pass/fail counts
186
+ - Per-task: title, strategy, outcome, test result, files changed
187
+ - Strategy adjustment notes for failed tasks
100
188
 
101
- **5c. Record in reflection-log.md:** Round number, task title, strategy, result (pass/fail), test outcome, adjustment for next round, files changed.
189
+ **5c. Handle failures (retry loop):**
102
190
 
103
- **5d. Handle test failures:**
104
- 1. Revert the change
105
- 2. Record failure + strategy adjustment in reflection-log.md
106
- 3. Retry with adjusted strategy (max 2 retries per task)
107
- 4. If still failing: mark task "blocked", continue to next
191
+ For each failed task in wave results:
192
+ 1. Increment `retry_count` in master CSV
193
+ 2. If `retry_count < 2`:
194
+ - Record failure analysis in `strategy_adjustment` column
195
+ - Re-add to next wave with adjusted description incorporating failure learnings
196
+ 3. If `retry_count >= 2`: mark task `blocked`, skip dependents
108
197
 
109
- **5e. Update state:**
110
- - `.task/TASK-{NNN}.json` status -> "completed" or "blocked"
111
- - `.summaries/TASK-{NNN}-summary.md` written
112
- - `index.json` execution and reflection fields updated
198
+ **5d. Update state per wave:**
199
+ - `.task/TASK-{NNN}.json` status synced from CSV
200
+ - `.summaries/TASK-{NNN}-summary.md` written per completed task
201
+ - `index.json` execution and reflection counters updated
113
202
 
114
203
  ### Step 6: Final Verification
115
204
 
@@ -143,9 +232,12 @@ Display report: scope, tasks completed/blocked, reflection rounds, strategy adju
143
232
  - [ ] Scope resolved and scratch directory created
144
233
  - [ ] Tech debt analysis completed with categorized findings
145
234
  - [ ] Refactoring plan approved by user
146
- - [ ] Each task executed with test verification
147
- - [ ] Failed changes reverted, retried with adjusted strategy
148
- - [ ] Reflection log records every round's strategy and outcome
235
+ - [ ] tasks.csv built from plan with proper wave assignment
236
+ - [ ] Each wave executed via spawn_agents_on_csv with test verification
237
+ - [ ] Failed tasks reverted, retried with strategy adjustment (max 2 retries)
238
+ - [ ] Reflection log records every wave's strategy and outcome
239
+ - [ ] discoveries.ndjson append-only throughout execution
149
240
  - [ ] Final test suite passes with zero regressions
241
+ - [ ] results.csv exported with all task outcomes
150
242
  - [ ] Completion report with key learnings displayed
151
243
  </success_criteria>
@@ -36,7 +36,7 @@
36
36
  "type": "ui_design",
37
37
  "regex": "ui.*design|design.*ui|prototype|设计.*原型|UI.*风格",
38
38
  "flags": "i",
39
- "route": { "graph": "ui-design-driven" }
39
+ "route": { "graph": "ui-craft-build" }
40
40
  },
41
41
  {
42
42
  "type": "init",
@@ -2,7 +2,7 @@
2
2
  "$schema": "../chain-graph.schema.json",
3
3
  "id": "singles/ui-design",
4
4
  "name": "UI Design",
5
- "description": "Generate UI design prototypes with multiple styles via ui-ux-pro-max",
5
+ "description": "UI design-driven production via maestro-ui-craft build chain",
6
6
  "version": "1.0.0",
7
7
  "tags": [
8
8
  "maestro",
@@ -18,11 +18,11 @@
18
18
  "nodes": {
19
19
  "ui_design": {
20
20
  "type": "command",
21
- "cmd": "maestro-ui-design",
21
+ "cmd": "maestro-ui-craft",
22
22
  "next": "done",
23
23
  "analyze": false,
24
- "args": "{phase}",
25
- "description": "Generate UI design prototypes with multiple styles via ui-ux-pro-max"
24
+ "args": "\"{phase}\" --chain build",
25
+ "description": "UI design-driven production via maestro-ui-craft build chain"
26
26
  },
27
27
  "done": {
28
28
  "type": "terminal",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./chain-graph.schema.json",
3
- "id": "ui-design-driven",
4
- "name": "UI Design-Driven",
5
- "description": "UI Design -> Plan -> Execute -> Verify pipeline",
3
+ "id": "ui-craft-build",
4
+ "name": "UI Craft Build",
5
+ "description": "UI Craft Build -> Plan -> Execute -> Verify pipeline",
6
6
  "version": "1.0.0",
7
7
  "tags": ["lifecycle", "ui-design"],
8
8
  "entry": "ui_design",
@@ -13,9 +13,9 @@
13
13
  "nodes": {
14
14
  "ui_design": {
15
15
  "type": "command",
16
- "cmd": "maestro-ui-design",
17
- "description": "Generate UI design prototypes with multiple styles, user selects winner",
18
- "args": "{phase}",
16
+ "cmd": "maestro-ui-craft",
17
+ "description": "UI design-driven production via maestro-ui-craft build chain",
18
+ "args": "\"{phase}\" --chain build",
19
19
  "auto_flag": "-y",
20
20
  "next": "plan"
21
21
  },
@@ -53,12 +53,12 @@
53
53
  "done": {
54
54
  "type": "terminal",
55
55
  "status": "success",
56
- "summary": "UI design-driven pipeline completed successfully"
56
+ "summary": "UI craft build pipeline completed successfully"
57
57
  },
58
58
  "done_with_issues": {
59
59
  "type": "terminal",
60
60
  "status": "paused",
61
- "summary": "UI design-driven pipeline completed with verification issues"
61
+ "summary": "UI craft build pipeline completed with verification issues"
62
62
  }
63
63
  }
64
64
  }