maestro-flow-one 0.2.4 → 0.2.6

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 (31) hide show
  1. package/maestro-flow/agents/ui-design-agent.md +1 -0
  2. package/maestro-flow/agents/workflow-executor.md +3 -0
  3. package/maestro-flow/commands/learn/decompose.md +91 -146
  4. package/maestro-flow/commands/learn/follow.md +102 -137
  5. package/maestro-flow/commands/learn/investigate.md +102 -167
  6. package/maestro-flow/commands/learn/retro.md +100 -243
  7. package/maestro-flow/commands/learn/second-opinion.md +95 -135
  8. package/maestro-flow/commands/lifecycle/amend.md +95 -232
  9. package/maestro-flow/commands/lifecycle/analyze.md +1 -6
  10. package/maestro-flow/commands/lifecycle/collab.md +104 -265
  11. package/maestro-flow/commands/lifecycle/composer.md +113 -293
  12. package/maestro-flow/commands/lifecycle/execute.md +11 -17
  13. package/maestro-flow/commands/lifecycle/impeccable.md +89 -0
  14. package/maestro-flow/commands/lifecycle/plan.md +1 -6
  15. package/maestro-flow/commands/lifecycle/player.md +111 -340
  16. package/maestro-flow/commands/lifecycle/quick.md +9 -0
  17. package/maestro-flow/commands/lifecycle/tools-register.md +28 -7
  18. package/maestro-flow/commands/lifecycle/ui-codify.md +13 -0
  19. package/maestro-flow/commands/lifecycle/ui-craft.md +364 -0
  20. package/maestro-flow/commands/lifecycle/ui-design.md +12 -1
  21. package/maestro-flow/commands/lifecycle/verify.md +12 -13
  22. package/maestro-flow/commands/manage/knowhow-capture.md +45 -161
  23. package/maestro-flow/commands/quality/auto-test.md +9 -0
  24. package/maestro-flow/commands/quality/debug.md +11 -24
  25. package/maestro-flow/commands/quality/refactor.md +9 -0
  26. package/maestro-flow/commands/quality/review.md +5 -13
  27. package/maestro-flow/commands/quality/test.md +5 -0
  28. package/maestro-flow/commands/spec/add.md +1 -1
  29. package/maestro-flow/commands/spec/load.md +3 -2
  30. package/package.json +1 -1
  31. package/maestro-flow/commands/lifecycle/link-coordinate.md +0 -71
@@ -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
@@ -13,8 +13,7 @@ allowed-tools:
13
13
  ---
14
14
  <purpose>
15
15
  Capture reusable knowledge into `.workflow/knowhow/` with type-specific structured fields.
16
- Six content types, each optimized for a different reuse pattern. All entries are automatically
17
- indexed by WikiIndexer (type=knowhow) and searchable via `maestro knowhow search`.
16
+ Auto-indexed by WikiIndexer (type=knowhow), searchable via `maestro knowhow search`.
18
17
  </purpose>
19
18
 
20
19
  <required_reading>
@@ -22,172 +21,57 @@ indexed by WikiIndexer (type=knowhow) and searchable via `maestro knowhow search
22
21
  </required_reading>
23
22
 
24
23
  <context>
25
- Arguments: $ARGUMENTS
26
-
27
- **Types:**
28
-
29
- | Type | Prefix | Use Case | Key Fields |
30
- |------|--------|----------|------------|
31
- | `compact` | KNW- | Session state recovery | objective, files, decisions, plan, pending |
32
- | `template` | TPL- | Code/config templates | language, code block, usage context |
33
- | `recipe` | RCP- | Step-by-step how-to | prerequisites, steps, expected outcome |
34
- | `reference` | REF- | External doc / API quick-ref | source URL, key points, scenarios |
35
- | `decision` | DCS- | Design decision record | context, alternatives, rationale, consequences |
36
- | `tip` | TIP- | Quick note / reminder | content, tags |
37
-
38
- No arguments: auto-detect type or ask user via AskUserQuestion.
39
-
40
- **Flags:**
41
- - `--lang <lang>` Language for templates (typescript, python, bash, yaml, etc.)
42
- - `--source <url>` Source URL for references
43
- - `--tag tag1,tag2`Categorization tags
44
- - `--title <title>` — Explicit title (auto-generated if omitted)
24
+ $ARGUMENTS — type token + description + optional flags.
25
+
26
+ **Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
27
+
28
+ **Type routing** (first token match):
29
+
30
+ | Token | Type | Prefix | Key fields |
31
+ |-------|------|--------|------------|
32
+ | `compact`/`session`/`压缩`/`保存` | compact | KNW- | objective, files, decisions, plan, pending |
33
+ | `template`/`tpl`/`模板` | template | TPL- | language, code block, usage, parameters |
34
+ | `recipe`/`rcp`/`配方`/`步骤` | recipe | RCP- | prerequisites, steps, expected outcome, pitfalls |
35
+ | `reference`/`ref`/`参考`/`引用` | reference | REF- | source URL, key points, scenarios, examples |
36
+ | `decision`/`dcs`/`决策`/`adr` | decision | DCS- | context, alternatives table, rationale, consequences |
37
+ | `tip`/`note`/`记录`/`快速` | tip | TIP- | content, tags |
38
+ | `asset`/`ast`/`资产`/`契约` | asset | AST- | assetType, codePaths, category |
39
+ | `blueprint`/`blp`/`蓝图` | blueprint | BLP- | codePaths, category |
40
+ | `document`/`doc`/`文档` | document | DOC- | (general fallback) |
41
+ | Short text + `--tag` | tip | TIP- | — |
42
+ | No args | | — | AskUserQuestion (9 options) |
43
+
44
+ **Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{HHMM}.md` with YAML frontmatter (title, type, category, created, tags, source, lang, status)
45
45
  </context>
