maestro-flow 0.3.46 → 0.3.47

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 +278 -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 +307 -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
@@ -14,391 +14,162 @@ allowed-tools:
14
14
  - Skill
15
15
  ---
16
16
  <purpose>
17
- Load a workflow template (produced by maestro-composer) → bind context variables →
18
- execute DAG nodes in topological order → persist state at checkpoints → support resume.
19
-
20
- Node execution mechanisms:
21
- - `skill` node → `Skill()` (synchronous)
22
- - `command` node → `Skill()` with namespace (synchronous)
23
- - `cli` node → `maestro delegate` (background + wait for callback)
24
- - `agent` node → `Agent()` (sync or background per config)
25
- - `checkpoint` node → state save, optional user pause
26
-
27
- Session state persisted at `.workflow/.maestro/<session_id>/status.json` (same tracking
28
- location as maestro.md), enabling resume from any checkpoint via `-c`.
17
+ Load workflow template (from maestro-composer) → bind context variables → execute DAG nodes in topological order → persist state at checkpoints → support resume.
18
+
19
+ Session: `.workflow/.maestro/player-{YYYYMMDD-HHmmss}/status.json`
29
20
  </purpose>
30
21
 
31
22
  <context>
32
23
  $ARGUMENTS — template slug/path, or flags.
33
24
 
34
- **Flags:**
35
- - `--context key=value` Bind context variables (repeatable)
36
- - `-c` / `--continue [session-id]` Resume paused/interrupted session (consistent with maestro.md)
37
- - `--list` List available templates from `~/.maestro/templates/workflows/index.json`
38
- - `--dry-run` Show execution plan without executing
39
-
40
- **Entry routing:**
25
+ **Flags**:
26
+ - `--context key=value`: Bind context variables (repeatable)
27
+ - `-c [session-id]`: Resume paused/interrupted session
28
+ - `--list`: List available templates from index.json
29
+ - `--dry-run`: Show execution plan without executing
41
30
 
42
- | Detection | Condition | Handler |
43
- |-----------|-----------|---------|
44
- | List templates | `--list` in args | handleList |
45
- | Resume session | `-c [session-id]` | Phase 0: Resume |
46
- | Dry run | `--dry-run` in args | Phase 1 + 2, print plan, exit |
47
- | Normal | Template slug/path provided | Phase 1 |
48
- | No args | Empty args | handleList + AskUserQuestion |
31
+ **Node execution mechanisms**:
49
32
 
50
- **Shared constants (aligned with maestro.md tracking):**
33
+ | Node type | Mechanism | Blocking |
34
+ |-----------|-----------|----------|
35
+ | skill | `Skill(skill, args)` | sync |
36
+ | command | `Skill(skill, args)` | sync |
37
+ | cli | `maestro delegate --to tool --mode mode` via `Bash(run_in_background: true)` | async, STOP + wait |
38
+ | agent | `Agent(subagent_type, prompt)` | configurable |
39
+ | checkpoint | State save + optional user pause | — |
51
40
 
52
- | Constant | Value |
53
- |----------|-------|
54
- | Session prefix | `player` |
55
- | Session dir | `.workflow/.maestro/player-<YYYYMMDD>-<HHmmss>/` |
56
- | State file | `status.json` |
57
- | Template dir (global) | `~/.maestro/templates/workflows/` |
58
- | Template index (global) | `~/.maestro/templates/workflows/index.json` |
41
+ **Runtime reference resolution** in args_template:
59
42
 
60
- **Session status.json schema (aligned with maestro.md):**
43
+ | Reference | Resolves to |
44
+ |-----------|-------------|
45
+ | `{variable}` | session context[variable] |
46
+ | `{N-001.session_id}` | node's session_id |
47
+ | `{N-001.output_path}` | node's output_path |
48
+ | `{prev_session_id}` | previous non-checkpoint node's session_id |
49
+ | `{prev_output_path}` | previous non-checkpoint node's output_path |
61
50
 
