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
@@ -13,281 +13,238 @@ allowed-tools:
13
13
  ---
14
14
  <purpose>
15
15
  Single-step executor for ralph (adaptive) and maestro (static) sessions.
16
- Sessions stored at `.workflow/.maestro/*/status.json`.
17
-
18
- Each invocation: locate session → find next pending step → resolve args → execute → update status → hand off to next iteration.
16
+ Each invocation: locate session → find next step → resolve args → execute → update → self-invoke next.
19
17
 
20
18
  Mutual invocation with `/maestro-ralph` forms a self-perpetuating work loop.
19
+ Session: `.workflow/.maestro/*/status.json`
21
20
  </purpose>
22
21
 
23
22
  <context>
24
23
  $ARGUMENTS — optional `-y` flag + optional session ID.
25
24
 
26
- **Flag parsing:**
25
+ **Parse:**
27
26
  ```
28
- -y / --yes → auto = true (remove from remaining args)
29
- Remaining → session_id (if matches maestro-* or ralph-* pattern)
27
+ -y / --yes → auto = true
28
+ Remaining → session_id (if matches maestro-* or ralph-*)
30
29
  ```
31
-
32
- Also read `session.auto_mode` from status.json — if `true`, treat as `-y` even without flag.
33
-
34
- **Session sources:**
35
- - **ralph** — Adaptive chain with decision nodes (primary)
36
- - **maestro** — Static chain, internal/external only, no decision callbacks
30
+ Also read `session.auto_mode` from status.json — if true, treat as `-y`.
37
31
 
38
32
  **Node types:**
39
33
 
40
34
  | Type | Execution | Flow after |
41
35
  |------|-----------|------------|
42
- | decision (ralph-only) | `Skill("maestro-ralph")` — ralph re-evaluates, may expand chain | Ralph handles handoff, this execution ends |
43
- | internal | `Skill({ skill, args })` — synchronous in-session | Self-invoke next |
44
- | external | `maestro delegate --to claude` new Claude Code session | STOP → callback → self-invoke next |
36
+ | decision (ralph-only) | `Skill("maestro-ralph")` — ralph re-evaluates | Execution ends here |
37
+ | internal | `Skill({ skill, args })` — synchronous | Self-invoke next |
38
+ | external | `maestro delegate --to claude --mode write` | STOP → callback → self-invoke |
45
39
 
46
- **Auto flag map** (appended to skill args when auto mode is active):
40
+ HARD RULE: External nodes ALWAYS append `-y` to skill args inside the prompt delegate sessions are non-interactive.
41
+ HARD RULE: External nodes ALWAYS delegate to `claude` — only Claude Code can execute slash-command skills.
42
+ </context>
47
43
 
48
- All lifecycle skills: `-y`. Exception: `quality-test` → `-y --auto-fix`.
44
+ <invariants>
45
+ 1. **Every step via Skill() or delegate** — never simulate or inline a skill's work
46
+ 2. **External → claude only** — `session.cli_tool` is for analysis delegates, NOT execution
47
+ 3. **Self-invocation chain** — continues until all steps complete or session paused
48
+ 4. **Status.json updated after every change** — resume-safe
49
+ </invariants>
49
50
 
50
- Fallback for unlisted skills: internal → no flag, external → `-y`.
51
+ <state_machine>
51
52
 
52
- HARD RULE: External nodes ALWAYS append `-y` **to the skill's args inside the prompt** (not as a `maestro delegate` CLI argument), regardless of auto mode — delegate sessions are non-interactive and cannot confirm prompts.
53
- </context>
53
+ <states>
54
+ S_LOCATE — 定位 session + 找下一个 pending step PERSIST: —
55
+ S_RESOLVE_ARGS — 解析占位符 + 丰富参数 PERSIST: step.args (enriched)
56
+ S_EXECUTE — 执行当前 step PERSIST: step.status = "running", session.current_step
57
+ S_POST_EXEC — 标记完成 + 传播上下文 PERSIST: step.status, session.context
58
+ S_HANDLE_FAIL — 处理失败(重试/跳过/中止) PERSIST: step.status, session.status
59
+ S_COMPLETE — 所有 step 完成 PERSIST: session.status = "completed"
60
+ S_FALLBACK — 无 session 可执行 PERSIST: —
61
+ </states>
54
62
 
55
- <execution>
63
+ <transitions>
56
64
 
