maestro-flow 0.3.12 → 0.3.14

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 (251) hide show
  1. package/.claude/CLAUDE.md +7 -0
  2. package/.claude/agents/workflow-analyzer.md +0 -1
  3. package/.claude/agents/workflow-collab-planner.md +0 -1
  4. package/.claude/agents/workflow-debugger.md +0 -1
  5. package/.claude/agents/workflow-integration-checker.md +2 -2
  6. package/.claude/agents/workflow-nyquist-auditor.md +0 -1
  7. package/.claude/agents/workflow-phase-researcher.md +2 -2
  8. package/.claude/agents/workflow-plan-checker.md +1 -1
  9. package/.claude/agents/workflow-planner.md +1 -2
  10. package/.claude/agents/workflow-roadmapper.md +1 -1
  11. package/.claude/agents/workflow-verifier.md +0 -1
  12. package/.claude/commands/learn-retro.md +2 -2
  13. package/.claude/commands/learn-second-opinion.md +2 -2
  14. package/.claude/commands/maestro-analyze.md +10 -2
  15. package/.claude/commands/maestro-brainstorm.md +1 -1
  16. package/.claude/commands/maestro-execute.md +21 -4
  17. package/.claude/commands/maestro-milestone-complete.md +14 -0
  18. package/.claude/commands/maestro-plan.md +12 -6
  19. package/.claude/commands/maestro-roadmap.md +1 -1
  20. package/.claude/commands/maestro-ui-design.md +7 -7
  21. package/.claude/commands/maestro-update.md +176 -0
  22. package/.claude/commands/maestro-verify.md +18 -3
  23. package/.claude/commands/manage-codebase-rebuild.md +0 -1
  24. package/.claude/commands/manage-harvest.md +1 -1
  25. package/.claude/commands/manage-learn.md +5 -5
  26. package/.claude/commands/manage-memory-capture.md +4 -4
  27. package/.claude/commands/manage-memory.md +1 -1
  28. package/.claude/commands/manage-wiki.md +62 -0
  29. package/.claude/commands/quality-business-test.md +2 -2
  30. package/.claude/commands/quality-debug.md +53 -7
  31. package/.claude/commands/quality-retrospective.md +5 -5
  32. package/.claude/commands/quality-review.md +39 -7
  33. package/.claude/commands/quality-sync.md +1 -1
  34. package/.claude/commands/quality-test-gen.md +1 -1
  35. package/.claude/commands/quality-test.md +45 -12
  36. package/.claude/commands/spec-remove.md +51 -0
  37. package/.claude/commands/spec-setup.md +1 -3
  38. package/.claude/commands/wiki-connect.md +9 -5
  39. package/.claude/commands/wiki-digest.md +6 -3
  40. package/.codex/skills/maestro/SKILL.md +2 -2
  41. package/.codex/skills/maestro-analyze/SKILL.md +4 -4
  42. package/.codex/skills/maestro-brainstorm/SKILL.md +4 -4
  43. package/.codex/skills/maestro-coordinate/SKILL.md +2 -2
  44. package/.codex/skills/maestro-execute/SKILL.md +15 -5
  45. package/.codex/skills/maestro-init/SKILL.md +1 -1
  46. package/.codex/skills/maestro-link-coordinate/SKILL.md +430 -224
  47. package/.codex/skills/maestro-milestone-complete/SKILL.md +18 -1
  48. package/.codex/skills/maestro-plan/SKILL.md +6 -6
  49. package/.codex/skills/maestro-roadmap/SKILL.md +3 -4
  50. package/.codex/skills/maestro-spec-generate/SKILL.md +2 -2
  51. package/.codex/skills/maestro-ui-design/SKILL.md +6 -6
  52. package/.codex/skills/maestro-verify/SKILL.md +20 -11
  53. package/.codex/skills/manage-codebase-rebuild/SKILL.md +4 -4
  54. package/.codex/skills/manage-harvest/SKILL.md +10 -1
  55. package/.codex/skills/manage-issue-discover/SKILL.md +3 -3
  56. package/.codex/skills/manage-learn/SKILL.md +3 -2
  57. package/.codex/skills/manage-memory/SKILL.md +3 -3
  58. package/.codex/skills/manage-memory-capture/SKILL.md +8 -14
  59. package/.codex/skills/manage-status/SKILL.md +9 -4
  60. package/.codex/skills/manage-wiki/SKILL.md +55 -0
  61. package/.codex/skills/quality-business-test/SKILL.md +8 -6
  62. package/.codex/skills/quality-debug/SKILL.md +22 -9
  63. package/.codex/skills/quality-integration-test/SKILL.md +11 -7
  64. package/.codex/skills/quality-retrospective/SKILL.md +45 -26
  65. package/.codex/skills/quality-review/SKILL.md +10 -7
  66. package/.codex/skills/quality-test/SKILL.md +9 -4
  67. package/.codex/skills/quality-test-gen/SKILL.md +13 -9
  68. package/.codex/skills/spec-add/SKILL.md +11 -3
  69. package/.codex/skills/spec-load/SKILL.md +7 -0
  70. package/.codex/skills/spec-map/SKILL.md +2 -2
  71. package/.codex/skills/spec-remove/SKILL.md +101 -0
  72. package/.codex/skills/spec-setup/SKILL.md +4 -8
  73. package/.codex/skills/wiki-connect/SKILL.md +6 -5
  74. package/.codex/skills/wiki-digest/SKILL.md +2 -2
  75. package/chains/milestone-fork-merge.json +6 -6
  76. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.d.ts +9 -0
  77. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +109 -9
  78. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  79. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js +49 -0
  80. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js.map +1 -1
  81. package/dashboard/dist-server/dashboard/src/server/routes/index.js +5 -4
  82. package/dashboard/dist-server/dashboard/src/server/routes/index.js.map +1 -1
  83. package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +5 -13
  84. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +97 -155
  85. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  86. package/dashboard/dist-server/dashboard/src/server/routes/wiki.d.ts +11 -1
  87. package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js +27 -6
  88. package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js.map +1 -1
  89. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +25 -7
  90. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  91. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +8 -0
  92. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
  93. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +1 -0
  94. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  95. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.d.ts +29 -0
  96. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +148 -0
  97. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -0
  98. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +4 -2
  99. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  100. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +8 -2
  101. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  102. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +5 -0
  103. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +80 -38
  104. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  105. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +8 -6
  106. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  107. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +40 -5
  108. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +21 -23
  109. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
  110. package/dashboard/dist-server/dashboard/src/server/wiki/writer.d.ts +33 -3
  111. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +184 -12
  112. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
  113. package/dashboard/dist-server/src/commands/delegate.js +26 -0
  114. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  115. package/dashboard/dist-server/src/coordinator/graph-types.d.ts +11 -1
  116. package/dashboard/dist-server/src/coordinator/graph-walker.js +29 -2
  117. package/dashboard/dist-server/src/coordinator/graph-walker.js.map +1 -1
  118. package/dashboard/dist-server/src/coordinator/prompt-assembler.js +3 -2
  119. package/dashboard/dist-server/src/coordinator/prompt-assembler.js.map +1 -1
  120. package/dashboard/dist-server/src/hooks/constants.d.ts +29 -60
  121. package/dashboard/dist-server/src/hooks/constants.js +105 -82
  122. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  123. package/dashboard/dist-server/src/types/index.d.ts +2 -1
  124. package/dist/src/commands/delegate.d.ts.map +1 -1
  125. package/dist/src/commands/delegate.js +26 -0
  126. package/dist/src/commands/delegate.js.map +1 -1
  127. package/dist/src/commands/hooks.d.ts +2 -4
  128. package/dist/src/commands/hooks.d.ts.map +1 -1
  129. package/dist/src/commands/hooks.js +4 -7
  130. package/dist/src/commands/hooks.js.map +1 -1
  131. package/dist/src/commands/install-ui/InstallConfirm.d.ts +2 -3
  132. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  133. package/dist/src/commands/install-ui/InstallConfirm.js +1 -1
  134. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  135. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  136. package/dist/src/commands/install-ui/InstallExecution.js +1 -2
  137. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  138. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  139. package/dist/src/commands/install-ui/InstallFlow.js +5 -7
  140. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  141. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +3 -6
  142. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  143. package/dist/src/commands/install-ui/StatuslineConfig.js +21 -17
  144. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  145. package/dist/src/commands/update.d.ts.map +1 -1
  146. package/dist/src/commands/update.js +95 -0
  147. package/dist/src/commands/update.js.map +1 -1
  148. package/dist/src/commands/wiki.d.ts.map +1 -1
  149. package/dist/src/commands/wiki.js +75 -11
  150. package/dist/src/commands/wiki.js.map +1 -1
  151. package/dist/src/coordinator/graph-types.d.ts +11 -1
  152. package/dist/src/coordinator/graph-types.d.ts.map +1 -1
  153. package/dist/src/coordinator/graph-walker.d.ts.map +1 -1
  154. package/dist/src/coordinator/graph-walker.js +29 -2
  155. package/dist/src/coordinator/graph-walker.js.map +1 -1
  156. package/dist/src/coordinator/prompt-assembler.d.ts.map +1 -1
  157. package/dist/src/coordinator/prompt-assembler.js +3 -2
  158. package/dist/src/coordinator/prompt-assembler.js.map +1 -1
  159. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +4 -1
  160. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -1
  161. package/dist/src/hooks/__tests__/statusline-visual-test.js +55 -174
  162. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
  163. package/dist/src/hooks/auto-mode.d.ts +18 -0
  164. package/dist/src/hooks/auto-mode.d.ts.map +1 -0
  165. package/dist/src/hooks/auto-mode.js +28 -0
  166. package/dist/src/hooks/auto-mode.js.map +1 -0
  167. package/dist/src/hooks/constants.d.ts +29 -60
  168. package/dist/src/hooks/constants.d.ts.map +1 -1
  169. package/dist/src/hooks/constants.js +105 -82
  170. package/dist/src/hooks/constants.js.map +1 -1
  171. package/dist/src/hooks/context-monitor.d.ts.map +1 -1
  172. package/dist/src/hooks/context-monitor.js +14 -3
  173. package/dist/src/hooks/context-monitor.js.map +1 -1
  174. package/dist/src/hooks/coordinator-tracker.d.ts +1 -0
  175. package/dist/src/hooks/coordinator-tracker.d.ts.map +1 -1
  176. package/dist/src/hooks/coordinator-tracker.js +19 -9
  177. package/dist/src/hooks/coordinator-tracker.js.map +1 -1
  178. package/dist/src/hooks/skill-context.d.ts.map +1 -1
  179. package/dist/src/hooks/skill-context.js +54 -6
  180. package/dist/src/hooks/skill-context.js.map +1 -1
  181. package/dist/src/hooks/statusline.d.ts +11 -8
  182. package/dist/src/hooks/statusline.d.ts.map +1 -1
  183. package/dist/src/hooks/statusline.js +284 -182
  184. package/dist/src/hooks/statusline.js.map +1 -1
  185. package/dist/src/hooks/workspace.d.ts.map +1 -1
  186. package/dist/src/hooks/workspace.js +2 -1
  187. package/dist/src/hooks/workspace.js.map +1 -1
  188. package/dist/src/migrations/_template.d.ts +12 -0
  189. package/dist/src/migrations/_template.d.ts.map +1 -0
  190. package/dist/src/migrations/_template.js +55 -0
  191. package/dist/src/migrations/_template.js.map +1 -0
  192. package/dist/src/migrations/index.d.ts +14 -0
  193. package/dist/src/migrations/index.d.ts.map +1 -0
  194. package/dist/src/migrations/index.js +20 -0
  195. package/dist/src/migrations/index.js.map +1 -0
  196. package/dist/src/migrations/run.d.ts +12 -0
  197. package/dist/src/migrations/run.d.ts.map +1 -0
  198. package/dist/src/migrations/run.js +119 -0
  199. package/dist/src/migrations/run.js.map +1 -0
  200. package/dist/src/migrations/v1-to-v2.d.ts +10 -0
  201. package/dist/src/migrations/v1-to-v2.d.ts.map +1 -0
  202. package/dist/src/migrations/v1-to-v2.js +71 -0
  203. package/dist/src/migrations/v1-to-v2.js.map +1 -0
  204. package/dist/src/tools/team-activity.d.ts.map +1 -1
  205. package/dist/src/tools/team-activity.js +22 -0
  206. package/dist/src/tools/team-activity.js.map +1 -1
  207. package/dist/src/tools/transition-recorder.d.ts +2 -17
  208. package/dist/src/tools/transition-recorder.d.ts.map +1 -1
  209. package/dist/src/tools/transition-recorder.js +6 -3
  210. package/dist/src/tools/transition-recorder.js.map +1 -1
  211. package/dist/src/types/index.d.ts +2 -1
  212. package/dist/src/types/index.d.ts.map +1 -1
  213. package/dist/src/utils/migration-registry.d.ts +65 -0
  214. package/dist/src/utils/migration-registry.d.ts.map +1 -0
  215. package/dist/src/utils/migration-registry.js +117 -0
  216. package/dist/src/utils/migration-registry.js.map +1 -0
  217. package/dist/src/utils/state-schema.d.ts +153 -0
  218. package/dist/src/utils/state-schema.d.ts.map +1 -0
  219. package/dist/src/utils/state-schema.js +329 -0
  220. package/dist/src/utils/state-schema.js.map +1 -0
  221. package/package.json +1 -1
  222. package/templates/state.json +17 -39
  223. package/workflows/brainstorm.md +3 -3
  224. package/workflows/codebase-rebuild.md +2 -12
  225. package/workflows/debug.md +7 -8
  226. package/workflows/execute.md +18 -4
  227. package/workflows/fork.md +37 -86
  228. package/workflows/init.md +1 -4
  229. package/workflows/integration-test.md +4 -5
  230. package/workflows/issue.md +3 -9
  231. package/workflows/learn.md +20 -19
  232. package/workflows/maestro-coordinate.codex.md +9 -9
  233. package/workflows/maestro-coordinate.md +9 -9
  234. package/workflows/maestro.codex.md +8 -1
  235. package/workflows/maestro.md +14 -5
  236. package/workflows/memory.md +26 -71
  237. package/workflows/merge.md +45 -107
  238. package/workflows/milestone-complete.md +24 -7
  239. package/workflows/retrospective.md +77 -109
  240. package/workflows/review.md +5 -12
  241. package/workflows/specs-remove.md +115 -0
  242. package/workflows/specs-setup.md +10 -32
  243. package/workflows/status.md +291 -290
  244. package/workflows/sync.md +5 -5
  245. package/workflows/test.md +4 -5
  246. package/workflows/ui-style.md +3 -4
  247. package/workflows/verify.md +2 -2
  248. package/workflows/wiki-connect.md +188 -0
  249. package/workflows/wiki-digest.md +221 -0
  250. package/workflows/wiki-manage.md +204 -0
  251. package/.codex/skills/maestro-chain/SKILL.md +0 -233
