maestro-flow 0.3.9 → 0.3.11

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 (281) hide show
  1. package/.claude/agents/workflow-collab-planner.md +1 -1
  2. package/.claude/agents/workflow-executor.md +1 -1
  3. package/.claude/agents/workflow-plan-checker.md +1 -1
  4. package/.claude/agents/workflow-planner.md +1 -1
  5. package/.claude/commands/learn-decompose.md +176 -176
  6. package/.claude/commands/learn-follow.md +167 -167
  7. package/.claude/commands/learn-retro.md +1 -1
  8. package/.claude/commands/maestro-analyze.md +46 -3
  9. package/.claude/commands/maestro-coordinate.md +1 -3
  10. package/.claude/commands/maestro-execute.md +14 -0
  11. package/.claude/commands/maestro-plan.md +16 -0
  12. package/.claude/commands/manage-harvest.md +131 -131
  13. package/.claude/commands/manage-issue-discover.md +2 -2
  14. package/.claude/commands/manage-issue.md +5 -5
  15. package/.claude/commands/spec-add.md +67 -56
  16. package/.claude/commands/spec-load.md +66 -64
  17. package/.claude/commands/spec-setup.md +5 -9
  18. package/.codex/skills/learn-decompose/SKILL.md +119 -0
  19. package/.codex/skills/learn-follow/SKILL.md +83 -0
  20. package/.codex/skills/learn-investigate/SKILL.md +83 -0
  21. package/.codex/skills/learn-retro/SKILL.md +83 -0
  22. package/.codex/skills/learn-second-opinion/SKILL.md +86 -0
  23. package/.codex/skills/maestro/SKILL.md +335 -0
  24. package/.codex/skills/maestro-analyze/SKILL.md +84 -75
  25. package/.codex/skills/maestro-brainstorm/SKILL.md +452 -463
  26. package/.codex/skills/maestro-chain/SKILL.md +233 -0
  27. package/.codex/skills/maestro-coordinate/SKILL.md +167 -278
  28. package/.codex/skills/maestro-execute/SKILL.md +435 -438
  29. package/.codex/skills/maestro-fork/SKILL.md +68 -0
  30. package/.codex/skills/maestro-init/SKILL.md +171 -167
  31. package/.codex/skills/maestro-learn/SKILL.md +80 -0
  32. package/.codex/skills/maestro-link-coordinate/SKILL.md +224 -220
  33. package/.codex/skills/maestro-merge/SKILL.md +62 -0
  34. package/.codex/skills/maestro-milestone-audit/SKILL.md +108 -103
  35. package/.codex/skills/maestro-milestone-complete/SKILL.md +155 -149
  36. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -0
  37. package/.codex/skills/maestro-overlay/SKILL.md +188 -185
  38. package/.codex/skills/maestro-plan/SKILL.md +66 -69
  39. package/.codex/skills/maestro-quick/SKILL.md +26 -23
  40. package/.codex/skills/maestro-roadmap/SKILL.md +65 -73
  41. package/.codex/skills/maestro-spec-generate/SKILL.md +66 -74
  42. package/.codex/skills/maestro-ui-design/SKILL.md +34 -31
  43. package/.codex/skills/maestro-verify/SKILL.md +556 -566
  44. package/.codex/skills/manage-codebase-rebuild/SKILL.md +397 -405
  45. package/.codex/skills/manage-codebase-refresh/SKILL.md +93 -82
  46. package/.codex/skills/manage-harvest/SKILL.md +82 -0
  47. package/.codex/skills/manage-issue/SKILL.md +80 -65
  48. package/.codex/skills/manage-issue-discover/SKILL.md +491 -503
  49. package/.codex/skills/manage-learn/SKILL.md +190 -186
  50. package/.codex/skills/manage-memory/SKILL.md +95 -72
  51. package/.codex/skills/manage-memory-capture/SKILL.md +99 -86
  52. package/.codex/skills/manage-status/SKILL.md +102 -89
  53. package/.codex/skills/quality-business-test/SKILL.md +228 -223
  54. package/.codex/skills/quality-debug/SKILL.md +54 -66
  55. package/.codex/skills/quality-integration-test/SKILL.md +532 -544
  56. package/.codex/skills/quality-refactor/SKILL.md +197 -191
  57. package/.codex/skills/quality-retrospective/SKILL.md +512 -505
  58. package/.codex/skills/quality-review/SKILL.md +93 -105
  59. package/.codex/skills/quality-sync/SKILL.md +101 -89
  60. package/.codex/skills/quality-test/SKILL.md +202 -198
  61. package/.codex/skills/quality-test-gen/SKILL.md +93 -104
  62. package/.codex/skills/spec-add/SKILL.md +58 -39
  63. package/.codex/skills/spec-load/SKILL.md +45 -40
  64. package/.codex/skills/spec-map/SKILL.md +180 -182
  65. package/.codex/skills/spec-setup/SKILL.md +94 -76
  66. package/.codex/skills/team-coordinate/SKILL.md +346 -357
  67. package/.codex/skills/team-executor/SKILL.md +70 -112
  68. package/.codex/skills/team-lifecycle-v4/SKILL.md +311 -299
  69. package/.codex/skills/team-quality-assurance/SKILL.md +234 -227
  70. package/.codex/skills/team-review/SKILL.md +232 -225
  71. package/.codex/skills/team-tech-debt/SKILL.md +78 -100
  72. package/.codex/skills/team-testing/SKILL.md +242 -235
  73. package/.codex/skills/wiki-connect/SKILL.md +75 -0
  74. package/.codex/skills/wiki-digest/SKILL.md +87 -0
  75. package/README.md +14 -11
  76. package/README.zh-CN.md +14 -11
  77. package/chains/issue-lifecycle.json +13 -13
  78. package/chains/singles/issue-analyze.json +3 -3
  79. package/chains/singles/issue-execute.json +3 -3
  80. package/chains/singles/issue-plan.json +3 -3
  81. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
  82. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  83. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  84. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  85. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
  86. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +1 -1
  88. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +75 -30
  89. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  90. package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +5 -0
  91. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +5 -0
  92. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
  93. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
  94. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  95. package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
  96. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  97. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
  98. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  99. package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
  100. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
  101. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
  102. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +21 -0
  103. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/shared/types.d.ts +3 -2
  105. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +1 -1
  106. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  107. package/dashboard/dist-server/src/hooks/constants.d.ts +92 -12
  108. package/dashboard/dist-server/src/hooks/constants.js +151 -16
  109. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  110. package/dashboard/dist-server/src/types/index.d.ts +5 -0
  111. package/dist/src/commands/collab.d.ts +1 -34
  112. package/dist/src/commands/collab.d.ts.map +1 -1
  113. package/dist/src/commands/collab.js +8 -76
  114. package/dist/src/commands/collab.js.map +1 -1
  115. package/dist/src/commands/hooks.d.ts +5 -1
  116. package/dist/src/commands/hooks.d.ts.map +1 -1
  117. package/dist/src/commands/hooks.js +115 -10
  118. package/dist/src/commands/hooks.js.map +1 -1
  119. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
  120. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  121. package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
  122. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  123. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  124. package/dist/src/commands/install-ui/InstallExecution.js +5 -1
  125. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  126. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  127. package/dist/src/commands/install-ui/InstallFlow.js +7 -3
  128. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  129. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
  130. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  131. package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
  132. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  133. package/dist/src/commands/spec.d.ts.map +1 -1
  134. package/dist/src/commands/spec.js +7 -2
  135. package/dist/src/commands/spec.js.map +1 -1
  136. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
  137. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
  138. package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
  139. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
  140. package/dist/src/hooks/constants.d.ts +92 -12
  141. package/dist/src/hooks/constants.d.ts.map +1 -1
  142. package/dist/src/hooks/constants.js +151 -16
  143. package/dist/src/hooks/constants.js.map +1 -1
  144. package/dist/src/hooks/guards/index.d.ts +2 -0
  145. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  146. package/dist/src/hooks/guards/index.js +2 -0
  147. package/dist/src/hooks/guards/index.js.map +1 -1
  148. package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
  149. package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
  150. package/dist/src/hooks/guards/preflight-guard.js +95 -0
  151. package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
  152. package/dist/src/hooks/guards/spec-validator.d.ts +25 -0
  153. package/dist/src/hooks/guards/spec-validator.d.ts.map +1 -0
  154. package/dist/src/hooks/guards/spec-validator.js +66 -0
  155. package/dist/src/hooks/guards/spec-validator.js.map +1 -0
  156. package/dist/src/hooks/index.d.ts +1 -0
  157. package/dist/src/hooks/index.d.ts.map +1 -1
  158. package/dist/src/hooks/index.js +1 -0
  159. package/dist/src/hooks/index.js.map +1 -1
  160. package/dist/src/hooks/keyword-spec-injector.d.ts +21 -0
  161. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -0
  162. package/dist/src/hooks/keyword-spec-injector.js +96 -0
  163. package/dist/src/hooks/keyword-spec-injector.js.map +1 -0
  164. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts +2 -1
  165. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
  166. package/dist/src/hooks/plugins/spec-injection-plugin.js +21 -12
  167. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  168. package/dist/src/hooks/preflight-core.d.ts +37 -0
  169. package/dist/src/hooks/preflight-core.d.ts.map +1 -0
  170. package/dist/src/hooks/preflight-core.js +86 -0
  171. package/dist/src/hooks/preflight-core.js.map +1 -0
  172. package/dist/src/hooks/spec-bridge.d.ts +40 -0
  173. package/dist/src/hooks/spec-bridge.d.ts.map +1 -0
  174. package/dist/src/hooks/spec-bridge.js +97 -0
  175. package/dist/src/hooks/spec-bridge.js.map +1 -0
  176. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  177. package/dist/src/hooks/spec-injector.js +18 -12
  178. package/dist/src/hooks/spec-injector.js.map +1 -1
  179. package/dist/src/hooks/statusline.d.ts +8 -17
  180. package/dist/src/hooks/statusline.d.ts.map +1 -1
  181. package/dist/src/hooks/statusline.js +269 -112
  182. package/dist/src/hooks/statusline.js.map +1 -1
  183. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  184. package/dist/src/i18n/locales/en.js +5 -0
  185. package/dist/src/i18n/locales/en.js.map +1 -1
  186. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  187. package/dist/src/i18n/locales/zh.js +5 -0
  188. package/dist/src/i18n/locales/zh.js.map +1 -1
  189. package/dist/src/i18n/types.d.ts +5 -0
  190. package/dist/src/i18n/types.d.ts.map +1 -1
  191. package/dist/src/team/phase-orchestrator.d.ts +52 -0
  192. package/dist/src/team/phase-orchestrator.d.ts.map +1 -0
  193. package/dist/src/team/phase-orchestrator.js +165 -0
  194. package/dist/src/team/phase-orchestrator.js.map +1 -0
  195. package/dist/src/team/phase-types.d.ts +51 -0
  196. package/dist/src/team/phase-types.d.ts.map +1 -0
  197. package/dist/src/team/phase-types.js +41 -0
  198. package/dist/src/team/phase-types.js.map +1 -0
  199. package/dist/src/tools/collab-adapter.d.ts +17 -0
  200. package/dist/src/tools/collab-adapter.d.ts.map +1 -1
  201. package/dist/src/tools/collab-adapter.js +138 -0
  202. package/dist/src/tools/collab-adapter.js.map +1 -1
  203. package/dist/src/tools/index.d.ts.map +1 -1
  204. package/dist/src/tools/index.js +6 -0
  205. package/dist/src/tools/index.js.map +1 -1
  206. package/dist/src/tools/merge-validator.d.ts +24 -0
  207. package/dist/src/tools/merge-validator.d.ts.map +1 -0
  208. package/dist/src/tools/merge-validator.js +220 -0
  209. package/dist/src/tools/merge-validator.js.map +1 -0
  210. package/dist/src/tools/spec-entry-parser.d.ts +56 -0
  211. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -0
  212. package/dist/src/tools/spec-entry-parser.js +196 -0
  213. package/dist/src/tools/spec-entry-parser.js.map +1 -0
  214. package/dist/src/tools/spec-init.d.ts.map +1 -1
  215. package/dist/src/tools/spec-init.js +66 -92
  216. package/dist/src/tools/spec-init.js.map +1 -1
  217. package/dist/src/tools/spec-keyword-index.d.ts +30 -0
  218. package/dist/src/tools/spec-keyword-index.d.ts.map +1 -0
  219. package/dist/src/tools/spec-keyword-index.js +101 -0
  220. package/dist/src/tools/spec-keyword-index.js.map +1 -0
  221. package/dist/src/tools/spec-loader.d.ts +3 -3
  222. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  223. package/dist/src/tools/spec-loader.js +49 -23
  224. package/dist/src/tools/spec-loader.js.map +1 -1
  225. package/dist/src/tools/team-agents.d.ts +27 -0
  226. package/dist/src/tools/team-agents.d.ts.map +1 -0
  227. package/dist/src/tools/team-agents.js +362 -0
  228. package/dist/src/tools/team-agents.js.map +1 -0
  229. package/dist/src/tools/team-mailbox.d.ts +40 -0
  230. package/dist/src/tools/team-mailbox.d.ts.map +1 -0
  231. package/dist/src/tools/team-mailbox.js +384 -0
  232. package/dist/src/tools/team-mailbox.js.map +1 -0
  233. package/dist/src/tools/team-msg.d.ts +17 -8
  234. package/dist/src/tools/team-msg.d.ts.map +1 -1
  235. package/dist/src/tools/team-msg.js +110 -13
  236. package/dist/src/tools/team-msg.js.map +1 -1
  237. package/dist/src/tools/team-tasks-mcp.d.ts +27 -0
  238. package/dist/src/tools/team-tasks-mcp.d.ts.map +1 -0
  239. package/dist/src/tools/team-tasks-mcp.js +408 -0
  240. package/dist/src/tools/team-tasks-mcp.js.map +1 -0
  241. package/dist/src/types/index.d.ts +5 -0
  242. package/dist/src/types/index.d.ts.map +1 -1
  243. package/package.json +2 -1
  244. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
  245. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
  246. package/templates/search-tools.md +1 -1
  247. package/workflows/analyze.md +816 -816
  248. package/workflows/brainstorm.md +471 -471
  249. package/workflows/cli-tools-usage.md +44 -27
  250. package/workflows/codebase-rebuild.md +332 -332
  251. package/workflows/codebase-refresh.md +240 -240
  252. package/workflows/delegate-usage.md +3 -3
  253. package/workflows/execute.md +1 -1
  254. package/workflows/harvest.md +420 -420
  255. package/workflows/integration-test.md +343 -343
  256. package/workflows/issue-analyze.md +6 -2
  257. package/workflows/issue-discover.md +414 -414
  258. package/workflows/issue-execute.md +6 -3
  259. package/workflows/issue-plan.md +5 -2
  260. package/workflows/maestro-coordinate.codex.md +281 -470
  261. package/workflows/maestro-coordinate.md +14 -14
  262. package/workflows/maestro-link-coordinate.md +2 -2
  263. package/workflows/maestro.codex.md +710 -0
  264. package/workflows/maestro.md +10 -11
  265. package/workflows/map.md +111 -111
  266. package/workflows/milestone-complete.md +176 -176
  267. package/workflows/plan.md +1 -1
  268. package/workflows/quick.md +497 -497
  269. package/workflows/refactor.md +300 -300
  270. package/workflows/retrospective.md +1 -1
  271. package/workflows/roadmap.md +335 -335
  272. package/workflows/spec-generate.md +640 -640
  273. package/workflows/specs-add.md +46 -81
  274. package/workflows/specs-load.md +15 -17
  275. package/workflows/specs-setup.md +40 -161
  276. package/.claude/commands/manage-issue-analyze.md +0 -62
  277. package/.claude/commands/manage-issue-execute.md +0 -73
  278. package/.claude/commands/manage-issue-plan.md +0 -62
  279. package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
  280. package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
  281. package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