46
46
 
47
47
  <execution>
48
-
49
- ### Step 1: Detect Type
50
-
51
- Parse first token as type. If ambiguous, AskUserQuestion with options:
52
-
53
- | Token Match | Type |
54
- |-------------|------|
55
- | `compact`, `session`, `压缩`, `保存` | compact |
56
- | `template`, `tpl`, `模板` | template |
57
- | `recipe`, `rcp`, `配方`, `步骤` | recipe |
58
- | `reference`, `ref`, `参考`, `引用` | reference |
59
- | `decision`, `dcs`, `决策`, `adr` | decision |
60
- | `tip`, `note`, `记录`, `快速` | tip |
61
- | No match, short text, `--tag` present | tip |
62
- | No arguments | AskUserQuestion (6 options) |
63
-
64
- ### Step 2: Generate Content by Type
65
-
66
- #### compact (KNW-{YYYYMMDD}-{HHMM}.md)
67
-
68
- Extract from conversation history:
69
- - **Session ID** — WFS-* if workflow session active, else `manual-{date}`
70
- - **Project Root** — Absolute path
71
- - **Objective** — High-level goal
72
- - **Execution Plan** — Source + complete verbatim content (never summarize)
73
- - **Working Files** — Modified files with roles (absolute paths, 3-8 files)
74
- - **Reference Files** — Read-only context files
75
- - **Last Action** — Final action + result
76
- - **Decisions** — Table: decision | reasoning
77
- - **Constraints** — User-specified limitations
78
- - **Dependencies** — Added/changed packages
79
- - **Known Issues** — Deferred bugs
80
- - **Changes Made** — Completed modifications
81
- - **Pending** — Next steps
82
- - **Notes** — Unstructured thoughts
83
-
84
- Plan detection priority: workflow session IMPL_PLAN.md > TodoWrite items > user-stated > inferred.
85
-
86
- #### template (TPL-{YYYYMMDD}-{HHMM}.md)
87
-
88
- Ask for or extract:
89
- - **Language / Tech** — `--lang` flag or inferred from context
90
- - **Usage** — When/how to use this template
91
- - **Code** — The template content (ask user to provide or select from conversation)
92
- - **Parameters** — Placeholders to replace (e.g. `{{name}}`, `{{port}}`)
93
- - **Dependencies** — Required packages/config
94
- - **Tags** — From `--tag` flag
95
-
96
- If code not provided explicitly, prompt user: "Paste the template code:"
97
-
98
- #### recipe (RCP-{YYYYMMDD}-{HHMM}.md)
99
-
100
- Ask for or extract:
101
- - **Goal** — What this recipe accomplishes
102
- - **Prerequisites** — Tools, access, config needed
103
- - **Steps** — Numbered step-by-step instructions
104
- - **Expected Outcome** — What success looks like
105
- - **Common Pitfalls** — Known issues / gotchas
106
- - **Related** — Links to templates, references, decisions used
107
- - **Tags** — From `--tag` flag
108
-
109
- If steps not clear, prompt user: "Describe the steps (numbered list):"
110
-
111
- #### reference (REF-{YYYYMMDD}-{HHMM}.md)
112
-
113
- Ask for or extract:
114
- - **Source** — `--source` flag (URL, doc title, API endpoint)
115
- - **Key Points** — Bullet list of essential info
116
- - **Applicable Scenarios** — When to consult this reference
117
- - **Quick Examples** — Copy-paste ready code snippets
118
- - **Last Verified** — Date (today)
119
- - **Tags** — From `--tag` flag
120
-
121
- If `--source` provided, offer to fetch and summarize via WebFetch.
122
-
123
- #### decision (DCS-{YYYYMMDD}-{HHMM}.md)
124
-
125
- Ask for or extract:
126
- - **Context** — Background and problem statement
127
- - **Decision** — What was decided
128
- - **Alternatives Considered** — Table: alternative | pros | cons | rejected because
129
- - **Rationale** — Why this choice over alternatives
130
- - **Consequences** — Positive and negative impact
131
- - **Related** — Links to affected specs, recipes, templates
132
- - **Date** — Decision date
133
- - **Status** — proposed | accepted | superseded
134
-
135
- #### tip (TIP-{YYYYMMDD}-{HHMM}.md)
136
-
137
- Simple note:
138
- - **Content** — Everything after type token (or full $ARGUMENTS)
139
- - **Context** — Auto-detected from recent conversation files
140
- - **Tags** — From `--tag` flag
141
- - **Timestamp** — ISO format
142
-
143
- ### Step 3: Write File
144
-
145
- Write to `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{HHMM}.md` with YAML frontmatter:
146
-
147
- ```yaml
148
- ---
149
- title: {auto or --title}
150
- type: {type}
151
- category: {type}
152
- created: {ISO timestamp}
153
- tags: [{tags}]
154
- source: {url if reference}
155
- lang: {language if template}
156
- status: {status if decision}
157
- ---
158
- {markdown body}
159
- ```
160
-
161
- ### Step 4: Confirm
162
-
163
- ```
164
- === KNOWHOW CAPTURED ===
165
- Type: {type}
166
- ID: knowhow-{slug}
167
- File: .workflow/knowhow/{filename}
168
-
169
- {type-specific summary line}
170
- ```
48
+ Follow '~/.maestro/workflows/knowhow.md' completely.
49
+
50
+ **Type-specific content rules**:
51
+
52
+ | Type | Content extraction |
53
+ |------|-------------------|
54
+ | compact | Extract from conversation: session ID, objective, execution plan (verbatim), working files (3-8), decisions, constraints, pending. Plan priority: workflow IMPL_PLAN.md > TodoWrite > user-stated > inferred. |
55
+ | template | Ask for: language, code block, parameters (placeholders), usage context, dependencies |
56
+ | recipe | Ask for: goal, prerequisites, numbered steps, expected outcome, common pitfalls |
57
+ | reference | From --source URL or ask. Key points, applicable scenarios, quick examples. Offer WebFetch if URL provided. |
58
+ | decision | Context, alternatives (table: alt/pros/cons/rejected-because), rationale, consequences. Status: proposed/accepted/superseded. |
59
+ | tip | Content = everything after type token. Auto-detect context from recent files. |
60
+ | asset | assetType (api-contract/data-model/prompt/config), codePaths, category for agent discovery |
61
+ | blueprint | Architecture design with codePaths and category |
171
62
  </execution>
