maestro-flow 0.3.38 → 0.3.40

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 (187) 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 +130 -126
  16. package/.claude/commands/maestro-brainstorm.md +104 -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 +154 -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 +48 -12
  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 +5 -1
  47. package/.claude/commands/quality-debug.md +125 -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 +107 -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 +11 -3
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +451 -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 +29 -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 +693 -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 +553 -547
  96. package/.codex/skills/quality-debug/SKILL.md +345 -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 +507 -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/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  130. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  131. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +6 -0
  132. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  133. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  134. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
  135. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
  136. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  137. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  138. package/dashboard/dist-server/src/commands/delegate.js +18 -0
  139. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  140. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
  141. package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
  142. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  143. package/dist/shared/agent-types.d.ts +2 -0
  144. package/dist/shared/agent-types.d.ts.map +1 -1
  145. package/dist/src/agents/cli-agent-runner.d.ts +2 -0
  146. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  147. package/dist/src/agents/cli-agent-runner.js +4 -0
  148. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  149. package/dist/src/commands/config.d.ts.map +1 -1
  150. package/dist/src/commands/config.js +29 -1
  151. package/dist/src/commands/config.js.map +1 -1
  152. package/dist/src/commands/delegate.d.ts +2 -0
  153. package/dist/src/commands/delegate.d.ts.map +1 -1
  154. package/dist/src/commands/delegate.js +18 -0
  155. package/dist/src/commands/delegate.js.map +1 -1
  156. package/dist/src/commands/launcher.d.ts.map +1 -1
  157. package/dist/src/commands/launcher.js +27 -4
  158. package/dist/src/commands/launcher.js.map +1 -1
  159. package/dist/src/config/cli-tools-config.d.ts +6 -0
  160. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  161. package/dist/src/config/cli-tools-config.js +2 -0
  162. package/dist/src/config/cli-tools-config.js.map +1 -1
  163. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  164. package/dist/src/core/overlay/applier.js +65 -5
  165. package/dist/src/core/overlay/applier.js.map +1 -1
  166. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  167. package/dist/src/core/overlay/loader.js +9 -4
  168. package/dist/src/core/overlay/loader.js.map +1 -1
  169. package/dist/src/core/overlay/types.d.ts +2 -0
  170. package/dist/src/core/overlay/types.d.ts.map +1 -1
  171. package/dist/src/core/overlay/types.js +2 -0
  172. package/dist/src/core/overlay/types.js.map +1 -1
  173. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  174. package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
  175. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  176. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  177. package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
  178. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  179. package/package.json +1 -1
  180. package/shared/agent-types.ts +2 -0
  181. package/workflows/analyze.md +24 -2
  182. package/workflows/auto-test.md +12 -0
  183. package/workflows/brainstorm.md +11 -1
  184. package/workflows/debug.md +13 -4
  185. package/workflows/delegate-protocol.codex.md +65 -0
  186. package/workflows/plan.md +14 -4
  187. package/workflows/test.md +10 -0
