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
@@ -12,206 +12,141 @@ allowed-tools:
12
12
  - AskUserQuestion
13
13
  ---
14
14
  <purpose>
15
- Systematic investigation workflow for understanding questions (not bug-fixing). Inspired by gstack `/investigate` with its 4-phase approach, scope lock, and 3-strike escalation rule.
15
+ Systematic investigation for understanding questions (not bug-fixing). 4-phase scientific method with scope lock and 3-strike escalation. Produces evidence trails and understanding docs that persist to the learning system.
16
16
 
17
- Unlike `quality-debug` which is designed for fixing bugs during execution phases, this command is for answering "how does X work?", "why does Y happen?", "what would happen if Z?" questions. It produces structured evidence trails and understanding documents that persist to the learning system.
17
+ Unlike `quality-debug` (fix bugs during execution), this answers "how does X work?", "why does Y happen?", "what if Z?".
18
18
  </purpose>
19
19
 
20
20
  <context>
21
- Arguments: $ARGUMENTS
22
-
23
- **Target:** First argument is the question or topic to investigate (quoted string or keywords).
24
-
25
- **Flags:**
26
- - `--scope <path>` — Restrict investigation to files under this directory (default: entire project)
27
- - `--max-hypotheses N` — Maximum hypotheses to test before escalating (default: 3)
28
-
29
- **Storage written:**
30
- - `.workflow/knowhow/KNW-investigate-{slug}/evidence.ndjson` — Structured evidence log (one JSON line per evidence)
31
- - `.workflow/knowhow/KNW-investigate-{slug}/understanding.md` — Evolving understanding document
32
- - `.workflow/knowhow/KNW-investigate-{slug}/report.md` — Final investigation report
33
- - `.workflow/knowhow/specs/learnings.md` Investigation findings as `<spec-entry>` blocks (source: "investigate")
34
-
35
- **Storage read:**
36
- - Source files within scope
37
- - `maestro wiki search "<question>"` — Prior knowledge about the topic
38
- - `.workflow/knowhow/specs/learnings.md` — Prior related investigations
39
- - `.workflow/specs/debug-notes.md` — Known gotchas and patterns
40
- - `.workflow/codebase/architecture.md` — Structural context (if exists)
21
+ $ARGUMENTS — question text and optional flags.
22
+
23
+ **Flags**:
24
+ - `--scope <path>`: Restrict to files under this dir (default: entire project)
25
+ - `--max-hypotheses N`: Max hypotheses before escalation (default: 3)
26
+
27
+ **Storage write**:
28
+ - `.workflow/knowhow/KNW-investigate-{slug}/evidence.ndjson` — structured evidence (one JSON line per item)
29
+ - `.workflow/knowhow/KNW-investigate-{slug}/understanding.md` — evolving understanding
30
+ - `.workflow/knowhow/KNW-investigate-{slug}/report.md` — final report
31
+ - `specs/learnings.md` — appended `<spec-entry>` blocks
32
+
33
+ **Storage read**: source files in scope + `maestro wiki search` + `specs/learnings.md` + `debug-notes.md` + `codebase/architecture.md`
41
34
  </context>
42
35
 
43
- <execution>
44
-
45
- ### Stage 1: Frame the Question
46
- - Parse question from arguments
47
- - Determine scope (--scope or full project)
48
- - Generate investigation slug from question keywords
49
- - Create `.workflow/knowhow/KNW-investigate-{slug}/` directory
50
- - Search prior knowledge:
51
- - `maestro wiki search "<question>"` for related entries
52
- - Search `specs/learnings.md` for related insights
53
- - Read `debug-notes.md` for known gotchas
54
-
55
- Write initial `understanding.md`:
56
- ```markdown
57
- # Investigation: {question}
58
- ## Initial Understanding
59
- - Prior knowledge: {summary of wiki/knowhow findings}
60
- - Scope: {path or "full project"}
61
- - Started: {timestamp}
62
- ```
36
+ <state_machine>
63
37
 