57
- ## Step 1: Locate Session + Find Next Step
65
+ S_LOCATE:
66
+ → S_RESOLVE_ARGS WHEN: pending step found DO: A_LOCATE_SESSION
67
+ → S_COMPLETE WHEN: no pending steps
68
+ → S_FALLBACK WHEN: no running session
58
69
 
59
- ```
60
- If session_id provided (matches maestro-* or ralph-*):
61
- session_path = .workflow/.maestro/{session_id}/status.json
62
- Else:
63
- Scan .workflow/.maestro/*/status.json
64
- Filter: status == "running"
65
- Sort: updated_at DESC (or dir mtime DESC)
66
- Take first
67
-
68
- If no session found:
69
- Output: "无运行中的会话。使用 /maestro 或 /maestro-ralph 创建新会话。"
70
- End.
71
- ```
70
+ S_RESOLVE_ARGS:
71
+ S_EXECUTE DO: A_RESOLVE_ARGS
72
72
 
73
- Read status.json → extract: `session_id`, `source`, `steps[]`, `current_step`, `status`, `phase`, `milestone`, `intent`, `auto_mode`, `context`, `cli_tool`.
73
+ S_EXECUTE:
74
+ → END WHEN: step.type == "decision" DO: A_EXEC_DECISION
75
+ → S_POST_EXEC WHEN: step.type == "internal" + success DO: A_EXEC_INTERNAL
76
+ → S_HANDLE_FAIL WHEN: step.type == "internal" + failure DO: A_EXEC_INTERNAL
77
+ → END WHEN: step.type == "external" DO: A_EXEC_EXTERNAL
78
+ (STOP after background delegate; on callback → S_POST_EXEC or S_HANDLE_FAIL)
74
79
 
75
- ```
76
- next = steps.find(step => step.status == "pending")
77
- If no pending step → Step 5 (Complete Session)
78
- ```
80
+ S_POST_EXEC:
81
+ S_LOCATE DO: A_MARK_COMPLETE + Skill("maestro-ralph-execute")
82
+
83
+ S_HANDLE_FAIL:
84
+ → S_LOCATE WHEN: auto + not retried DO: A_RETRY
85
+ → END WHEN: auto + retried DO: A_PAUSE_SESSION
86
+ → S_LOCATE WHEN: interactive + user selects retry DO: A_RETRY
87
+ → S_LOCATE WHEN: interactive + user selects skip DO: A_SKIP_STEP
88
+ → END WHEN: interactive + user selects abort DO: A_PAUSE_SESSION
89
+
90
+ S_COMPLETE:
91
+ → END DO: A_COMPLETE_SESSION
92
+
93
+ S_FALLBACK:
94
+ → END DO: display "无运行中的会话。使用 /maestro 或 /maestro-ralph 创建。"
95
+
96
+ </transitions>
79
97
 
80
- ## Step 2: Resolve Args
98
+ <actions>
81
99
 
82
- Enrich `next.args` with session context before execution.
100
+ ### A_LOCATE_SESSION
101
+
102
+ 1. If session_id provided → load `.workflow/.maestro/{session_id}/status.json`
103
+ 2. Else: scan `.workflow/.maestro/*/status.json`, filter `status == "running"`, sort DESC, take first
104
+ 3. Extract: session_id, source, steps[], current_step, phase, milestone, intent, auto_mode, context, cli_tool
105
+ 4. Find first step with `status == "pending"` → next step
106
+
107
+ ### A_RESOLVE_ARGS
83
108
 
84
109
  **Placeholder substitution:**
85
110
 
86
111
  | Placeholder | Source |
87
112
  |-------------|--------|
88
- | `{phase}` | status.phase |
89
- | `{milestone}` | status.milestone |
90
- | `{intent}` | status.intent |
91
- | `{description}` | status.intent (alias) |
92
- | `{scratch_dir}` | status.context.scratch_dir or latest artifact path |
93
- | `{plan_dir}` | status.context.plan_dir |
94
- | `{analysis_dir}` | status.context.analysis_dir |
95
- | `{issue_id}` | status.context.issue_id |
96
- | `{milestone_num}` | status.context.milestone_num |
97
-
98
- **Per-skill enrichment** (when args is empty or only has phase number):
113
+ | `{phase}` | session.phase |
114
+ | `{milestone}` | session.milestone |
115
+ | `{intent}` | session.intent |
116
+ | `{description}` | session.intent (alias) |
117
+ | `{scratch_dir}` | session.context.scratch_dir or latest artifact path |
118
+ | `{plan_dir}` | session.context.plan_dir |
119
+ | `{analysis_dir}` | session.context.analysis_dir |
120
+ | `{issue_id}` | session.context.issue_id |
121
+ | `{milestone_num}` | session.context.milestone_num |
122
+
123
+ **Per-skill enrichment** (when args empty or minimal):
99
124
 