51
+ **Session schema** (status.json — must align with maestro.md tracking):
62
52
  ```json
63
53
  {
64
54
  "session_id": "player-<YYYYMMDD>-<HHmmss>",
65
- "created_at": "<ISO>",
66
- "intent": "<template_name> with context",
67
- "task_type": "player",
68
- "chain_name": "<template_id>",
55
+ "status": "running|paused|completed|failed|aborted",
69
56
  "template_id": "wft-<slug>-<date>",
70
- "template_path": "~/.maestro/templates/workflows/<slug>.json",
71
- "template_name": "<name>",
57
+ "template_path": "<path>",
72
58
  "auto_mode": false,
73
- "status": "running | paused | completed | failed | aborted",
74
- "context": { "goal": "...", "scope": "..." },
75
- "steps": [
76
- {
77
- "index": 0,
78
- "node_id": "N-001",
79
- "skill": "<executor>",
80
- "args": "<resolved_args>",
81
- "type": "skill | cli | command | agent | checkpoint",
82
- "status": "pending | running | completed | skipped | failed",
83
- "started_at": null,
84
- "completed_at": null,
85
- "session_id": null,
86
- "output_path": null,
87
- "artifacts": [],
88
- "error": null
89
- }
90
- ],
59
+ "context": { "goal": "..." },
60
+ "steps": [{
61
+ "index": 0, "node_id": "N-001", "skill": "<executor>",
62
+ "args": "<resolved>", "type": "skill|cli|agent|checkpoint",
63
+ "status": "pending|running|completed|skipped|failed",
64
+ "session_id": null, "output_path": null, "artifacts": []
65
+ }],
91
66
  "current_step": 0,
92
- "last_checkpoint": null,
93
- "updated_at": "<ISO>",
94
- "completed_at": null
67
+ "last_checkpoint": null
95
68
  }
96
69
  ```
97
-
98
- **Session directory structure (under .workflow/.maestro/):**
99
-
100
- ```
101
- .workflow/.maestro/player-<YYYYMMDD>-<HHmmss>/
102
- ├── status.json # Main state file (maestro.md compatible)
103
- ├── checkpoints/
104
- │ ├── CP-01.json
105
- │ └── CP-02.json
106
- └── artifacts/
107
- └── N-001-output.md
108
- ```
109
-
110
- **Node execution mechanisms:**
111
-
112
- | Node type | Mechanism | Blocking |
113
- |-----------|-----------|----------|
114
- | skill | `Skill(skill=executor, args=resolved_args)` | sync |
115
- | command | `Skill(skill=executor, args=resolved_args)` | sync |
116
- | cli | `maestro delegate "prompt" --to tool --mode mode --rule rule` via `Bash(run_in_background: true)` | async, wait for callback |
117
- | agent | `Agent(subagent_type=executor, prompt=resolved_args)` | configurable |
118
- | checkpoint | State save + optional user pause | — |
119
-
120
- **Runtime reference resolution:**
121
-
122
- Before executing each node, resolve `{ref}` patterns in `args_template`:
123
-
124
- | Reference | Resolves To |
125
- |-----------|-------------|
126
- | `{variable}` | `session_state.context[variable]` |
127
- | `{N-001.session_id}` | `node_states["N-001"].session_id` |
128
- | `{N-001.output_path}` | `node_states["N-001"].output_path` |
129
- | `{prev_session_id}` | session_id of previous non-checkpoint node |
130
- | `{prev_output_path}` | output_path of previous non-checkpoint node |
131
-
132
- Fallback: if referenced field is null, substitution results in empty string.
133
70
  </context>
134
71
 