64
- ### Stage 2: Evidence Collection
65
- Systematically gather evidence related to the question:
38
+ <states>
39
+ S_FRAME — 解析问题、确定 scope、搜索先验知识 PERSIST: understanding.md (initial)
40
+ S_EVIDENCE — 系统收集证据 PERSIST: evidence.ndjson
41
+ S_PATTERN — 比对已知模式 PERSIST: understanding.md (patterns)
42
+ S_HYPOTHESIZE — 生成假设列表 PERSIST: understanding.md (hypotheses)
43
+ S_CLI_EXPLORE — CLI 辅助探索(可选) PERSIST: evidence.ndjson (append)
44
+ S_TEST — 逐假设测试 PERSIST: evidence.ndjson + understanding.md
45
+ S_ESCALATE — 3-strike 升级 PERSIST: —
46
+ S_REPORT — 综合报告 + persist PERSIST: report.md + specs/learnings.md
47
+ </states>
66
48
 
67
- 1. **Code search**: Grep for keywords from the question across the scoped files
68
- 2. **File inspection**: Read the most relevant files identified by search
69
- 3. **Import/dependency tracing**: Follow imports to understand the dependency chain
70
- 4. **Git history**: `git log --oneline -10 -- <relevant-files>` for recent changes
49
+ <transitions>
71
50
 
72
- For each piece of evidence, append to `evidence.ndjson`:
73
- ```json
74
- {"ts": "ISO", "type": "code|git|search|doc", "source": "file:line", "relevance": "high|medium|low", "content": "...", "note": "why this matters"}
75
- ```
51
+ S_FRAME:
52
+ → S_EVIDENCE DO: A_FRAME_QUESTION
76
53
 
77
- ### Stage 3: Pattern Matching
78
- Compare collected evidence against known patterns:
79
- - Check `debug-notes.md` entries for matching situations
80
- - Check `specs/learnings.md` for related technique/pattern/gotcha entries
81
- - Identify: does this match a documented pattern, or is it novel?
82
-
83
- Update `understanding.md` with pattern analysis section.
84
-
85
- ### Stage 4: Hypothesis Formation
86
- From evidence and patterns, generate ranked hypotheses:
87
- - Each hypothesis: a specific, testable claim about "how/why"
88
- - Rank by plausibility (evidence strength)
89
- - Write hypotheses to `understanding.md`
90
-
91
- ```markdown
92
- ## Hypotheses
93
- 1. **[HIGH]** {hypothesis 1} — Evidence: {refs}
94
- 2. **[MEDIUM]** {hypothesis 2} — Evidence: {refs}
95
- 3. **[LOW]** {hypothesis 3} — Evidence: {refs}
96
- ```
54
+ S_EVIDENCE:
55
+ S_PATTERN DO: A_COLLECT_EVIDENCE
97
56
 
98
- ### Stage 4.5: CLI Supplementary Exploration (optional)
57
+ S_PATTERN:
58
+ → S_HYPOTHESIZE DO: match evidence against debug-notes.md + specs/learnings.md patterns
99
59
 
100
- **Skip if** no enabled CLI tools or hypotheses are trivially testable.
60
+ S_HYPOTHESIZE:
61
+ → S_CLI_EXPLORE WHEN: CLI tools enabled AND hypotheses non-trivial DO: A_FORM_HYPOTHESES
62
+ → S_TEST WHEN: no CLI tools OR trivial hypotheses DO: A_FORM_HYPOTHESES
101
63
 
102
- ```
103
- IF no CLI tools enabled: skip to Stage 5
104
-
105
- hypothesis_summary = hypotheses.map(h => "${h.rank}: ${h.claim}").join("\n")
106
-
107
- Bash({
108
- command: 'maestro delegate "PURPOSE: Gather evidence for investigation hypotheses
109
- TASK: For each hypothesis, trace relevant call chains and data flows | Find corroborating or contradicting code patterns
110
- MODE: analysis
111
- CONTEXT: @${scope_path}/**/*
112
- EXPECTED: JSON array of { hypothesis_rank, evidence: [{ file, line, supports: bool, explanation }] }
113
- CONSTRAINTS: Focus on code-level evidence only | Max 5 evidence items per hypothesis
114
-
115
- Hypotheses:
116
- ${hypothesis_summary}
117
- " --role explore --mode analysis',
118
- run_in_background: true
119
- })
120
- ```
64
+ S_CLI_EXPLORE:
65
+ S_TEST DO: A_CLI_SUPPLEMENT (maestro delegate --role explore --mode analysis, run_in_background, STOP)
121
66
 