100
125
  | Skill | Required context | Source |
101
126
  |-------|-----------------|--------|
102
- | maestro-brainstorm | topic description | `"{intent}"` |
103
- | maestro-roadmap | description + context | `"{intent}"` |
104
- | maestro-analyze | phase or topic | `{phase}` or `"{intent}"` if no phase |
127
+ | maestro-brainstorm | topic | `"{intent}"` |
128
+ | maestro-roadmap | description | `"{intent}"` |
129
+ | maestro-analyze | phase or topic | `{phase}` or `"{intent}"` |
105
130
  | maestro-plan | phase or --dir | `{phase}`, or `--dir {scratch_dir}` if standalone |
106
131
  | maestro-execute | phase or --dir | `{phase}`, or `--dir {scratch_dir}` if standalone |
107
- | maestro-verify | phase | `{phase}` |
108
- | quality-debug | gap context | Read previous step's error/gap summary from artifact dir |
132
+ | quality-debug | gap context | Read previous step's error/gap from artifact dir |
109
133
  | quality-* | phase | `{phase}` |
110
134
 
111
- **Artifact dir resolution for --dir args:**
135
+ **Artifact dir resolution for --dir:**
112
136
  ```
113
- Read .workflow/state.json
114
- Filter artifacts: milestone == session.milestone, phase == session.phase
115
- For plan commands: find latest type=="analyze" artifact → --dir .workflow/scratch/{path}
116
- For execute commands: find latest type=="plan" artifact → --dir .workflow/scratch/{path}
137
+ Read state.json → filter artifacts by milestone + phase
138
+ plan commands: latest type=="analyze" --dir .workflow/scratch/{path}
139
+ execute commands: latest type=="plan" → --dir .workflow/scratch/{path}
117
140
  ```
118
141
 
119
142
  Write enriched args back to status.json (resume-safe).
120
143
 
121
- ## Step 3: Execute
144
+ ### A_EXEC_DECISION
122
145
 
123
- Mark step as running:
124
- ```
125
- next.status = "running"
126
- next.started_at = ISO timestamp
127
- status.current_step = next.index
128
- status.updated_at = ISO timestamp
129
- Write status.json
130
- ```
146
+ 1. Mark step running, write status.json
147
+ 2. Display: `[{index}/{total}] ◆ {skill} [decision] Retry: {retry}/{max}`
148
+ 3. `Skill({ skill: "maestro-ralph" })` — ralph detects running decision → evaluates → handoff
149
+ 4. **This execution ends here** — ralph handles the handoff back
131
150
 
132
- Display banner:
133
- ```
134
- ------------------------------------------------------------
135
- [{next.index}/{steps.length - 1}] {next.skill} [{next.type}]
136
- ------------------------------------------------------------
137
- Session: {session_id} [{source}]
138
- Args: {next.args}
139
- ```
140
- If decision node: also show `Retry: {retry_count}/{max_retries}`.
151
+ ### A_EXEC_INTERNAL
141
152
 
142
- ### decision node
153
+ 1. Mark step running, write status.json
154
+ 2. Display: `[{index}/{total}] {skill} [internal]`
155
+ 3. Resolve auto flag: `auto ? (flag_map[skill] || "") : ""`
156
+ 4. `Skill({ skill: next.skill, args: effective_args })`
157
+ 5. Return success/failure
143
158
 
144
- ```
145
- Skill({ skill: "maestro-ralph" })
146
- ```
159
+ **Auto flag map:** all lifecycle skills → `-y`; `quality-test` → `-y --auto-fix`; unlisted internal → no flag
147
160
 
148
- Ralph detects the running decision → evaluates → optionally expands steps[] → marks completed → calls ralph-execute. **This execution ends here — ralph handles the handoff.**
161
+ ### A_EXEC_EXTERNAL
149
162
 
150
- ### internal node
163
+ 1. Mark step running, write status.json
164
+ 2. Display: `[{index}/{total}] ⚡ {skill} [external]`
165
+ 3. Always append `-y` to skill args (delegates are non-interactive): `flag = flag_map[skill] || "-y"`
166
+ 4. Execute:
167
+ ```
168
+ Bash({
169
+ command: `maestro delegate "/${skill} ${effective_args}" --to claude --mode write`,
170
+ run_in_background: true, timeout: 600000
171
+ })
172
+ STOP — wait for callback.
173
+ ```
174
+ 5. On callback: retrieve output → S_POST_EXEC or S_HANDLE_FAIL
151
175
 