@@ -1,438 +1,435 @@
1
- ---
2
- name: maestro-execute
3
- description: Wave-based parallel task execution via CSV wave pipeline. Reads plan.json to build CSV with pre-computed waves, executes tasks in parallel per wave with cross-wave context propagation. Core execution engine replacing maestro-execute command.
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--auto-commit] [--method agent|cli] [--dir <path>]\""
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- ## Auto Mode
9
-
10
- When `--yes` or `-y`: Auto-confirm task breakdown, skip blocked-task prompts, auto-continue through all waves.
11
-
12
- # Maestro Execute (CSV Wave)
13
-
14
- ## Usage
15
-
16
- ```bash
17
- $maestro-execute "3"
18
- $maestro-execute -c 4 "3 --auto-commit"
19
- $maestro-execute -y "3 --method cli"
20
- $maestro-execute "3 --dir .workflow/scratch/quick-fix"
21
- $maestro-execute --continue "execute-phase3-20260318"
22
- ```
23
-
24
- **Flags**:
25
- - `-y, --yes`: Skip all confirmations (auto mode)
26
- - `-c, --concurrency N`: Max concurrent agents within each wave (default: 5)
27
- - `--continue`: Resume existing session
28
-
29
- **Inner flags** (passed inside quotes):
30
- - `--auto-commit`: Atomic git commit after each task completion
31
- - `--method agent|cli`: Override execution method (default: from config.json)
32
- - `--dir <path>`: Use arbitrary directory instead of phase resolution (scratch mode)
33
-
34
- **Output Directory**: `.workflow/.csv-wave/{session-id}/`
35
- **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
36
-
37
- ---
38
-
39
- ## Overview
40
-
41
- Wave-based parallel task execution using `spawn_agents_on_csv`. Reads plan.json to build a CSV where waves are pre-computed from the plan. Each wave runs tasks in parallel, with cross-wave context propagation via `prev_context`. This is the core execution engine of the maestro pipeline.
42
-
43
- **Core workflow**: Load Plan → Build CSV from Tasks → Wave-by-Wave Parallel Execution → Aggregate Results
44
-
45
- **Topology**: Custom (waves inherited from plan.json — no Kahn's algorithm needed)
46
-
47
- ```
48
- +---------------------------------------------------------------------------+
49
- | TASK EXECUTION CSV WAVE WORKFLOW |
50
- +---------------------------------------------------------------------------+
51
- | |
52
- | Phase 1: Plan Resolution -> CSV |
53
- | +-- Resolve phase directory (or --dir path) |
54
- | +-- Read plan.json + .task/TASK-*.json definitions |
55
- | +-- Detect completed tasks (breakpoint resume) |
56
- | +-- Build tasks.csv with one row per pending task |
57
- | +-- Waves inherited from plan.json (pre-computed) |
58
- | +-- Load project specs for executor context |
59
- | +-- User validates task breakdown (skip if -y) |
60
- | |
61
- | Phase 2: Wave Execution Engine |
62
- | +-- For each wave (sequential): |
63
- | | +-- Wave N: Task Execution (parallel within wave) |
64
- | | | +-- Each agent implements one task |
65
- | | | +-- Agent reads task definition + convergence criteria |
66
- | | | +-- Agent creates/modifies files per task.files |
67
- | | | +-- Agent verifies convergence.criteria (max 3 fix attempts) |
68
- | | | +-- Agent writes .summaries/TASK-{NNN}-summary.md |
69
- | | | +-- Atomic commit if --auto-commit |
70
- | | | +-- Discoveries shared via board (patterns, blockers) |
71
- | | +-- Merge wave results into master tasks.csv |
72
- | | +-- Build prev_context for next wave from completed findings |
73
- | | +-- If blocked tasks: prompt user (skip if -y: auto-continue) |
74
- | +-- discoveries.ndjson shared across all waves (append-only) |
75
- | |
76
- | Phase 3: Results Aggregation |
77
- | +-- Export results.csv |
78
- | +-- Update .task/TASK-*.json statuses |
79
- | +-- Update index.json execution progress |
80
- | +-- Update state.json project progress |
81
- | +-- Generate context.md with execution report |
82
- | +-- Auto-sync codebase docs (if configured) |
83
- | +-- Display summary with next steps |
84
- | |
85
- +---------------------------------------------------------------------------+
86
- ```
87
-
88
- ---
89
-
90
- ## CSV Schema
91
-
92
- ### tasks.csv (Master State)
93
-
94
- ```csv
95
- id,title,description,scope,convergence_criteria,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,error
96
- "TASK-001","Setup auth module","Create authentication module with JWT token generation and verification. Export verifyToken and generateToken functions.","src/auth/","auth.ts contains export function verifyToken(; auth.ts contains export function generateToken(","Reference existing middleware pattern in src/middleware/auth.ts","npm test -- --grep auth","","","1","","","","",""
97
- "TASK-002","Create user model","Define User interface and database schema with email, passwordHash, role fields. Use existing Result type pattern.","src/models/","user.ts contains export interface User; user.ts contains email: string","See src/models/session.ts for existing model pattern","npm test -- --grep user","","","1","","","","",""
98
- "TASK-003","Auth middleware","Create Express middleware that validates JWT from Authorization header. Use verifyToken from auth module. Return 401 on invalid token.","src/middleware/","auth-middleware.ts contains export function authMiddleware(; auth-middleware.ts contains verifyToken","Follows existing middleware pattern in src/middleware/logging.ts","npm test -- --grep middleware","TASK-001","TASK-001","2","","","","",""
99
- "TASK-004","Login endpoint","Implement POST /api/login endpoint. Validate credentials against user model, return JWT on success. Use generateToken from auth module.","src/routes/","login.ts contains router.post('/api/login'; login.ts contains generateToken(","Wire into existing Express app in src/app.ts","curl -X POST localhost:3000/api/login","TASK-001;TASK-002","TASK-001;TASK-002","2","","","","",""
100
- "TASK-005","Integration tests","Write integration tests for full auth flow: register, login, access protected route, token refresh.","tests/","tests/auth.test.ts exists; npm test exits with code 0","Use existing test setup in tests/setup.ts","npm test","TASK-003;TASK-004","TASK-003;TASK-004","3","","","","",""
101
- ```
102
-
103
- **Columns**:
104
-
105
- | Column | Phase | Description |
106
- |--------|-------|-------------|
107
- | `id` | Input | Task ID (TASK-NNN format, from plan.json) |
108
- | `title` | Input | Short task title from task definition |
109
- | `description` | Input | Full task description from TASK-*.json |
110
- | `scope` | Input | Target file/directory glob from task.files |
111
- | `convergence_criteria` | Input | Grep-verifiable completion criteria (semicolon-separated) |
112
- | `hints` | Input | Implementation hints + reference files from task definition |
113
- | `execution_directives` | Input | Verification commands to run after implementation |
114
- | `deps` | Input | Semicolon-separated dependency task IDs |
115
- | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
116
- | `wave` | Computed | Wave number from plan.json wave assignment |
117
- | `status` | Output | `pending` -> `completed` / `failed` / `blocked` / `skipped` |
118
- | `findings` | Output | Implementation notes and observations (max 500 chars) |
119
- | `files_modified` | Output | Semicolon-separated list of created/modified files |
120
- | `tests_passed` | Output | Test pass/fail status from execution_directives |
121
- | `error` | Output | Error message if failed or blocked |
122
-
123
- ### Per-Wave CSV (Temporary)
124
-
125
- Each wave generates `wave-{N}.csv` with extra `prev_context` column populated from predecessor task findings.
126
-
127
- ---
128
-
129
- ## Output Artifacts
130
-
131
- | File | Purpose | Lifecycle |
132
- |------|---------|-----------|
133
- | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
134
- | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
135
- | `wave-{N}-results.csv` | Per-wave output | Created by spawn_agents_on_csv |
136
- | `results.csv` | Final export of all task results | Created in Phase 3 |
137
- | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
138
- | `context.md` | Human-readable execution report | Created in Phase 3 |
139
-
140
- ---
141
-
142
- ## Session Structure
143
-
144
- ```
145
- .workflow/.csv-wave/execute-{phase}-{date}/
146
- +-- tasks.csv
147
- +-- results.csv
148
- +-- discoveries.ndjson
149
- +-- context.md
150
- +-- config.json
151
- +-- wave-{N}.csv (temporary)
152
- +-- wave-{N}-results.csv (temporary)
153
- ```
154
-
155
- ---
156
-
157
- ## Implementation
158
-
159
- ### Session Initialization
160
-
161
- ```javascript
162
- const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
163
-
164
- // Parse flags
165
- const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
166
- const continueMode = $ARGUMENTS.includes('--continue')
167
- const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
168
- const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 5
169
-
170
- // Parse execute-specific flags
171
- const autoCommit = $ARGUMENTS.includes('--auto-commit')
172
- const methodMatch = $ARGUMENTS.match(/--method\s+(agent|cli)/)
173
- const executionMethod = methodMatch ? methodMatch[1] : null
174
- const dirMatch = $ARGUMENTS.match(/--dir\s+(\S+)/)
175
- const scratchDir = dirMatch ? dirMatch[1] : null
176
-
177
- // Clean phase text
178
- const phaseArg = $ARGUMENTS
179
- .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--auto-commit|--method\s+\w+|--dir\s+\S+/g, '')
180
- .trim()
181
-
182
- const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
183
- const sessionId = scratchDir
184
- ? `execute-scratch-${dateStr}`
185
- : `execute-phase${phaseArg}-${dateStr}`
186
- const sessionFolder = `.workflow/.csv-wave/${sessionId}`
187
-
188
- Bash(`mkdir -p ${sessionFolder}`)
189
- ```
190
-
191
- ---
192
-
193
- ### Phase 1: Plan Resolution -> CSV
194
-
195
- **Objective**: Resolve phase, load plan + task definitions, detect resume point, generate tasks.csv.
196
-
197
- **Decomposition Rules**:
198
-
199
- 1. **Plan resolution** (per scratch-milestone-architecture):
200
-
201
- | Input | Resolution |
202
- |-------|------------|
203
- | `--dir <path>` | Use path directly (scratch plan dir) |
204
- | No args | Find all pending plans for current milestone from state.json.artifacts[] |
205
- | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[] |
206
-
207
- For multi-plan: execute sequentially. Each plan is a full CSV session.
208
-
209
- 2. **Load plan** (per PLAN_DIR):
210
- - Read `{PLAN_DIR}/plan.json` for wave structure
211
- - Extract `plan.waves` array with task assignments
212
-
213
- 3. **Detect completed tasks (breakpoint resume)**:
214
- - For each task in plan, read `.task/TASK-{NNN}.json`
215
- - If `status == "completed"`: exclude from CSV
216
- - Log: "Resuming: {completed}/{total} tasks already completed"
217
-
218
- 4. **Build tasks.csv from task definitions**:
219
- - For each pending task in each wave:
220
- - Read `.task/TASK-{NNN}.json`
221
- - Extract: title, description, files (build scope), convergence.criteria, hints, execution_directives
222
- - Set `deps` from task dependency field
223
- - Set `context_from` = same as deps (findings propagate along dependency edges)
224
- - Set `wave` from plan.json wave assignment
225
- - Write `tasks.csv`
226
-
227
- 5. **Load project specs**:
228
- - Read `.workflow/specs/` for coding conventions and architecture constraints
229
- - Pass as context to all executor agents
230
-
231
- 6. **User validation**: Display task/wave breakdown. Skip if AUTO_YES.
232
-
233
- ---
234
-
235
- ### Phase 2: Wave Execution Engine
236
-
237
- **Objective**: Execute tasks wave-by-wave via spawn_agents_on_csv with cross-wave context propagation.
238
-
239
- #### Per-Wave Execution Loop
240
-
241
- For each wave in ascending order:
242
-
243
- 1. Read master `tasks.csv`
244
- 2. Filter rows where `wave == N` AND `status == pending`
245
- 3. If no pending tasks in this wave: skip to next wave
246
- 4. Build `prev_context` for each task from completed predecessor findings:
247
- ```
248
- [TASK-001: Setup auth module] Created src/auth/auth.ts with verifyToken and generateToken...
249
- [TASK-002: Create user model] Created src/models/user.ts with User interface...
250
- ```
251
- 5. Write `wave-{N}.csv` with `prev_context` column added
252
- 6. Execute:
253
-
254
- ```javascript
255
- spawn_agents_on_csv({
256
- csv_path: `${sessionFolder}/wave-${N}.csv`,
257
- id_column: "id",
258
- instruction: buildExecutorInstruction(sessionFolder, phaseDir, autoCommit, specsContent),
259
- max_concurrency: maxConcurrency,
260
- max_runtime_seconds: 900,
261
- output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
262
- output_schema: {
263
- type: "object",
264
- properties: {
265
- id: { type: "string" },
266
- status: { type: "string", enum: ["completed", "failed", "blocked"] },
267
- findings: { type: "string" },
268
- files_modified: { type: "string" },
269
- tests_passed: { type: "string" },
270
- error: { type: "string" }
271
- },
272
- required: ["id", "status", "findings"]
273
- }
274
- })
275
- ```
276
-
277
- 7. Read `wave-{N}-results.csv`, merge into master `tasks.csv`
278
- 8. Delete `wave-{N}.csv`
279
-
280
- #### Blocked Task Handling
281
-
282
- After each wave:
283
- - Count blocked/failed tasks
284
- - If any blocked and NOT AUTO_YES:
285
- ```
286
- AskUserQuestion: "Tasks blocked: {blocked_list}. Continue to next wave or stop?"
287
- Options: [Continue (skip blocked deps), Stop and review]
288
- ```
289
- - If AUTO_YES: auto-continue, skip tasks whose deps are blocked
290
-
291
- #### Cascading Skip
292
-
293
- If a task is blocked/failed and other tasks in later waves depend on it:
294
- - Mark dependent tasks as `skipped` with error: "Dependency {dep_id} blocked/failed"
295
- - Do not attempt execution of skipped tasks
296
-
297
- ---
298
-
299
- ### Phase 3: Results Aggregation
300
-
301
- **Objective**: Update all state files and generate execution report.
302
-
303
- 1. Read final master `tasks.csv`
304
- 2. Export as `results.csv`
305
-
306
- 3. **Update task files**: For each row in results:
307
- - Read `.task/{id}.json`
308
- - Update `status` to match CSV status
309
- - Write back to disk
310
-
311
- 4. **Register EXC artifact in state.json**:
312
- ```
313
- Read .workflow/state.json
314
- plan_artifact = state.json.artifacts.find(a => a.type == "plan" && a.path == PLAN_DIR_relative)
315
- next_id = max EXC-NNN + 1
316
- Push artifact: { id: "EXC-{next_id}", type: "execute", milestone: plan_artifact.milestone,
317
- phase: plan_artifact.phase, scope: plan_artifact.scope, path: plan_artifact.path,
318
- status: "completed", depends_on: plan_artifact.id, harvested: false,
319
- created_at: execution_start, completed_at: now() }
320
- Write state.json (atomic)
321
- ```
322
-
323
- 5. **Extract incremental learnings**:
324
- - Read all `.summaries/` from PLAN_DIR
325
- - Extract strategy adjustments, patterns, pitfalls
326
- - Append to `.workflow/specs/learnings.md`
327
- - Mark artifact `harvested: true` in state.json
328
-
329
- 6. **Generate context.md**:
330
-
331
- ```markdown
332
- # Execution Report -- Phase {phase}
333
-
334
- ## Summary
335
- - Tasks: {completed}/{total} completed
336
- - Blocked: {blocked_count}
337
- - Waves executed: {waves_run}/{waves_total}
338
- - Auto-commit: {yes/no}
339
-
340
- ## Wave Results
341
-
342
- ### Wave {N}
343
- | Task | Status | Files Modified | Tests |
344
- |------|--------|---------------|-------|
345
- | {id}: {title} | {status} | {files} | {tests} |
346
-
347
- ## Blocked Tasks
348
- {if any: task ID, error, checkpoint info}
349
-
350
- ## Discovery Board Summary
351
- {aggregated discovery findings}
352
-
353
- ## Next Steps
354
- - Run verify to validate results
355
- - Run debug for any blocked tasks
356
- ```
357
-
358
- 7. **Auto-sync** (if config.json.codebase.auto_sync_after_execute == true):
359
- - Detect changed files from execution
360
- - Trigger codebase doc update
361
-
362
- 8. **Display completion report**:
363
-
364
- ```
365
- === EXECUTION COMPLETE ===
366
- Phase: {phase_name}
367
- Completed: {completed_count}/{total_count} tasks
368
- Blocked: {blocked_count} tasks
369
- Waves: {waves_executed}/{total_waves}
370
-
371
- Summaries: {PLAN_DIR}/.summaries/
372
- Tasks: {PLAN_DIR}/.task/
373
-
374
- Next steps:
375
- Skill({ skill: "maestro-verify" })
376
- Skill({ skill: "maestro-verify", args: "--dir {PLAN_DIR}" })
377
- Skill({ skill: "manage-status" })
378
- ```
379
-
380
- ---
381
-
382
- ## Shared Discovery Board Protocol
383
-
384
- ### Standard Discovery Types
385
-
386
- | Type | Dedup Key | Data Schema | Description |
387
- |------|-----------|-------------|-------------|
388
- | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found during implementation |
389
- | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point discovered |
390
- | `convention` | singleton | `{naming, imports, formatting}` | Project coding conventions observed |
391
- | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue encountered |
392
- | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack detail confirmed |
393
- | `test_command` | `data.command` | `{command, scope, result}` | Working test command discovered |
394
-
395
- ### Protocol
396
-
397
- 1. **Read** `{session_folder}/discoveries.ndjson` before starting task implementation
398
- 2. **Skip covered**: If discovery of same type + dedup key exists, skip
399
- 3. **Write immediately**: Append findings as discovered
400
- 4. **Append-only**: Never modify or delete existing entries
401
- 5. **Deduplicate**: Check before writing
402
-
403
- ```bash
404
- echo '{"ts":"<ISO>","worker":"TASK-001","type":"code_pattern","data":{"name":"Result type","file":"src/types/result.ts","description":"All functions return Result<T,E> for error handling"}}' >> {session_folder}/discoveries.ndjson
405
- ```
406
-
407
- ---
408
-
409
- ## Error Handling
410
-
411
- | Error | Resolution |
412
- |-------|------------|
413
- | Phase directory not found | Abort with error: "Phase {N} not found" |
414
- | plan.json not found | Abort with error: "No plan found -- run plan first" |
415
- | No pending tasks (all completed) | Abort with info: "All tasks already completed" |
416
- | Task file (.task/TASK-*.json) missing | Skip task, log error, mark as failed |
417
- | Agent spawn fails | Retry once, then mark task as blocked with checkpoint |
418
- | Convergence criteria not met after 3 attempts | Mark task as blocked, write checkpoint |
419
- | Git commit fails (--auto-commit) | Log warning, continue (task still marked completed) |
420
- | All tasks in wave blocked | Stop execution, report blocked wave |
421
- | CSV parse error | Validate format, show line number |
422
- | discoveries.ndjson corrupt | Ignore malformed lines, continue |
423
- | Continue mode: no session found | List available sessions |
424
-
425
- ---
426
-
427
- ## Core Rules
428
-
429
- 1. **Start Immediately**: First action is session initialization, then Phase 1
430
- 2. **Wave Order is Sacred**: Never execute wave N+1 before wave N completes and results are merged
431
- 3. **CSV is Source of Truth**: Master tasks.csv holds all execution state
432
- 4. **Context Propagation**: prev_context built from master CSV findings, not from memory
433
- 5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
434
- 6. **Cascading Skip on Failure**: If a task fails/blocks, all dependent tasks are skipped
435
- 7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
436
- 8. **Max 3 Fix Attempts**: Per task, auto-fix convergence failures up to 3 times, then mark blocked
437
- 9. **Breakpoint Resume**: Always detect completed tasks and skip them on re-run
438
- 10. **DO NOT STOP**: Continuous execution until all waves complete or user explicitly stops
1
+ ---
2
+ name: maestro-execute
3
+ description: Wave-based parallel task execution via CSV wave pipeline. Reads plan.json to build CSV with pre-computed waves, executes tasks in parallel per wave with cross-wave context propagation. Core execution engine replacing maestro-execute command.
4
+ argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--auto-commit] [--method agent|cli] [--dir <path>]\""
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based parallel task execution using `spawn_agents_on_csv`. Reads plan.json to build a CSV where waves are pre-computed from the plan. Each wave runs tasks in parallel, with cross-wave context propagation via `prev_context`. This is the core execution engine of the maestro pipeline.
10
+
11
+ **Core workflow**: Load Plan -> Build CSV from Tasks -> Wave-by-Wave Parallel Execution -> Aggregate Results
12
+
13
+ **Topology**: Custom (waves inherited from plan.json -- no Kahn's algorithm needed)
14
+
15
+ ```
16
+ +---------------------------------------------------------------------------+
17
+ | TASK EXECUTION CSV WAVE WORKFLOW |
18
+ +---------------------------------------------------------------------------+
19
+ | |
20
+ | Phase 1: Plan Resolution -> CSV |
21
+ | +-- Resolve phase directory (or --dir path) |
22
+ | +-- Read plan.json + .task/TASK-*.json definitions |
23
+ | +-- Detect completed tasks (breakpoint resume) |
24
+ | +-- Build tasks.csv with one row per pending task |
25
+ | +-- Waves inherited from plan.json (pre-computed) |
26
+ | +-- Load project specs for executor context |
27
+ | +-- User validates task breakdown (skip if -y) |
28
+ | |
29
+ | Phase 2: Wave Execution Engine |
30
+ | +-- For each wave (sequential): |
31
+ | | +-- Wave N: Task Execution (parallel within wave) |
32
+ | | | +-- Each agent implements one task |
33
+ | | | +-- Agent reads task definition + convergence criteria |
34
+ | | | +-- Agent creates/modifies files per task.files |
35
+ | | | +-- Agent verifies convergence.criteria (max 3 fix attempts) |
36
+ | | | +-- Agent writes .summaries/TASK-{NNN}-summary.md |
37
+ | | | +-- Atomic commit if --auto-commit |
38
+ | | | +-- Discoveries shared via board (patterns, blockers) |
39
+ | | +-- Merge wave results into master tasks.csv |
40
+ | | +-- Build prev_context for next wave from completed findings |
41
+ | | +-- If blocked tasks: prompt user (skip if -y: auto-continue) |
42
+ | +-- discoveries.ndjson shared across all waves (append-only) |
43
+ | |
44
+ | Phase 3: Results Aggregation |
45
+ | +-- Export results.csv |
46
+ | +-- Update .task/TASK-*.json statuses |
47
+ | +-- Update index.json execution progress |
48
+ | +-- Update state.json project progress |
49
+ | +-- Generate context.md with execution report |
50
+ | +-- Auto-sync codebase docs (if configured) |
51
+ | +-- Display summary with next steps |
52
+ | |
53
+ +---------------------------------------------------------------------------+
54
+ ```
55
+ </purpose>
56
+
57
+ <context>
58
+ ```bash
59
+ $maestro-execute "3"
60
+ $maestro-execute -c 4 "3 --auto-commit"
61
+ $maestro-execute -y "3 --method cli"
62
+ $maestro-execute "3 --dir .workflow/scratch/quick-fix"
63
+ $maestro-execute --continue "execute-phase3-20260318"
64
+ ```
65
+
66
+ **Flags**:
67
+ - `-y, --yes`: Skip all confirmations (auto mode)
68
+ - `-c, --concurrency N`: Max concurrent agents within each wave (default: 5)
69
+ - `--continue`: Resume existing session
70
+
71
+ **Inner flags** (passed inside quotes):
72
+ - `--auto-commit`: Atomic git commit after each task completion
73
+ - `--method agent|cli`: Override execution method (default: from config.json)
74
+ - `--dir <path>`: Use arbitrary directory instead of phase resolution (scratch mode)
75
+
76
+ When `--yes` or `-y`: Auto-confirm task breakdown, skip blocked-task prompts, auto-continue through all waves.
77
+
78
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
79
+ **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
80
+ </context>
81
+
82
+ <csv_schema>
83
+
84
+ ### tasks.csv (Master State)
85
+
86
+ ```csv
87
+ id,title,description,scope,convergence_criteria,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,error
88
+ "TASK-001","Setup auth module","Create authentication module with JWT token generation and verification. Export verifyToken and generateToken functions.","src/auth/","auth.ts contains export function verifyToken(; auth.ts contains export function generateToken(","Reference existing middleware pattern in src/middleware/auth.ts","npm test -- --grep auth","","","1","","","","",""
89
+ "TASK-002","Create user model","Define User interface and database schema with email, passwordHash, role fields. Use existing Result type pattern.","src/models/","user.ts contains export interface User; user.ts contains email: string","See src/models/session.ts for existing model pattern","npm test -- --grep user","","","1","","","","",""
90
+ "TASK-003","Auth middleware","Create Express middleware that validates JWT from Authorization header. Use verifyToken from auth module. Return 401 on invalid token.","src/middleware/","auth-middleware.ts contains export function authMiddleware(; auth-middleware.ts contains verifyToken","Follows existing middleware pattern in src/middleware/logging.ts","npm test -- --grep middleware","TASK-001","TASK-001","2","","","","",""
91
+ "TASK-004","Login endpoint","Implement POST /api/login endpoint. Validate credentials against user model, return JWT on success. Use generateToken from auth module.","src/routes/","login.ts contains router.post('/api/login'; login.ts contains generateToken(","Wire into existing Express app in src/app.ts","curl -X POST localhost:3000/api/login","TASK-001;TASK-002","TASK-001;TASK-002","2","","","","",""
92
+ "TASK-005","Integration tests","Write integration tests for full auth flow: register, login, access protected route, token refresh.","tests/","tests/auth.test.ts exists; npm test exits with code 0","Use existing test setup in tests/setup.ts","npm test","TASK-003;TASK-004","TASK-003;TASK-004","3","","","","",""
93
+ ```
94
+
95
+ **Columns**:
96
+
97
+ | Column | Phase | Description |
98
+ |--------|-------|-------------|
99
+ | `id` | Input | Task ID (TASK-NNN format, from plan.json) |
100
+ | `title` | Input | Short task title from task definition |
101
+ | `description` | Input | Full task description from TASK-*.json |
102
+ | `scope` | Input | Target file/directory glob from task.files |
103
+ | `convergence_criteria` | Input | Grep-verifiable completion criteria (semicolon-separated) |
104
+ | `hints` | Input | Implementation hints + reference files from task definition |
105
+ | `execution_directives` | Input | Verification commands to run after implementation |
106
+ | `deps` | Input | Semicolon-separated dependency task IDs |
107
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
108
+ | `wave` | Computed | Wave number from plan.json wave assignment |
109
+ | `status` | Output | `pending` -> `completed` / `failed` / `blocked` / `skipped` |
110
+ | `findings` | Output | Implementation notes and observations (max 500 chars) |
111
+ | `files_modified` | Output | Semicolon-separated list of created/modified files |
112
+ | `tests_passed` | Output | Test pass/fail status from execution_directives |
113
+ | `error` | Output | Error message if failed or blocked |
114
+
115
+ ### Per-Wave CSV (Temporary)
116
+
117
+ Each wave generates `wave-{N}.csv` with extra `prev_context` column populated from predecessor task findings.
118
+
119
+ ### Output Artifacts
120
+
121
+ | File | Purpose | Lifecycle |
122
+ |------|---------|-----------|
123
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
124
+ | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
125
+ | `wave-{N}-results.csv` | Per-wave output | Created by spawn_agents_on_csv |
126
+ | `results.csv` | Final export of all task results | Created in Phase 3 |
127
+ | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
128
+ | `context.md` | Human-readable execution report | Created in Phase 3 |
129
+
130
+ ### Session Structure
131
+
132
+ ```
133
+ .workflow/.csv-wave/execute-{phase}-{date}/
134
+ +-- tasks.csv
135
+ +-- results.csv
136
+ +-- discoveries.ndjson
137
+ +-- context.md
138
+ +-- config.json
139
+ +-- wave-{N}.csv (temporary)
140
+ +-- wave-{N}-results.csv (temporary)
141
+ ```
142
+ </csv_schema>
143
+
144
+ <invariants>
145
+ 1. **Start Immediately**: First action is session initialization, then Phase 1
146
+ 2. **Wave Order is Sacred**: Never execute wave N+1 before wave N completes and results are merged
147
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all execution state
148
+ 4. **Context Propagation**: prev_context built from master CSV findings, not from memory
149
+ 5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
150
+ 6. **Cascading Skip on Failure**: If a task fails/blocks, all dependent tasks are skipped
151
+ 7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
152
+ 8. **Max 3 Fix Attempts**: Per task, auto-fix convergence failures up to 3 times, then mark blocked
153
+ 9. **Breakpoint Resume**: Always detect completed tasks and skip them on re-run
154
+ 10. **DO NOT STOP**: Continuous execution until all waves complete or user explicitly stops
155
+ </invariants>
156
+
157
+ <execution>
158
+
159
+ ### Session Initialization
160
+
161
+ ```javascript
162
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
163
+
164
+ // Parse flags
165
+ const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
166
+ const continueMode = $ARGUMENTS.includes('--continue')
167
+ const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
168
+ const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 5
169
+
170
+ // Parse execute-specific flags
171
+ const autoCommit = $ARGUMENTS.includes('--auto-commit')
172
+ const methodMatch = $ARGUMENTS.match(/--method\s+(agent|cli)/)
173
+ const executionMethod = methodMatch ? methodMatch[1] : null
174
+ const dirMatch = $ARGUMENTS.match(/--dir\s+(\S+)/)
175
+ const scratchDir = dirMatch ? dirMatch[1] : null
176
+
177
+ // Clean phase text
178
+ const phaseArg = $ARGUMENTS
179
+ .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--auto-commit|--method\s+\w+|--dir\s+\S+/g, '')
180
+ .trim()
181
+
182
+ const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
183
+ const sessionId = scratchDir
184
+ ? `execute-scratch-${dateStr}`
185
+ : `execute-phase${phaseArg}-${dateStr}`
186
+ const sessionFolder = `.workflow/.csv-wave/${sessionId}`
187
+
188
+ Bash(`mkdir -p ${sessionFolder}`)
189
+ ```
190
+
191
+ ### Phase 1: Plan Resolution -> CSV
192
+
193
+ **Objective**: Resolve phase, load plan + task definitions, detect resume point, generate tasks.csv.
194
+
195
+ **Decomposition Rules**:
196
+
197
+ 1. **Plan resolution** (per scratch-milestone-architecture):
198
+
199
+ | Input | Resolution |
200
+ |-------|------------|
201
+ | `--dir <path>` | Use path directly (scratch plan dir) |
202
+ | No args | Find all pending plans for current milestone from state.json.artifacts[] |
203
+ | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[] |
204
+
205
+ For multi-plan: execute sequentially. Each plan is a full CSV session.
206
+
207
+ 2. **Load plan** (per PLAN_DIR):
208
+ - Read `{PLAN_DIR}/plan.json` for wave structure
209
+ - Extract `plan.waves` array with task assignments
210
+
211
+ 3. **Detect completed tasks (breakpoint resume)**:
212
+ - For each task in plan, read `.task/TASK-{NNN}.json`
213
+ - If `status == "completed"`: exclude from CSV
214
+ - Log: "Resuming: {completed}/{total} tasks already completed"
215
+
216
+ 4. **Build tasks.csv from task definitions**:
217
+ - For each pending task in each wave:
218
+ - Read `.task/TASK-{NNN}.json`
219
+ - Extract: title, description, files (build scope), convergence.criteria, hints, execution_directives
220
+ - Set `deps` from task dependency field
221
+ - Set `context_from` = same as deps (findings propagate along dependency edges)
222
+ - Set `wave` from plan.json wave assignment
223
+ - Write `tasks.csv`
224
+
225
+ 5. **Load project specs**:
226
+ - Read `.workflow/specs/` for coding conventions and architecture constraints
227
+ - Pass as context to all executor agents
228
+
229
+ 6. **User validation**: Display task/wave breakdown. Skip if AUTO_YES.
230
+
231
+ ### Phase 2: Wave Execution Engine
232
+
233
+ **Objective**: Execute tasks wave-by-wave via spawn_agents_on_csv with cross-wave context propagation.
234
+
235
+ #### Per-Wave Execution Loop
236
+
237
+ For each wave in ascending order:
238
+
239
+ 1. Read master `tasks.csv`
240
+ 2. Filter rows where `wave == N` AND `status == pending`
241
+ 3. If no pending tasks in this wave: skip to next wave
242
+ 4. Build `prev_context` for each task from completed predecessor findings:
243
+ ```
244
+ [TASK-001: Setup auth module] Created src/auth/auth.ts with verifyToken and generateToken...
245
+ [TASK-002: Create user model] Created src/models/user.ts with User interface...
246
+ ```
247
+ 5. Write `wave-{N}.csv` with `prev_context` column added
248
+ 6. Execute:
249
+
250
+ ```javascript
251
+ spawn_agents_on_csv({
252
+ csv_path: `${sessionFolder}/wave-${N}.csv`,
253
+ id_column: "id",
254
+ instruction: buildExecutorInstruction(sessionFolder, phaseDir, autoCommit, specsContent),
255
+ max_concurrency: maxConcurrency,
256
+ max_runtime_seconds: 900,
257
+ output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
258
+ output_schema: {
259
+ type: "object",
260
+ properties: {
261
+ id: { type: "string" },
262
+ status: { type: "string", enum: ["completed", "failed", "blocked"] },
263
+ findings: { type: "string" },
264
+ files_modified: { type: "string" },
265
+ tests_passed: { type: "string" },
266
+ error: { type: "string" }
267
+ },
268
+ required: ["id", "status", "findings"]
269
+ }
270
+ })
271
+ ```
272
+
273
+ 7. Read `wave-{N}-results.csv`, merge into master `tasks.csv`
274
+ 8. Delete `wave-{N}.csv`
275
+
276
+ #### Blocked Task Handling
277
+
278
+ After each wave:
279
+ - Count blocked/failed tasks
280
+ - If any blocked and NOT AUTO_YES:
281
+ ```
282
+ AskUserQuestion: "Tasks blocked: {blocked_list}. Continue to next wave or stop?"
283
+ Options: [Continue (skip blocked deps), Stop and review]
284
+ ```
285
+ - If AUTO_YES: auto-continue, skip tasks whose deps are blocked
286
+
287
+ #### Cascading Skip
288
+
289
+ If a task is blocked/failed and other tasks in later waves depend on it:
290
+ - Mark dependent tasks as `skipped` with error: "Dependency {dep_id} blocked/failed"
291
+ - Do not attempt execution of skipped tasks
292
+
293
+ ### Phase 3: Results Aggregation
294
+
295
+ **Objective**: Update all state files and generate execution report.
296
+
297
+ 1. Read final master `tasks.csv`
298
+ 2. Export as `results.csv`
299
+
300
+ 3. **Update task files**: For each row in results:
301
+ - Read `.task/{id}.json`
302
+ - Update `status` to match CSV status
303
+ - Write back to disk
304
+
305
+ 3b. **Issue status sync**: For each completed/failed task that has `issue_id`:
306
+ - Read issue from `.workflow/issues/issues.jsonl` by `issue_id`
307
+ - Collect all `task_refs[]` statuses for that issue:
308
+ - All task_refs completed -> `issue.status = "resolved"`
309
+ - Any task_ref failed -> `issue.status = "in_progress"`
310
+ - Append history entry: `{ action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }`
311
+ - Write updated issue back to `issues.jsonl`
312
+
313
+ 4. **Register EXC artifact in state.json**:
314
+ ```
315
+ Read .workflow/state.json
316
+ plan_artifact = state.json.artifacts.find(a => a.type == "plan" && a.path == PLAN_DIR_relative)
317
+ next_id = max EXC-NNN + 1
318
+ Push artifact: { id: "EXC-{next_id}", type: "execute", milestone: plan_artifact.milestone,
319
+ phase: plan_artifact.phase, scope: plan_artifact.scope, path: plan_artifact.path,
320
+ status: "completed", depends_on: plan_artifact.id, harvested: false,
321
+ created_at: execution_start, completed_at: now() }
322
+ Write state.json (atomic)
323
+ ```
324
+
325
+ 5. **Extract incremental learnings**:
326
+ - Read all `.summaries/` from PLAN_DIR
327
+ - Extract strategy adjustments, patterns, pitfalls
328
+ - Append to `.workflow/specs/learnings.md`
329
+ - Mark artifact `harvested: true` in state.json
330
+
331
+ 6. **Generate context.md**:
332
+
333
+ ```markdown
334
+ # Execution Report -- Phase {phase}
335
+
336
+ ## Summary
337
+ - Tasks: {completed}/{total} completed
338
+ - Blocked: {blocked_count}
339
+ - Waves executed: {waves_run}/{waves_total}
340
+ - Auto-commit: {yes/no}
341
+
342
+ ## Wave Results
343
+
344
+ ### Wave {N}
345
+ | Task | Status | Files Modified | Tests |
346
+ |------|--------|---------------|-------|
347
+ | {id}: {title} | {status} | {files} | {tests} |
348
+
349
+ ## Blocked Tasks
350
+ {if any: task ID, error, checkpoint info}
351
+
352
+ ## Discovery Board Summary
353
+ {aggregated discovery findings}
354
+
355
+ ## Next Steps
356
+ - Run verify to validate results
357
+ - Run debug for any blocked tasks
358
+ ```
359
+
360
+ 7. **Auto-sync** (if config.json.codebase.auto_sync_after_execute == true):
361
+ - Detect changed files from execution
362
+ - Trigger codebase doc update
363
+
364
+ 8. **Display completion report**:
365
+
366
+ ```
367
+ === EXECUTION COMPLETE ===
368
+ Phase: {phase_name}
369
+ Completed: {completed_count}/{total_count} tasks
370
+ Blocked: {blocked_count} tasks
371
+ Waves: {waves_executed}/{total_waves}
372
+
373
+ Summaries: {PLAN_DIR}/.summaries/
374
+ Tasks: {PLAN_DIR}/.task/
375
+
376
+ Next steps:
377
+ Skill({ skill: "maestro-verify" })
378
+ Skill({ skill: "maestro-verify", args: "--dir {PLAN_DIR}" })
379
+ Skill({ skill: "manage-status" })
380
+ ```
381
+
382
+ ### Shared Discovery Board Protocol
383
+
384
+ #### Standard Discovery Types
385
+
386
+ | Type | Dedup Key | Data Schema | Description |
387
+ |------|-----------|-------------|-------------|
388
+ | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found during implementation |
389
+ | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point discovered |
390
+ | `convention` | singleton | `{naming, imports, formatting}` | Project coding conventions observed |
391
+ | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue encountered |
392
+ | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack detail confirmed |
393
+ | `test_command` | `data.command` | `{command, scope, result}` | Working test command discovered |
394
+
395
+ #### Protocol
396
+
397
+ 1. **Read** `{session_folder}/discoveries.ndjson` before starting task implementation
398
+ 2. **Skip covered**: If discovery of same type + dedup key exists, skip
399
+ 3. **Write immediately**: Append findings as discovered
400
+ 4. **Append-only**: Never modify or delete existing entries
401
+ 5. **Deduplicate**: Check before writing
402
+
403
+ ```bash
404
+ echo '{"ts":"<ISO>","worker":"TASK-001","type":"code_pattern","data":{"name":"Result type","file":"src/types/result.ts","description":"All functions return Result<T,E> for error handling"}}' >> {session_folder}/discoveries.ndjson
405
+ ```
406
+ </execution>
407
+
408
+ <error_codes>
409
+
410
+ | Error | Resolution |
411
+ |-------|------------|
412
+ | Phase directory not found | Abort with error: "Phase {N} not found" |
413
+ | plan.json not found | Abort with error: "No plan found -- run plan first" |
414
+ | No pending tasks (all completed) | Abort with info: "All tasks already completed" |
415
+ | Task file (.task/TASK-*.json) missing | Skip task, log error, mark as failed |
416
+ | Agent spawn fails | Retry once, then mark task as blocked with checkpoint |
417
+ | Convergence criteria not met after 3 attempts | Mark task as blocked, write checkpoint |
418
+ | Git commit fails (--auto-commit) | Log warning, continue (task still marked completed) |
419
+ | All tasks in wave blocked | Stop execution, report blocked wave |
420
+ | CSV parse error | Validate format, show line number |
421
+ | discoveries.ndjson corrupt | Ignore malformed lines, continue |
422
+ | Continue mode: no session found | List available sessions |
423
+ </error_codes>
424
+
425
+ <success_criteria>
426
+ - [ ] Session folder created with valid tasks.csv
427
+ - [ ] All waves executed in order with cross-wave context propagation
428
+ - [ ] Completed tasks have .summaries/TASK-{NNN}-summary.md
429
+ - [ ] .task/TASK-*.json statuses updated to match execution results
430
+ - [ ] state.json updated with EXC artifact
431
+ - [ ] context.md produced with execution report
432
+ - [ ] Blocked tasks have checkpoint info for resume
433
+ - [ ] Cascading skip applied for dependent tasks
434
+ - [ ] discoveries.ndjson append-only throughout
435
+ </success_criteria>