122
- **On callback:** Parse result, append each evidence item to `evidence.ndjson` with `type: "cli-exploration"`. Pass as supplementary context to Stage 5 testing.
67
+ S_TEST:
68
+ → S_REPORT WHEN: hypothesis confirmed DO: A_TEST_HYPOTHESIS
69
+ → S_REPORT WHEN: all hypotheses tested (some confirmed) DO: A_TEST_HYPOTHESIS
70
+ → S_ESCALATE WHEN: max_hypotheses all failed DO: A_TEST_HYPOTHESIS
123
71
 
124
- ### Stage 5: Hypothesis Testing
125
- For each hypothesis (in rank order):
72
+ S_ESCALATE:
73
+ S_HYPOTHESIZE WHEN: user broadens scope or provides new hypothesis DO: AskUserQuestion
74
+ → S_REPORT WHEN: user selects "Escalate" or still stuck DO: mark INCONCLUSIVE
126
75
 
127
- 1. **Design test**: What specific evidence would confirm or disprove this?
128
- 2. **Execute test**: Code trace, targeted search, data inspection, or experiment
129
- 3. **Record result**: Append to `evidence.ndjson` with `type: "test"`
130
- 4. **Update understanding**: Mark hypothesis as confirmed / disproved / inconclusive
76
+ S_REPORT:
77
+ END DO: A_SYNTHESIZE_REPORT
131
78
 
132
- ```markdown
133
- ## Test Results
134
- ### Hypothesis 1: {claim}
135
- - Test: {what was done}
136
- - Result: CONFIRMED / DISPROVED / INCONCLUSIVE
137
- - Evidence: {file:line references}
138
- ```
79
+ </transitions>
80
+
81
+ <actions>
139
82
 
140
- ### Stage 6: 3-Strike Escalation
141
- If `--max-hypotheses` hypotheses all fail:
83
+ ### A_FRAME_QUESTION
142
84
 
143
- 1. **Broaden scope**: If scope was restricted, suggest expanding. AskUserQuestion:
144
- ```
145
- {N} hypotheses tested, none confirmed.
146
- A) Broaden scope to full project
147
- B) I have a new hypothesis: [user provides]
148
- C) Escalate — this needs deeper investigation
149
- ```
150
- 2. **Search wiki for clues**: `maestro wiki search` with alternative keywords
151
- 3. **If still stuck**: Mark as INCONCLUSIVE with what was learned and what remains unknown
85
+ 1. Parse question, generate slug, create KNW-investigate-{slug}/
86
+ 2. Search prior knowledge: `maestro wiki search "<question>"` + search specs/learnings.md + read debug-notes.md
87
+ 3. Write initial understanding.md (question, prior knowledge summary, scope, timestamp)
152
88
 
153
- ### Stage 7: Synthesize & Report
154
- Write final `report.md`:
89
+ ### A_COLLECT_EVIDENCE
155
90
 
156
- ```markdown
157
- # Investigation Report: {question}
91
+ Parallel evidence gathering:
92
+ 1. Code search: Grep keywords from question
93
+ 2. File inspection: Read most relevant files
94
+ 3. Import tracing: follow dependency chain
95
+ 4. Git history: `git log --oneline -10 -- <relevant-files>`
158
96
 
159
- ## Answer
160
- {confirmed understanding or "INCONCLUSIVE: ..."}
97
+ Each item → append evidence.ndjson: `{ts, type (code|git|search|doc), source (file:line), relevance (high|medium|low), content, note}`
161
98
 
162
- ## Evidence Trail
163
- | # | Type | Source | Relevance | Finding |
164
- |---|------|--------|-----------|---------|
165
- | 1 | code | file:line | high | ... |
99
+ ### A_FORM_HYPOTHESES
166
100
 
167
- ## Hypotheses Tested
168
- | Hypothesis | Result | Key Evidence |
169
- |-----------|--------|-------------|
170
- | ... | confirmed/disproved | file:line |
101
+ Generate ranked hypotheses: each is specific, testable claim about "how/why".
102
+ Rank by plausibility (evidence strength). Write to understanding.md:
103
+ - `[HIGH]` hypothesis — Evidence: {refs}
104
+ - `[MEDIUM]` hypothesis Evidence: {refs}
171
105
 
172
- ## Key Learnings
173
- - {learning 1}
174
- - {learning 2}
106
+ ### A_CLI_SUPPLEMENT
175
107
 
176
- ## Open Questions
177
- - {what remains unknown}
178
108
  ```