135
- <execution>
136
-
137
- ### handleList
138
-
139
- Scan `~/.maestro/templates/workflows/index.json`. Display:
140
- ```
141
- Available workflow templates:
142
- feature-tdd-review [feature, complex] 3 work nodes, 2 checkpoints
143
- quick-bugfix [bugfix, simple] 2 work nodes, 1 checkpoint
144
-
145
- Run: /maestro-player <slug> --context goal="..."
146
- ```
147
-
148
- If index not found, output: "No templates found. Create one with /maestro-composer"
149
-
150
- ---
151
-
152
- ### Phase 0: Resume — Session Reconciliation
153
-
154
- **Trigger**: `-c [session-id]`
155
-
156
- 1. If session-id provided: load `.workflow/.maestro/<session-id>/status.json`
157
- 2. If no session-id: scan `.workflow/.maestro/player-*/status.json` for `status = "running" | "paused"`
158
- 3. Multiple found → AskUserQuestion for selection
159
- 4. None found → error E004
160
- 5. Reset any `running` steps back to `pending` (interrupted mid-execution)
161
- 6. Determine next executable step from `steps[]` after `last_checkpoint`
162
- 7. Set `current_step` to resume point
163
- 8. Resume at Phase 3 (Execute Loop) from that step
164
-
165
- ---
166
-
167
- ### Phase 1: Load & Bind
168
-
169
- **Objective**: Load template, collect missing variables, bind all references.
170
-
171
- **Step 1.1** — Resolve template path:
172
- 1. Absolute path → use as-is
173
- 2. Relative path (`.` prefix) → resolve from cwd
174
- 3. Slug only → look up in `~/.maestro/templates/workflows/index.json`
175
- 4. Partial match → scan index, confirm with user
176
- 5. Not found → show available templates, AskUserQuestion
177
-
178
- **Step 1.2** — Parse `--context key=value` pairs into `bound_context`.
179
-
180
- **Step 1.3** — Load and validate template JSON (`template_id`, `nodes`, `edges`, `context_schema` must be present).
181
-
182
- **Step 1.4** — Collect missing required variables:
183
- - For each `context_schema` entry where `required: true` and not in `bound_context`:
184
- AskUserQuestion to collect value
185
- - For optional variables: use `default` or empty string
186
-
187
- **Step 1.5** — Bind variables: replace `{variable_name}` with values in all `args_template` strings. Leave `{N-xxx.field}` and `{prev_*}` unresolved (runtime Phase 3).
188
-
189
- **Step 1.6** — If `--dry-run`: print execution plan and exit:
190
- ```
191
- Workflow: <template.name>
192
- Context: goal = "<value>"
193
-
194
- Execution Plan:
195
- [1] N-001 [skill] maestro-plan "<goal>"
196
- [2] CP-01 [checkpoint] After Plan auto-continue
197
- [3] N-002 [skill] maestro-execute --resume-session {N-001.session_id}
198
-
199
- To execute: /maestro-player <slug> --context goal="..."
200
- ```
201
-
202
- ---
203
-
204
- ### Phase 2: Instantiate — Init Session State
205
-
206
- **Objective**: Create session directory, init state, compute execution plan.
207
-
208
- **Step 2.1** — Generate session ID: `player-<YYYYMMDD>-<HHmmss>`. Create directory at `.workflow/.maestro/<session_id>/`.
209
-
210
- **Step 2.2** — Topological sort via Kahn's algorithm. Flatten nodes into `steps[]` array (maestro.md format). Parallel nodes get same batch index.
211
-
212
- **Step 2.3** — Init all steps as `status: "pending"`.
213
-
214
- **Step 2.4** — Write `status.json` (see schema in Context section).
215
-
216
- **Step 2.5** — Show execution start banner:
217
- ```
218
- ============================================================
219
- MAESTRO PLAYER
220
- ============================================================
221
- Template: <template.name>
222
- Session: <session_id>
223
- Context: goal="<value>"
224
-
225
- Pipeline:
226
- 1. N-001 [skill] maestro-plan
227
- 2. CP-01 [checkpoint] After Plan
228
- 3. N-002 [skill] maestro-execute
229
- ============================================================
230
- ```
231
-
232
- ---
233
-
234
- ### Phase 3: Execute Loop
235
-
236
- **Objective**: Execute each step in order. Save state after every step.
237
-
238
- **CRITICAL**: After each step status change, write `status.json` immediately. This enables resume on interruption.
239
-
240
- **For each step starting at `current_step`:**
241
-
242
- **3a. Display step banner** (consistent with maestro.md):
243
- ```
244
- ------------------------------------------------------------
245
- STEP {i+1}/{total}: {node_id} [{type}] {executor}
246
- ------------------------------------------------------------
247
- Args: {resolved_args}
248
- ```
72
+ <state_machine>
249
73
 