152
- HARD RULE: Every step MUST be executed via `Skill({ skill, args })`. Never simulate or inline a skill's work.
176
+ ### A_MARK_COMPLETE
153
177
 
154
- ```
155
- flag = auto ? (auto_flag_map[next.skill] || "") : ""
156
- effective_args = flag ? `${next.args} ${flag}` : next.args
178
+ 1. `step.status = "completed"`, `step.completed_at = now`
179
+ 2. Scan output for context signals:
180
+ - `PHASE: N` session.phase
181
+ - `scratch_dir: path` → context.scratch_dir
182
+ - `SPEC-xxx` → context.spec_session_id
183
+ 3. Write status.json
184
+ 4. Display: `[{index}/{total}] ✓ {skill} completed`
157
185
 
158
- Skill({ skill: next.skill, args: effective_args })
159
- ```
186
+ ### A_RETRY
160
187
 
161
- On success: Step 4a. On failure: Step 4b.
188
+ 1. `step.retried = true`, `step.status = "pending"`, `step.error = null`
189
+ 2. Write status.json
162
190
 
163
- ### external node
191
+ ### A_SKIP_STEP
164
192
 
165
- HARD RULE: External nodes ALWAYS delegate to `claude` — only Claude Code can execute slash-command skills. `session.cli_tool` is for analysis-mode delegates (e.g., decision evaluation in ralph), NOT for external node execution.
193
+ 1. `step.status = "skipped"`
194
+ 2. Write status.json
166
195
 
167
- ```
168
- // Always append -y to skill args inside the prompt — delegate sessions cannot confirm
169
- flag = auto_flag_map[next.skill] || "-y"
170
- effective_args = `${next.args} ${flag}`
196
+ ### A_PAUSE_SESSION
171
197
 
172
- Bash({
173
- command: `maestro delegate "/${next.skill} ${effective_args}" --to claude --mode write`,
174
- run_in_background: true,
175
- timeout: 600000
176
- })
198
+ 1. `session.status = "paused"`, write status.json
199
+ 2. Display: `[{index}/{total}] {skill} 失败,会话已暂停。/maestro-ralph continue 恢复。`
177
200
 
178
- STOP — wait for background callback.
179
- ```
201
+ ### A_COMPLETE_SESSION
180
202
 
181
- On callback: retrieve output via `maestro delegate output <exec_id>`.
182
- On success: Step 4a. On failure: Step 4b.
203
+ 1. `session.status = "completed"`, write status.json
204
+ 2. Display completion report:
205
+ ```
206
+ ============================================================
207
+ SESSION COMPLETE
208
+ ============================================================
209
+ Session: {session_id} [{source}]
210
+ Steps: {completed}/{total}
183
211
 
184
- ## Step 4: Post-Execution
212
+ [✓] 0. maestro-plan 1 [internal]
213
+ [✓] 1. ⚡ maestro-execute 1 [external]
214
+ [✓] 2. maestro-verify 1 [internal]
215
+ [✓] 3. ◆ post-verify [decision]
216
+ ...
217
+ ============================================================
218
+ ```
219
+ Icons: `✓` completed, `—` skipped, `✗` failed, `◆` decision, `⚡` external
185
220
 
186
- ### 4a. Mark Complete
221
+ </actions>
187
222
 
188
- ```
189
- next.status = "completed"
190
- next.completed_at = ISO timestamp
223
+ </state_machine>
191
224
 
192
- Scan output for context propagation signals:
193
- PHASE: N → status.phase
194
- scratch_dir: path → context.scratch_dir
195
- SPEC-xxx → context.spec_session_id
225
+ <appendix>
196
226
 
197
- Write status.json
198
- Display: [{next.index}/{total}] ✓ {next.skill} completed {next.type == "external" ? "[external]" : ""}
199
- ```
200
-
201
- → `Skill({ skill: "maestro-ralph-execute" })` (next iteration)
202
-
203
- ### 4b. Handle Failure
204
-
205
- ```
206
- next.status = "failed"
207
- next.error = "{error message}"
208
- next.completed_at = ISO timestamp
209
- Write status.json
210
-
211
- Display: [{next.index}/{total}] ✗ {next.skill} failed: {error}
212
- ```
213
-
214
- **Auto mode:**
215
- ```
216
- If not next.retried:
217
- next.retried = true, next.status = "pending", next.error = null
218
- Write status.json → Skill("maestro-ralph-execute") // retry once
219
- Else:
220
- status.status = "paused"
221
- Write status.json
222
- Display: [{next.index}/{total}] ✗ {next.skill} 重试后仍失败,会话已暂停。请检查后 /maestro-ralph continue 恢复。
223
- End.
224
- ```
225
-
226
- **Interactive mode:**
227
- ```
228
- AskUserQuestion: "retry / skip / abort"
229
- retry → next.status = "pending", next.error = null → Skill("maestro-ralph-execute")
230
- skip → next.status = "skipped" → Skill("maestro-ralph-execute")
231
- abort → status.status = "paused" → Write status.json → End.
232
- ```
227
+ ### Error Codes
233
228
 
