maestro-flow 0.3.46 → 0.3.48

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 (241) hide show
  1. package/.claude/agents/ui-design-agent.md +1 -0
  2. package/.claude/agents/workflow-executor.md +3 -0
  3. package/.claude/commands/learn-decompose.md +91 -146
  4. package/.claude/commands/learn-follow.md +102 -137
  5. package/.claude/commands/learn-investigate.md +102 -167
  6. package/.claude/commands/learn-retro.md +100 -243
  7. package/.claude/commands/learn-second-opinion.md +95 -135
  8. package/.claude/commands/maestro-amend.md +95 -232
  9. package/.claude/commands/maestro-analyze.md +1 -6
  10. package/.claude/commands/maestro-collab.md +104 -265
  11. package/.claude/commands/maestro-composer.md +113 -293
  12. package/.claude/commands/maestro-execute.md +10 -17
  13. package/.claude/commands/maestro-impeccable.md +89 -0
  14. package/.claude/commands/maestro-plan.md +1 -6
  15. package/.claude/commands/maestro-player.md +111 -340
  16. package/.claude/commands/maestro-quick.md +9 -0
  17. package/.claude/commands/maestro-ralph-execute.md +167 -210
  18. package/.claude/commands/maestro-ralph.md +245 -426
  19. package/.claude/commands/maestro-ui-codify.md +13 -0
  20. package/.claude/commands/maestro-ui-craft.md +364 -0
  21. package/.claude/commands/maestro-ui-design.md +12 -1
  22. package/.claude/commands/maestro-verify.md +12 -13
  23. package/.claude/commands/maestro.md +142 -72
  24. package/.claude/commands/manage-knowhow-capture.md +45 -170
  25. package/.claude/commands/quality-auto-test.md +9 -0
  26. package/.claude/commands/quality-debug.md +11 -25
  27. package/.claude/commands/quality-refactor.md +9 -0
  28. package/.claude/commands/quality-review.md +5 -14
  29. package/.claude/commands/spec-add.md +1 -1
  30. package/.claude/commands/spec-load.md +3 -2
  31. package/.claude/skills/maestro-impeccable/SKILL.md +169 -0
  32. package/.codex/skills/learn-decompose/SKILL.md +1 -1
  33. package/.codex/skills/learn-investigate/SKILL.md +2 -1
  34. package/.codex/skills/maestro/SKILL.md +420 -313
  35. package/.codex/skills/maestro-analyze/SKILL.md +126 -417
  36. package/.codex/skills/maestro-brainstorm/SKILL.md +129 -451
  37. package/.codex/skills/maestro-collab/SKILL.md +134 -547
  38. package/.codex/skills/maestro-execute/SKILL.md +3 -1
  39. package/.codex/skills/maestro-impeccable/SKILL.md +112 -0
  40. package/.codex/skills/maestro-plan/SKILL.md +88 -437
  41. package/.codex/skills/maestro-player/SKILL.md +191 -333
  42. package/.codex/skills/maestro-quick/SKILL.md +2 -0
  43. package/.codex/skills/maestro-ralph/SKILL.md +327 -710
  44. package/.codex/skills/maestro-roadmap/SKILL.md +201 -518
  45. package/.codex/skills/maestro-ui-codify/SKILL.md +1 -0
  46. package/.codex/skills/maestro-ui-craft/SKILL.md +341 -0
  47. package/.codex/skills/maestro-ui-design/SKILL.md +10 -0
  48. package/.codex/skills/maestro-verify/SKILL.md +116 -409
  49. package/.codex/skills/quality-auto-test/SKILL.md +145 -443
  50. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  51. package/.codex/skills/quality-test/SKILL.md +229 -517
  52. package/.codex/skills/spec-add/SKILL.md +1 -1
  53. package/README.md +4 -1
  54. package/README.zh-CN.md +3 -1
  55. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +3 -0
  56. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  57. package/dashboard/dist-server/dashboard/src/server/routes/install.js +110 -1
  58. package/dashboard/dist-server/dashboard/src/server/routes/install.js.map +1 -1
  59. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +56 -0
  60. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  61. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +2 -0
  62. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  63. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +2 -2
  64. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -1
  65. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +2 -0
  66. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  67. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +3 -1
  68. package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +2 -0
  69. package/dashboard/dist-server/dashboard/src/shared/constants.js +2 -0
  70. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  71. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  72. package/dist/src/agents/cli-agent-runner.js +1 -3
  73. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  74. package/dist/src/agents/cli-history-store.d.ts +5 -0
  75. package/dist/src/agents/cli-history-store.d.ts.map +1 -1
  76. package/dist/src/agents/cli-history-store.js +65 -13
  77. package/dist/src/agents/cli-history-store.js.map +1 -1
  78. package/dist/src/cli.js +13 -0
  79. package/dist/src/cli.js.map +1 -1
  80. package/dist/src/commands/command-help.d.ts +3 -0
  81. package/dist/src/commands/command-help.d.ts.map +1 -0
  82. package/dist/src/commands/command-help.js +60 -0
  83. package/dist/src/commands/command-help.js.map +1 -0
  84. package/dist/src/commands/config.d.ts.map +1 -1
  85. package/dist/src/commands/config.js +17 -0
  86. package/dist/src/commands/config.js.map +1 -1
  87. package/dist/src/commands/delegate.d.ts.map +1 -1
  88. package/dist/src/commands/delegate.js +12 -2
  89. package/dist/src/commands/delegate.js.map +1 -1
  90. package/dist/src/commands/impeccable.d.ts +10 -0
  91. package/dist/src/commands/impeccable.d.ts.map +1 -0
  92. package/dist/src/commands/impeccable.js +181 -0
  93. package/dist/src/commands/impeccable.js.map +1 -0
  94. package/dist/src/commands/spec.js +1 -1
  95. package/dist/src/commands/spec.js.map +1 -1
  96. package/dist/src/commands/wiki.d.ts.map +1 -1
  97. package/dist/src/commands/wiki.js +5 -1
  98. package/dist/src/commands/wiki.js.map +1 -1
  99. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  100. package/dist/src/config/cli-tools-config.js +10 -7
  101. package/dist/src/config/cli-tools-config.js.map +1 -1
  102. package/dist/src/core/addon-registry.d.ts +31 -0
  103. package/dist/src/core/addon-registry.d.ts.map +1 -0
  104. package/dist/src/core/addon-registry.js +28 -0
  105. package/dist/src/core/addon-registry.js.map +1 -0
  106. package/dist/src/hooks/plugins/spec-injection-plugin.js +2 -0
  107. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  108. package/dist/src/hooks/spec-injector.js +2 -2
  109. package/dist/src/hooks/spec-injector.js.map +1 -1
  110. package/dist/src/index.d.ts +2 -0
  111. package/dist/src/index.d.ts.map +1 -1
  112. package/dist/src/index.js +1 -0
  113. package/dist/src/index.js.map +1 -1
  114. package/dist/src/tools/impeccable/critique-storage.d.ts +28 -0
  115. package/dist/src/tools/impeccable/critique-storage.d.ts.map +1 -0
  116. package/dist/src/tools/impeccable/critique-storage.js +120 -0
  117. package/dist/src/tools/impeccable/critique-storage.js.map +1 -0
  118. package/dist/src/tools/impeccable/design-parser.d.ts +90 -0
  119. package/dist/src/tools/impeccable/design-parser.d.ts.map +1 -0
  120. package/dist/src/tools/impeccable/design-parser.js +696 -0
  121. package/dist/src/tools/impeccable/design-parser.js.map +1 -0
  122. package/dist/src/tools/impeccable/detect-csp.d.ts +6 -0
  123. package/dist/src/tools/impeccable/detect-csp.d.ts.map +1 -0
  124. package/dist/src/tools/impeccable/detect-csp.js +130 -0
  125. package/dist/src/tools/impeccable/detect-csp.js.map +1 -0
  126. package/dist/src/tools/impeccable/is-generated.d.ts +4 -0
  127. package/dist/src/tools/impeccable/is-generated.d.ts.map +1 -0
  128. package/dist/src/tools/impeccable/is-generated.js +56 -0
  129. package/dist/src/tools/impeccable/is-generated.js.map +1 -0
  130. package/dist/src/tools/impeccable/live/accept.d.ts +50 -0
  131. package/dist/src/tools/impeccable/live/accept.d.ts.map +1 -0
  132. package/dist/src/tools/impeccable/live/accept.js +556 -0
  133. package/dist/src/tools/impeccable/live/accept.js.map +1 -0
  134. package/dist/src/tools/impeccable/live/bootstrap.d.ts +2 -0
  135. package/dist/src/tools/impeccable/live/bootstrap.d.ts.map +1 -0
  136. package/dist/src/tools/impeccable/live/bootstrap.js +244 -0
  137. package/dist/src/tools/impeccable/live/bootstrap.js.map +1 -0
  138. package/dist/src/tools/impeccable/live/complete.d.ts +7 -0
  139. package/dist/src/tools/impeccable/live/complete.d.ts.map +1 -0
  140. package/dist/src/tools/impeccable/live/complete.js +67 -0
  141. package/dist/src/tools/impeccable/live/complete.js.map +1 -0
  142. package/dist/src/tools/impeccable/live/completion.d.ts +24 -0
  143. package/dist/src/tools/impeccable/live/completion.d.ts.map +1 -0
  144. package/dist/src/tools/impeccable/live/completion.js +26 -0
  145. package/dist/src/tools/impeccable/live/completion.js.map +1 -0
  146. package/dist/src/tools/impeccable/live/inject.d.ts +41 -0
  147. package/dist/src/tools/impeccable/live/inject.d.ts.map +1 -0
  148. package/dist/src/tools/impeccable/live/inject.js +394 -0
  149. package/dist/src/tools/impeccable/live/inject.js.map +1 -0
  150. package/dist/src/tools/impeccable/live/poll.d.ts +24 -0
  151. package/dist/src/tools/impeccable/live/poll.d.ts.map +1 -0
  152. package/dist/src/tools/impeccable/live/poll.js +180 -0
  153. package/dist/src/tools/impeccable/live/poll.js.map +1 -0
  154. package/dist/src/tools/impeccable/live/resume.d.ts +5 -0
  155. package/dist/src/tools/impeccable/live/resume.d.ts.map +1 -0
  156. package/dist/src/tools/impeccable/live/resume.js +30 -0
  157. package/dist/src/tools/impeccable/live/resume.js.map +1 -0
  158. package/dist/src/tools/impeccable/live/server.d.ts +6 -0
  159. package/dist/src/tools/impeccable/live/server.d.ts.map +1 -0
  160. package/dist/src/tools/impeccable/live/server.js +867 -0
  161. package/dist/src/tools/impeccable/live/server.js.map +1 -0
  162. package/dist/src/tools/impeccable/live/session-store.d.ts +72 -0
  163. package/dist/src/tools/impeccable/live/session-store.d.ts.map +1 -0
  164. package/dist/src/tools/impeccable/live/session-store.js +281 -0
  165. package/dist/src/tools/impeccable/live/session-store.js.map +1 -0
  166. package/dist/src/tools/impeccable/live/static/live-browser-session.js +123 -0
  167. package/dist/src/tools/impeccable/live/static/live-browser.js +4860 -0
  168. package/dist/src/tools/impeccable/live/static/modern-screenshot.umd.js +14 -0
  169. package/dist/src/tools/impeccable/live/status.d.ts +2 -0
  170. package/dist/src/tools/impeccable/live/status.d.ts.map +1 -0
  171. package/dist/src/tools/impeccable/live/status.js +52 -0
  172. package/dist/src/tools/impeccable/live/status.js.map +1 -0
  173. package/dist/src/tools/impeccable/live/wrap.d.ts +33 -0
  174. package/dist/src/tools/impeccable/live/wrap.d.ts.map +1 -0
  175. package/dist/src/tools/impeccable/live/wrap.js +572 -0
  176. package/dist/src/tools/impeccable/live/wrap.js.map +1 -0
  177. package/dist/src/tools/impeccable/load-context.d.ts +13 -0
  178. package/dist/src/tools/impeccable/load-context.d.ts.map +1 -0
  179. package/dist/src/tools/impeccable/load-context.js +79 -0
  180. package/dist/src/tools/impeccable/load-context.js.map +1 -0
  181. package/dist/src/tools/impeccable/paths.d.ts +34 -0
  182. package/dist/src/tools/impeccable/paths.d.ts.map +1 -0
  183. package/dist/src/tools/impeccable/paths.js +102 -0
  184. package/dist/src/tools/impeccable/paths.js.map +1 -0
  185. package/dist/src/tools/spec-entry-parser.d.ts +1 -1
  186. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
  187. package/dist/src/tools/spec-entry-parser.js +1 -1
  188. package/dist/src/tools/spec-entry-parser.js.map +1 -1
  189. package/dist/src/tools/spec-init.d.ts.map +1 -1
  190. package/dist/src/tools/spec-init.js +26 -1
  191. package/dist/src/tools/spec-init.js.map +1 -1
  192. package/dist/src/tools/spec-loader.d.ts +1 -1
  193. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  194. package/dist/src/tools/spec-loader.js +2 -0
  195. package/dist/src/tools/spec-loader.js.map +1 -1
  196. package/package.json +2 -2
  197. package/workflows/claude-instructions.md +17 -5
  198. package/workflows/cli-tools-usage.md +10 -3
  199. package/workflows/delegate-usage.md +3 -2
  200. package/workflows/impeccable/adapt.md +190 -0
  201. package/workflows/impeccable/animate.md +175 -0
  202. package/workflows/impeccable/audit.md +133 -0
  203. package/workflows/impeccable/bolder.md +113 -0
  204. package/workflows/impeccable/brand.md +118 -0
  205. package/workflows/impeccable/clarify.md +174 -0
  206. package/workflows/impeccable/codex.md +105 -0
  207. package/workflows/impeccable/cognitive-load.md +106 -0
  208. package/workflows/impeccable/color-and-contrast.md +105 -0
  209. package/workflows/impeccable/colorize.md +154 -0
  210. package/workflows/impeccable/craft.md +123 -0
  211. package/workflows/impeccable/critique.md +261 -0
  212. package/workflows/impeccable/delight.md +302 -0
  213. package/workflows/impeccable/distill.md +111 -0
  214. package/workflows/impeccable/document.md +439 -0
  215. package/workflows/impeccable/extract.md +69 -0
  216. package/workflows/impeccable/harden.md +347 -0
  217. package/workflows/impeccable/heuristics-scoring.md +234 -0
  218. package/workflows/impeccable/interaction-design.md +195 -0
  219. package/workflows/impeccable/layout.md +141 -0
  220. package/workflows/impeccable/live.md +622 -0
  221. package/workflows/impeccable/motion-design.md +109 -0
  222. package/workflows/impeccable/onboard.md +234 -0
  223. package/workflows/impeccable/optimize.md +258 -0
  224. package/workflows/impeccable/overdrive.md +130 -0
  225. package/workflows/impeccable/personas.md +179 -0
  226. package/workflows/impeccable/polish.md +242 -0
  227. package/workflows/impeccable/product.md +62 -0
  228. package/workflows/impeccable/quieter.md +99 -0
  229. package/workflows/impeccable/responsive-design.md +114 -0
  230. package/workflows/impeccable/shape.md +165 -0
  231. package/workflows/impeccable/spatial-design.md +100 -0
  232. package/workflows/impeccable/teach.md +168 -0
  233. package/workflows/impeccable/typeset.md +124 -0
  234. package/workflows/impeccable/typography.md +159 -0
  235. package/workflows/impeccable/ux-writing.md +107 -0
  236. package/workflows/impeccable.md +164 -0
  237. package/workflows/maestro.md +7 -3
  238. package/workflows/skill-authoring.md +265 -0
  239. package/workflows/specs-add.md +3 -2
  240. package/workflows/specs-load.md +2 -1
  241. package/workflows/specs-setup.md +21 -1
