pi-maestro-flow 0.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 (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,302 @@
1
+ ---
2
+ name: maestro-impeccable
3
+ description: "Use when designing, auditing, polishing, or improving frontend UI — websites, dashboards, landing pages, components Arguments: <command|intent> [target] [flags] — 可选 chain: build|redesign|improve|enhance|launch|harden|foundation|live"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion TodoWrite
5
+ ---
6
+
7
+ <purpose>
8
+ UI design command: direct single-command, chain multi-step with quality gates, or search design knowledge.
9
+ Parse input → prerequisites → read workflow file → execute → track.
10
+ </purpose>
11
+
12
+ ## Input
13
+
14
+ $ARGUMENTS first word determines mode:
15
+
16
+ | First Word | Mode |
17
+ |------------|------|
18
+ | Known command (see routing table) | Direct |
19
+ | Chain name: build, redesign, improve, enhance, launch, harden, foundation, live | Chain |
20
+ | continue / next / -c | Resume |
21
+ | search | Search: `maestro impeccable search "$REST"` |
22
+ | Free text (concrete task) | Direct craft — has specific target + specs/reference |
23
+ | Free text (project intent) | Intent → classify → chain |
24
+ | (empty) | Menu: show commands by category |
25
+
26
+ ## Command Routing
27
+
28
+ All workflows at `~/.maestro/workflows/impeccable/{command}.md`:
29
+
30
+ | Command | Category | Description |
31
+ |---------|----------|-------------|
32
+ | craft | Build | Shape then build end-to-end — full page/component implementation |
33
+ | shape | Build | Plan UX/UI before code — information architecture, wireframe, visual direction |
34
+ | teach | Build | Set up PRODUCT.md — users, brand, tone, anti-references, principles |
35
+ | document | Build | Generate DESIGN.md from existing code — extract tokens, typography, colors |
36
+ | extract | Build | Pull tokens/components into reusable design system |
37
+ | explore | Build | Multi-style comparison — generate variants, render prototypes, visual compare, select/mix |
38
+ | critique | Evaluate | UX heuristic review with Nielsen scoring (/40) + P0/P1 findings |
39
+ | audit | Evaluate | Technical quality checks — a11y, performance, responsive, code quality (/20) |
40
+ | polish | Refine | Final quality pass — micro-adjustments, pixel perfection |
41
+ | bolder | Refine | Amplify bland/safe designs — stronger personality, more contrast |
42
+ | quieter | Refine | Tone down aggressive/overwhelming designs — reduce visual noise |
43
+ | distill | Refine | Strip to essence — remove clutter, reduce cognitive load |
44
+ | harden | Refine | Production-ready — error states, i18n, edge cases, overflow, empty states |
45
+ | onboard | Refine | First-run flows, empty states, activation paths, progressive disclosure |
46
+ | animate | Enhance | Add purposeful motion — transitions, micro-interactions, scroll effects |
47
+ | colorize | Enhance | Add strategic color — OKLCH palette, contrast, color strategy |
48
+ | typeset | Enhance | Improve typography — scale, hierarchy, font pairing, line length |
49
+ | layout | Enhance | Fix spacing, rhythm, visual hierarchy, alignment, grid |
50
+ | delight | Enhance | Add personality — memorable details, joy, surprise moments |
51
+ | overdrive | Enhance | Push past conventional limits — ambitious visual effects |
52
+ | clarify | Fix | Improve UX copy — labels, error messages, microcopy, CTAs |
53
+ | adapt | Fix | Adapt for devices/screens — responsive, touch targets, breakpoints |
54
+ | optimize | Fix | Fix UI performance — loading, rendering, bundle, paint/layout jank |
55
+ | live | Iterate | Browser-based variant iteration — real-time design in DevTools |
56
+
57
+ Reference files (loaded by workflow as needed, not standalone commands):
58
+ brand.md, product.md, design.md, codex.md, heuristics-scoring.md, cognitive-load.md,
59
+ color-and-contrast.md, interaction-design.md, motion-design.md, personas.md,
60
+ responsive-design.md, spatial-design.md, typography.md, ux-writing.md
61
+
62
+ ## Chains
63
+
64
+ Chain step names below reuse Command Routing names but resolve through the chain runner. To avoid ambiguity with Direct command invocation, internal display, todo items, and session status records always tag chain steps with the `impeccable:` prefix (e.g. `impeccable:craft`, `impeccable:critique`). The bare names in this table refer to the workflow file at `~/.maestro/workflows/impeccable/{name}.md` that the chain step reads.
65
+
66
+ | Chain | Steps | Scenario |
67
+ |-------|-------|----------|
68
+ | build | teach? → explore? → shape → craft → critique → [refine] → audit → polish | New from scratch |
69
+ | redesign | document → explore → shape → craft → critique → [refine] → audit → polish | Redesign existing code |
70
+ | improve | critique → [refine] → polish → audit | Iterative improvement |
71
+ | enhance | {cmd...} → critique → [refine] → polish | Targeted enhancement (multi-command) |
72
+ | launch | harden → adapt → optimize → audit → polish | Full production readiness |
73
+ | harden | harden → audit → polish | Edge case hardening |
74
+ | foundation | teach? → explore → document → extract | Design system setup |
75
+ | live | live | Real-time iteration |
76
+
77
+ - `?` = conditional: teach if PRODUCT.md missing; explore if DESIGN.md missing and --skip-design not set
78
+ - `[refine]` = quality gate loop: gate fails → auto-select fix commands from findings → re-gate
79
+ - `{cmd...}` = enhance supports multiple commands, comma-separated: `enhance colorize,typeset landing-page`
80
+
81
+ Chain flags: --threshold <N> (default 26/40), --max-loops <N> (default 3), --skip-design, --styles <N>, -y
82
+
83
+ ## Free Text Routing
84
+
85
+ Three-layer priority matching. Stop on first match — do not continue to lower layers.
86
+
87
+ ### Layer 1: Single command intent → Direct
88
+
89
+ Semantically match user description against the Command Routing table's Description column. Match the closest **single** command.
90
+
91
+ **Skip condition**: If the prompt also contains a Layer 2 chain keyword AND does not focus on a single design dimension, skip this layer.
92
+ Example: `enhance colors and typography` — "enhance" is a chain keyword + multiple design dimensions → skip to Layer 2.
93
+
94
+ | Intent signal | Command |
95
+ |---------------|---------|
96
+ | review, check UX, score, heuristic, evaluate usability | critique |
97
+ | audit, a11y, accessibility, technical check, performance audit, code quality | audit |
98
+ | add animation, motion, transitions, micro-interactions | animate |
99
+ | color, palette, OKLCH, contrast, color scheme | colorize |
100
+ | font, typography, type scale, line height, font pairing | typeset |
101
+ | layout, spacing, grid, alignment, visual hierarchy | layout |
102
+ | too loud, tone down, visual noise, make it simpler, too busy | quieter |
103
+ | too bland, bolder, more personality, stronger, more contrast | bolder |
104
+ | too complex, simplify, strip, remove clutter, cognitive load | distill |
105
+ | polish, fine-tune, pixel perfect, final pass, refine details | polish |
106
+ | copy, labels, error messages, UX writing, microcopy, CTAs | clarify |
107
+ | responsive, mobile, adapt, breakpoints, touch targets | adapt |
108
+ | performance, loading, bundle, jank, speed, rendering | optimize |
109
+ | edge cases, error states, i18n, overflow, empty state hardening | harden |
110
+ | onboarding, first-run, empty state, activation, progressive disclosure | onboard |
111
+ | fun, surprise, personality, memorable, joy, delight | delight |
112
+ | extraordinary, push limits, ambitious effects, cutting-edge | overdrive |
113
+ | plan UX, wireframe, information architecture, visual direction | shape |
114
+ | multi-style, variants, compare styles, style comparison | explore |
115
+ | brand definition, PRODUCT.md, product context | teach |
116
+ | extract design, DESIGN.md, document design system | document |
117
+ | pull tokens, extract components, design system extraction | extract |
118
+ | real-time, browser iteration, live editing | live |
119
+
120
+ ### Layer 2: Project intent → Chain
121
+
122
+ Layer 1 did not match. Check for chain-level keywords — even if the prompt also contains a specific target/path, chain matching takes priority.
123
+
124
+ | Pattern | Chain |
125
+ |---------|-------|
126
+ | new, create, build, from scratch, start fresh | build |
127
+ | redo, redesign, rethink, restyle, overhaul, revamp | redesign |
128
+ | improve, iterate, better, refine overall | improve |
129
+ | enhance, visual upgrade, level up | enhance |
130
+ | launch, deploy, ship, production-ready, go live | launch |
131
+ | harden, production-harden, edge cases | harden |
132
+ | design system, tokens, design foundation, design infrastructure | foundation |
133
+ | real-time, live, browser | live |
134
+
135
+ Ambiguous + no `-y`:
136
+
137
+ AskUserQuestion (single-select, header: "意图确认"):
138
+ - Options: top 2-3 matched chains from Layer 2 table, each with label = chain name, description = matched keywords
139
+ - Last option: **"直接构建"** — skip chain, route to Layer 3 craft
140
+
141
+ ### Layer 3: Concrete build task → Direct craft
142
+
143
+ Layer 1+2 both did not match, but intent is to build/create a specific thing:
144
+ - Contains a specific file path or target (`d:\path`, `src/pages/`, `index.html`)
145
+ - Contains detailed visual specs (layout, style, color scheme)
146
+ - Contains reference material (`based on...`, `like...`, `similar to...`)
147
+
148
+ → Route to **craft** (Direct)
149
+
150
+ ## Prerequisites
151
+
152
+ Before reading any command workflow:
153
+
154
+ 1. **Context**: `maestro load --type spec --category ui` → if empty → `maestro impeccable load-context`
155
+ 2. **PRODUCT.md**: missing/placeholder (<200 chars / `[TODO]`) → execute teach first, then resume original task
156
+ 3. **Register**: identify brand/product → Read `~/.maestro/workflows/impeccable/{brand|product}.md`
157
+
158
+ ## Direct Execution
159
+
160
+ 1. Prerequisites ✓
161
+ 2. **Display execution info**:
162
+ ```
163
+ ── Command: {command} ────────────────────
164
+ Category: {category} | Target: {target}
165
+ ─────────────────────────────────────────
166
+ ```
167
+ 3. Read `~/.maestro/workflows/impeccable/{command}.md`
168
+ 4. **TodoWrite tracking**: create todo items for each major phase in the workflow file
169
+ - Format: `[{command}] {phase description}`
170
+ - Mark each phase completed immediately upon finishing
171
+ 5. Follow workflow file instructions
172
+ 6. Post: suggest logical next command (teach→shape, shape→craft, craft→critique, etc.)
173
+
174
+ ## Chain Execution
175
+
176
+ 1. Prerequisites ✓
177
+ 2. **Display chain preview**: parse chain definition, output full step preview (chain steps prefixed `impeccable:` to disambiguate from Direct commands):
178
+ ```
179
+ ── Chain: build ──────────────────────────
180
+ 1. impeccable:teach (conditional: PRODUCT.md missing)
181
+ 2. impeccable:explore (conditional: DESIGN.md missing)
182
+ 3. impeccable:shape
183
+ 4. impeccable:craft
184
+ 5. impeccable:critique ◆ quality gate (threshold: 26/40)
185
+ 6. impeccable:[refine] ↺ auto-fix loop (max: 3)
186
+ 7. impeccable:audit ◆ quality gate (threshold: 14/20)
187
+ 8. impeccable:polish
188
+ ─────────────────────────────────────────
189
+ Target: {target}
190
+ ```
191
+ - `◆` marks quality gate steps with threshold
192
+ - `↺` marks refine loop with max iteration count
193
+ - Conditional steps show trigger condition
194
+ - Skipped conditional steps marked `(skipped)`
195
+ 3. **Confirm chain session**: AskUserQuestion "Create chain session for '{chain_type}' targeting '{target}'?" — proceed only if user confirms. On decline, abort chain.
196
+ Create session: `.workflow/.maestro/ui-craft-{YYYYMMDD-HHmmss}/status.json`
197
+ ```json
198
+ { "chain_type": "...", "target": "...", "steps": [...], "current_step": 0,
199
+ "gate_history": [], "loop_count": 0, "status": "running" }
200
+ ```
201
+ 4. **TodoWrite init**: create todo items for all chain steps
202
+ - One item per step, format: `[chain] step N: impeccable:{command} — {description}` (use `impeccable:` prefix to disambiguate from Direct command items)
203
+ - If conditional step is skipped, immediately mark completed
204
+ - Quality gate steps include threshold: `[chain] step 5: impeccable:critique ◆ gate ≥26/40`
205
+ 5. For each step:
206
+ - Read `~/.maestro/workflows/impeccable/{command}.md` → execute
207
+ - **Step start**: TodoWrite marks current step in_progress
208
+ - **Step done**: TodoWrite marks completed + update status.json (`current_step`, step `status`)
209
+ - **Step failed**: TodoWrite marks completed (with note) + record reason
210
+ 6. **Quality gate** (critique/audit steps):
211
+ - Parse score: critique `**Total** | | **N/40**`, audit `**Total** | | **N/20**`
212
+ - Count `[P0]` / `[P1]` tags
213
+ - Pass: score ≥ threshold AND P0 == 0 → advance
214
+ - Fail: collect suggested commands from findings → execute → re-gate
215
+ - Max loops exceeded → force advance with warning
216
+ - TodoWrite: record gate result in current step notes (score, P0/P1 count, pass/fail)
217
+ 7. Final report: scores + trend + commands executed
218
+
219
+ ## Resume
220
+
221
+ Scan `.workflow/.maestro/ui-craft-*/status.json` for `status == "running"` → most recent → resume from `current_step`.
222
+
223
+ ## Quality Gate — Finding → Command Fallback
224
+
225
+ When findings lack explicit suggested command:
226
+
227
+ | Finding Category | Command |
228
+ |-----------------|---------|
229
+ | Layout, spacing, hierarchy, alignment | layout |
230
+ | Color, contrast, palette | colorize |
231
+ | Typography, font, readability | typeset |
232
+ | Animation, motion, transitions | animate |
233
+ | Copy, labels, UX writing | clarify |
234
+ | Responsive, mobile, breakpoints | adapt |
235
+ | Performance, loading, speed | optimize |
236
+ | Complexity, overload, clutter | distill |
237
+ | Bland, safe, generic | bolder |
238
+ | Aggressive, overwhelming | quieter |
239
+ | Onboarding, empty state | onboard |
240
+ | Edge cases, i18n, error handling | harden |
241
+ | Personality, memorability | delight |
242
+
243
+ Never auto-select: teach, shape, craft, live, document, extract, overdrive, critique, audit.
244
+
245
+ ## Chain Phase Gates (MANDATORY for chain mode)
246
+
247
+ **GATE: Quality Gate Step → Next Step**
248
+ - REQUIRED: Score parsed from critique/audit output (not assumed or estimated).
249
+ - REQUIRED: P0 count extracted from findings — P0 == 0 required for pass.
250
+ - REQUIRED: If gate fails, refine commands executed and re-gate attempted.
251
+ - BLOCKED if: score not parsed from actual output, or P0 > 0 and max refine loops not exhausted — do not advance past gate.
252
+ - Do NOT skip quality gate steps or mark as "passed" without parsing actual score.
253
+
254
+ **GATE: Chain → Completion**
255
+ - REQUIRED: All non-skipped steps executed (TodoWrite all completed).
256
+ - REQUIRED: status.json updated with `status: "completed"` and final scores.
257
+ - REQUIRED: If any step failed: documented in status.json with reason.
258
+ - BLOCKED if missing: steps not all completed or status.json not updated — chain is incomplete.
259
+
260
+ <error_codes>
261
+ | Code | Severity | Condition | Recovery |
262
+ |------|----------|-----------|----------|
263
+ | E001 | error | No command or intent resolved from input | Provide a known command, chain name, or descriptive intent |
264
+ | E002 | error | Source/target path not found | Verify path exists |
265
+ | E003 | error | PRODUCT.md missing and teach step failed | Run `maestro impeccable teach` manually first |
266
+ | E004 | error | Chain quality gate failed after max loops | Review findings manually, fix critical issues, then resume |
267
+ | W001 | warning | UI specs not found via spec load | Continuing without specs — output may miss project conventions |
268
+ | W002 | warning | Quality gate score below threshold but P0 == 0 | Auto-refine loop triggered |
269
+ | W003 | warning | Chain step failed but non-blocking | Step failure documented, chain continues |
270
+ </error_codes>
271
+
272
+ <success_criteria>
273
+ Direct mode:
274
+ - [ ] Command resolved from input (routing table or free text matching)
275
+ - [ ] Prerequisites satisfied (UI specs loaded, PRODUCT.md present)
276
+ - [ ] Workflow file read and executed completely
277
+ - [ ] TodoWrite tracking created and all phases marked completed
278
+ - [ ] Next-step suggestion provided
279
+
280
+ Chain mode:
281
+ - [ ] Chain steps resolved and preview displayed
282
+ - [ ] Session status.json created in `.workflow/.maestro/ui-craft-*/`
283
+ - [ ] TodoWrite items created for all chain steps
284
+ - [ ] Each step executed with workflow file read
285
+ - [ ] Quality gates parsed with actual scores (not estimated)
286
+ - [ ] Refine loops executed when gate fails (up to max-loops)
287
+ - [ ] status.json updated with `status: "completed"` and final scores
288
+ - [ ] Final report with scores, trend, and commands executed
289
+ </success_criteria>
290
+
291
+ <completion>
292
+ ### Next-step routing
293
+
294
+ | Condition | Suggestion |
295
+ |-----------|-----------|
296
+ | Direct teach complete | `maestro impeccable shape` |
297
+ | Direct shape complete | `maestro impeccable craft` |
298
+ | Direct craft complete | `maestro impeccable critique` |
299
+ | Direct critique findings | `maestro impeccable polish` or targeted fix command |
300
+ | Chain complete | Review final scores, consider `maestro impeccable improve` for iteration |
301
+ | Chain paused/interrupted | `maestro impeccable continue` to resume |
302
+ </completion>
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: maestro-init
3
+ description: "Initialize project with auto state detection Arguments: [-y] [--from <source>] [--from-brainstorm SESSION-ID]"
4
+ allowed-tools: Read Write Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Initialize project: detect state, create `.workflow/` with project.md, state.json, config.json.
9
+ Entry point; downstream: maestro-roadmap or maestro-brainstorm.
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @~/.maestro/workflows/init.md
14
+ </required_reading>
15
+
16
+ <deferred_reading>
17
+ - [project.md](~/.maestro/templates/project.md) — read when generating project description
18
+ - [state.json](~/.maestro/templates/state.json) — read when creating initial state
19
+ - [config.json](~/.maestro/templates/config.json) — read when creating workflow configuration
20
+ </deferred_reading>
21
+
22
+ <context>
23
+ $ARGUMENTS — none for interactive mode, or `-y` with `@file` reference for auto mode.
24
+
25
+ **Flags:**
26
+
27
+ | Flag | Effect | Default |
28
+ |------|--------|---------|
29
+ | `-y` / `--yes` | Automatic mode. After config questions, runs research without further interaction. Expects idea document via @ reference. | `false` |
30
+ | `--from <source>` | Load upstream context package (brainstorm:ID, @file, or path). Consumes context-package.json to pre-fill project vision, goals, constraints, and terminology. Skips interactive questioning. Alias: `--from-brainstorm` | — |
31
+
32
+ **Load project state if exists:**
33
+ Check for `.workflow/state.json` -- loads context if project already initialized.
34
+
35
+ **Output boundary**: ALL file writes MUST target `.workflow/` (project.md, state.json, config.json, specs/) only. NEVER modify source code or files outside `.workflow/`.
36
+ </context>
37
+
38
+ <invariants>
39
+ 1. **Idempotent init** — re-running init on an already-initialized project MUST detect existing `.workflow/` and warn (E002); NEVER silently overwrite existing state
40
+ 2. **Scope guard** — init MUST only make initialization decisions; NEVER prejudge roadmap structure, plan scope, or implementation details
41
+ 3. **All artifacts required** — init MUST NOT report completion until project.md, state.json, and config.json all exist; missing artifacts MUST be created before exit
42
+ 4. **Template-driven** — deferred templates (project.md, state.json, config.json) MUST be read from `~/.maestro/templates/` and customized; NEVER generate from scratch without template
43
+ 5. **Interview writes back** — all interactive decisions MUST be written to project.md/config.json before proceeding to research or completion; NEVER leave decisions unrecorded
44
+ </invariants>
45
+
46
+ <interview_protocol>
47
+ Follows @~/.maestro/workflows/interview-mechanics.md standard.
48
+
49
+ **Interaction mode**: convergent menu-driven
50
+ **Decision tree** (strict order): project type (greenfield / existing codebase onboarding) → tech stack detection and confirmation → directory structure preferences → initial configuration (specs categories, wiki bootstrap)
51
+ **Scope guard**: only init decisions; do not prejudge roadmap structure or plan scope
52
+ **Writeback target**: project.md (project description) + config.json (settings) + state.json (initial state)
53
+ **Additional skip conditions**: --from source (upstream context pre-fills decisions)
54
+ **Exit condition**: all configuration questions settled → proceed to workflow execution
55
+ </interview_protocol>
56
+
57
+ <execution>
58
+
59
+ ### Phase Gates (MANDATORY, BLOCKING)
60
+
61
+ **GATE 1: Pre-flight → Interview**
62
+ - REQUIRED: `.workflow/` existence check completed.
63
+ - REQUIRED: `--from` source validated (if provided).
64
+ - BLOCKED if: E002 (greenfield conflict with existing `.workflow/`) unresolved.
65
+
66
+ **GATE 2: Interview → Research**
67
+ - REQUIRED: All interview decisions recorded in project.md and config.json.
68
+ - REQUIRED: `.workflow/` directory created with initial structure.
69
+ - BLOCKED if: interview decisions not yet written to files.
70
+
71
+ **GATE 3: Research → Completion**
72
+ - REQUIRED: All 3 required artifacts exist (project.md, state.json, config.json).
73
+ - REQUIRED: `.workflow/specs/` initialized.
74
+ - BLOCKED if: any artifact missing — write it before reporting completion.
75
+
76
+ ### Pre-flight
77
+
78
+ 1. Check if `.workflow/` already exists — if so, load state and warn (E002 for greenfield conflicts)
79
+ 2. Validate `--from` source is accessible if provided
80
+
81
+ Follow '~/.maestro/workflows/init.md' completely.
82
+
83
+ ### Artifact Verification (before completion)
84
+
85
+ ```
86
+ REQUIRED_ARTIFACTS = [
87
+ ".workflow/project.md", // Core Value, Requirements, Key Decisions
88
+ ".workflow/state.json", // artifacts[], initialized to idle state
89
+ ".workflow/config.json" // Workflow configuration
90
+ ]
91
+ ```
92
+ If any artifact is missing: DO NOT report completion. Write the missing file first.
93
+ </execution>
94
+
95
+ <completion>
96
+ ### Standalone report
97
+
98
+ ```
99
+ === WORKFLOW INITIALIZED ===
100
+ Project: {project_name}
101
+ State: .workflow/state.json (active)
102
+
103
+ Created:
104
+ .workflow/project.md
105
+ .workflow/state.json
106
+ .workflow/config.json
107
+ .workflow/specs/
108
+ ```
109
+
110
+ ### Ralph-invoked completion
111
+
112
+ End the step by calling the CLI (no text block output):
113
+ ```
114
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
115
+ ```
116
+
117
+ Status verdicts:
118
+ - **DONE** — Normal completion
119
+ - **DONE_WITH_CONCERNS** — Completed with caveats; pass `--concerns`
120
+ - **NEEDS_RETRY** — Tooling error / transient issue; ralph will retry
121
+ - **BLOCKED** — External hard blocker; pass `--reason`
122
+
123
+ ### Next-step routing
124
+
125
+ | Condition | Suggestion |
126
+ |-----------|-----------|
127
+ | Roadmap needed (default light) | `/maestro-roadmap <requirement>` |
128
+ | Full spec package | `/maestro-blueprint <idea>` |
129
+ | Explore ideas first | `/maestro-brainstorm <topic>` |
130
+ | View project dashboard | `/manage-status` |
131
+ | Quick ad-hoc task | `/maestro-quick <task>` |
132
+ </completion>
133
+
134
+ <error_codes>
135
+ | Code | Severity | Condition | Recovery |
136
+ |------|----------|-----------|----------|
137
+ | E001 | error | No arguments provided when -y requires @ reference | Check arguments format, re-run with correct input |
138
+ | E002 | error | .workflow/ already exists for greenfield init | Check .workflow/ directory state, resolve conflicts |
139
+ | E003 | error | Context source not found (--from / --from-brainstorm) | Check arguments format, re-run with correct input |
140
+ | W001 | warning | Research agent failed, continuing with partial results | Retry research or proceed with partial results |
141
+ </error_codes>
142
+
143
+ <success_criteria>
144
+ - [ ] `.workflow/project.md` created with Core Value, Requirements (Validated/Active/Out of Scope), Key Decisions
145
+ - [ ] `.workflow/state.json` created with artifacts[] array, initialized to idle state
146
+ - [ ] `.workflow/config.json` created with workflow / execution / git / gates / codebase / guard / collab / specInjection / dashboard segments
147
+ - [ ] `.workflow/specs/` initialized with convention files
148
+ - [ ] All interview decisions written to project.md / config.json before proceeding
149
+ - [ ] Research completed (if enabled) — parallel agents spawned with results merged
150
+ - [ ] Next-step routing displayed in completion report
151
+ </success_criteria>
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: maestro-merge
3
+ description: "Merge milestone worktree branch back to main Arguments: -m <milestone-number> [--force] [--dry-run] [--no-cleanup] [--continue]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Merge a milestone worktree branch back into main, sync scratch artifacts, and reconcile the artifact registry.
9
+ Two-phase: git merge first, artifact sync second (only after git succeeds).
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @~/.maestro/workflows/merge.md
14
+ </required_reading>
15
+
16
+ <context>
17
+ $ARGUMENTS -- milestone number and optional flags.
18
+
19
+ Flags (`-m`, `--force`, `--dry-run`, `--no-cleanup`, `--continue`), merge sequence, artifact sync detail, and conflict handling are defined in workflow `merge.md`.
20
+ </context>
21
+
22
+ <execution>
23
+ Follow '~/.maestro/workflows/merge.md' completely.
24
+
25
+ ### Phase Gates (MANDATORY, BLOCKING)
26
+
27
+ **GATE 1: Pre-merge → Git Merge**
28
+ - REQUIRED: Registry health check completed (stale entries cleaned or flagged).
29
+ - REQUIRED: Pre-merge rebase successful (worktree has latest main).
30
+ - BLOCKED if rebase has conflicts: resolve in worktree first (W003).
31
+
32
+ **GATE 2: Git Merge → Artifact Sync**
33
+ - REQUIRED: Git merge completed without conflicts (or conflicts resolved via --continue).
34
+ - BLOCKED if: merge has unresolved conflicts — do NOT sync artifacts until git merge succeeds (prevents partial state corruption).
35
+
36
+ **GATE 3: Artifact Sync → Completion**
37
+ - REQUIRED: All scratch artifacts synced to main `.workflow/scratch/`.
38
+ - REQUIRED: `state.json.artifacts[]` reconciled (worktree entries merged into main).
39
+ - REQUIRED: Worktree cleaned up (unless --no-cleanup).
40
+ - BLOCKED if missing: artifacts not synced or registry not reconciled — main worktree would have incomplete state.
41
+
42
+ </execution>
43
+
44
+ <completion>
45
+ ### Knowledge inquiry
46
+
47
+ After successful merge, use `AskUserQuestion` to confirm knowledge persistence:
48
+
49
+ ```
50
+ question: "Merge 完成。是否记录里程碑经验教训?"
51
+ options:
52
+ - label: "记录经验"
53
+ description: "通过 spec-add 持久化此次里程碑的关键洞察"
54
+ - label: "跳过"
55
+ description: "不记录,直接完成"
56
+ ```
57
+
58
+ User selects "记录经验" → prompt for title/insight, then persist via `Skill("spec-add", "learning \"<title>\" \"<insight>\" --keywords <kw1>,<kw2> --description \"<summary>\"")`. User selects "跳过" → proceed to next-step routing.
59
+
60
+ ### Next-step routing
61
+
62
+ | Condition | Suggestion |
63
+ |-----------|-----------|
64
+ | Merge complete | Skill({ skill: "manage-status" }) |
65
+ | Audit needed | Skill({ skill: "maestro-milestone-audit" }) |
66
+ </completion>
67
+
68
+ <error_codes>
69
+ | Code | Severity | Condition | Recovery |
70
+ |------|----------|-----------|----------|
71
+ | E001 | error | Running inside a worktree | Run from main worktree |
72
+ | E002 | error | No worktree registry found | Nothing to merge |
73
+ | E003 | error | --continue but no merge state | Start fresh merge |
74
+ | E004 | error | No milestone number provided | Provide `-m <N>` |
75
+ | W001 | warning | Stale registry entries found | Auto-cleaned |
76
+ | W002 | warning | Incomplete artifacts (without --force) | Confirm or use --force |
77
+ | W003 | warning | Conflict pulling main into worktree | Resolve in worktree first |
78
+ </error_codes>
79
+
80
+ <success_criteria>
81
+ - [ ] Registry health check passed (stale entries cleaned)
82
+ - [ ] Pre-merge rebase successful (worktree has latest main)
83
+ - [ ] Git merge completed without conflicts (or conflicts resolved via --continue)
84
+ - [ ] All scratch artifacts synced to main `.workflow/scratch/`
85
+ - [ ] `state.json.artifacts[]` reconciled (worktree entries merged into main)
86
+ - [ ] Milestone `"forked"` flag removed in `state.json.milestones[]`
87
+ - [ ] `roadmap.md` completed phases marked
88
+ - [ ] Worktree removed and branch deleted (unless --no-cleanup)
89
+ - [ ] `worktrees.json` registry updated (entry removed)
90
+ </success_criteria>
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: maestro-milestone-audit
3
+ description: "Audit current milestone for cross-phase integration gaps Arguments: [<milestone>]"
4
+ allowed-tools: Read Write Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Audit milestone for phase coverage, execution completeness, and integration gaps.
9
+ Produces audit-report.md with PASS/FAIL verdict.
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @~/.maestro/workflows/milestone-audit.md
14
+ </required_reading>
15
+
16
+ <context>
17
+ Milestone: $ARGUMENTS (optional -- defaults to current_milestone from state.json).
18
+ If $ARGUMENTS is empty AND current_milestone is null → raise E001 with message "No milestone specified and no current_milestone set in state.json. Provide a milestone identifier as argument."
19
+
20
+ **Requires:** All phases in the milestone should have completed execute artifacts.
21
+
22
+ **Data source:**
23
+ - `.workflow/state.json` — artifacts[], current_milestone, milestones[]
24
+ - `.workflow/roadmap.md` — milestone-to-phase mapping reference (standard milestones only; phase coverage primarily from PLN artifact's plan.json per GATE 1)
25
+ - Plan scratch dirs — for task status verification
26
+
27
+ **Adhoc milestone support (D-008):** When the target milestone has `type == "adhoc"` (or `type` field is missing, defaulting to `"standard"`), the audit skips roadmap.md parsing and phase coverage checks. It only validates artifact chain completeness (PLN→EXC exists) and runs integration checks.
28
+
29
+ ### Pre-load
30
+
31
+ 1. **Codebase docs**: IF `.workflow/codebase/doc-index.json` exists → Read ARCHITECTURE.md for integration checks
32
+ 2. **Specs**: `maestro load --type spec --category review` — load review standards for audit
33
+ 3. All optional — proceed without if unavailable
34
+
35
+ ### Role Knowledge
36
+
37
+ 1. Browse: `maestro search --category review`
38
+ 2. Select entries relevant to milestone integration audit
39
+ 3. Load: `maestro load --type knowhow --id <id1> [id2...]`
40
+ </context>
41
+
42
+ <execution>
43
+ Follow '~/.maestro/workflows/milestone-audit.md' completely.
44
+
45
+ Audit checklist steps (phase coverage, ad-hoc completeness, execution completeness, cross-artifact integration) are defined in workflow `milestone-audit.md`.
46
+
47
+ ### Phase Gates (MANDATORY, BLOCKING)
48
+
49
+ **GATE 1: Load → Phase Coverage Check**
50
+ - REQUIRED: state.json loaded with artifacts[] filtered by target milestone.
51
+ - REQUIRED: Milestone phases identified from the PLN artifact's plan.json (standard) or milestone_obj.phases (adhoc). Phase coverage is verified from the PLN artifact's plan.json, not from roadmap.
52
+ - BLOCKED if no execute artifacts found: error E003.
53
+
54
+ **GATE 2: Phase Coverage → Integration Check**
55
+ - REQUIRED: Every phase checked for artifact chain completeness (ANL→PLN→EXC for standard, PLN→EXC for adhoc).
56
+ - REQUIRED: Execution completeness verified — all tasks in executed plans checked for status.
57
+ - BLOCKED if missing: phase coverage check incomplete — do not proceed to integration check with unchecked phases.
58
+ - Do NOT skip incomplete chains — each gap MUST be logged in audit report.
59
+
60
+ **GATE 3: Integration Check → Report**
61
+ - REQUIRED: Cross-artifact integration check completed (shared interfaces, data contracts, configuration consistency).
62
+ - REQUIRED: Clear PASS/FAIL verdict determined with evidence for each check.
63
+ - BLOCKED if missing: integration check not completed — do not write report without cross-artifact verification.
64
+
65
+ </execution>
66
+
67
+ <completion>
68
+ ### Standalone report
69
+
70
+ ```
71
+ === MILESTONE AUDIT READY ===
72
+ Milestone: {milestone}
73
+ Verdict: {PASS|FAIL}
74
+ Phases audited: {N}
75
+ Integration gaps: {N}
76
+ Report: .workflow/milestones/{milestone}/audit-report.md
77
+ ```
78
+
79
+ ### Ralph-invoked completion
80
+
81
+ End the step by calling the CLI (no text block output):
82
+ ```
83
+ maestro ralph complete <idx> --status {STATUS} [--evidence .workflow/milestones/{milestone}/audit-report.md]
84
+ ```
85
+
86
+ Status verdicts:
87
+ - **DONE** — Audit passed, no gaps found
88
+ - **DONE_WITH_CONCERNS** — Audit passed with minor caveats; pass `--concerns`
89
+ - **NEEDS_RETRY** — Tooling error / transient issue; ralph will retry
90
+ - **BLOCKED** — External hard blocker; pass `--reason`
91
+
92
+ ### Next-step routing
93
+
94
+ | Condition | Suggestion |
95
+ |-----------|-----------|
96
+ | Verdict PASS | `/maestro-milestone-complete {milestone}` |
97
+ | Verdict FAIL, integration gaps | `/maestro-plan --gaps` |
98
+ | Verdict FAIL, incomplete execution | `/maestro-execute` |
99
+ </completion>
100
+
101
+ <error_codes>
102
+ | Code | Severity | Condition | Recovery |
103
+ |------|----------|-----------|----------|
104
+ | E001 | error | Milestone identifier required | Check arguments format |
105
+ | E002 | error | Milestone not found in state.json | Check milestone ID |
106
+ | E003 | error | No execute artifacts found for milestone | Run maestro-execute first |
107
+ | W001 | warning | Some phases lack complete artifact chains | Review incomplete phases |
108
+ </error_codes>
109
+
110
+ <success_criteria>
111
+ - [ ] All phases in milestone identified from the PLN artifact's plan.json (standard) or milestone_obj.phases (adhoc)
112
+ - [ ] Artifact chains verified: ANL→PLN→EXC per phase (standard) or PLN→EXC exists (adhoc)
113
+ - [ ] Ad-hoc artifacts checked for completion
114
+ - [ ] Integration check completed (shared interfaces, data contracts)
115
+ - [ ] Audit report written with clear PASS/FAIL verdict
116
+ - [ ] Next-step routing provided
117
+ </success_criteria>