@@ -1,318 +1,346 @@
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 "20260318-execute-P3-phase3"
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/{YYYYMMDD}-execute-P{N}-{slug}/
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
- ```
162
- Parse from $ARGUMENTS:
163
- AUTO_YES ← --yes | -y
164
- continueMode ← --continue
165
- maxConcurrency ← --concurrency | -c N (default: 5)
166
- autoCommit ← --auto-commit
167
- executionMethod ← --method agent|cli (default: from config.json)
168
- scratchDir ← --dir <path> (default: null)
169
- phaseArg remaining text after flag removal
170
-
171
- Derive:
172
- dateStr ← UTC+8 YYYYMMDD
173
- sessionId scratchDir ? "{dateStr}-execute-scratch" : "{dateStr}-execute-P{phaseArg}-{phaseSlug}"
174
- sessionFolder ← ".workflow/.csv-wave/{sessionId}"
175
-
176
- mkdir -p {sessionFolder}
177
- ```
178
-
179
- ### Phase 1: Plan Resolution -> CSV
180
-
181
- **Objective**: Resolve phase, load plan + task definitions, detect resume point, generate tasks.csv.
182
-
183
- **Decomposition Rules**:
184
-
185
- 1. **Plan resolution** (per scratch-milestone-architecture):
186
-
187
- | Input | Resolution |
188
- |-------|------------|
189
- | `--dir <path>` | Use path directly (scratch plan dir) |
190
- | No args | Find all pending plans for current milestone from state.json.artifacts[] |
191
- | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[] |
192
-
193
- For multi-plan: execute sequentially. Each plan is a full CSV session.
194
-
195
- 2. **Load plan**: Read `{PLAN_DIR}/plan.json` for wave structure and task assignments
196
-
197
- 3. **Detect completed tasks (breakpoint resume)**: Read `.task/TASK-{NNN}.json` for each task; exclude completed ones from CSV. Log resume count.
198
-
199
- 4. **Build tasks.csv**: For each pending task per wave, read `.task/TASK-{NNN}.json` and extract: title, description, scope (from files), convergence.criteria, hints, execution_directives. Set `deps` from task dependency, `context_from` = deps, `wave` from plan.json.
200
-
201
- 5. **Load project specs**: Read `.workflow/specs/` for coding conventions and architecture constraints (passed to all agents)
202
-
203
- 6. **User validation**: Display task/wave breakdown. Skip if AUTO_YES.
204
-
205
- ### Phase 2: Wave Execution Engine
206
-
207
- **Objective**: Execute tasks wave-by-wave via spawn_agents_on_csv with cross-wave context propagation.
208
-
209
- #### Per-Wave Execution Loop
210
-
211
- For each wave N in ascending order:
212
-
213
- 1. Extract wave N pending rows from master `tasks.csv` (skip wave if none)
214
- 2. Build `prev_context` per task from completed predecessor findings
215
- 3. Write `wave-{N}.csv` with `prev_context` column, then execute:
216
-
217
- ```javascript
218
- spawn_agents_on_csv({
219
- csv_path: `${sessionFolder}/wave-${N}.csv`,
220
- id_column: "id",
221
- instruction: buildExecutorInstruction(sessionFolder, phaseDir, autoCommit, specsContent),
222
- max_concurrency: maxConcurrency, max_runtime_seconds: 3600,
223
- output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
224
- output_schema: { id, status: [completed|failed|blocked], findings, files_modified, tests_passed, error }
225
- })
226
- ```
227
-
228
- 4. Merge results into master `tasks.csv`, delete `wave-{N}.csv`
229
-
230
- #### Blocked Task Handling
231
-
232
- After each wave: if blocked tasks exist, prompt user to continue or stop (AUTO_YES: auto-continue). Skip tasks whose deps are blocked/failed.
233
-
234
- #### Cascading Skip
235
-
236
- Blocked/failed tasks cascade: mark all downstream dependents as `skipped` with error "Dependency {dep_id} blocked/failed".
237
-
238
- ### Phase 3: Results Aggregation
239
-
240
- **Objective**: Update all state files and generate execution report.
241
-
242
- 1. Export final `tasks.csv` as `results.csv`
243
-
244
- 2. **Update task files**: Write each task's status from CSV back to `.task/{id}.json`
245
-
246
- 3. **Issue status sync**: For tasks with `issue_id`, update `.workflow/issues/issues.jsonl`:
247
- - All task_refs completed -> `issue.status = "resolved"`; any failed -> `"in_progress"`
248
- - Append history entry: `{ action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }`
249
-
250
- 4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`
251
-
252
- 5. **Extract incremental specs**: Read `.summaries/`, use `maestro spec add` CLI:
253
- - Learnings/pitfalls → `maestro spec add learning "<title>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
254
- - Design rationale `maestro spec add coding "<title>" "<content>" --keywords ...`
255
- - Root cause/workaround → `maestro spec add debug "<title>" "<content>" --keywords ...`
256
- Mark artifact `harvested: true`
257
-
258
- 6. **Post-task Knowledge Inquiry**: Prompt user to capture knowledge when:
259
- - Execution deviation detected (plan change) -> `/spec-add arch`
260
- - Retry success (>=2 retries) -> `/spec-add debug`
261
- - Implicit design rationale found -> `/spec-add learning`
262
-
263
- 7. **Generate context.md**: Execution report with summary (tasks/blocked/waves/auto-commit), per-wave result table (task, status, files, tests), blocked tasks, discovery board summary, next steps.
264
-
265
- 8. **Auto-sync** (if config.json.codebase.auto_sync_after_execute == true): detect changed files, trigger codebase doc update.
266
-
267
- 9. **Display completion report**: Phase, completed/blocked counts, wave progress, paths to `.summaries/` and `.task/`, next step suggestions (`maestro-verify`, `manage-status`).
268
-
269
- ### Shared Discovery Board Protocol
270
-
271
- #### Standard Discovery Types
272
-
273
- | Type | Dedup Key | Data Schema | Description |
274
- |------|-----------|-------------|-------------|
275
- | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found during implementation |
276
- | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point discovered |
277
- | `convention` | singleton | `{naming, imports, formatting}` | Project coding conventions observed |
278
- | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue encountered |
279
- | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack detail confirmed |
280
- | `test_command` | `data.command` | `{command, scope, result}` | Working test command discovered |
281
-
282
- #### Protocol
283
-
284
- Read `discoveries.ndjson` before implementation. Append-only: dedup by type+key before writing, never modify/delete.
285
-
286
- ```bash
287
- 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
288
- ```
289
- </execution>
290
-
291
- <error_codes>
292
-
293
- | Error | Resolution |
294
- |-------|------------|
295
- | Phase directory not found | Abort with error: "Phase {N} not found" |
296
- | plan.json not found | Abort with error: "No plan found -- run plan first" |
297
- | No pending tasks (all completed) | Abort with info: "All tasks already completed" |
298
- | Task file (.task/TASK-*.json) missing | Skip task, log error, mark as failed |
299
- | Agent spawn fails | Retry once, then mark task as blocked with checkpoint |
300
- | Convergence criteria not met after 3 attempts | Mark task as blocked, write checkpoint |
301
- | Git commit fails (--auto-commit) | Log warning, continue (task still marked completed) |
302
- | All tasks in wave blocked | Stop execution, report blocked wave |
303
- | CSV parse error | Validate format, show line number |
304
- | discoveries.ndjson corrupt | Ignore malformed lines, continue |
305
- | Continue mode: no session found | List available sessions |
306
- </error_codes>
307
-
308
- <success_criteria>
309
- - [ ] Session folder created with valid tasks.csv
310
- - [ ] All waves executed in order with cross-wave context propagation
311
- - [ ] Completed tasks have .summaries/TASK-{NNN}-summary.md
312
- - [ ] .task/TASK-*.json statuses updated to match execution results
313
- - [ ] state.json updated with EXC artifact
314
- - [ ] context.md produced with execution report
315
- - [ ] Blocked tasks have checkpoint info for resume
316
- - [ ] Cascading skip applied for dependent tasks
317
- - [ ] discoveries.ndjson append-only throughout
318
- </success_criteria>
1
+ ---
2
+ name: maestro-execute
3
+ description: Execute plan with parallel waves and atomic commits
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, request_user_input
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
+
56
+ </purpose>
57
+
58
+ <context>
59
+ ```bash
60
+ $maestro-execute "3"
61
+ $maestro-execute -c 4 "3 --auto-commit"
62
+ $maestro-execute -y "3 --method cli"
63
+ $maestro-execute "3 --dir .workflow/scratch/quick-fix"
64
+ $maestro-execute --continue "20260318-execute-P3-phase3"
65
+ ```
66
+
67
+ **Flags**:
68
+ - `-y, --yes`: Skip all confirmations (auto mode)
69
+ - `-c, --concurrency N`: Max concurrent agents within each wave (default: 5)
70
+ - `--continue`: Resume existing session
71
+
72
+ **Inner flags** (passed inside quotes):
73
+ - `--auto-commit`: Atomic git commit after each task completion
74
+ - `--method agent|cli`: Override execution method (default: from config.json)
75
+ - `--dir <path>`: Use arbitrary directory instead of phase resolution (scratch mode)
76
+
77
+ When `--yes` or `-y`: Auto-confirm task breakdown, skip blocked-task prompts, auto-continue through all waves.
78
+
79
+ **Output Directory**: `.workflow/.csv-wave/{session-id}/`
80
+ **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
81
+ </context>
82
+
83
+ <csv_schema>
84
+
85
+ ### tasks.csv (Master State)
86
+
87
+ ```csv
88
+ id,title,description,scope,convergence_criteria,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,error
89
+ "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","","","","",""
90
+ "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","","","","",""
91
+ "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","","","","",""
92
+ "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","","","","",""
93
+ "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","","","","",""
94
+ ```
95
+
96
+ **Columns**:
97
+
98
+ | Column | Phase | Description |
99
+ |--------|-------|-------------|
100
+ | `id` | Input | Task ID (TASK-NNN format, from plan.json) |
101
+ | `title` | Input | Short task title from task definition |
102
+ | `description` | Input | Full task description from TASK-*.json |
103
+ | `scope` | Input | Target file/directory glob from task.files |
104
+ | `convergence_criteria` | Input | Grep-verifiable completion criteria (semicolon-separated) |
105
+ | `hints` | Input | Implementation hints + reference files from task definition |
106
+ | `execution_directives` | Input | Verification commands to run after implementation |
107
+ | `deps` | Input | Semicolon-separated dependency task IDs |
108
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
109
+ | `wave` | Computed | Wave number from plan.json wave assignment |
110
+ | `status` | Output | `pending` -> `completed` / `failed` / `blocked` / `skipped` |
111
+ | `findings` | Output | Implementation notes and observations (max 500 chars) |
112
+ | `files_modified` | Output | Semicolon-separated list of created/modified files |
113
+ | `tests_passed` | Output | Test pass/fail status from execution_directives |
114
+ | `error` | Output | Error message if failed or blocked |
115
+
116
+ ### Per-Wave CSV (Temporary)
117
+
118
+ Each wave generates `wave-{N}.csv` with extra `prev_context` column populated from predecessor task findings.
119
+
120
+ ### Output Artifacts
121
+
122
+ | File | Purpose | Lifecycle |
123
+ |------|---------|-----------|
124
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
125
+ | `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
126
+ | `wave-{N}-results.csv` | Per-wave output | Created by spawn_agents_on_csv |
127
+ | `results.csv` | Final export of all task results | Created in Phase 3 |
128
+ | `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
129
+ | `context.md` | Human-readable execution report | Created in Phase 3 |
130
+
131
+ ### Session Structure
132
+
133
+ ```
134
+ .workflow/.csv-wave/{YYYYMMDD}-execute-P{N}-{slug}/
135
+ +-- tasks.csv
136
+ +-- results.csv
137
+ +-- discoveries.ndjson
138
+ +-- context.md
139
+ +-- config.json
140
+ +-- wave-{N}.csv (temporary)
141
+ +-- wave-{N}-results.csv (temporary)
142
+ ```
143
+ </csv_schema>
144
+
145
+ <invariants>
146
+ 1. **Start Immediately**: First action is session initialization, then Phase 1
147
+ 2. **Wave Order is Sacred**: Never execute wave N+1 before wave N completes and results are merged
148
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all execution state
149
+ 4. **Context Propagation**: prev_context built from master CSV findings, not from memory
150
+ 5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
151
+ 6. **Cascading Skip on Failure**: If a task fails/blocks, all dependent tasks are skipped
152
+ 7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
153
+ 8. **Max 3 Fix Attempts**: Per task, auto-fix convergence failures up to 3 times, then mark blocked
154
+ 9. **Breakpoint Resume**: Always detect completed tasks and skip them on re-run
155
+ 10. **DO NOT STOP**: Continuous execution until all waves complete or user explicitly stops
156
+ </invariants>
157
+
158
+ <execution>
159
+
160
+ ### Session Initialization
161
+
162
+ ```
163
+ Parse from $ARGUMENTS:
164
+ AUTO_YES ← --yes | -y
165
+ continueMode ← --continue
166
+ maxConcurrency ← --concurrency | -c N (default: 5)
167
+ autoCommit ← --auto-commit
168
+ executionMethod ← --method agent|cli (default: from config.json)
169
+ scratchDir --dir <path> (default: null)
170
+ phaseArg ← remaining text after flag removal
171
+
172
+ Derive:
173
+ dateStr UTC+8 YYYYMMDD
174
+ sessionId scratchDir ? "{dateStr}-execute-scratch" : "{dateStr}-execute-P{phaseArg}-{phaseSlug}"
175
+ sessionFolder ← ".workflow/.csv-wave/{sessionId}"
176
+
177
+ mkdir -p {sessionFolder}
178
+ ```
179
+
180
+ ### Pre-flight: Team Conflict Check
181
+
182
+ Before any task execution, run:
183
+ ```
184
+ Bash("maestro collab preflight --phase <phase-number>")
185
+ ```
186
+ If exit code is 1, present warnings and ask whether to proceed.
187
+
188
+ ### Phase 1: Plan Resolution -> CSV
189
+
190
+ **Objective**: Resolve phase, load plan + task definitions, detect resume point, generate tasks.csv.
191
+
192
+ **Decomposition Rules**:
193
+
194
+ 1. **Plan resolution** (per scratch-milestone-architecture):
195
+
196
+ | Input | Resolution |
197
+ |-------|------------|
198
+ | `--dir <path>` | Use path directly (scratch plan dir) |
199
+ | No args | Find all pending plans for current milestone from state.json.artifacts[] |
200
+ | Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[] |
201
+
202
+ For multi-plan: execute sequentially. Each plan is a full CSV session.
203
+
204
+ 2. **Load plan**: Read `{PLAN_DIR}/plan.json` for wave structure and task assignments
205
+
206
+ 3. **Detect completed tasks (breakpoint resume)**: Read `.task/TASK-{NNN}.json` for each task; exclude completed ones from CSV. Log resume count.
207
+
208
+ 4. **Build tasks.csv**: For each pending task per wave, read `.task/TASK-{NNN}.json` and extract: title, description, scope (from files), convergence.criteria, hints, execution_directives. Set `deps` from task dependency, `context_from` = deps, `wave` from plan.json.
209
+
210
+ 5. **Load project specs**: Read `.workflow/specs/` for coding conventions and architecture constraints (passed to all agents)
211
+
212
+ 6. **Load codebase + wiki context** (optional, passed to all agents):
213
+ - If `.workflow/codebase/ARCHITECTURE.md` exists: read and include as `codebase_context` in agent instructions
214
+ - Run `maestro wiki search "<phase keywords>" --json 2>/dev/null`; if results: include top 5 entries as `wiki_context`
215
+ - Both are optional proceed without if unavailable
216
+
217
+ 7. **User validation**: Display task/wave breakdown. Skip if AUTO_YES.
218
+
219
+ ### Phase 2: Wave Execution Engine
220
+
221
+ **Objective**: Execute tasks wave-by-wave via spawn_agents_on_csv with cross-wave context propagation.
222
+
223
+ #### Per-Wave Execution Loop
224
+
225
+ For each wave N in ascending order:
226
+
227
+ 1. Extract wave N pending rows from master `tasks.csv` (skip wave if none)
228
+ 2. Build `prev_context` per task from completed predecessor findings
229
+ 3. Write `wave-{N}.csv` with `prev_context` column, then execute:
230
+
231
+ ```javascript
232
+ spawn_agents_on_csv({
233
+ csv_path: `${sessionFolder}/wave-${N}.csv`,
234
+ id_column: "id",
235
+ instruction: buildExecutorInstruction(sessionFolder, phaseDir, autoCommit, specsContent), // agent: ~/.codex/agents/workflow-executor.toml
236
+ max_concurrency: maxConcurrency, max_runtime_seconds: 3600,
237
+ output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
238
+ output_schema: { id, status: [completed|failed|blocked], findings, files_modified, tests_passed, error }
239
+ })
240
+ ```
241
+
242
+ 4. Merge results into master `tasks.csv`, delete `wave-{N}.csv`
243
+
244
+ #### Blocked Task Handling
245
+
246
+ After each wave: if blocked tasks exist, prompt user to continue or stop (AUTO_YES: auto-continue). Skip tasks whose deps are blocked/failed.
247
+
248
+ #### Cascading Skip
249
+
250
+ Blocked/failed tasks cascade: mark all downstream dependents as `skipped` with error "Dependency {dep_id} blocked/failed".
251
+
252
+ ### Phase 3: Results Aggregation
253
+
254
+ **Objective**: Update all state files and generate execution report.
255
+
256
+ 1. Export final `tasks.csv` as `results.csv`
257
+
258
+ 2. **Update task files**: Write each task's status from CSV back to `.task/{id}.json`
259
+
260
+ 3. **Issue status sync**: For tasks with `issue_id`, update `.workflow/issues/issues.jsonl`:
261
+ - All task_refs completed -> `issue.status = "resolved"`; any failed -> `"in_progress"`
262
+ - Append history entry: `{ action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }`
263
+
264
+ 4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`
265
+
266
+ 5. **Extract incremental specs**: Read `.summaries/`, use `maestro spec add` CLI:
267
+ - Learnings/pitfalls `maestro spec add learning "<title>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
268
+ - Design rationale → `maestro spec add coding "<title>" "<content>" --keywords ...`
269
+ - Root cause/workaround `maestro spec add debug "<title>" "<content>" --keywords ...`
270
+ Mark artifact `harvested: true`
271
+
272
+ 6. **Post-task Knowledge Inquiry**: After each task completes, evaluate inquiry triggers:
273
+
274
+ - **Execution deviation**: If task summary mentions approach change, dependency swap, or plan deviation:
275
+ Prompt: "TASK-{NNN} deviated from the plan. Record as architecture constraint?"
276
+ On confirm: `maestro spec add arch "<decision>" "<rationale>" --keywords ... --source execute:{PLAN_DIR}`
277
+
278
+ - **Retry success**: If task required >=2 retries before completion:
279
+ Prompt: "TASK-{NNN} succeeded after {N} retries. Document this fix pattern?"
280
+ On confirm: `maestro spec add debug "<pattern>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
281
+
282
+ - **Implicit knowledge**: If task summary contains design rationale ("chose X because", "rejected Y due to"):
283
+ → Prompt: "Design decision detected. Record as a learning?"
284
+ On confirm: `maestro spec add learning "<decision>" "<rationale>" --keywords ... --source execute:{PLAN_DIR}`
285
+
286
+ Use `request_user_input` for prompts:
287
+ ```json
288
+ { "questions": [{ "id": "knowledge-capture", "header": "Knowledge Capture", "question": "...", "options": [{ "label": "Yes", "description": "Record to specs" }, { "label": "Skip", "description": "Continue without recording" }] }] }
289
+ ```
290
+
291
+ 7. **Generate context.md**: Execution report with summary (tasks/blocked/waves/auto-commit), per-wave result table (task, status, files, tests), blocked tasks, discovery board summary, next steps.
292
+
293
+ 8. **Auto-sync** (if config.json.codebase.auto_sync_after_execute == true): detect changed files, trigger codebase doc update.
294
+
295
+ 9. **Display completion report**: Phase, completed/blocked counts, wave progress, paths to `.summaries/` and `.task/`, next step suggestions (`maestro-verify`, `manage-status`).
296
+
297
+ ### Shared Discovery Board Protocol
298
+
299
+ #### Standard Discovery Types
300
+
301
+ | Type | Dedup Key | Data Schema | Description |
302
+ |------|-----------|-------------|-------------|
303
+ | `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found during implementation |
304
+ | `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point discovered |
305
+ | `convention` | singleton | `{naming, imports, formatting}` | Project coding conventions observed |
306
+ | `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue encountered |
307
+ | `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack detail confirmed |
308
+ | `test_command` | `data.command` | `{command, scope, result}` | Working test command discovered |
309
+
310
+ #### Protocol
311
+
312
+ Read `discoveries.ndjson` before implementation. Append-only: dedup by type+key before writing, never modify/delete.
313
+
314
+ ```bash
315
+ 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
316
+ ```
317
+ </execution>
318
+
319
+ <error_codes>
320
+
321
+ | Error | Resolution |
322
+ |-------|------------|
323
+ | Phase directory not found | Abort with error: "Phase {N} not found" |
324
+ | plan.json not found | Abort with error: "No plan found -- run plan first" |
325
+ | No pending tasks (all completed) | Abort with info: "All tasks already completed" |
326
+ | Task file (.task/TASK-*.json) missing | Skip task, log error, mark as failed |
327
+ | Agent spawn fails | Retry once, then mark task as blocked with checkpoint |
328
+ | Convergence criteria not met after 3 attempts | Mark task as blocked, write checkpoint |
329
+ | Git commit fails (--auto-commit) | Log warning, continue (task still marked completed) |
330
+ | All tasks in wave blocked | Stop execution, report blocked wave |
331
+ | CSV parse error | Validate format, show line number |
332
+ | discoveries.ndjson corrupt | Ignore malformed lines, continue |
333
+ | Continue mode: no session found | List available sessions |
334
+ </error_codes>
335
+
336
+ <success_criteria>
337
+ - [ ] Session folder created with valid tasks.csv
338
+ - [ ] All waves executed in order with cross-wave context propagation
339
+ - [ ] Completed tasks have .summaries/TASK-{NNN}-summary.md
340
+ - [ ] .task/TASK-*.json statuses updated to match execution results
341
+ - [ ] state.json updated with EXC artifact
342
+ - [ ] context.md produced with execution report
343
+ - [ ] Blocked tasks have checkpoint info for resume
344
+ - [ ] Cascading skip applied for dependent tasks
345
+ - [ ] discoveries.ndjson append-only throughout
346
+ </success_criteria>