maestro-flow 0.3.37 → 0.3.39

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 (186) hide show
  1. package/.claude/agents/workflow-analyzer.md +2 -0
  2. package/.claude/agents/workflow-debugger.md +2 -0
  3. package/.claude/agents/workflow-executor.md +2 -0
  4. package/.claude/agents/workflow-integration-checker.md +1 -0
  5. package/.claude/agents/workflow-nyquist-auditor.md +1 -0
  6. package/.claude/agents/workflow-planner.md +2 -0
  7. package/.claude/agents/workflow-reviewer.md +2 -0
  8. package/.claude/agents/workflow-verifier.md +2 -0
  9. package/.claude/commands/learn-decompose.md +176 -176
  10. package/.claude/commands/learn-follow.md +167 -167
  11. package/.claude/commands/learn-investigate.md +221 -221
  12. package/.claude/commands/learn-retro.md +303 -303
  13. package/.claude/commands/learn-second-opinion.md +167 -167
  14. package/.claude/commands/maestro-amend.md +300 -300
  15. package/.claude/commands/maestro-analyze.md +126 -126
  16. package/.claude/commands/maestro-brainstorm.md +100 -100
  17. package/.claude/commands/maestro-composer.md +354 -354
  18. package/.claude/commands/maestro-execute.md +120 -114
  19. package/.claude/commands/maestro-fork.md +86 -86
  20. package/.claude/commands/maestro-init.md +78 -78
  21. package/.claude/commands/maestro-learn.md +140 -140
  22. package/.claude/commands/maestro-link-coordinate.md +1 -1
  23. package/.claude/commands/maestro-merge.md +61 -61
  24. package/.claude/commands/maestro-milestone-release.md +96 -96
  25. package/.claude/commands/maestro-overlay.md +178 -178
  26. package/.claude/commands/maestro-plan.md +150 -138
  27. package/.claude/commands/maestro-player.md +404 -404
  28. package/.claude/commands/maestro-quick.md +56 -56
  29. package/.claude/commands/maestro-ralph-execute.md +7 -18
  30. package/.claude/commands/maestro-ralph.md +9 -3
  31. package/.claude/commands/maestro-roadmap.md +1 -1
  32. package/.claude/commands/maestro-ui-design.md +93 -93
  33. package/.claude/commands/maestro-update.md +176 -176
  34. package/.claude/commands/maestro-verify.md +96 -90
  35. package/.claude/commands/maestro.md +121 -121
  36. package/.claude/commands/manage-codebase-rebuild.md +75 -75
  37. package/.claude/commands/manage-codebase-refresh.md +57 -57
  38. package/.claude/commands/manage-harvest.md +94 -94
  39. package/.claude/commands/manage-issue-discover.md +77 -77
  40. package/.claude/commands/manage-issue.md +73 -73
  41. package/.claude/commands/manage-knowhow-capture.md +193 -193
  42. package/.claude/commands/manage-knowhow.md +77 -77
  43. package/.claude/commands/manage-learn.md +67 -67
  44. package/.claude/commands/manage-status.md +51 -51
  45. package/.claude/commands/manage-wiki.md +62 -62
  46. package/.claude/commands/quality-auto-test.md +1 -1
  47. package/.claude/commands/quality-debug.md +121 -115
  48. package/.claude/commands/quality-refactor.md +55 -55
  49. package/.claude/commands/quality-retrospective.md +78 -78
  50. package/.claude/commands/quality-review.md +114 -108
  51. package/.claude/commands/quality-sync.md +51 -51
  52. package/.claude/commands/quality-test.md +103 -103
  53. package/.claude/commands/spec-add.md +49 -49
  54. package/.claude/commands/spec-load.md +51 -51
  55. package/.claude/commands/spec-remove.md +51 -51
  56. package/.claude/commands/spec-setup.md +51 -51
  57. package/.claude/commands/wiki-connect.md +62 -62
  58. package/.claude/commands/wiki-digest.md +69 -69
  59. package/.codex/skills/learn-decompose/SKILL.md +113 -113
  60. package/.codex/skills/learn-follow/SKILL.md +1 -1
  61. package/.codex/skills/learn-investigate/SKILL.md +83 -83
  62. package/.codex/skills/learn-retro/SKILL.md +83 -83
  63. package/.codex/skills/learn-second-opinion/SKILL.md +86 -86
  64. package/.codex/skills/maestro/SKILL.md +304 -304
  65. package/.codex/skills/maestro-analyze/SKILL.md +9 -8
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +442 -397
  67. package/.codex/skills/maestro-composer/SKILL.md +213 -213
  68. package/.codex/skills/maestro-execute/SKILL.md +346 -318
  69. package/.codex/skills/maestro-fork/SKILL.md +56 -2
  70. package/.codex/skills/maestro-init/SKILL.md +40 -16
  71. package/.codex/skills/maestro-learn/SKILL.md +80 -80
  72. package/.codex/skills/maestro-link-coordinate/SKILL.md +257 -257
  73. package/.codex/skills/maestro-merge/SKILL.md +1 -1
  74. package/.codex/skills/maestro-milestone-audit/SKILL.md +1 -1
  75. package/.codex/skills/maestro-milestone-complete/SKILL.md +40 -9
  76. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -70
  77. package/.codex/skills/maestro-overlay/SKILL.md +1 -1
  78. package/.codex/skills/maestro-plan/SKILL.md +19 -4
  79. package/.codex/skills/maestro-player/SKILL.md +323 -323
  80. package/.codex/skills/maestro-quick/SKILL.md +1 -1
  81. package/.codex/skills/maestro-ralph/SKILL.md +681 -578
  82. package/.codex/skills/maestro-roadmap/SKILL.md +518 -468
  83. package/.codex/skills/maestro-ui-design/SKILL.md +109 -12
  84. package/.codex/skills/maestro-verify/SKILL.md +27 -9
  85. package/.codex/skills/manage-codebase-rebuild/SKILL.md +3 -2
  86. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  87. package/.codex/skills/manage-harvest/SKILL.md +91 -91
  88. package/.codex/skills/manage-issue/SKILL.md +19 -6
  89. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  90. package/.codex/skills/manage-knowhow/SKILL.md +95 -95
  91. package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -110
  92. package/.codex/skills/manage-learn/SKILL.md +1 -1
  93. package/.codex/skills/manage-status/SKILL.md +1 -1
  94. package/.codex/skills/manage-wiki/SKILL.md +55 -55
  95. package/.codex/skills/quality-auto-test/SKILL.md +547 -547
  96. package/.codex/skills/quality-debug/SKILL.md +339 -334
  97. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  98. package/.codex/skills/quality-retrospective/SKILL.md +292 -292
  99. package/.codex/skills/quality-review/SKILL.md +365 -364
  100. package/.codex/skills/quality-sync/SKILL.md +1 -1
  101. package/.codex/skills/quality-test/SKILL.md +498 -498
  102. package/.codex/skills/spec-add/SKILL.md +101 -101
  103. package/.codex/skills/spec-load/SKILL.md +77 -77
  104. package/.codex/skills/spec-map/SKILL.md +1 -1
  105. package/.codex/skills/spec-remove/SKILL.md +69 -69
  106. package/.codex/skills/spec-setup/SKILL.md +1 -1
  107. package/.codex/skills/team-coordinate/SKILL.md +2 -1
  108. package/.codex/skills/team-executor/SKILL.md +116 -115
  109. package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -1
  110. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +14 -6
  111. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +16 -4
  112. package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +7 -1
  113. package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +16 -4
  114. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +8 -2
  115. package/.codex/skills/team-quality-assurance/SKILL.md +2 -1
  116. package/.codex/skills/team-quality-assurance/roles/scout/role.md +9 -2
  117. package/.codex/skills/team-review/SKILL.md +2 -1
  118. package/.codex/skills/team-review/roles/reviewer/role.md +10 -1
  119. package/.codex/skills/team-review/roles/scanner/role.md +10 -1
  120. package/.codex/skills/team-tech-debt/SKILL.md +144 -143
  121. package/.codex/skills/team-tech-debt/roles/executor/role.md +9 -5
  122. package/.codex/skills/team-tech-debt/roles/scanner/role.md +10 -0
  123. package/.codex/skills/team-tech-debt/roles/validator/role.md +8 -2
  124. package/.codex/skills/team-testing/SKILL.md +2 -1
  125. package/.codex/skills/team-testing/roles/executor/role.md +8 -2
  126. package/.codex/skills/team-testing/roles/generator/role.md +8 -2
  127. package/.codex/skills/wiki-connect/SKILL.md +73 -73
  128. package/.codex/skills/wiki-digest/SKILL.md +87 -87
  129. package/README.md +6 -0
  130. package/README.zh-CN.md +6 -0
  131. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  132. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  133. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +118 -7
  134. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  135. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  136. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
  137. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
  138. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  139. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  140. package/dashboard/dist-server/src/commands/delegate.js +18 -0
  141. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  142. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
  143. package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
  144. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  145. package/dist/shared/agent-types.d.ts +2 -0
  146. package/dist/shared/agent-types.d.ts.map +1 -1
  147. package/dist/src/agents/cli-agent-runner.d.ts +2 -0
  148. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  149. package/dist/src/agents/cli-agent-runner.js +4 -0
  150. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  151. package/dist/src/commands/config.d.ts.map +1 -1
  152. package/dist/src/commands/config.js +29 -1
  153. package/dist/src/commands/config.js.map +1 -1
  154. package/dist/src/commands/delegate.d.ts +2 -0
  155. package/dist/src/commands/delegate.d.ts.map +1 -1
  156. package/dist/src/commands/delegate.js +18 -0
  157. package/dist/src/commands/delegate.js.map +1 -1
  158. package/dist/src/commands/launcher.d.ts.map +1 -1
  159. package/dist/src/commands/launcher.js +27 -4
  160. package/dist/src/commands/launcher.js.map +1 -1
  161. package/dist/src/config/cli-tools-config.d.ts +6 -0
  162. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  163. package/dist/src/config/cli-tools-config.js +2 -0
  164. package/dist/src/config/cli-tools-config.js.map +1 -1
  165. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  166. package/dist/src/core/overlay/applier.js +65 -5
  167. package/dist/src/core/overlay/applier.js.map +1 -1
  168. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  169. package/dist/src/core/overlay/loader.js +9 -4
  170. package/dist/src/core/overlay/loader.js.map +1 -1
  171. package/dist/src/core/overlay/types.d.ts +2 -0
  172. package/dist/src/core/overlay/types.d.ts.map +1 -1
  173. package/dist/src/core/overlay/types.js +2 -0
  174. package/dist/src/core/overlay/types.js.map +1 -1
  175. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  176. package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
  177. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  178. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  179. package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
  180. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  181. package/package.json +1 -1
  182. package/shared/agent-types.ts +2 -0
  183. package/workflows/delegate-protocol.codex.md +65 -0
  184. package/workflows/issue-analyze.md +2 -3
  185. package/workflows/issue-gaps-analyze.codex.md +260 -0
  186. package/workflows/issue-gaps-analyze.md +214 -0