@@ -41,6 +41,18 @@ Flags:
41
41
  </context>
42
42
 
43
43
  <execution>
44
+ ## 1. Load UI Specs
45
+
46
+ Load project UI conventions before extracting design system:
47
+
48
+ ```bash
49
+ maestro spec load --category ui
50
+ ```
51
+
52
+ If specs not initialized, continue without — the workflow still produces valid output.
53
+
54
+ ## 2. Execute Workflow
55
+
44
56
  Route to `~/.maestro/workflows/ui-codify.md` and follow completely.
45
57
 
46
58
  The workflow orchestrates 4 phases with deferred loading of phase-specific workflow files. Each phase reads its workflow file only when execution reaches that phase.
@@ -56,6 +68,7 @@ The workflow orchestrates 4 phases with deferred loading of phase-specific workf
56
68
  </error_codes>
57
69
 
58
70
  <success_criteria>
71
+ - [ ] UI specs loaded via `spec load --category ui` (if available)
59
72
  - [ ] Source path validated and file discovery completed
60
73
  - [ ] design-tokens.json generated with color, typography, spacing tokens
61
74
  - [ ] layout-templates.json generated with component patterns (universal/specialized)
@@ -0,0 +1,364 @@
1
+ ---
2
+ name: maestro-ui-craft
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:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - Skill
14
+ - AskUserQuestion
15
+ - TodoWrite
16
+ ---
17
+ <purpose>
18
+ Orchestrate maestro-impeccable skill commands via intelligent intent routing + quality gate auto-iteration.
19
+ Chain: Build → Evaluate → Auto-Refine → Re-evaluate → Verify.
20
+
21
+ Core innovation: critique/audit scores drive automatic command selection and iteration loops.
22
+ Impeccable has 23 commands across 6 categories — this command chains them into automated pipelines
23
+ with quality gates that loop until design quality meets the threshold.
24
+
25
+ Prerequisite: maestro-impeccable skill available (auto-discovered by harness).
26
+
27
+ Session: `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`
28
+ </purpose>
29
+
30
+ <invariants>
31
+ 1. **Session before execution** — status.json created before any chain step runs
32
+ 2. **All steps via Skill** — every impeccable command dispatched through `Skill({ skill: "maestro-impeccable" })`
33
+ 3. **Gate scores drive loops** — refine loop auto-selects commands from P0/P1 findings, never from hardcoded lists
34
+ 4. **Interactive gates respected** — teach, shape, craft retain their user gates; never suppress
35
+ </invariants>
36
+
37
+ <context>
38
+ $ARGUMENTS — intent description or target path, with optional flags.
39
+
40
+ **Keywords:** `continue`/`next` → resume previous session
41
+
42
+ **Flags:**
43
+ - `--chain <type>` — Force chain type: build, improve, enhance, harden, live
44
+ - `--enhance <cmd>` — Specific enhance command for enhance chain (animate|colorize|typeset|layout|delight|overdrive|bolder)
45
+ - `--threshold <score>` — Critique pass threshold (default: 26/40). Audit threshold auto-computed as threshold×0.5
46
+ - `--max-loops <n>` — Maximum quality gate iterations (default: 3)
47
+ - `-c` / `--continue` — Resume previous ui-craft session
48
+ - `-y` — Auto mode: auto-select at ambiguous routing, skip confirmations where impeccable allows
49
+ </context>
50
+
51
+ <chains>
52
+
53
+ ### Chain Definitions
54
+
55
+ | Chain | Sequence | Gate Condition |
56
+ |-------|----------|----------------|
57
+ | **build** | teach? → shape → craft → **critique** → [refine loop] → audit → polish | critique ≥ threshold AND P0 == 0 |
58
+ | **improve** | **critique** → [refine loop] → polish → audit | critique ≥ threshold AND P0 == 0 |
59
+ | **enhance** | {cmd} → **critique** → polish (if needed) | critique ≥ threshold |
60
+ | **harden** | harden → **audit** → polish | audit ≥ threshold×0.5 |
61
+ | **live** | live | — (interactive, no gate) |
62
+
63
+ - `teach?` — conditional: only if PRODUCT.md missing/placeholder
64
+ - `[refine loop]` — quality gate loop: extract suggested commands from critique → execute → re-critique
65
+
66
+ ### Intent → Chain Routing
67
+
68
+ | Intent Pattern | Chain |
69
+ |---------------|-------|
70
+ | 新建, create, build, new, 从零, landing, feature, page | build |
71
+ | 改进, improve, fix, 优化, iterate, better, 迭代 | improve |
72
+ | 动画, 颜色, 排版, animate, color, type, bold, delight, enhance | enhance |
73
+ | 生产, production, harden, 上线, ship, edge case, i18n | harden |
74
+ | 实时, live, browser, 浏览器, variant | live |
75
+
76
+ Explicit `--chain` overrides routing. Ambiguous + no `-y` → AskUserQuestion.
77
+
78
+ </chains>
79
+
80
+ <state_machine>
81
+
82
+ <states>
83
+ S_PARSE — 解析参数、意图分类、chain 选择 PERSIST: —
84
+ S_RESUME — 扫描已有 ui-craft session、恢复执行 PERSIST: —
85
+ S_SETUP — 加载 context、检查 PRODUCT.md PERSIST: —
86
+ S_CREATE — 创建 session + status.json PERSIST: session (全量)
87
+ S_CHAIN — 按序执行 chain 步骤 PERSIST: step progress, executed commands
88
+ S_GATE — 质量门控:解析评分、决策 PERSIST: scores, loop count
89
+ S_REFINE — 执行自动选取的 refine 命令 PERSIST: refine commands, loop state
90
+ S_REPORT — 最终报告 + 趋势 PERSIST: final scores, status
91
+ </states>
92
+
93
+ <transitions>
94
+
95
+ S_PARSE:
96
+ → S_RESUME WHEN: -c / --continue flag OR keyword "continue"/"next"
97
+ → S_SETUP WHEN: chain selected (explicit or routed)
98
+ → S_PARSE WHEN: ambiguous AND not -y DO: AskUserQuestion
99
+ → END WHEN: no intent AND no target → E002
100
+
101
+ S_RESUME:
102
+ → S_CHAIN WHEN: session found DO: A_LOCATE_SESSION
103
+ → S_FALLBACK WHEN: no session found → E005
104
+
105
+ S_SETUP:
106
+ → S_CREATE DO: A_LOAD_CONTEXT
107
+
108
+ S_CREATE:
109
+ → S_CHAIN DO: A_CREATE_SESSION
110
+
111
+ S_CHAIN:
112
+ → S_GATE WHEN: current step is gate command (critique/audit)
113
+ → S_CHAIN WHEN: step is normal command → execute → advance
114
+ → S_REPORT WHEN: all steps complete
115
+
116
+ S_GATE:
117
+ → S_CHAIN WHEN: PASS (score ≥ threshold AND P0 == 0) → advance to next step
118
+ → S_REFINE WHEN: FAIL (score < threshold OR P0 > 0)
119
+ → S_CHAIN WHEN: max loops exceeded → W002 → force advance
120
+
121
+ S_REFINE:
122
+ → S_GATE DO: execute auto-selected commands → re-run gate command
123
+ GUARD: loop_count < max_loops
124
+
125
+ S_REPORT:
126
+ → END DO: A_FINAL_REPORT
127
+
128
+ </transitions>
129
+
130
+ <actions>
131
+
132
+ ### A_LOCATE_SESSION
133
+
134
+ 1. Scan `.workflow/.maestro/ui-craft-*/status.json`, filter `status == "running"`, sort DESC
135
+ 2. Take most recent; load into context as current session
136
+ 3. Resume from `current_step` position
137
+
138
+ ### A_LOAD_CONTEXT
139
+
140
+ 1. Trigger impeccable context loading by invoking: `Skill({ skill: "maestro-impeccable", args: "teach" })`
141
+ - Impeccable's own setup will auto-discover and load PRODUCT.md / DESIGN.md
142
+ - If PRODUCT.md missing/placeholder, impeccable teach handles the interview
143
+ 2. If teach was not in the chain but PRODUCT.md is missing:
144
+ - Prepend `teach` to chain start
145
+ - Announce: W001
146
+ 3. Context is now in conversation for subsequent commands
147
+
148
+ ### A_CREATE_SESSION
149
+
150
+ 1. Read `.workflow/state.json` for project context (phase, milestone)
151
+ 2. Create `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`:
152
+ ```json
153
+ { "session_id": "ui-craft-{ts}", "source": "ui-craft", "intent": "...",
154
+ "chain_type": "build|improve|enhance|harden|live", "target": "...",
155
+ "auto_mode": false, "threshold": 26, "max_loops": 3,
156
+ "steps": [{ "index": 0, "command": "shape", "status": "pending" }],
157
+ "gate_history": [], "loop_count": 0,
158
+ "current_step": 0, "status": "running",
159
+ "created_at": "ISO-8601", "updated_at": "ISO-8601" }
160
+ ```
161
+ 3. Write status.json before executing any step
162
+
163
+ ### A_FINAL_REPORT
164
+
165
+ 1. Read critique trend if available (impeccable's critique persists snapshots automatically)
166
+ 2. Update status.json with `status: "completed"` and final scores
167
+ 3. Present summary table with scores, iterations, commands executed
168
+
169
+ </actions>
170
+
171
+ </state_machine>
172
+
173
+ <execution>
174
+
175
+ ## 1. Parse & Route
176
+
177
+ 1. If `-c` / `--continue` or keyword "continue"/"next" → S_RESUME
178
+ 2. If `--chain` present → use directly
179
+ 3. Otherwise → match $ARGUMENTS against intent patterns
180
+ 4. If `--enhance` present → chain = enhance, cmd = --enhance value
181
+ 5. For enhance chain without `--enhance` → infer from intent ("动画" → animate, "颜色" → colorize, etc.)
182
+ 6. Ambiguous + no `-y` → ask user to pick chain
183
+
184
+ Create TodoWrite with chain steps.
185
+
186
+ ## 2. Setup Context
187
+
188
+ 1. If chain starts with `teach` → execute it first, impeccable handles context loading internally
189
+ 2. Otherwise → invoke `Skill({ skill: "maestro-impeccable" })` with no args to trigger setup (context + register)
190
+ 3. If impeccable reports PRODUCT.md missing → prepend teach, execute, then resume
191
+
192
+ ## 3. Create Session
193
+
194
+ Write `.workflow/.maestro/ui-craft-{ts}/status.json` with chain steps before any execution.
195
+
196
+ ## 4. Execute Chain
197
+
198
+ For each step in chain, sequentially:
199
+
200
+ ```
201
+ ▸ Step {n}/{total}: /maestro-impeccable {command} {target}
202
+ ```
203
+
204
+ Execute via: `Skill({ skill: "maestro-impeccable", args: "{command} {target}" })`
205
+
206
+ After each step: update status.json `current_step` and step `status`.
207
+
208
+ **Rules:**
209
+ - `teach`, `shape`, `craft` are interactive — do NOT suppress their user gates
210
+ - After `teach` completes → re-run context loader for fresh PRODUCT.md
211
+ - After `craft` completes → the build exists, ready for evaluation
212
+ - Gate steps (critique/audit) → transition to quality gate logic
213
+
214
+ ## 5. Quality Gate
215
+
216
+ When chain reaches a gate step (critique or audit):
217
+
218
+ ### 5a. Execute Gate Command
219
+
220
+ ```
221
+ Skill({ skill: "maestro-impeccable", args: "critique {target}" })
222
+ ```
223
+ or
224
+ ```
225
+ Skill({ skill: "maestro-impeccable", args: "audit {target}" })
226
+ ```
227
+
228
+ ### 5b. Parse Score
229
+
230
+ From critique output, extract:
231
+ - **score**: Nielsen's total (N/40) — from "**Total** | | **N/40**" row
232
+ - **P0_count**: count of `[P0]` tagged findings
233
+ - **P1_count**: count of `[P1]` tagged findings
234
+ - **suggested_commands**: list of "/maestro-impeccable <cmd>" from "Suggested command" fields
235
+
236
+ From audit output, extract:
237
+ - **score**: dimension total (N/20) — from "**Total** | | **N/20**" row
238
+ - **P0_count**: count of `[P0]` findings
239
+
240
+ ### 5c. Evaluate
241
+
242
+ ```
243
+ critique_pass = (score >= threshold) AND (P0_count == 0)
244
+ audit_pass = (score >= threshold * 0.5) AND (P0_count == 0)
245
+ ```
246
+
247
+ ### 5d. On PASS
248
+
249
+ ```
250
+ ✓ Gate passed: {score}/{max} (P0: 0)
251
+ ```
252
+ → advance to next chain step
253
+
254
+ ### 5e. On FAIL
255
+
256
+ ```
257
+ ⟳ Loop {n}/{max_loops}: {score}/{max}, P0={count}
258
+ Running: {command_list}
259
+ ```
260
+
261
+ 1. Collect suggested commands from P0/P1 findings
262
+ 2. If no suggestions found → use fallback mapping (see quality_gate_routing)
263
+ 3. De-duplicate, cap at 3 commands per iteration
264
+ 4. Sort: P0-suggested first
265
+ 5. Execute each: `Skill({ skill: "maestro-impeccable", args: "{cmd} {target}" })`
266
+ - Pass issue context: the specific findings that triggered this command are already in conversation
267
+ 6. Re-run gate command (critique/audit)
268
+ 7. Increment loop_count
269
+ 8. Append to status.json `gate_history`
270
+
271
+ ### 5f. On Max Loops Exceeded
272
+
273
+ ```
274
+ ⚠ Max iterations ({max_loops}) reached. Score: {score}/{max}, P0: {count}
275
+ Continuing chain with remaining issues.
276
+ ```
277
+ → force advance to next chain step
278
+
279
+ ## 6. Final Report
280
+
281
+ ```
282
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
283
+ Chain complete: {chain_type}
284
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
285
+
286
+ Critique : {score}/40 (trend: {trend_line})
287
+ Audit : {score}/20
288
+ Loops : {total_iterations}
289
+ Commands : {executed_command_list}
290
+
291
+ Status : {PASS | PARTIAL — N issues remain}
292
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
293
+ ```
294
+
295
+ Update status.json: `status: "completed"`, `final_scores`, `completed_at`.
296
+
297
+ If issues remain → suggest: "Run `/maestro-ui-craft --chain improve {target}` to continue iteration."
298
+
299
+ </execution>
300
+
301
+ <quality_gate_routing>
302
+
303
+ ### Finding → Command Fallback Mapping
304
+
305
+ When critique/audit findings lack explicit "Suggested command", map by category:
306
+
307
+ | Finding Category | Command |
308
+ |-----------------|---------|
309
+ | Visual hierarchy, layout, spacing, alignment | layout |
310
+ | Color, contrast, palette, monochromatic | colorize |
311
+ | Typography, font, readability, hierarchy | typeset |
312
+ | Animation, motion, transitions, micro-interaction | animate |
313
+ | Copy, labels, error messages, UX writing | clarify |
314
+ | Responsive, mobile, breakpoints, touch targets | adapt |
315
+ | Performance, loading, speed, bundle, jank | optimize |
316
+ | Complexity, overload, clutter, cognitive load | distill |
317
+ | Bland, safe, generic, lacks personality | bolder |
318
+ | Aggressive, overwhelming, loud, overstimulating | quieter |
319
+ | Onboarding, empty state, first-run, activation | onboard |
320
+ | Edge cases, i18n, error handling, overflow | harden |
321
+ | Personality, memorability, joy, delight | delight |
322
+
323
+ ### Commands Never Auto-Selected
324
+
325
+ These are structural/interactive — never picked by the refine loop:
326
+
327
+ | Command | Reason |
328
+ |---------|--------|
329
+ | teach | Project setup (run in S_SETUP only) |
330
+ | shape | Requires user interview |
331
+ | craft | Full build with multiple gates |
332
+ | live | Interactive browser mode |
333
+ | document | Generates DESIGN.md (setup) |
334
+ | extract | Design system extraction (setup) |
335
+ | overdrive | Requires explicit user vision |
336
+ | critique | Gate command, not a fix |
337
+ | audit | Gate command, not a fix |
338
+
339
+ </quality_gate_routing>
340
+
341
+ <error_codes>
342
+ | Code | Severity | Description |
343
+ |------|----------|-------------|
344
+ | E001 | error | Impeccable skill not found in project |
345
+ | E002 | error | No intent or target specified |
346
+ | E003 | error | Invalid --chain type |
347
+ | E004 | error | Invalid --enhance command |
348
+ | E005 | error | Resume session not found |
349
+ | W001 | warning | PRODUCT.md missing, prepending teach to chain |
350
+ | W002 | warning | Max quality gate loops exceeded, forcing continue |
351
+ | W003 | warning | Could not parse score from critique/audit output |
352
+ </error_codes>
353
+
354
+ <success_criteria>
355
+ - [ ] Intent classified and chain type selected
356
+ - [ ] Context loaded (PRODUCT.md present or taught)
357
+ - [ ] Session dir created with status.json before execution
358
+ - [ ] All chain steps executed via Skill("maestro-impeccable", ...)
359
+ - [ ] Quality gate evaluated with parsed scores
360
+ - [ ] Refine loop executed when gate failed (if applicable)
361
+ - [ ] Gate history and scores persisted to status.json
362
+ - [ ] Final report with scores and trend presented
363
+ - [ ] Progress tracked via TodoWrite throughout
364
+ </success_criteria>
@@ -40,7 +40,17 @@ Flags, workflow routing, scope modes, and output artifacts defined in the routed
40
40
  </context>
41
41
 
42
42
  <execution>
43
- ## Workflow Routing
43
+ ## 1. Load UI Specs
44
+
45
+ Load project UI conventions before generating designs:
46
+
47
+ ```bash
48
+ maestro spec load --category ui
49
+ ```
50
+
51
+ If specs not initialized, continue without — the workflow still produces valid output.
52
+
53
+ ## 2. Workflow Routing
44
54
 
45
55
  Detect ui-ux-pro-max skill availability and route to the appropriate workflow:
46
56
 
@@ -71,6 +81,7 @@ Skill detection logic, report format, and complete pipeline steps defined in the
71
81
 
72
82
  <success_criteria>
73
83
  **Both paths (common):**
84
+ - [ ] UI specs loaded via `spec load --category ui` (if available)
74
85
  - [ ] Requirements extracted from phase context (context.md, brainstorm, spec, or user input)
75
86
  - [ ] N style variants generated with contrasting design directions
76
87
  - [ ] User selected preferred variant (or auto-selected in -y mode)
@@ -42,8 +42,12 @@ Flags (`--skip-tests`, `--skip-antipattern`, `--dir`), scope routing, output pat
42
42
  ### Pre-load context (before verification)
43
43
 
44
44
  1. **Codebase docs**: If `.workflow/codebase/` exists, read `ARCHITECTURE.md` for expected module wiring and `FEATURES.md` for component mapping. Use in Layer 3 (Connection) checks.
45
- 2. **Wiki constraints**: Run `maestro wiki search "architecture constraint" --json 2>/dev/null`. If results found, include documented invariants as additional truth checks in Layer 1.
46
- 3. Both are optional proceed without if unavailable.
45
+ 2. **Review specs**: Run `maestro spec load --category review` to load review standards. Use as quality baseline for anti-pattern scan and constraint checks.
46
+ 3. **Wiki constraints**: Run `maestro wiki search "architecture constraint" --json 2>/dev/null`. If results found, include documented invariants as additional truth checks in Layer 1.
47
+ 4. **Role Knowledge**:
48
+ - Browse: `maestro wiki list --category review`
49
+ - Load task-relevant entries: `maestro wiki load <id1> [id2...]`
50
+ 5. All are optional — proceed without if unavailable.
47
51
  </context>
48
52
 
49
53
  <execution>
@@ -51,18 +55,13 @@ Follow '~/.maestro/workflows/verify.md' completely.
51
55
 
52
56
  ### Post-verify Knowledge Inquiry
53
57
 
54
- After verification completes, evaluate inquiry triggers:
58
+ | Condition | Ask | Route |
59
+ |-----------|-----|-------|
60
+ | Anti-pattern blockers found (TODO/FIXME/stubs) | "Update quality-rules.md?" | spec-add quality |
61
+ | Architecture constraint violations | "Update architecture-constraints.md?" | spec-add arch |
62
+ | Recurring test coverage gap (same module across tasks) | "Add to test-conventions.md?" | spec-add test |
55
63
 
56
- 1. **Anti-pattern detection**: If anti-pattern scan found blockers (TODO/FIXME, stubs, empty returns):
57
- → Ask: "Verification found {N} anti-patterns. Should `quality-rules.md` be updated to enforce these checks? (`/spec-add quality`)"
58
-
59
- 2. **Constraint violation**: If Goal-Backward check found constraint_violations or missing wiring:
60
- → Ask: "Verification found architecture constraint violations. Should `architecture-constraints.md` be updated? (`/spec-add arch`)"
61
-
62
- 3. **Test coverage gaps**: If Nyquist gaps found with recurring pattern (same module/type across tasks):
63
- → Ask: "Persistent test coverage gap detected in {module}. Should it be added to `test-conventions.md` as a required test area? (`/spec-add test`)"
64
-
65
- If user confirms, invoke `Skill({ skill: "spec-add", args: "<category> <content>" })`.
64
+ On confirm `Skill("spec-add", "<category> <content>")`.
66
65
 
67
66
  **Next-step routing on completion:**
68
67
  - All checks pass, no gaps → /quality-review