@@ -1,224 +1,430 @@
1
- ---
2
- name: maestro-link-coordinate
3
- description: Step-mode graph coordinator via maestro coordinate CLI endpoint. Walks chain graphs node by node using start/next/status subcommands. Decision and gate nodes auto-resolve between steps. Session persisted for resume via -c.
4
- argument-hint: "\"intent text\" [--list] [-c [sessionId]] [--chain <name>] [--tool <tool>] [-y]"
5
- allowed-tools: Read, Write, Bash, Glob, Grep
6
- ---
7
-
8
- <purpose>
9
- Step-mode coordinator that drives `maestro coordinate` CLI subcommands one node at a time. Each call to `maestro coordinate next` advances the walker one graph node forward. Decision nodes resolve via `strategy: 'expr'` fast-path with LLM decider fallback. Gate nodes auto-bypass when conditions are met. The driver loop calls `next` until session status is `completed` or `step_paused` (on user checkpoint). Sessions are persisted by the server; `-c` resumes from the last paused node.
10
-
11
- ```
12
- +-------------------------------------------------------------------+
13
- | maestro-link-coordinate Driver Loop |
14
- +-------------------------------------------------------------------+
15
- | |
16
- | Phase 1: Session Start |
17
- | +-- Parse flags |
18
- | +-- [--list] exec: coordinate list -> display -> stop |
19
- | +-- [-c] exec: coordinate status [sessionId] -> resume loop |
20
- | +-- exec: coordinate start "intent" --chain X |
21
- | +-- Parse sessionId from output |
22
- | |
23
- | Phase 2: Step Driver Loop |
24
- | +-- while (status != completed): |
25
- | | +-- exec: coordinate next [sessionId] |
26
- | | +-- Parse node type from output: |
27
- | | | command -> display result, [confirm?] |
28
- | | | decision -> auto-resolved by walker (expr / llm) |
29
- | | | gate -> auto-bypassed if conditions met |
30
- | | | checkpoint -> pause, display status, await user |
31
- | | +-- Update progress display |
32
- | +-- exec: coordinate status [sessionId] after completion |
33
- | |
34
- | Phase 3: Completion Summary |
35
- | +-- Display per-node execution results |
36
- | +-- Show final session state |
37
- +-------------------------------------------------------------------+
38
- ```
39
- </purpose>
40
-
41
- <context>
42
- $ARGUMENTS -- user intent text, or special flags.
43
-
44
- **Usage**:
45
-
46
- ```bash
47
- $maestro-link-coordinate "implement OAuth2 authentication"
48
- $maestro-link-coordinate "--list"
49
- $maestro-link-coordinate -c "MLC-20260401-143022"
50
- $maestro-link-coordinate --chain quality-full-cycle "fix all test failures"
51
- $maestro-link-coordinate -y "refactor auth module"
52
- ```
53
-
54
- **Flags**:
55
- - `--list` -- List all available chain graphs (uses `maestro coordinate list`)
56
- - `-c / --continue [sessionId]` -- Resume `step_paused` session; uses last session if no id given
57
- - `--chain <name>` -- Force a specific chain graph
58
- - `--tool <tool>` -- CLI tool override for command nodes (default: claude)
59
- - `-y / --yes` -- Auto mode: no step confirmations
60
-
61
- When `-y` or `--yes`: Skip step confirmations between nodes. Runs to completion without pausing.
62
-
63
- **CLI endpoints used**:
64
- - `maestro coordinate list` -- enumerate available chains
65
- - `maestro coordinate start "intent" --chain X` -- begin step-mode session
66
- - `maestro coordinate next [sessionId]` -- advance one step
67
- - `maestro coordinate status [sessionId]` -- query current state
68
- - `maestro coordinate run "intent"` -- autonomous full run (used when `-y`)
69
- - `maestro coordinate watch <sessionId> [--follow]` -- read-only event tail
70
- - `maestro coordinate report` -- agent-invoked result writer (authoritative result channel)
71
- </context>
72
-
73
- <invariants>
74
- 1. **Quick-exit for `--list`**: Never start a session if user only wants to list chains
75
- 2. **One step at a time**: Drive with `coordinate next` calls -- never batch-advance multiple nodes
76
- 3. **Decision nodes are walker-owned**: Never try to resolve decision nodes manually; trust walker output
77
- 4. **Checkpoint is a hard pause**: Never auto-advance past a checkpoint node without explicit user confirmation
78
- 5. **Resume is server-side**: Session state is held by the server; `-c` only provides the sessionId -- the walker has all state
79
- 6. **Auto mode uses `run`**: When `-y`, use `coordinate run` directly rather than the start + next loop
80
- 7. **Status is authoritative**: After loop exits, always call `coordinate status` to get the canonical final state
81
- </invariants>
82
-
83
- <execution>
84
-
85
- ### Phase 1: Session Start
86
-
87
- ```javascript
88
- functions.update_plan({
89
- explanation: "Starting link-coordinate session",
90
- plan: [
91
- { step: "Phase 1: Session start", status: "in_progress" },
92
- { step: "Phase 2: Step driver loop", status: "pending" },
93
- { step: "Phase 3: Completion summary", status: "pending" }
94
- ]
95
- })
96
- ```
97
-
98
- **Quick-exit: `--list`**
99
- ```javascript
100
- functions.exec_command({
101
- cmd: "maestro coordinate list",
102
- workdir: "."
103
- })
104
- // Display output and stop
105
- ```
106
-
107
- **Resume mode: `-c [sessionId]`**
108
- ```javascript
109
- functions.exec_command({
110
- cmd: `maestro coordinate status ${sessionId || ''}`,
111
- workdir: "."
112
- })
113
- // Parse sessionId from output, skip to Phase 2 driver loop
114
- ```
115
-
116
- **Fresh session**:
117
- ```javascript
118
- functions.exec_command({
119
- cmd: `maestro coordinate start "${intent}"${chain ? ' --chain ' + chain : ''}`,
120
- workdir: "."
121
- })
122
- // Parse sessionId from JSON output: { "session_id": "...", "chain": "...", "first_node": "..." }
123
- ```
124
-
125
- ### Phase 2: Step Driver Loop
126
-
127
- ```javascript
128
- functions.update_plan({
129
- explanation: "Stepping through chain graph",
130
- plan: [
131
- { step: "Phase 1: Session start", status: "completed" },
132
- { step: "Phase 2: Step driver loop", status: "in_progress" },
133
- { step: "Phase 3: Completion summary", status: "pending" }
134
- ]
135
- })
136
- ```
137
-
138
- Main loop:
139
- ```javascript
140
- while (status !== 'completed' && status !== 'failed') {
141
- functions.exec_command({
142
- cmd: `maestro coordinate next ${sessionId}`,
143
- workdir: "."
144
- })
145
- // Parse response JSON: { node_type, node_id, status, result, next_status }
146
- }
147
- ```
148
-
149
- **Node type handling**:
150
-
151
- | node_type | Action |
152
- |-----------|--------|
153
- | `command` | Display result summary; if `!AUTO_YES`, call `request_user_input` to confirm before next |
154
- | `decision` | Auto-resolved by walker (expr fast-path or LLM). Display resolved edge. |
155
- | `gate` | Auto-bypassed if conditions met. Display gate status. |
156
- | `checkpoint` | Pause loop, display current state, await explicit user `$maestro-link-coordinate -c` |
157
- | `eval` | Display evaluation result and score |
158
-
159
- **Auto mode (`-y`)**: Use `maestro coordinate run "${intent}"` instead of start + next loop for autonomous execution.
160
-
161
- **Watch mode** (optional, for long-running steps):
162
- ```javascript
163
- functions.exec_command({
164
- cmd: `maestro coordinate watch ${sessionId} --follow`,
165
- workdir: "."
166
- })
167
- ```
168
-
169
- ### Phase 3: Completion Summary
170
-
171
- ```javascript
172
- functions.exec_command({
173
- cmd: `maestro coordinate status ${sessionId}`,
174
- workdir: "."
175
- })
176
- ```
177
-
178
- ```javascript
179
- functions.update_plan({
180
- explanation: "Link-coordinate complete",
181
- plan: [
182
- { step: "Phase 1: Session start", status: "completed" },
183
- { step: "Phase 2: Step driver loop", status: "completed" },
184
- { step: "Phase 3: Completion summary", status: "completed" }
185
- ]
186
- })
187
- ```
188
-
189
- Display:
190
- ```
191
- === GRAPH WALK COMPLETE ===
192
- Session: <sessionId>
193
- Chain: <chain>
194
- Nodes: <N> executed
195
-
196
- NODE RESULTS:
197
- [1] <node_id> (command) -- completed
198
- [2] <node_id> (decision) -- resolved: <edge>
199
- [3] <node_id> (command) -- completed
200
-
201
- To re-run: $maestro-link-coordinate "<intent>" --chain <chain>
202
- ```
203
- </execution>
204
-
205
- <error_codes>
206
- | Code | Severity | Description | Recovery |
207
- |------|----------|-------------|----------|
208
- | E001 | error | No intent and no `--list`/`--chain` provided | Suggest `--list` to see available chains |
209
- | E002 | error | Chain graph not found | Display `maestro coordinate list` output |
210
- | E003 | error | Step execution failed on a command node | Check node result, use `-c` to retry from that node |
211
- | E004 | error | Resume session not found | List sessions in coordinate status |
212
- | E005 | error | `maestro coordinate` CLI endpoint unavailable | Check maestro installation |
213
- </error_codes>
214
-
215
- <success_criteria>
216
- - [ ] Session started or resumed successfully
217
- - [ ] Each node advanced one at a time via `coordinate next`
218
- - [ ] Decision and gate nodes auto-resolved by walker
219
- - [ ] Checkpoint nodes pause execution and await explicit resume
220
- - [ ] Auto mode (`-y`) uses `coordinate run` for unattended execution
221
- - [ ] Completion summary displays per-node results
222
- - [ ] `--list` quick-exits without starting a session
223
- - [ ] `-c` resumes from last paused node
224
- </success_criteria>
1
+ ---
2
+ name: maestro-link-coordinate
3
+ description: Chain-graph walker with in-process flow control. Loads chain JSON, walks nodes in main process, dispatches command nodes via spawn_agents_on_csv. Decision nodes resolved in-process between waves.
4
+ argument-hint: "\"intent text\" [--list] [-c [sessionId]] [--chain <name>] [-y]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ In-process chain-graph coordinator. Unlike the CLI-delegated version (maestro coordinate start/next),
10
+ this coordinator loads chain graph JSON directly and drives flow in the main process:
11
+
12
+ - Command nodes → spawn via `spawn_agents_on_csv` (one command = one wave, always solo)
13
+ - Decision nodes → resolve in-process using expression evaluation against accumulated context
14
+ - Gate/terminal nodes → handle in-process
15
+
16
+ Coordinator responsibilities: load graph → walk nodes → build skill_call → spawn → read result →
17
+ evaluate decision → advance → persist state → repeat until terminal.
18
+
19
+ ```
20
+ +-------------------------------------------------------------------+
21
+ | maestro-link-coordinate (in-process walker) |
22
+ +-------------------------------------------------------------------+
23
+ | |
24
+ | Phase 1: Load Chain Graph |
25
+ | +-- Parse flags (--chain, -y, -c, --list) |
26
+ | +-- Load chain JSON from chains/ directory |
27
+ | +-- Initialize session state |
28
+ | |
29
+ | Phase 2: Walk Loop |
30
+ | +-- while (current_node != terminal): |
31
+ | | +-- command → build skill_call → spawn_agents_on_csv |
32
+ | | | → read result update context → follow next|
33
+ | | +-- decision → evaluate expr against ctx.result |
34
+ | | | → match edge → follow target |
35
+ | | +-- gate → evaluate condition → on_pass / on_fail |
36
+ | | +-- terminal exit loop |
37
+ | +-- Persist state after each node |
38
+ | |
39
+ | Phase 3: Completion Report |
40
+ | +-- Per-node results with outcomes |
41
+ | +-- Final status and resume hint |
42
+ +-------------------------------------------------------------------+
43
+ ```
44
+ </purpose>
45
+
46
+ <context>
47
+ $ARGUMENTS user intent text, or flags.
48
+
49
+ **Flags**:
50
+ - `--list` List all available chain graphs (scan chains/ directory)
51
+ - `-c / --continue [sessionId]` — Resume from last completed node
52
+ - `--chain <name>` — Force a specific chain graph
53
+ - `-y / --yes` — Auto mode: no confirmations between nodes
54
+
55
+ **Session state**: `.workflow/.maestro-coordinate/{session-id}/`
56
+ **Chain graphs**: `chains/` and `chains/singles/` directories (JSON files)
57
+ </context>
58
+
59
+ <invariants>
60
+ 1. **ALL command-node execution via spawn_agents_on_csv**: Coordinator NEVER executes skills directly. Every command node dispatches through `spawn_agents_on_csv`.
61
+ 2. **Coordinator = graph walker + prompt assembler**: Load graph walk build skill_call → spawn → read result → evaluate decisions → persist. Nothing else.
62
+ 3. **One command per wave**: Each command node runs as a solo wave (result needed for subsequent decisions).
63
+ 4. **Decision nodes are in-process**: Coordinator evaluates `node.eval` against `ctx.result` directly. No sub-agent or CLI delegation.
64
+ 5. **Context flows forward**: Each command result is captured and available to subsequent decision expressions and command args.
65
+ 6. **max_visits enforced**: Track visit count per node; bail with failure if exceeded.
66
+ 7. **Resume from node**: `-c` loads saved state and continues from last incomplete node.
67
+ </invariants>
68
+
69
+ <execution>
70
+
71
+ ### Phase 1: Load Chain Graph
72
+
73
+ ```javascript
74
+ const args = $ARGUMENTS.trim();
75
+ const listMode = /\b--list\b/.test(args);
76
+ const autoYes = /\b(-y|--yes)\b/.test(args);
77
+ const resumeMode = /\b(-c|--continue)\b/.test(args);
78
+ const resumeId = args.match(/(?:-c|--continue)\s+(\S+)/)?.[1] || null;
79
+ const forcedChain = args.match(/--chain\s+(\S+)/)?.[1] || null;
80
+ const intent = args
81
+ .replace(/\b(-y|--yes|--list|-c|--continue)\b/g, '')
82
+ .replace(/(?:-c|--continue)\s+\S+/g, '')
83
+ .replace(/--chain\s+\S+/g, '')
84
+ .trim();
85
+ ```
86
+
87
+ **`--list`**: Scan `chains/*.json` and `chains/singles/*.json`, display names + descriptions, stop.
88
+
89
+ **`-c` (resume)**:
90
+ 1. Glob `.workflow/.maestro-coordinate/MLC-*/state.json`, pick most recent (or by `resumeId`)
91
+ 2. Load state find first node with `status !== "completed"` → set as `current_node`
92
+ 3. Jump to **Phase 2**
93
+
94
+ **Fresh session**:
95
+ 1. Resolve chain: `--chain` direct or classify from intent using `chains/_intent-map.json`
96
+ 2. Load chain JSON: try `chains/{name}.json` then `chains/singles/{name}.json`
97
+ 3. Read `.workflow/state.json` for project context (phase, milestone)
98
+ 4. Initialize session:
99
+
100
+ ```javascript
101
+ const sessionId = `MLC-${dateStr}-${timeStr}`;
102
+ const sessionDir = `.workflow/.maestro-coordinate/${sessionId}`;
103
+
104
+ const state = {
105
+ id: sessionId, intent, chain: graph.id, auto_mode: autoYes,
106
+ status: "in_progress", started_at: new Date().toISOString(),
107
+ current_node: graph.entry,
108
+ context: {
109
+ phase: resolvedPhase ?? null, description: intent,
110
+ result: null // last command result, used by decision eval
111
+ },
112
+ visit_counts: {}, // nodeId → number
113
+ history: [], // { node_id, type, outcome, summary, timestamp }
114
+ };
115
+ Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
116
+ ```
117
+
118
+ **`--dry-run`**: Display node walk order with types, stop.
119
+
120
+ **Confirm** (skip if `autoYes`): Display chain summary, prompt `Proceed?`.
121
+
122
+ ### Phase 2: Walk Loop
123
+
124
+ ```javascript
125
+ while (state.status === 'in_progress') {
126
+ const nodeId = state.current_node;
127
+ const node = graph.nodes[nodeId];
128
+
129
+ if (!node) {
130
+ state.status = 'failed';
131
+ state.history.push({ node_id: nodeId, type: 'error', outcome: 'failed',
132
+ summary: `Node "${nodeId}" not found in graph`, timestamp: now() });
133
+ break;
134
+ }
135
+
136
+ // max_visits guard
137
+ state.visit_counts[nodeId] = (state.visit_counts[nodeId] ?? 0) + 1;
138
+ if (node.max_visits && state.visit_counts[nodeId] > node.max_visits) {
139
+ state.status = 'failed';
140
+ state.history.push({ node_id: nodeId, type: node.type, outcome: 'max_visits_exceeded',
141
+ summary: `Exceeded max_visits (${node.max_visits})`, timestamp: now() });
142
+ break;
143
+ }
144
+
145
+ switch (node.type) {
146
+ case 'command': handleCommand(state, graph, nodeId, node); break;
147
+ case 'decision': handleDecision(state, nodeId, node); break;
148
+ case 'gate': handleGate(state, nodeId, node); break;
149
+ case 'terminal': handleTerminal(state, nodeId, node); break;
150
+ }
151
+
152
+ // Persist after every node
153
+ Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
154
+ }
155
+ ```
156
+
157
+ #### handleCommand spawn via CSV
158
+
159
+ ```javascript
160
+ function handleCommand(state, graph, nodeId, node) {
161
+ // 1. Build skill_call
162
+ const skillCall = buildSkillCall(node, state.context, state.auto_mode);
163
+
164
+ // 2. Write single-row CSV
165
+ const csvPath = `${sessionDir}/wave-${nodeId}.csv`;
166
+ const csv = `id,skill_call,topic\n"${nodeId}","${skillCall.replace(/"/g, '""')}","Chain \\"${state.chain}\\" node ${nodeId}"`;
167
+ Write(csvPath, csv);
168
+
169
+ // 3. Spawn
170
+ spawn_agents_on_csv({
171
+ csv_path: csvPath,
172
+ id_column: "id",
173
+ instruction: AGENT_INSTRUCTION,
174
+ max_workers: 1,
175
+ max_runtime_seconds: 1800,
176
+ output_csv_path: `${sessionDir}/wave-${nodeId}-results.csv`,
177
+ output_schema: RESULT_SCHEMA
178
+ });
179
+
180
+ // 4. Read result
181
+ const results = readCSV(`${sessionDir}/wave-${nodeId}-results.csv`);
182
+ const result = results[0];
183
+ const outcome = result?.status === 'completed' ? 'success' : 'failed';
184
+
185
+ // 5. Update context with result (for downstream decision eval)
186
+ state.context.result = parseResultContext(result);
187
+
188
+ // 6. Record history
189
+ state.history.push({
190
+ node_id: nodeId, type: 'command', outcome,
191
+ summary: result?.summary ?? '', timestamp: now()
192
+ });
193
+
194
+ // 7. Advance or fail
195
+ if (outcome === 'failed') {
196
+ if (node.on_failure) {
197
+ state.current_node = node.on_failure;
198
+ } else {
199
+ state.status = 'failed';
200
+ }
201
+ } else {
202
+ state.current_node = node.next;
203
+ }
204
+ }
205
+ ```
206
+
207
+ #### handleDecision — in-process expr evaluation
208
+
209
+ ```javascript
210
+ function handleDecision(state, nodeId, node) {
211
+ // Resolve eval expression from context
212
+ const evalKey = node.eval; // e.g. "ctx.result.verification_status"
213
+ const value = resolveExpr(evalKey, state.context);
214
+
215
+ // Match edge
216
+ let target = null;
217
+ let matchedLabel = null;
218
+ for (const edge of node.edges) {
219
+ if (edge.value !== undefined && String(edge.value) === String(value)) {
220
+ target = edge.target;
221
+ matchedLabel = edge.label ?? edge.description ?? String(edge.value);
222
+ break;
223
+ }
224
+ if (edge.match && new RegExp(edge.match).test(String(value))) {
225
+ target = edge.target;
226
+ matchedLabel = edge.label ?? edge.description ?? edge.match;
227
+ break;
228
+ }
229
+ }
230
+ // Default fallback
231
+ if (!target) {
232
+ const defaultEdge = node.edges.find(e => e.default);
233
+ if (defaultEdge) {
234
+ target = defaultEdge.target;
235
+ matchedLabel = defaultEdge.label ?? defaultEdge.description ?? 'default';
236
+ }
237
+ }
238
+
239
+ state.history.push({
240
+ node_id: nodeId, type: 'decision',
241
+ outcome: target ? 'resolved' : 'no_match',
242
+ summary: `${evalKey} = "${value}" → ${matchedLabel ?? 'none'}`,
243
+ timestamp: now()
244
+ });
245
+
246
+ if (target) {
247
+ state.current_node = target;
248
+ } else {
249
+ state.status = 'failed';
250
+ }
251
+ }
252
+ ```
253
+
254
+ #### handleGate — condition check
255
+
256
+ ```javascript
257
+ function handleGate(state, nodeId, node) {
258
+ const passed = resolveExpr(node.condition, state.context);
259
+ state.history.push({
260
+ node_id: nodeId, type: 'gate',
261
+ outcome: passed ? 'passed' : 'blocked',
262
+ summary: `${node.condition} → ${passed}`,
263
+ timestamp: now()
264
+ });
265
+ state.current_node = passed ? node.on_pass : node.on_fail;
266
+ }
267
+ ```
268
+
269
+ #### handleTerminal
270
+
271
+ ```javascript
272
+ function handleTerminal(state, nodeId, node) {
273
+ state.status = node.status === 'success' ? 'completed' : 'failed';
274
+ state.history.push({
275
+ node_id: nodeId, type: 'terminal',
276
+ outcome: node.status ?? 'completed',
277
+ summary: node.summary ?? 'Chain walk complete',
278
+ timestamp: now()
279
+ });
280
+ }
281
+ ```
282
+
283
+ ### Shared Utilities
284
+
285
+ ```javascript
286
+ const AUTO_FLAG_MAP = {
287
+ 'maestro-analyze': '-y', 'maestro-brainstorm': '-y',
288
+ 'maestro-ui-design': '-y', 'maestro-plan': '--auto',
289
+ 'maestro-spec-generate': '-y', 'quality-test': '--auto-fix',
290
+ 'quality-retrospective': '--auto-yes', 'maestro-roadmap': '-y',
291
+ };
292
+
293
+ function buildSkillCall(node, ctx, autoMode) {
294
+ let args = (node.args ?? '')
295
+ .replace(/{phase}/g, ctx.phase ?? '')
296
+ .replace(/{description}/g, ctx.description ?? '')
297
+ .replace(/{issue_id}/g, ctx.issue_id ?? '')
298
+ .replace(/{milestone_num}/g, ctx.milestone_num ?? '');
299
+ if (autoMode) {
300
+ const flag = node.auto_flag ?? AUTO_FLAG_MAP[node.cmd];
301
+ if (flag && !args.includes(flag)) args = args ? `${args} ${flag}` : flag;
302
+ }
303
+ return `$${node.cmd} ${args}`.trim();
304
+ }
305
+
306
+ function resolveExpr(expr, ctx) {
307
+ // expr is "ctx.result.verification_status" or "all_phases_completed"
308
+ // Navigate dot-path from context root
309
+ if (!expr) return undefined;
310
+ const path = expr.replace(/^ctx\./, '').split('.');
311
+ let val = ctx;
312
+ for (const key of path) {
313
+ if (val == null) return undefined;
314
+ val = val[key];
315
+ }
316
+ return val;
317
+ }
318
+
319
+ function parseResultContext(result) {
320
+ // Extract structured fields from agent result for decision eval
321
+ if (!result) return {};
322
+ try {
323
+ const parsed = typeof result.findings === 'string'
324
+ ? JSON.parse(result.findings) : result.findings;
325
+ return { ...parsed, _raw_summary: result.summary, _status: result.status };
326
+ } catch {
327
+ return { _raw_summary: result.summary ?? '', _status: result.status ?? 'unknown' };
328
+ }
329
+ }
330
+ ```
331
+
332
+ ### Sub-Agent Instruction Template
333
+
334
+ ```
335
+ 你是 CSV job 子 agent。
336
+
337
+ 先原样执行这一段技能调用:
338
+ {skill_call}
339
+
340
+ 然后基于结果完成这一行任务说明:
341
+ {topic}
342
+
343
+ 限制:
344
+ - 不要修改 .workflow/.maestro-coordinate/ 下的 state 文件
345
+ - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
346
+
347
+ 最后必须调用 `report_agent_job_result`,返回 JSON:
348
+ {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","findings":"JSON 结构化结果(含 decision 所需字段)","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
349
+ ```
350
+
351
+ **findings 字段规约**:sub-agent 必须在 findings 中返回 decision node 需要的字段。例如:
352
+ - `maestro-verify` → `{"verification_status": "passed|failed", ...}`
353
+ - `quality-review` → `{"review_verdict": "PASS|BLOCK", ...}`
354
+ - `quality-test` → `{"uat_status": "passed|failed", ...}`
355
+ - `maestro-milestone-audit` → `{"audit_verdict": "PASS|BLOCK", ...}`
356
+
357
+ Coordinator 将 `findings` 解析后写入 `ctx.result`,供后续 decision node 的 `eval` 表达式读取。
358
+
359
+ ### Result Schema
360
+
361
+ ```javascript
362
+ const RESULT_SCHEMA = {
363
+ type: "object",
364
+ properties: {
365
+ status: { type: "string", enum: ["completed", "failed"] },
366
+ skill_call: { type: "string" },
367
+ summary: { type: "string" },
368
+ findings: { type: "string" },
369
+ artifacts: { type: "string" },
370
+ error: { type: "string" }
371
+ },
372
+ required: ["status", "skill_call", "summary", "findings", "artifacts", "error"]
373
+ };
374
+ ```
375
+
376
+ ### Phase 3: Completion Report
377
+
378
+ ```javascript
379
+ state.completed_at = new Date().toISOString();
380
+ Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
381
+ ```
382
+
383
+ Display:
384
+ ```
385
+ === LINK-COORDINATE COMPLETE ===
386
+ Session: {sessionId}
387
+ Chain: {chain.name} ({chain.id})
388
+ Status: {completed|failed}
389
+
390
+ NODE WALK:
391
+ [✓] plan (command) — success — Plan generated
392
+ [→] check_verify (decision) — ctx.result.verification_status = "passed" → review
393
+ [✓] review (command) — success — No blockers
394
+ [→] check_review (decision) — ctx.result.review_verdict = "PASS" → test
395
+ [✓] test (command) — success — All tests passing
396
+
397
+ Nodes: {completed}/{total} | Visits: {total_visits}
398
+ State: .workflow/.maestro-coordinate/{sessionId}/state.json
399
+ Resume: $maestro-link-coordinate -c {sessionId}
400
+ ```
401
+
402
+ </execution>
403
+
404
+ <error_codes>
405
+ | Code | Severity | Description | Recovery |
406
+ |------|----------|-------------|----------|
407
+ | E001 | error | No intent and no --list/--chain | Suggest --list |
408
+ | E002 | error | Chain graph JSON not found | List available chains |
409
+ | E003 | error | Command node spawn failed | Check wave result CSV, resume with -c |
410
+ | E004 | error | Decision node: no matching edge | Show eval value and available edges |
411
+ | E005 | error | max_visits exceeded on node | Show loop path, suggest --chain with simpler graph |
412
+ | E006 | error | Resume session not found | List available sessions |
413
+ | W001 | warning | Decision eval returned undefined | Fall through to default edge |
414
+ </error_codes>
415
+
416
+ <success_criteria>
417
+ - [ ] Chain graph loaded from chains/ directory (multi-path resolution)
418
+ - [ ] Session state initialized with graph entry node
419
+ - [ ] Every command node dispatched via spawn_agents_on_csv — coordinator never executes skills
420
+ - [ ] Decision nodes resolved in-process via expr evaluation against ctx.result
421
+ - [ ] Gate nodes evaluated in-process with pass/fail routing
422
+ - [ ] max_visits tracked per node, exceeded → failure
423
+ - [ ] Context flows forward: command result → ctx.result → decision eval → next command args
424
+ - [ ] State persisted after every node for resumability
425
+ - [ ] -c resumes from last incomplete node
426
+ - [ ] --list displays available chains without starting a session
427
+ - [ ] -y propagates auto_flag to command skill_calls
428
+ - [ ] Completion report shows per-node walk with outcomes
429
+ - [ ] findings from sub-agent parsed into ctx.result for decision routing
430
+ </success_criteria>