@@ -1,257 +1,257 @@
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/{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
- Parse `$ARGUMENTS` to extract: `listMode` (`--list`), `autoYes` (`-y`/`--yes`), `resumeMode` (`-c`/`--continue`), `resumeId`, `forcedChain` (`--chain <name>`), `intent` (remaining text).
74
-
75
- **`--list`**: Scan `chains/*.json` and `chains/singles/*.json`, display names + descriptions, stop.
76
-
77
- **`-c` (resume)**: Glob `.workflow/.maestro/MLC-*/state.json`, pick most recent (or by `resumeId`). Load state → find first incomplete node → jump to Phase 2.
78
-
79
- **Fresh session**:
80
- 1. Resolve chain: `--chain` direct or classify from intent using `chains/_intent-map.json`
81
- 2. Load chain JSON: try `chains/{name}.json` then `chains/singles/{name}.json`
82
- 3. Read `.workflow/state.json` for project context (phase, milestone)
83
- 4. Initialize session state:
84
-
85
- ```json
86
- {
87
- "id": "MLC-{YYYYMMDD}-{HHmmss}",
88
- "intent": "<intent>", "chain": "<graph.id>", "auto_mode": false,
89
- "status": "in_progress", "started_at": "<ISO>",
90
- "current_node": "<graph.entry>",
91
- "context": { "phase": null, "description": "<intent>", "result": null },
92
- "visit_counts": {},
93
- "history": []
94
- }
95
- ```
96
-
97
- Session dir: `.workflow/.maestro/{sessionId}/`
98
-
99
- **`--dry-run`**: Display node walk order with types, stop.
100
- **Confirm** (skip if `autoYes`): Display chain summary, prompt `Proceed?`.
101
-
102
- ### Phase 2: Walk Loop
103
-
104
- Loop while `state.status === 'in_progress'`:
105
- 1. Resolve `current_node` from graph — fail if not found
106
- 2. Increment `visit_counts[nodeId]` — fail if exceeds `node.max_visits`
107
- 3. Dispatch by `node.type`: command → handleCommand, decision → handleDecision, gate → handleGate, terminal → handleTerminal
108
- 4. Persist `state.json` after every node
109
-
110
- #### handleCommand — spawn via CSV
111
-
112
- 1. Build `skill_call` from node config + context + auto_mode
113
- 2. Write single-row CSV: `wave-{nodeId}.csv` with columns `id,skill_call,topic`
114
- 3. Spawn:
115
-
116
- ```javascript
117
- spawn_agents_on_csv({
118
- csv_path: csvPath,
119
- id_column: "id",
120
- instruction: AGENT_INSTRUCTION,
121
- max_workers: 1,
122
- max_runtime_seconds: 3600,
123
- output_csv_path: `${sessionDir}/wave-${nodeId}-results.csv`,
124
- output_schema: RESULT_SCHEMA
125
- })
126
- ```
127
-
128
- 4. Read result → parse findings into `state.context.result` (for downstream decision eval)
129
- 5. Record history entry with outcome
130
- 6. Advance: success → `node.next`, failure → `node.on_failure` or fail state
131
-
132
- #### handleDecision — in-process expr evaluation
133
-
134
- 1. Evaluate `node.eval` expression (e.g. `ctx.result.verification_status`) against `state.context` via dot-path resolution
135
- 2. Match against `node.edges[]`: first by exact `edge.value`, then by regex `edge.match`, finally `edge.default`
136
- 3. Record history: `evalKey = "value" → matchedLabel`
137
- 4. Advance to matched `edge.target` — fail if no match found
138
-
139
- #### handleGate — condition check
140
-
141
- Evaluate `node.condition` against context. Route to `node.on_pass` or `node.on_fail`. Record history with passed/blocked outcome.
142
-
143
- #### handleTerminal
144
-
145
- Set `state.status` to completed/failed based on `node.status`. Record final history entry.
146
-
147
- ### Shared Utilities
148
-
149
- **AUTO_FLAG_MAP** (skill → auto-confirm flag):
150
-
151
- | Skill | Flag |
152
- |-------|------|
153
- | `maestro-init`, `maestro-analyze`, `maestro-brainstorm`, `maestro-ui-design`, `maestro-roadmap` | `-y` |
154
- | `maestro-plan`, `maestro-execute`, `maestro-milestone-complete` | `-y` |
155
- | `quality-auto-test`, `quality-retrospective` | `-y` |
156
- | `quality-test` | `-y --auto-fix` |
157
-
158
- **buildSkillCall(node, ctx, autoMode)**: Substitute `{phase}`, `{description}`, `{issue_id}`, `{milestone_num}` from context into `node.args`. If autoMode, append auto flag from `node.auto_flag` or AUTO_FLAG_MAP. Return `$${node.cmd} ${resolvedArgs}`.
159
-
160
- **resolveExpr(expr, ctx)**: Navigate dot-path (e.g. `ctx.result.verification_status`) from context root. Strip `ctx.` prefix, walk path segments, return leaf value or undefined.
161
-
162
- **parseResultContext(result)**: Parse `result.findings` as JSON if string, merge with `_raw_summary` and `_status`. Fallback to raw summary on parse failure.
163
-
164
- ### Sub-Agent Instruction Template
165
-
166
- ```
167
- 你是 CSV job 子 agent。
168
-
169
- 先原样执行这一段技能调用:
170
- {skill_call}
171
-
172
- 然后基于结果完成这一行任务说明:
173
- {topic}
174
-
175
- 限制:
176
- - 不要修改 .workflow/.maestro/ 下的 state 文件
177
- - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
178
-
179
- 最后必须调用 `report_agent_job_result`,返回 JSON:
180
- {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","findings":"JSON 结构化结果(含 decision 所需字段)","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
181
- ```
182
-
183
- **findings 字段规约**:sub-agent 必须在 findings 中返回 decision node 需要的字段。例如:
184
- - `maestro-verify` → `{"verification_status": "passed|failed", ...}`
185
- - `quality-review` → `{"review_verdict": "PASS|BLOCK", ...}`
186
- - `quality-test` → `{"uat_status": "passed|failed", ...}`
187
- - `maestro-milestone-audit` → `{"audit_verdict": "PASS|BLOCK", ...}`
188
-
189
- Coordinator 将 `findings` 解析后写入 `ctx.result`,供后续 decision node 的 `eval` 表达式读取。
190
-
191
- ### Result Schema
192
-
193
- ```javascript
194
- const RESULT_SCHEMA = {
195
- type: "object",
196
- properties: {
197
- status: { type: "string", enum: ["completed", "failed"] },
198
- skill_call: { type: "string" },
199
- summary: { type: "string" },
200
- findings: { type: "string" },
201
- artifacts: { type: "string" },
202
- error: { type: "string" }
203
- },
204
- required: ["status", "skill_call", "summary", "findings", "artifacts", "error"]
205
- };
206
- ```
207
-
208
- ### Phase 3: Completion Report
209
-
210
- Set `state.completed_at`, persist final `state.json`. Display:
211
- ```
212
- === LINK-COORDINATE COMPLETE ===
213
- Session: {sessionId}
214
- Chain: {chain.name} ({chain.id})
215
- Status: {completed|failed}
216
-
217
- NODE WALK:
218
- [✓] plan (command) — success — Plan generated
219
- [→] check_verify (decision) — ctx.result.verification_status = "passed" → review
220
- [✓] review (command) — success — No blockers
221
- [→] check_review (decision) — ctx.result.review_verdict = "PASS" → test
222
- [✓] test (command) — success — All tests passing
223
-
224
- Nodes: {completed}/{total} | Visits: {total_visits}
225
- State: .workflow/.maestro/{sessionId}/state.json
226
- Resume: $maestro-link-coordinate -c {sessionId}
227
- ```
228
-
229
- </execution>
230
-
231
- <error_codes>
232
- | Code | Severity | Description | Recovery |
233
- |------|----------|-------------|----------|
234
- | E001 | error | No intent and no --list/--chain | Suggest --list |
235
- | E002 | error | Chain graph JSON not found | List available chains |
236
- | E003 | error | Command node spawn failed | Check wave result CSV, resume with -c |
237
- | E004 | error | Decision node: no matching edge | Show eval value and available edges |
238
- | E005 | error | max_visits exceeded on node | Show loop path, suggest --chain with simpler graph |
239
- | E006 | error | Resume session not found | List available sessions |
240
- | W001 | warning | Decision eval returned undefined | Fall through to default edge |
241
- </error_codes>
242
-
243
- <success_criteria>
244
- - [ ] Chain graph loaded from chains/ directory (multi-path resolution)
245
- - [ ] Session state initialized with graph entry node
246
- - [ ] Every command node dispatched via spawn_agents_on_csv — coordinator never executes skills
247
- - [ ] Decision nodes resolved in-process via expr evaluation against ctx.result
248
- - [ ] Gate nodes evaluated in-process with pass/fail routing
249
- - [ ] max_visits tracked per node, exceeded → failure
250
- - [ ] Context flows forward: command result → ctx.result → decision eval → next command args
251
- - [ ] State persisted after every node for resumability
252
- - [ ] -c resumes from last incomplete node
253
- - [ ] --list displays available chains without starting a session
254
- - [ ] -y propagates auto_flag to command skill_calls
255
- - [ ] Completion report shows per-node walk with outcomes
256
- - [ ] findings from sub-agent parsed into ctx.result for decision routing
257
- </success_criteria>
1
+ ---
2
+ name: maestro-link-coordinate
3
+ description: Execute command chain nodes step by step
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/{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
+ Parse `$ARGUMENTS` to extract: `listMode` (`--list`), `autoYes` (`-y`/`--yes`), `resumeMode` (`-c`/`--continue`), `resumeId`, `forcedChain` (`--chain <name>`), `intent` (remaining text).
74
+
75
+ **`--list`**: Scan `chains/*.json` and `chains/singles/*.json`, display names + descriptions, stop.
76
+
77
+ **`-c` (resume)**: Glob `.workflow/.maestro/MLC-*/state.json`, pick most recent (or by `resumeId`). Load state → find first incomplete node → jump to Phase 2.
78
+
79
+ **Fresh session**:
80
+ 1. Resolve chain: `--chain` direct or classify from intent using `chains/_intent-map.json`
81
+ 2. Load chain JSON: try `chains/{name}.json` then `chains/singles/{name}.json`
82
+ 3. Read `.workflow/state.json` for project context (phase, milestone)
83
+ 4. Initialize session state:
84
+
85
+ ```json
86
+ {
87
+ "id": "MLC-{YYYYMMDD}-{HHmmss}",
88
+ "intent": "<intent>", "chain": "<graph.id>", "auto_mode": false,
89
+ "status": "in_progress", "started_at": "<ISO>",
90
+ "current_node": "<graph.entry>",
91
+ "context": { "phase": null, "description": "<intent>", "result": null },
92
+ "visit_counts": {},
93
+ "history": []
94
+ }
95
+ ```
96
+
97
+ Session dir: `.workflow/.maestro/{sessionId}/`
98
+
99
+ **`--dry-run`**: Display node walk order with types, stop.
100
+ **Confirm** (skip if `autoYes`): Display chain summary, prompt `Proceed?`.
101
+
102
+ ### Phase 2: Walk Loop
103
+
104
+ Loop while `state.status === 'in_progress'`:
105
+ 1. Resolve `current_node` from graph — fail if not found
106
+ 2. Increment `visit_counts[nodeId]` — fail if exceeds `node.max_visits`
107
+ 3. Dispatch by `node.type`: command → handleCommand, decision → handleDecision, gate → handleGate, terminal → handleTerminal
108
+ 4. Persist `state.json` after every node
109
+
110
+ #### handleCommand — spawn via CSV
111
+
112
+ 1. Build `skill_call` from node config + context + auto_mode
113
+ 2. Write single-row CSV: `wave-{nodeId}.csv` with columns `id,skill_call,topic`
114
+ 3. Spawn:
115
+
116
+ ```javascript
117
+ spawn_agents_on_csv({
118
+ csv_path: csvPath,
119
+ id_column: "id",
120
+ instruction: AGENT_INSTRUCTION,
121
+ max_workers: 1,
122
+ max_runtime_seconds: 3600,
123
+ output_csv_path: `${sessionDir}/wave-${nodeId}-results.csv`,
124
+ output_schema: RESULT_SCHEMA
125
+ })
126
+ ```
127
+
128
+ 4. Read result → parse findings into `state.context.result` (for downstream decision eval)
129
+ 5. Record history entry with outcome
130
+ 6. Advance: success → `node.next`, failure → `node.on_failure` or fail state
131
+
132
+ #### handleDecision — in-process expr evaluation
133
+
134
+ 1. Evaluate `node.eval` expression (e.g. `ctx.result.verification_status`) against `state.context` via dot-path resolution
135
+ 2. Match against `node.edges[]`: first by exact `edge.value`, then by regex `edge.match`, finally `edge.default`
136
+ 3. Record history: `evalKey = "value" → matchedLabel`
137
+ 4. Advance to matched `edge.target` — fail if no match found
138
+
139
+ #### handleGate — condition check
140
+
141
+ Evaluate `node.condition` against context. Route to `node.on_pass` or `node.on_fail`. Record history with passed/blocked outcome.
142
+
143
+ #### handleTerminal
144
+
145
+ Set `state.status` to completed/failed based on `node.status`. Record final history entry.
146
+
147
+ ### Shared Utilities
148
+
149
+ **AUTO_FLAG_MAP** (skill → auto-confirm flag):
150
+
151
+ | Skill | Flag |
152
+ |-------|------|
153
+ | `maestro-init`, `maestro-analyze`, `maestro-brainstorm`, `maestro-ui-design`, `maestro-roadmap` | `-y` |
154
+ | `maestro-plan`, `maestro-execute`, `maestro-milestone-complete` | `-y` |
155
+ | `quality-auto-test`, `quality-retrospective` | `-y` |
156
+ | `quality-test` | `-y --auto-fix` |
157
+
158
+ **buildSkillCall(node, ctx, autoMode)**: Substitute `{phase}`, `{description}`, `{issue_id}`, `{milestone_num}` from context into `node.args`. If autoMode, append auto flag from `node.auto_flag` or AUTO_FLAG_MAP. Return `$${node.cmd} ${resolvedArgs}`.
159
+
160
+ **resolveExpr(expr, ctx)**: Navigate dot-path (e.g. `ctx.result.verification_status`) from context root. Strip `ctx.` prefix, walk path segments, return leaf value or undefined.
161
+
162
+ **parseResultContext(result)**: Parse `result.findings` as JSON if string, merge with `_raw_summary` and `_status`. Fallback to raw summary on parse failure.
163
+
164
+ ### Sub-Agent Instruction Template
165
+
166
+ ```
167
+ 你是 CSV job 子 agent。
168
+
169
+ 先原样执行这一段技能调用:
170
+ {skill_call}
171
+
172
+ 然后基于结果完成这一行任务说明:
173
+ {topic}
174
+
175
+ 限制:
176
+ - 不要修改 .workflow/.maestro/ 下的 state 文件
177
+ - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
178
+
179
+ 最后必须调用 `report_agent_job_result`,返回 JSON:
180
+ {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","findings":"JSON 结构化结果(含 decision 所需字段)","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
181
+ ```
182
+
183
+ **findings 字段规约**:sub-agent 必须在 findings 中返回 decision node 需要的字段。例如:
184
+ - `maestro-verify` → `{"verification_status": "passed|failed", ...}`
185
+ - `quality-review` → `{"review_verdict": "PASS|BLOCK", ...}`
186
+ - `quality-test` → `{"uat_status": "passed|failed", ...}`
187
+ - `maestro-milestone-audit` → `{"audit_verdict": "PASS|BLOCK", ...}`
188
+
189
+ Coordinator 将 `findings` 解析后写入 `ctx.result`,供后续 decision node 的 `eval` 表达式读取。
190
+
191
+ ### Result Schema
192
+
193
+ ```javascript
194
+ const RESULT_SCHEMA = {
195
+ type: "object",
196
+ properties: {
197
+ status: { type: "string", enum: ["completed", "failed"] },
198
+ skill_call: { type: "string" },
199
+ summary: { type: "string" },
200
+ findings: { type: "string" },
201
+ artifacts: { type: "string" },
202
+ error: { type: "string" }
203
+ },
204
+ required: ["status", "skill_call", "summary", "findings", "artifacts", "error"]
205
+ };
206
+ ```
207
+
208
+ ### Phase 3: Completion Report
209
+
210
+ Set `state.completed_at`, persist final `state.json`. Display:
211
+ ```
212
+ === LINK-COORDINATE COMPLETE ===
213
+ Session: {sessionId}
214
+ Chain: {chain.name} ({chain.id})
215
+ Status: {completed|failed}
216
+
217
+ NODE WALK:
218
+ [✓] plan (command) — success — Plan generated
219
+ [→] check_verify (decision) — ctx.result.verification_status = "passed" → review
220
+ [✓] review (command) — success — No blockers
221
+ [→] check_review (decision) — ctx.result.review_verdict = "PASS" → test
222
+ [✓] test (command) — success — All tests passing
223
+
224
+ Nodes: {completed}/{total} | Visits: {total_visits}
225
+ State: .workflow/.maestro/{sessionId}/state.json
226
+ Resume: $maestro-link-coordinate -c {sessionId}
227
+ ```
228
+
229
+ </execution>
230
+
231
+ <error_codes>
232
+ | Code | Severity | Description | Recovery |
233
+ |------|----------|-------------|----------|
234
+ | E001 | error | No intent and no --list/--chain | Suggest --list |
235
+ | E002 | error | Chain graph JSON not found | List available chains |
236
+ | E003 | error | Command node spawn failed | Check wave result CSV, resume with -c |
237
+ | E004 | error | Decision node: no matching edge | Show eval value and available edges |
238
+ | E005 | error | max_visits exceeded on node | Show loop path, suggest --chain with simpler graph |
239
+ | E006 | error | Resume session not found | List available sessions |
240
+ | W001 | warning | Decision eval returned undefined | Fall through to default edge |
241
+ </error_codes>
242
+
243
+ <success_criteria>
244
+ - [ ] Chain graph loaded from chains/ directory (multi-path resolution)
245
+ - [ ] Session state initialized with graph entry node
246
+ - [ ] Every command node dispatched via spawn_agents_on_csv — coordinator never executes skills
247
+ - [ ] Decision nodes resolved in-process via expr evaluation against ctx.result
248
+ - [ ] Gate nodes evaluated in-process with pass/fail routing
249
+ - [ ] max_visits tracked per node, exceeded → failure
250
+ - [ ] Context flows forward: command result → ctx.result → decision eval → next command args
251
+ - [ ] State persisted after every node for resumability
252
+ - [ ] -c resumes from last incomplete node
253
+ - [ ] --list displays available chains without starting a session
254
+ - [ ] -y propagates auto_flag to command skill_calls
255
+ - [ ] Completion report shows per-node walk with outcomes
256
+ - [ ] findings from sub-agent parsed into ctx.result for decision routing
257
+ </success_criteria>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: maestro-merge
3
- description: Two-phase merge of milestone worktree branch back git merge first, scratch artifact sync and registry reconciliation only on success.
3
+ description: Merge milestone worktree branch back to main
4
4
  argument-hint: "-m <milestone-number> [--force] [--dry-run] [--no-cleanup] [--continue]"
5
5
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: maestro-milestone-audit
3
- description: Audit current milestone using artifact registry for cross-phase integration gaps and produce verdict report
3
+ description: Audit current milestone for cross-phase integration gaps
4
4
  argument-hint: "[milestone, e.g., 'M1']"
5
5
  allowed-tools: Read, Write, Bash, Glob, Grep, Agent
6
6
  ---
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: maestro-milestone-complete
3
- description: Archive completed milestone scratch artifacts to milestones/ dir, move artifact entries to milestone_history, extract learnings, advance state.
3
+ description: Archive completed milestone and prepare for next
4
4
  argument-hint: "[milestone] [--force] [-y]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
8
8
  <purpose>
@@ -33,24 +33,55 @@ $maestro-milestone-complete --force "M1" # skip audit check
33
33
 
34
34
  ### Step 1: Parse & Validate
35
35
 
36
- Read `.workflow/state.json` for `current_milestone`, `artifacts[]`, `milestones[]`. Determine target from args or current_milestone (E001 if none). Validate audit report at `.workflow/milestones/{milestone}/audit-report.md` with PASS verdict (E002 unless `--force`). Verify all milestone artifacts completed (E003 unless `--force`).
36
+ Read `.workflow/state.json` for `current_milestone`, `artifacts[]`, `milestones[]`. Determine target from args or current_milestone (E001 if none).
37
+
38
+ Validate audit report at `.workflow/milestones/{milestone}/audit-report.md`:
39
+ - Parse for `## Verdict` section (or `**Verdict:**` inline)
40
+ - PASS condition: verdict line contains the word `PASS` (case-insensitive)
41
+ - Any other verdict (FAIL, PARTIAL, missing section) → E002 unless `--force`
42
+
43
+ Verify all milestone artifacts completed (E003 unless `--force`).
37
44
 
38
45
  ### Step 2: Archive Scratch Dirs
39
46
 
40
- Copy each milestone artifact's directory to `.workflow/milestones/{milestone}/artifacts/`. Snapshot `roadmap.md` as `roadmap-snapshot.md` in the milestone archive.
47
+ Copy each milestone artifact's directory to `.workflow/milestones/{milestone}/artifacts/`.
48
+
49
+ **Source path resolution**: For each entry in `state.json.artifacts[]`, resolve the source directory from `artifact.path`:
50
+ - If `artifact.path` is relative (e.g. `scratch/M1-auth`), resolve from `.workflow/` (→ `.workflow/scratch/M1-auth`)
51
+ - If `artifact.path` is absolute, use as-is
52
+ - Copy the entire resolved directory to `.workflow/milestones/{milestone}/artifacts/{artifact.name}/`
53
+
54
+ Snapshot `roadmap.md` as `roadmap-snapshot.md` in the milestone archive.
41
55
 
42
56
  ### Step 3: Extract Learnings
43
57
 
44
- Read `.summaries/` and `reflection-log.md` from execute artifacts. Extract patterns, pitfalls, strategy adjustments. Dedup against existing entries via `maestro spec load --category learning`. Append to `.workflow/specs/learnings.md` using `<spec-entry>` closed-tag format (category=`learning`, auto-extract keywords, date=today, source=`milestone-complete`).
58
+ **Source files** (read in order):
59
+ 1. `.workflow/milestones/{milestone}/artifacts/**/.summaries/*.md` — task completion summaries
60
+ 2. `.workflow/milestones/{milestone}/artifacts/**/reflection-log.md` — retrospective entries
61
+
62
+ **Extraction**: Parse each source for patterns, pitfalls, strategy adjustments. Look for recurring themes across summaries and explicit lessons in reflection logs.
63
+
64
+ **Dedup**: Run `maestro spec load --category learning` to load existing entries. Skip any extracted learning whose keywords fully overlap with an existing entry.
65
+
66
+ **Write**: Append to `.workflow/specs/learnings.md` using `<spec-entry>` closed-tag format:
67
+ ```
68
+ <spec-entry category="learning" keywords="kw1, kw2" date="YYYY-MM-DD" source="milestone-complete:{milestone}">
69
+ Learning content here.
70
+ </spec-entry>
71
+ ```
45
72
 
46
73
  ### Step 3b: Knowledge Promotion Inquiry
47
74
 
48
- 1. **High-frequency patterns**: Scan learning entries for keyword overlap (>=2 entries) -- offer promotion to coding convention via `/spec-add coding`
49
- 2. **Convention drift**: Compare summaries against `coding-conventions.md` and `architecture-constraints.md` -- ask if conventions need updating
50
- 3. **Wiki island check**: Auto-trigger `wiki-connect --fix` to link new knowledge
75
+ 1. **High-frequency patterns**: Scan all `<spec-entry category="learning">` entries for keyword overlap. Trigger threshold: **>=2 entries sharing the same keyword**. For each triggered keyword, ask: "Keyword '{keyword}' appears in {N} learning entries. Promote to formal coding convention?"
76
+ 2. **Convention drift**: Compare executed task summaries against `coding-conventions.md` and `architecture-constraints.md`. Trigger threshold: **any deviation found** (technique used but not documented, or documented convention not followed). Ask: "Convention '{convention}' was bypassed during this milestone. Update conventions?"
77
+ 3. **Wiki island check**: Auto-trigger `wiki-connect --fix` to link new knowledge. Trigger threshold: **always runs** (no user confirmation needed).
51
78
 
52
79
  If `-y`: auto-accept all promotions without asking.
53
- If not `-y`: ask user for confirmation. If user confirms, append `<spec-entry>` to target category file preserving original date and source.
80
+ If not `-y`: ask user for confirmation via `request_user_input`:
81
+ ```json
82
+ { "questions": [{ "id": "promote_learning", "header": "Knowledge Promotion", "question": "Keyword '{keyword}' appears in {N} learning entries. Promote to coding convention?", "options": [{ "label": "Yes, promote (Recommended)", "description": "Add as formal coding convention via spec-add" }, { "label": "No, keep as learning", "description": "Leave in learnings.md without promotion" }] }] }
83
+ ```
84
+ If user confirms, append `<spec-entry>` to target category file preserving original date and source.
54
85
 
55
86
  ### Step 4: Archive Artifact Entries
56
87