250
- **3b. Update status.json**: Set step status = `"running"`, started_at = now.
74
+ <states>
75
+ S_ROUTE — 入口路由(list/resume/dry-run/normal) PERSIST: —
76
+ S_RESUME — 恢复已暂停 session PERSIST: —
77
+ S_LOAD — 加载模板、收集变量、绑定引用 PERSIST: —
78
+ S_INIT — 创建 session、拓扑排序、初始化 steps PERSIST: status.json
79
+ S_EXEC_LOOP — 逐步执行(核心循环) PERSIST: status.json (每步更新)
80
+ S_COMPLETE — 标记完成、输出摘要 PERSIST: status.json (final)
81
+ </states>
251
82
 
252
- **3c. Execute by node type:**
83
+ <transitions>
253
84
 
254
- **skill / command node**:
255
- ```
256
- resolved_args = resolveArgs(step.args_template, status)
257
- Skill(skill=step.skill, args=resolved_args)
85
+ S_ROUTE:
86
+ → handleList WHEN: --list DO: scan index.json, display templates
87
+ S_RESUME WHEN: -c flag
88
+ S_LOAD WHEN: template slug/path provided
89
+ → handleList WHEN: no args DO: display templates + AskUserQuestion
258
90
 
259
- Extract from result: session_id (WFS-*), output_path, artifacts
260
- Update step: status="completed", session_id, output_path, artifacts, completed_at
261
- Write status.json
262
- ```
91
+ S_RESUME:
92
+ S_EXEC_LOOP WHEN: session found DO: A_RESUME_SESSION
93
+ ERROR(E004) WHEN: no session found
263
94
 
264
- **cli node — CRITICAL: background + stop**:
265
- ```
266
- resolved_args = resolveArgs(step.args_template, status)
95
+ S_LOAD:
96
+ → S_INIT DO: A_LOAD_AND_BIND
267
97
 
268
- Bash({
269
- command: `maestro delegate "${resolved_args}" --to ${step.cli_tool} --mode ${step.cli_mode} --rule ${step.cli_rule}`,
270
- run_in_background: true
271
- })
98
+ S_INIT:
99
+ → END WHEN: --dry-run DO: display execution plan
100
+ → S_EXEC_LOOP DO: A_INIT_SESSION (topological sort → steps[], write status.json, display banner)
272
101
 
273
- Write status.json // persist "running" state
274
- STOP wait for background callback
275
- ```
102
+ S_EXEC_LOOP:
103
+ S_EXEC_LOOP WHEN: step completed, more steps DO: A_EXECUTE_STEP → advance current_step
104
+ → S_COMPLETE WHEN: all steps completed
105
+ → END WHEN: checkpoint pause DO: set status=paused, display resume command
106
+ → END WHEN: abort chosen DO: set status=aborted, save progress
107
+ GUARD: cli nodes → Bash(run_in_background: true) + STOP, wait for callback
108
+ GUARD: on failure → on_fail: skip (log, advance) | retry (once) | abort (AskUserQuestion: Retry/Skip/Abort)
109
+ GUARD: after step 3+ → display context hint "可随时 /maestro-player -c 恢复"
276
110
 
277
- On callback:
278
- ```
279
- Load status.json
280
- Find step with status "running"
281
- Retrieve output: maestro delegate output <exec_id>
282
- Update step: status="completed", output_path, completed_at
283
- Write status.json
284
- Advance to next step
285
- ```
111
+ S_COMPLETE:
112
+ → END DO: A_COMPLETE_SESSION
286
113
 
287
- **agent node**:
288
- ```
289
- resolved_args = resolveArgs(step.args_template, status)
114
+ </transitions>
290
115
 
291
- Agent({
292
- subagent_type: step.skill,
293
- prompt: resolved_args,
294
- run_in_background: step.run_in_background ?? false,
295
- description: step.node_id
296
- })
116
+ <actions>
297
117
 
298
- Update step: status="completed", output_path, completed_at
299
- Write status.json
300
- ```
118
+ ### A_RESUME_SESSION
301
119
 