109
+ maestro delegate "PURPOSE: Gather evidence for hypotheses
110
+ TASK: Trace call chains and data flows per hypothesis | Find corroborating/contradicting patterns
111
+ EXPECTED: JSON [{hypothesis_rank, evidence: [{file, line, supports: bool, explanation}]}]
112
+ " --role explore --mode analysis
113
+ ```
114
+ Run_in_background, STOP, wait. On callback: append to evidence.ndjson.
115
+
116
+ ### A_TEST_HYPOTHESIS
179
117
 
180
- ### Stage 8: Persist
181
- 1. Append findings as `<spec-entry>` blocks to `specs/learnings.md` via `maestro spec add learning --body "<content>" --keywords "investigate,{question-slug}"`:
182
- - Confirmed hypotheses `roles="implement"` (merge "technique"/"pattern" into keywords)
183
- - Disproved hypotheses `roles="analyze"` (merge "gotcha" into keywords)
184
- - Stable INS-id from `hash("investigate" + question + finding_title)`
185
- 3. Display summary with answer and next steps
118
+ For each hypothesis (rank order):
119
+ 1. Design test: what evidence would confirm/disprove?
120
+ 2. Execute: code trace, targeted search, data inspection
121
+ 3. Record: append evidence.ndjson with type: "test"
122
+ 4. Update: mark hypothesis confirmed / disproved / inconclusive
186
123
 
187
- **Next-step routing:**
188
- - Save finding to specs → `/spec-add debug <finding>`
189
- - Follow-along on discovered code `/learn-follow <path>`
190
- - Decompose patterns found`/learn-decompose <module>`
191
- - Create wiki entry for understanding → `maestro wiki create --type note`
192
- </execution>
124
+ ### A_SYNTHESIZE_REPORT
125
+
126
+ Write report.md: Answer (or INCONCLUSIVE), Evidence Trail table, Hypotheses Tested table, Key Learnings, Open Questions.
127
+ Append to specs/learnings.md: confirmedroles="implement", disproved → roles="analyze" (gotcha).
128
+
129
+ </actions>
130
+
131
+ </state_machine>
193
132
 
194
133
  <error_codes>
195
- | Code | Severity | Condition | Recovery |
196
- |------|----------|-----------|----------|
197
- | E001 | error | No question provided | Provide a question as the first argument |
198
- | E002 | error | Scope path does not exist | Check --scope path is valid |
199
- | W001 | warning | No prior knowledge found in wiki/knowhow | Proceed with fresh investigation |
200
- | W002 | warning | Evidence collection found very few matches (<3) | Broaden search terms or expand scope |
201
- | W003 | warning | All hypotheses inconclusive — escalating | Investigation marked INCONCLUSIVE |
134
+ | Code | Condition | Recovery |
135
+ |------|-----------|----------|
136
+ | E002 | --scope path not found | Check path |
137
+ | W002 | Very few evidence matches (<3) | Broaden search terms or expand scope |
138
+ | W003 | All hypotheses inconclusive | Investigation marked INCONCLUSIVE |
202
139
  </error_codes>
203
140
 
204
141
  <success_criteria>
205
- - [ ] Question parsed and investigation slug generated
206
- - [ ] Investigation directory created under `.workflow/knowhow/`
207
- - [ ] Prior knowledge loaded from wiki and knowhow
208
- - [ ] Evidence collected and logged to `evidence.ndjson` (structured NDJSON)
209
- - [ ] Pattern matching performed against debug-notes and knowhow insights
142
+ - [ ] Evidence collected and logged to evidence.ndjson (structured NDJSON)
210
143
  - [ ] At least 1 hypothesis formed and tested
211
- - [ ] `understanding.md` tracks evolving understanding with timestamps
212
- - [ ] `report.md` written with answer, evidence trail, hypothesis results
213
- - [ ] Findings appended to `specs/learnings.md` as `<spec-entry>` blocks with stable INS-ids
214
- - [ ] 3-strike escalation triggered if all hypotheses fail
215
- - [ ] No files modified outside `.workflow/knowhow/`
216
- - [ ] Summary displayed with answer and next-step routing
144
+ - [ ] 3-strike escalation triggered if all fail
145
+ - [ ] Report + spec-entry blocks written
217
146
  </success_criteria>
147
+
148
+ <next_step_routing>
149
+ - Save to specs → `/spec-add debug <finding>`
150
+ - Follow code → `/learn-follow <path>`
151
+ - Decompose patterns → `/learn-decompose <module>`
152
+ </next_step_routing>