234
- ## Step 5: Complete Session
235
-
236
- When no pending steps remain:
237
-
238
- ```
239
- status.status = "completed"
240
- status.updated_at = ISO timestamp
241
- Write status.json
242
- ```
243
-
244
- Display completion report:
245
- ```
246
- ============================================================
247
- SESSION COMPLETE
248
- ============================================================
249
- Session: {session_id} [{source}]
250
- Chain: {chain_name}
251
- Phase: {phase}
252
- Steps: {completed}/{total}
253
-
254
- [✓] 0. maestro-plan 1 [internal]
255
- [✓] 1. ⚡ maestro-execute 1 [external]
256
- [✓] 2. maestro-verify 1 [internal]
257
- [✓] 3. ◆ post-verify [decision]
258
- [—] 4. quality-auto-test 1 [internal] (skipped)
259
- ...
260
- ============================================================
261
- ```
262
-
263
- Status icons: `✓` completed, `—` skipped, `✗` failed, ` ` pending.
264
- Type badges: `◆` decision, `⚡` external, (none) internal.
265
-
266
- **End.**
267
-
268
- </execution>
269
-
270
- <error_codes>
271
229
  | Code | Severity | Description | Recovery |
272
230
  |------|----------|-------------|----------|
273
231
  | E001 | error | No running session found | Suggest /maestro or /maestro-ralph |
274
- | E002 | error | Session status.json corrupt | Show path, suggest manual check |
275
- | E003 | error | CLI delegate failed + user abort | Mark paused, suggest resume |
232
+ | E002 | error | status.json corrupt | Show path, suggest manual check |
233
+ | E003 | error | Delegate failed + user abort | Mark paused, suggest resume |
276
234
  | W001 | warning | Step completed with warnings | Log and continue |
277
- </error_codes>
278
-
279
- <success_criteria>
280
- - [ ] Session discovery scans .workflow/.maestro/ (covers both maestro-* and ralph-*)
281
- - [ ] `-y` flag parsed from args OR inherited from session.auto_mode
282
- - [ ] Placeholder substitution resolves all `{...}` tokens from session context
283
- - [ ] Per-skill enrichment provides correct args when empty/minimal
284
- - [ ] Artifact dir resolution finds latest artifact for --dir args
285
- - [ ] decision nodes hand off to maestro-ralph via Skill() (ralph sessions only)
286
- - [ ] internal nodes execute via Skill() with auto flag propagation
287
- - [ ] external nodes delegate to claude with `-y` in prompt args (not CLI args), run_in_background + STOP
288
- - [ ] Context propagation: output signals update status.json.context
289
- - [ ] status.json updated after every status change (resume-safe)
290
- - [ ] Auto mode: retry once then pause; interactive: AskUserQuestion retry/skip/abort
291
- - [ ] Completion report shows all steps with status icons and type badges
292
- - [ ] Self-invocation chain continues until all steps complete or session paused
293
- </success_criteria>
235
+
236
+ ### Success Criteria
237
+
238
+ - [ ] Session discovery covers both maestro-* and ralph-*
239
+ - [ ] `-y` parsed from args OR inherited from session.auto_mode
240
+ - [ ] Placeholders resolved from session context
241
+ - [ ] Per-skill enrichment provides correct args
242
+ - [ ] Decision nodes hand off to maestro-ralph via Skill()
243
+ - [ ] Internal nodes execute via Skill() with auto flag
244
+ - [ ] External nodes delegate to claude with `-y` in prompt args, run_in_background + STOP
245
+ - [ ] Context signals propagate to status.json
246
+ - [ ] Auto mode: retry once then pause
247
+ - [ ] Interactive: AskUserQuestion retry/skip/abort
248
+ - [ ] Self-invocation continues until complete or paused
249
+
250
+ </appendix>