302
- **checkpoint node**:
303
- ```
304
- // 1. Write checkpoint snapshot
305
- Write <session_dir>/checkpoints/<step.node_id>.json with:
306
- session_id, checkpoint_id, saved_at, steps_snapshot, last_completed_step
307
-
308
- // 2. Update status.json
309
- status.last_checkpoint = step.node_id
310
- Mark step completed, write status.json
311
-
312
- // 3. If auto_continue == false: pause for user
313
- AskUserQuestion:
314
- - Continue → proceed
315
- - Pause → set status="paused", write status.json, output resume command, EXIT
316
- - Abort → set status="aborted", EXIT
317
- ```
318
-
319
- **3d. Handle result** (consistent with maestro.md):
120
+ 1. If session-id: load status.json. If none: scan player-*/status.json for running|paused.
121
+ 2. Reset any "running" steps to "pending" (interrupted mid-execution)
122
+ 3. Set current_step to resume point after last_checkpoint
123
+ 4. Enter S_EXEC_LOOP
320
124
 
321
- On success: update step status = `"completed"`, advance `current_step`.
125
+ ### A_LOAD_AND_BIND
322
126
 
323
- On failure:
324
- ```
325
- on_fail = step.on_fail || "abort"
326
-
327
- skip → mark "skipped", log warning, advance
328
- retry → retry once, if still fails → fall to abort
329
- abort → AskUserQuestion: Retry / Skip / Abort
330
- On Abort: save progress, display: "Resume with: /maestro-player -c"
331
- ```
127
+ 1. Resolve template: absolute path → as-is; relative → from cwd; slug → index.json lookup
128
+ 2. Parse `--context key=value` pairs
129
+ 3. Validate template (template_id, nodes, edges, context_schema required)
130
+ 4. Collect missing required variables via AskUserQuestion
131
+ 5. Bind {variable} placeholders (leave {N-xxx.field} and {prev_*} for runtime)
332
132
 
333
- **3e. Context cleanup hint** (after step 3+, consistent with maestro.md):
334
- ```
335
- ⚡ 已执行 {i} 步,上下文较重。可随时 /maestro-player -c 在新上下文中恢复。
336
- ```
133
+ ### A_INIT_SESSION
337
134
 