172
63
 
173
64
  <error_codes>
174
- | Code | Severity | Description | Stage |
175
- |------|----------|-------------|-------|
176
- | E001 | error | `.workflow/` not initialized run `/maestro-init` first | validate |
177
- | E002 | error | Template: no code provided after prompt | template |
178
- | E003 | error | Recipe: no steps provided after prompt | recipe |
179
- | W001 | warning | No active workflow session compact captures conversation only | compact |
180
- | W002 | warning | Plan detection found no explicit plan — using inferred plan | compact |
181
- | W003 | warning | `--source` URL could not be fetched — proceeding with manual entry | reference |
65
+ | Code | Condition | Recovery |
66
+ |------|-----------|----------|
67
+ | E002 | Template: no code provided after prompt | Ask again or cancel |
68
+ | E003 | Recipe: no steps provided after prompt | Ask again or cancel |
69
+ | W001 | No active workflow session (compact) | Captures conversation only |
70
+ | W002 | Plan detection found no explicit plan (compact) | Uses inferred plan |
182
71
  </error_codes>
183
72
 
184
73
  <success_criteria>
185
- - [ ] Type correctly detected or selected
186
- - [ ] All type-specific fields populated (not empty)
187
- - [ ] YAML frontmatter written with correct fields
188
- - [ ] Markdown body follows type structure
189
- - [ ] File written to `.workflow/knowhow/` with correct prefix
190
- - [ ] Auto-indexed by WikiIndexer (type=knowhow)
191
- - [ ] Confirmation displayed with ID, type, file path
192
- - [ ] Next step hint appropriate to type shown
74
+ - [ ] Type detected or selected, all type-specific fields populated
75
+ - [ ] File written to .workflow/knowhow/ with correct prefix and YAML frontmatter
76
+ - [ ] Confirmation displayed with ID, type, path
193
77
  </success_criteria>
@@ -50,6 +50,15 @@ Phase or task: $ARGUMENTS (required — phase number)
50
50
  | 5 | Default | code | quality-integration-test |
51
51
 
52
52
  Flags, artifact context resolution, and output formats defined in workflow auto-test.md.
53
+
54
+ ### Pre-load context (before test generation)
55
+
56
+ 1. **Test specs + tools**: Run `maestro spec load --category test` to load test conventions (framework, patterns, naming). Apply to all generated tests.
57
+ 2. **Coding specs**: Run `maestro spec load --category coding` to understand coding patterns for accurate test targeting.
58
+ 3. **Role Knowledge**:
59
+ - Browse: `maestro wiki list --category test`
60
+ - Load task-relevant entries: `maestro wiki load <id1> [id2...]`
61
+ 4. All are optional — proceed without if unavailable.
53
62
  </context>
54
63
 
55
64
  <execution>