338
- ---
135
+ 1. Generate session_id: player-{YYYYMMDD-HHmmss}
136
+ 2. Topological sort (Kahn's algorithm) → flatten to steps[] (parallel nodes share batch index)
137
+ 3. All steps status: "pending"
138
+ 4. Write status.json
339
139
 
340
- ### Phase 4: Complete — Archive + Summary
140
+ ### A_EXECUTE_STEP
341
141
 
342
- **Objective**: Mark session complete, output summary.
142
+ 1. Resolve runtime references ({N-xxx.field}, {prev_*}) in args
143
+ 2. Set step status="running", write status.json
144
+ 3. Execute by type:
145
+ - **skill/command**: `Skill(skill, resolved_args)` → extract session_id, output_path, artifacts
146
+ - **cli**: `Bash(run_in_background: true)` → STOP, wait for callback → `maestro delegate output <id>`
147
+ - **agent**: `Agent(subagent_type, resolved_args)`
148
+ - **checkpoint**: write checkpoint snapshot. If auto_continue==false: AskUserQuestion (Continue/Pause/Abort)
149
+ 4. Set step status="completed" (or "skipped"/"failed"), write status.json
343
150
 
344
- **Step 4.1** — Set `status = "completed"`, `completed_at = <ISO>`, write `status.json`.
151
+ ### A_COMPLETE_SESSION
345
152
 
346
- **Step 4.2** Collect all artifacts from steps.
153
+ Set status="completed", completed_at. Display summary: session, template, steps completed, context, per-step results, artifacts, session dir.
154
+ AskUserQuestion: Keep session / Run again / Done.
347
155
 
348
- **Step 4.3** — Display execution summary (consistent with maestro.md):
349
- ```
350
- ============================================================
351
- MAESTRO PLAYER SESSION COMPLETE
352
- ============================================================
353
- Session: <session_id>
354
- Template: <template_name> (<template_id>)
355
- Steps: <completed>/<total> completed
356
- Context: goal="<value>"
357
-
358
- Results:
359
- [✓] 1. N-001 maestro-plan — completed (WFS-plan-xxx)
360
- [✓] 2. CP-01 After Plan — completed (checkpoint)
361
- [✓] 3. N-002 maestro-execute — completed (WFS-exec-xxx)
362
- [✓] 4. N-003 quality-test — completed (WFS-test-xxx)
363
-
364
- Artifacts:
365
- - IMPL_PLAN.md (N-001)
366
- - src/auth/index.ts (N-002)
367
- - test/auth.test.ts (N-003)
368
-
369
- Session dir: .workflow/.maestro/<session_id>/
370
- ============================================================
371
- ```
156
+ </actions>
372
157
 
373
- **Step 4.4** — AskUserQuestion completion action:
374
- - **Keep session** → leave at current path
375
- - **Run again** → AskUserQuestion for same/new context, re-enter Phase 1
376
- - **Nothing** → done
377
- </execution>
158
+ </state_machine>
378
159
 
379
160
  <error_codes>
380
- | Code | Severity | Description | Recovery |
381
- |------|----------|-------------|----------|
382
- | E001 | error | Template not found | Show --list output, suggest closest match |
383
- | E002 | error | Template JSON invalid (missing required fields) | Point to template file for fix |
384
- | E003 | error | Required context variable missing and user declined | Cannot proceed without required vars |
385
- | E004 | error | Resume session not found | Scan `.workflow/.maestro/player-*/`, list available |
386
- | E005 | error | DAG cycle in template | Point to template for fix, suggest maestro-composer --edit |
387
- | E006 | error | Node execution failed + abort chosen | Save state, suggest --resume |
388
- | W001 | warning | Node completed with warnings | Log and continue |
389
- | W002 | warning | Runtime reference resolved to empty string | Log, executor handles gracefully |
161
+ | Code | Condition | Recovery |
162
+ |------|-----------|----------|
163
+ | E001 | Template not found | Show --list, suggest closest match |
164
+ | E002 | Template JSON invalid (missing template_id/nodes/edges) | Point to template file for fix |
165
+ | E004 | Resume session not found | List available player-*/ sessions |
166
+ | E005 | DAG cycle in template | Point to template, suggest --edit |
167
+ | E006 | Node execution failed + abort chosen | Save state, suggest `-c` resume |
390
168
  </error_codes>
391
169
 
392
170
  <success_criteria>
393
- - [ ] Template loaded from `~/.maestro/templates/workflows/` and validated
394
- - [ ] All required context variables bound (from --context or user input)
395
- - [ ] Session directory created at `.workflow/.maestro/player-*/` with `status.json`
396
- - [ ] Steps array computed via topological sort (maestro.md compatible format)
397
- - [ ] Each step executed with correct mechanism (Skill/delegate/Agent)
398
- - [ ] Runtime references ({N-xxx.field}, {prev_*}) resolved before each step
399
- - [ ] `status.json` written after every step status change (resume-safe)
400
- - [ ] Checkpoints saved with snapshots under `checkpoints/`
401
- - [ ] CLI nodes use `maestro delegate` with `Bash(run_in_background: true)` + stop pattern
402
- - [ ] Step banners and completion report match maestro.md format
403
- - [ ] Resume via `-c` scans `.workflow/.maestro/player-*/status.json`
171
+ - [ ] Template loaded, variables bound, session created with topological steps
172
+ - [ ] status.json written after every step change (resume-safe)
173
+ - [ ] CLI nodes use Bash(run_in_background) + STOP pattern
174
+ - [ ] Checkpoints saved, resume via -c works
404
175
  </success_criteria>
@@ -27,6 +27,15 @@ Parse for:
27
27
  - `--full` flag -- Enables plan-checking (max 2 iterations) and post-execution verification
28
28
  - `--discuss` flag -- Decision extraction before planning (gray areas, Locked/Free/Deferred classification)
29
29
  - Remaining text as task description
30
+
31
+ ### Pre-load context
32
+
33
+ 1. **Coding specs + tools**: Run `maestro spec load --category coding` to load coding conventions and discoverable tools. Apply to implementation.
34
+ 2. **UI specs (conditional)**: If the task involves frontend/UI work (description contains component, page, style, layout, CSS, HTML, frontend), also run `maestro spec load --category ui`.
35
+ 3. **Role Knowledge**:
36
+ - Browse: `maestro wiki list --category coding`
37
+ - Load task-relevant entries: `maestro wiki load <id1> [id2...]`
38
+ 3. All are optional — proceed without if unavailable.
30
39
  </context>
31
40
 
32
41
  <execution>