maestro-flow 0.3.37 → 0.3.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/.claude/agents/workflow-analyzer.md +2 -0
  2. package/.claude/agents/workflow-debugger.md +2 -0
  3. package/.claude/agents/workflow-executor.md +2 -0
  4. package/.claude/agents/workflow-integration-checker.md +1 -0
  5. package/.claude/agents/workflow-nyquist-auditor.md +1 -0
  6. package/.claude/agents/workflow-planner.md +2 -0
  7. package/.claude/agents/workflow-reviewer.md +2 -0
  8. package/.claude/agents/workflow-verifier.md +2 -0
  9. package/.claude/commands/learn-decompose.md +176 -176
  10. package/.claude/commands/learn-follow.md +167 -167
  11. package/.claude/commands/learn-investigate.md +221 -221
  12. package/.claude/commands/learn-retro.md +303 -303
  13. package/.claude/commands/learn-second-opinion.md +167 -167
  14. package/.claude/commands/maestro-amend.md +300 -300
  15. package/.claude/commands/maestro-analyze.md +126 -126
  16. package/.claude/commands/maestro-brainstorm.md +100 -100
  17. package/.claude/commands/maestro-composer.md +354 -354
  18. package/.claude/commands/maestro-execute.md +120 -114
  19. package/.claude/commands/maestro-fork.md +86 -86
  20. package/.claude/commands/maestro-init.md +78 -78
  21. package/.claude/commands/maestro-learn.md +140 -140
  22. package/.claude/commands/maestro-link-coordinate.md +1 -1
  23. package/.claude/commands/maestro-merge.md +61 -61
  24. package/.claude/commands/maestro-milestone-release.md +96 -96
  25. package/.claude/commands/maestro-overlay.md +178 -178
  26. package/.claude/commands/maestro-plan.md +150 -138
  27. package/.claude/commands/maestro-player.md +404 -404
  28. package/.claude/commands/maestro-quick.md +56 -56
  29. package/.claude/commands/maestro-ralph-execute.md +7 -18
  30. package/.claude/commands/maestro-ralph.md +9 -3
  31. package/.claude/commands/maestro-roadmap.md +1 -1
  32. package/.claude/commands/maestro-ui-design.md +93 -93
  33. package/.claude/commands/maestro-update.md +176 -176
  34. package/.claude/commands/maestro-verify.md +96 -90
  35. package/.claude/commands/maestro.md +121 -121
  36. package/.claude/commands/manage-codebase-rebuild.md +75 -75
  37. package/.claude/commands/manage-codebase-refresh.md +57 -57
  38. package/.claude/commands/manage-harvest.md +94 -94
  39. package/.claude/commands/manage-issue-discover.md +77 -77
  40. package/.claude/commands/manage-issue.md +73 -73
  41. package/.claude/commands/manage-knowhow-capture.md +193 -193
  42. package/.claude/commands/manage-knowhow.md +77 -77
  43. package/.claude/commands/manage-learn.md +67 -67
  44. package/.claude/commands/manage-status.md +51 -51
  45. package/.claude/commands/manage-wiki.md +62 -62
  46. package/.claude/commands/quality-auto-test.md +1 -1
  47. package/.claude/commands/quality-debug.md +121 -115
  48. package/.claude/commands/quality-refactor.md +55 -55
  49. package/.claude/commands/quality-retrospective.md +78 -78
  50. package/.claude/commands/quality-review.md +114 -108
  51. package/.claude/commands/quality-sync.md +51 -51
  52. package/.claude/commands/quality-test.md +103 -103
  53. package/.claude/commands/spec-add.md +49 -49
  54. package/.claude/commands/spec-load.md +51 -51
  55. package/.claude/commands/spec-remove.md +51 -51
  56. package/.claude/commands/spec-setup.md +51 -51
  57. package/.claude/commands/wiki-connect.md +62 -62
  58. package/.claude/commands/wiki-digest.md +69 -69
  59. package/.codex/skills/learn-decompose/SKILL.md +113 -113
  60. package/.codex/skills/learn-follow/SKILL.md +1 -1
  61. package/.codex/skills/learn-investigate/SKILL.md +83 -83
  62. package/.codex/skills/learn-retro/SKILL.md +83 -83
  63. package/.codex/skills/learn-second-opinion/SKILL.md +86 -86
  64. package/.codex/skills/maestro/SKILL.md +304 -304
  65. package/.codex/skills/maestro-analyze/SKILL.md +9 -8
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +442 -397
  67. package/.codex/skills/maestro-composer/SKILL.md +213 -213
  68. package/.codex/skills/maestro-execute/SKILL.md +346 -318
  69. package/.codex/skills/maestro-fork/SKILL.md +56 -2
  70. package/.codex/skills/maestro-init/SKILL.md +40 -16
  71. package/.codex/skills/maestro-learn/SKILL.md +80 -80
  72. package/.codex/skills/maestro-link-coordinate/SKILL.md +257 -257
  73. package/.codex/skills/maestro-merge/SKILL.md +1 -1
  74. package/.codex/skills/maestro-milestone-audit/SKILL.md +1 -1
  75. package/.codex/skills/maestro-milestone-complete/SKILL.md +40 -9
  76. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -70
  77. package/.codex/skills/maestro-overlay/SKILL.md +1 -1
  78. package/.codex/skills/maestro-plan/SKILL.md +19 -4
  79. package/.codex/skills/maestro-player/SKILL.md +323 -323
  80. package/.codex/skills/maestro-quick/SKILL.md +1 -1
  81. package/.codex/skills/maestro-ralph/SKILL.md +681 -578
  82. package/.codex/skills/maestro-roadmap/SKILL.md +518 -468
  83. package/.codex/skills/maestro-ui-design/SKILL.md +109 -12
  84. package/.codex/skills/maestro-verify/SKILL.md +27 -9
  85. package/.codex/skills/manage-codebase-rebuild/SKILL.md +3 -2
  86. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  87. package/.codex/skills/manage-harvest/SKILL.md +91 -91
  88. package/.codex/skills/manage-issue/SKILL.md +19 -6
  89. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  90. package/.codex/skills/manage-knowhow/SKILL.md +95 -95
  91. package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -110
  92. package/.codex/skills/manage-learn/SKILL.md +1 -1
  93. package/.codex/skills/manage-status/SKILL.md +1 -1
  94. package/.codex/skills/manage-wiki/SKILL.md +55 -55
  95. package/.codex/skills/quality-auto-test/SKILL.md +547 -547
  96. package/.codex/skills/quality-debug/SKILL.md +339 -334
  97. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  98. package/.codex/skills/quality-retrospective/SKILL.md +292 -292
  99. package/.codex/skills/quality-review/SKILL.md +365 -364
  100. package/.codex/skills/quality-sync/SKILL.md +1 -1
  101. package/.codex/skills/quality-test/SKILL.md +498 -498
  102. package/.codex/skills/spec-add/SKILL.md +101 -101
  103. package/.codex/skills/spec-load/SKILL.md +77 -77
  104. package/.codex/skills/spec-map/SKILL.md +1 -1
  105. package/.codex/skills/spec-remove/SKILL.md +69 -69
  106. package/.codex/skills/spec-setup/SKILL.md +1 -1
  107. package/.codex/skills/team-coordinate/SKILL.md +2 -1
  108. package/.codex/skills/team-executor/SKILL.md +116 -115
  109. package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -1
  110. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +14 -6
  111. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +16 -4
  112. package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +7 -1
  113. package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +16 -4
  114. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +8 -2
  115. package/.codex/skills/team-quality-assurance/SKILL.md +2 -1
  116. package/.codex/skills/team-quality-assurance/roles/scout/role.md +9 -2
  117. package/.codex/skills/team-review/SKILL.md +2 -1
  118. package/.codex/skills/team-review/roles/reviewer/role.md +10 -1
  119. package/.codex/skills/team-review/roles/scanner/role.md +10 -1
  120. package/.codex/skills/team-tech-debt/SKILL.md +144 -143
  121. package/.codex/skills/team-tech-debt/roles/executor/role.md +9 -5
  122. package/.codex/skills/team-tech-debt/roles/scanner/role.md +10 -0
  123. package/.codex/skills/team-tech-debt/roles/validator/role.md +8 -2
  124. package/.codex/skills/team-testing/SKILL.md +2 -1
  125. package/.codex/skills/team-testing/roles/executor/role.md +8 -2
  126. package/.codex/skills/team-testing/roles/generator/role.md +8 -2
  127. package/.codex/skills/wiki-connect/SKILL.md +73 -73
  128. package/.codex/skills/wiki-digest/SKILL.md +87 -87
  129. package/README.md +6 -0
  130. package/README.zh-CN.md +6 -0
  131. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  132. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  133. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +118 -7
  134. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  135. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  136. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
  137. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
  138. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  139. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  140. package/dashboard/dist-server/src/commands/delegate.js +18 -0
  141. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  142. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
  143. package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
  144. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  145. package/dist/shared/agent-types.d.ts +2 -0
  146. package/dist/shared/agent-types.d.ts.map +1 -1
  147. package/dist/src/agents/cli-agent-runner.d.ts +2 -0
  148. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  149. package/dist/src/agents/cli-agent-runner.js +4 -0
  150. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  151. package/dist/src/commands/config.d.ts.map +1 -1
  152. package/dist/src/commands/config.js +29 -1
  153. package/dist/src/commands/config.js.map +1 -1
  154. package/dist/src/commands/delegate.d.ts +2 -0
  155. package/dist/src/commands/delegate.d.ts.map +1 -1
  156. package/dist/src/commands/delegate.js +18 -0
  157. package/dist/src/commands/delegate.js.map +1 -1
  158. package/dist/src/commands/launcher.d.ts.map +1 -1
  159. package/dist/src/commands/launcher.js +27 -4
  160. package/dist/src/commands/launcher.js.map +1 -1
  161. package/dist/src/config/cli-tools-config.d.ts +6 -0
  162. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  163. package/dist/src/config/cli-tools-config.js +2 -0
  164. package/dist/src/config/cli-tools-config.js.map +1 -1
  165. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  166. package/dist/src/core/overlay/applier.js +65 -5
  167. package/dist/src/core/overlay/applier.js.map +1 -1
  168. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  169. package/dist/src/core/overlay/loader.js +9 -4
  170. package/dist/src/core/overlay/loader.js.map +1 -1
  171. package/dist/src/core/overlay/types.d.ts +2 -0
  172. package/dist/src/core/overlay/types.d.ts.map +1 -1
  173. package/dist/src/core/overlay/types.js +2 -0
  174. package/dist/src/core/overlay/types.js.map +1 -1
  175. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  176. package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
  177. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  178. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  179. package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
  180. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  181. package/package.json +1 -1
  182. package/shared/agent-types.ts +2 -0
  183. package/workflows/delegate-protocol.codex.md +65 -0
  184. package/workflows/issue-analyze.md +2 -3
  185. package/workflows/issue-gaps-analyze.codex.md +260 -0
  186. package/workflows/issue-gaps-analyze.md +214 -0
@@ -1,304 +1,304 @@
1
- ---
2
- name: maestro
3
- description: Intelligent coordinator — analyze intent, read project state, select chain, execute wave-by-wave via spawn_agents_on_csv. Coordinator only assembles prompts and reads artifacts — never executes skills directly.
4
- argument-hint: "\"intent text\" [-y] [-c|--continue] [--dry-run] [--super]"
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Wave-based pipeline coordinator. All skill execution happens exclusively in spawned sub-agents
10
- via `spawn_agents_on_csv` — the coordinator never executes skills directly.
11
-
12
- Coordinator loop: classify intent → resolve chain → build wave CSV → spawn → read results →
13
- (barrier: read artifacts, update context, assemble next skill_call args) → next wave → report.
14
-
15
- Each wave = 1 barrier task (solo) or N parallel non-barrier tasks.
16
- </purpose>
17
-
18
- <required_reading>
19
- @~/.maestro/workflows/maestro.codex.md — authoritative `detectTaskType`, `detectNextAction`, `chainMap` (35+ intent patterns, 40+ chain types). Read before executing any step.
20
- </required_reading>
21
-
22
- <deferred_reading>
23
- - [maestro-super.md](~/.maestro/workflows/maestro-super.md) — read when `--super` flag is active
24
- </deferred_reading>
25
-
26
- <context>
27
- $ARGUMENTS — user intent text, or special flags.
28
-
29
- **Flags:**
30
- - `-y, --yes` — Auto mode: skip all prompts; propagate `-y` to each skill
31
- - `--continue` — Resume latest paused session from last incomplete wave
32
- - `--dry-run` — Display planned chain without executing
33
- - `--super` — Super mode: deliver production-ready complete software system. Read `maestro-super.md` from deferred_reading, then follow it completely.
34
-
35
- **Session state**: `.workflow/.maestro/{session-id}/`
36
- **Core output**: `tasks.csv` (master) + `wave-{N}-results.csv` (per wave) + `context.md` (report)
37
- </context>
38
-
39
- <invariants>
40
- 1. **ALL skills via spawn_agents_on_csv**: Every skill invocation — barrier or non-barrier — MUST go through `spawn_agents_on_csv`. Coordinator NEVER directly executes any skill. No exceptions.
41
- 2. **Coordinator = prompt assembler only**: Classify intent → build CSV → spawn → read results → assemble next CSV. It never runs skill logic itself.
42
- 3. **Barrier ≠ execution**: Barrier designation only means the coordinator **pauses after the wave** to read artifacts and assemble the next wave's prompt args. Coordinator role at barrier: **discover artifacts → read → update context → assemble next skill_call args**. Nothing more.
43
- 4. **Barrier = solo wave**: A barrier skill always executes alone in its wave (wave size = 1).
44
- 5. **Non-barriers can parallel**: Consecutive non-barrier skills grouped into one wave (`max_workers = N`).
45
- 6. **Wave-by-wave**: Never start wave N+1 before wave N results are read and analyzed.
46
- 7. **Coordinator owns context**: Sub-agents never read prior results — coordinator assembles the full `skill_call` with resolved args.
47
- 8. **Simple instruction**: Sub-agent instruction is minimal — just "execute {skill_call}, report result".
48
- 9. **Abort on failure**: Failed step → mark remaining as skipped → report.
49
- 10. **Resume from wave**: `--continue` finds last completed wave, resumes from next pending step.
50
- </invariants>
51
-
52
- <chain_map>
53
- | Intent keywords | Chain | Steps (skills, in order) |
54
- |----------------|-------|--------------------------|
55
- | fix, bug, error, broken, crash | `quality-fix` | $maestro-analyze --gaps → $maestro-plan --gaps → $maestro-execute → $maestro-verify |
56
- | test, spec, coverage | `quality-test` | $quality-test |
57
- | refactor, cleanup, debt | `quality-refactor` | $quality-refactor |
58
- | feature, implement, add, build | `feature` | $maestro-plan → $maestro-execute → $maestro-verify |
59
- | review, check, audit | `quality-review` | $quality-review |
60
- | deploy, release, ship | `deploy` | $maestro-verify → $maestro-milestone-release |
61
- | brainstorm, explore, ideate | `brainstorm-driven` | $maestro-brainstorm → $maestro-plan → $maestro-execute → $maestro-verify |
62
- | plan, design, architect | `plan` | $maestro-plan |
63
- | debug, diagnose, troubleshoot | `debug` | $quality-debug |
64
- | continue, next, go | `state_continue` | (from project state) |
65
- | status, dashboard | `status` | $manage-status |
66
-
67
- Full chain map with 40+ chains: see `@~/.maestro/workflows/maestro.codex.md` §3c
68
- </chain_map>
69
-
70
- <barrier_skills>
71
- Skills that produce artifacts the coordinator must read before assembling the next wave.
72
- After a barrier skill completes **in its spawned sub-agent**, coordinator reads output and updates `state.context`.
73
-
74
- | Skill | Artifacts to Read | Context Updates |
75
- |-------|------------------|-----------------|
76
- | `maestro-analyze` | `.workflow/.csv-wave/*/context.md`, `state.json` | `gaps`, `phase`, `analysis_dir` |
77
- | `maestro-plan` | `{artifact_dir}/plan.json`, `{artifact_dir}/.task/TASK-*.json` | `plan_dir`, `task_count`, `wave_count` |
78
- | `maestro-brainstorm` | `.workflow/.csv-wave/*/.brainstorming/` | `brainstorm_dir`, `features` |
79
- | `maestro-roadmap` | `.workflow/.csv-wave/*/specs/` | `spec_session_id` |
80
- | `maestro-execute` | `.workflow/.csv-wave/*/results.csv` | `exec_status`, `completed_tasks`, `failed_tasks` |
81
-
82
- **Non-barrier skills** (groupable into multi-task waves): `maestro-verify`, `quality-review`, `quality-test`, `quality-debug`, `quality-refactor`, `quality-sync`, `manage-*`
83
-
84
- ### Barrier Analysis Logic
85
-
86
- After each barrier skill completes, read its artifacts and update `state.context`:
87
-
88
- | Barrier Skill | Read | Context Updates |
89
- |---------------|------|-----------------|
90
- | `maestro-analyze` | `{artifacts}/context.md` | `analysis_dir`, `gaps` (extracted), `phase` (if unset) |
91
- | `maestro-plan` | `{artifacts}/plan.json` | `plan_dir`, `task_count`, `wave_count` from plan JSON |
92
- | `maestro-brainstorm` | `{artifacts}/` | `brainstorm_dir` |
93
- | `maestro-roadmap` | `{artifacts}/` | `spec_session_id` (extracted) |
94
- | `maestro-execute` | `{artifacts}/results.csv` | `exec_completed`, `exec_failed` (counted by status) |
95
- </barrier_skills>
96
-
97
- <execution>
98
-
99
- ### Phase 1: Resolve Intent and Chain
100
-
101
- **`--continue`**: Glob `.workflow/.maestro/maestro-*/status.json` sorted desc; load most recent; resume from first pending wave.
102
-
103
- **Fresh mode**:
104
- 1. Read `.workflow/state.json` for project context (derive current phase from artifact registry, `workflow_name`)
105
- 2. Classify intent via keyword heuristics (see chain_map)
106
- 4. No match + not AUTO_YES → one clarifying question via `AskUserQuestion`
107
- 5. Resolve chain's skill list
108
- 6. Create session dir `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/` and write `status.json`:
109
-
110
- ```json
111
- {
112
- "session_id": "maestro-{YYYYMMDD-HHMMSS}",
113
- "source": "maestro",
114
- "created_at": "ISO",
115
- "updated_at": "ISO",
116
- "intent": "...",
117
- "task_type": "...",
118
- "chain_name": "...",
119
- "phase": null,
120
- "milestone": null,
121
- "auto_mode": false,
122
- "exec_mode": "auto",
123
- "cli_tool": "codex",
124
- "lifecycle_position": null,
125
- "target": null,
126
- "context": {
127
- "issue_id": null,
128
- "milestone_num": null,
129
- "spec_session_id": null,
130
- "scratch_dir": null,
131
- "plan_dir": null,
132
- "analysis_dir": null,
133
- "brainstorm_dir": null
134
- },
135
- "waves": [],
136
- "steps": [{ "index": 0, "skill": "...", "args": "", "type": "skill", "status": "pending", "started_at": null, "completed_at": null, "error": null, "wave_n": null }],
137
- "current_step": 0,
138
- "status": "running"
139
- }
140
- ```
141
-
142
- 7. **Initialize plan tracking** (dual-track: status.json + update_plan):
143
-
144
- ```
145
- functions.update_plan({
146
- plan: steps.map((step, i) => ({
147
- id: `step-${i}`,
148
- title: `[${i + 1}/${steps.length}] ${step.skill}${barrier(step) ? ' [BARRIER]' : ''}`,
149
- status: "open"
150
- }))
151
- })
152
- ```
153
-
154
- **`--dry-run`**: Display chain with `[BARRIER]` markers, stop.
155
-
156
- **User confirmation** (skip if AUTO_YES): Display plan, prompt `Proceed? (yes/no)`.
157
-
158
- **`--continue` plan rebuild**: When resuming, rebuild `update_plan` from status.json — completed steps → `"completed"`, current → `"in_progress"`, rest → `"open"`.
159
-
160
- ### Phase 2: Wave Execution Loop
161
-
162
- **While pending steps remain**, increment `waveNum` and repeat:
163
-
164
- 1. **Build wave**: Select next wave steps via `buildNextWave` (barrier = solo, non-barriers = grouped)
165
- 2. **Write CSV**: `{sessionDir}/wave-{N}.csv` with columns `id,skill_call,topic` — one row per step, skill_call assembled with resolved context
166
- 3. **Spawn**:
167
- ```
168
- spawn_agents_on_csv({
169
- csv_path: "{sessionDir}/wave-{N}.csv",
170
- id_column: "id", instruction: WAVE_INSTRUCTION,
171
- max_workers: <wave size>, max_runtime_seconds: 3600,
172
- output_csv_path: "{sessionDir}/wave-{N}-results.csv",
173
- output_schema: RESULT_SCHEMA
174
- })
175
- ```
176
- 4. **Read results**: Update each step's `status`, `wave_n` from results CSV
177
- 5. **Barrier check**: If wave was a barrier skill, run barrier analysis logic (read artifacts, update context)
178
- 6. **Dual-track persist**:
179
- - status.json: Append wave to `state.waves[]`, update step statuses, write `status.json`
180
- - update_plan: Sync plan items from status.json step statuses:
181
- ```
182
- functions.update_plan({
183
- plan: steps.map((step, i) => ({
184
- id: `step-${i}`,
185
- title: `[${i + 1}/${steps.length}] ${step.skill}`,
186
- status: step.status === 'completed' ? 'completed'
187
- : step.status === 'pending' && i === nextPendingIndex ? 'in_progress'
188
- : step.status
189
- }))
190
- })
191
- ```
192
- 7. **Abort on failure**: If any result `status === 'failed'` → mark remaining steps `skipped` in both status.json and update_plan, set `state.status = 'aborted'`, break
193
-
194
- ### Skill Call Assembly
195
-
196
- **Barrier skills**: `maestro-analyze`, `maestro-plan`, `maestro-brainstorm`, `maestro-roadmap`, `maestro-execute`
197
-
198
- **Auto-yes flag map** (appended when `status.auto_mode` is true):
199
-
200
- | Skill | Flag |
201
- |-------|------|
202
- | `maestro-init`, `maestro-analyze`, `maestro-brainstorm`, `maestro-ui-design`, `maestro-roadmap` | `-y` |
203
- | `maestro-plan`, `maestro-execute`, `maestro-milestone-complete` | `-y` |
204
- | `quality-auto-test`, `quality-retrospective` | `-y` |
205
- | `quality-test` | `-y --auto-fix` |
206
-
207
- **`buildSkillCall(step, ctx)`**: Replace placeholders `{phase}`, `{description}`, `{issue_id}`, `{plan_dir}`, `{analysis_dir}`, `{brainstorm_dir}`, `{spec_session_id}` in `step.args` with corresponding `ctx` values. Append auto-yes flag if applicable. Return `$<skill> <args>`.
208
-
209
- **`buildNextWave(steps)`**: Take first pending step. If it is a barrier skill, return it solo. Otherwise, collect consecutive non-barrier pending steps into one wave (stop at first barrier).
210
-
211
- ### Sub-Agent Instruction Template
212
-
213
- ```
214
- 你是 CSV job 子 agent。
215
-
216
- 先原样执行这一段技能调用:
217
- {skill_call}
218
-
219
- 然后基于结果完成这一行任务说明:
220
- {topic}
221
-
222
- 限制:
223
- - 不要修改 .workflow/.maestro/ 下的 status 文件
224
- - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
225
-
226
- 最后必须调用 `report_agent_job_result`,返回 JSON:
227
- {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
228
- ```
229
-
230
- ### Result Schema
231
-
232
- Object with all fields required: `status` ("completed"|"failed"), `skill_call` (string), `summary` (string), `artifacts` (path or ""), `error` (reason or "").
233
-
234
- ### Phase 3: Completion Report
235
-
236
- Finalize dual tracking:
237
- - status.json: `state.status = 'completed'`
238
- - update_plan: all steps → `"completed"` (skipped steps also marked completed)
239
-
240
- ```
241
- === COORDINATE COMPLETE ===
242
- Session: <sessionId>
243
- Chain: <chain>
244
- Waves: <N> executed
245
- Steps: <completed>/<total>
246
-
247
- WAVE RESULTS:
248
- [W1] $maestro-analyze --gaps → ✓ found 3 gaps
249
- [W2] $maestro-plan --gaps → ✓ 12 tasks in 3 waves
250
- [W3] $maestro-execute → ✓ 12/12 tasks done
251
- [W4] $maestro-verify → ✓ all criteria met
252
-
253
- State: .workflow/.maestro/<sessionId>/status.json
254
- Resume: $maestro --continue
255
- ```
256
- </execution>
257
-
258
- <csv_schema>
259
- ### wave-{N}.csv (Per-Wave Input)
260
-
261
- ```csv
262
- id,skill_call,topic
263
- "1","$maestro-analyze --gaps \"fix auth\" -y","Chain \"quality-fix\" step 1/4"
264
- ```
265
-
266
- | Column | Description |
267
- |--------|-------------|
268
- | `id` | Step number from chain (string) |
269
- | `skill_call` | Full skill invocation assembled by coordinator with resolved context |
270
- | `topic` | Brief description for the agent |
271
-
272
- ### tasks.csv (Master State)
273
-
274
- ```csv
275
- id,skill,args,wave_n,status,findings,artifacts,error
276
- ```
277
-
278
- Accumulated across all waves. Updated after each wave completes.
279
- </csv_schema>
280
-
281
- <error_codes>
282
- | Code | Severity | Condition | Recovery |
283
- |------|----------|-----------|----------|
284
- | E001 | error | Intent unclassifiable after clarification | Default to `feature` chain |
285
- | E002 | error | Intent unresolvable after retry | List available chains, abort |
286
- | E003 | error | Wave timeout (max_runtime_seconds) | Mark step `failed`, abort chain |
287
- | E004 | error | Barrier artifact not found | Retry wave once, then abort |
288
- | E005 | error | `--continue`: no session found | List sessions, prompt |
289
- | W001 | warning | Barrier artifact partial | Continue with available context |
290
- </error_codes>
291
-
292
- <success_criteria>
293
- - [ ] Intent classified and chain resolved (keyword heuristics or `--chain`)
294
- - [ ] Session dir initialized with `status.json` before first wave
295
- - [ ] Every skill invocation goes through `spawn_agents_on_csv` — none executed in coordinator
296
- - [ ] Barrier skills execute solo in their wave; coordinator only reads artifacts afterward
297
- - [ ] Non-barrier skills grouped into parallel waves where possible
298
- - [ ] Each wave: CSV built → spawned → results read → state updated
299
- - [ ] Barrier artifacts read and context updated before assembling next wave's skill_call args
300
- - [ ] Failed step → remaining marked skipped → abort reported
301
- - [ ] Completion report with per-wave status written to `context.md`
302
- - [ ] `--dry-run` shows chain with [BARRIER] markers, no execution
303
- - [ ] `--continue` resumes from last incomplete wave
304
- </success_criteria>
1
+ ---
2
+ name: maestro
3
+ description: Auto-route intent to optimal command chain
4
+ argument-hint: "\"intent text\" [-y] [-c|--continue] [--dry-run] [--super]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based pipeline coordinator. All skill execution happens exclusively in spawned sub-agents
10
+ via `spawn_agents_on_csv` — the coordinator never executes skills directly.
11
+
12
+ Coordinator loop: classify intent → resolve chain → build wave CSV → spawn → read results →
13
+ (barrier: read artifacts, update context, assemble next skill_call args) → next wave → report.
14
+
15
+ Each wave = 1 barrier task (solo) or N parallel non-barrier tasks.
16
+ </purpose>
17
+
18
+ <required_reading>
19
+ @~/.maestro/workflows/maestro.codex.md — authoritative `detectTaskType`, `detectNextAction`, `chainMap` (35+ intent patterns, 40+ chain types). Read before executing any step.
20
+ </required_reading>
21
+
22
+ <deferred_reading>
23
+ - [maestro-super.md](~/.maestro/workflows/maestro-super.md) — read when `--super` flag is active
24
+ </deferred_reading>
25
+
26
+ <context>
27
+ $ARGUMENTS — user intent text, or special flags.
28
+
29
+ **Flags:**
30
+ - `-y, --yes` — Auto mode: skip all prompts; propagate `-y` to each skill
31
+ - `--continue` — Resume latest paused session from last incomplete wave
32
+ - `--dry-run` — Display planned chain without executing
33
+ - `--super` — Super mode: deliver production-ready complete software system. Read `maestro-super.md` from deferred_reading, then follow it completely.
34
+
35
+ **Session state**: `.workflow/.maestro/{session-id}/`
36
+ **Core output**: `tasks.csv` (master) + `wave-{N}-results.csv` (per wave) + `context.md` (report)
37
+ </context>
38
+
39
+ <invariants>
40
+ 1. **ALL skills via spawn_agents_on_csv**: Every skill invocation — barrier or non-barrier — MUST go through `spawn_agents_on_csv`. Coordinator NEVER directly executes any skill. No exceptions.
41
+ 2. **Coordinator = prompt assembler only**: Classify intent → build CSV → spawn → read results → assemble next CSV. It never runs skill logic itself.
42
+ 3. **Barrier ≠ execution**: Barrier designation only means the coordinator **pauses after the wave** to read artifacts and assemble the next wave's prompt args. Coordinator role at barrier: **discover artifacts → read → update context → assemble next skill_call args**. Nothing more.
43
+ 4. **Barrier = solo wave**: A barrier skill always executes alone in its wave (wave size = 1).
44
+ 5. **Non-barriers can parallel**: Consecutive non-barrier skills grouped into one wave (`max_workers = N`).
45
+ 6. **Wave-by-wave**: Never start wave N+1 before wave N results are read and analyzed.
46
+ 7. **Coordinator owns context**: Sub-agents never read prior results — coordinator assembles the full `skill_call` with resolved args.
47
+ 8. **Simple instruction**: Sub-agent instruction is minimal — just "execute {skill_call}, report result".
48
+ 9. **Abort on failure**: Failed step → mark remaining as skipped → report.
49
+ 10. **Resume from wave**: `--continue` finds last completed wave, resumes from next pending step.
50
+ </invariants>
51
+
52
+ <chain_map>
53
+ | Intent keywords | Chain | Steps (skills, in order) |
54
+ |----------------|-------|--------------------------|
55
+ | fix, bug, error, broken, crash | `quality-fix` | $maestro-analyze --gaps → $maestro-plan --gaps → $maestro-execute → $maestro-verify |
56
+ | test, spec, coverage | `quality-test` | $quality-test |
57
+ | refactor, cleanup, debt | `quality-refactor` | $quality-refactor |
58
+ | feature, implement, add, build | `feature` | $maestro-plan → $maestro-execute → $maestro-verify |
59
+ | review, check, audit | `quality-review` | $quality-review |
60
+ | deploy, release, ship | `deploy` | $maestro-verify → $maestro-milestone-release |
61
+ | brainstorm, explore, ideate | `brainstorm-driven` | $maestro-brainstorm → $maestro-plan → $maestro-execute → $maestro-verify |
62
+ | plan, design, architect | `plan` | $maestro-plan |
63
+ | debug, diagnose, troubleshoot | `debug` | $quality-debug |
64
+ | continue, next, go | `state_continue` | (from project state) |
65
+ | status, dashboard | `status` | $manage-status |
66
+
67
+ Full chain map with 40+ chains: see `@~/.maestro/workflows/maestro.codex.md` §3c
68
+ </chain_map>
69
+
70
+ <barrier_skills>
71
+ Skills that produce artifacts the coordinator must read before assembling the next wave.
72
+ After a barrier skill completes **in its spawned sub-agent**, coordinator reads output and updates `state.context`.
73
+
74
+ | Skill | Artifacts to Read | Context Updates |
75
+ |-------|------------------|-----------------|
76
+ | `maestro-analyze` | `.workflow/.csv-wave/*/context.md`, `state.json` | `gaps`, `phase`, `analysis_dir` |
77
+ | `maestro-plan` | `{artifact_dir}/plan.json`, `{artifact_dir}/.task/TASK-*.json` | `plan_dir`, `task_count`, `wave_count` |
78
+ | `maestro-brainstorm` | `.workflow/.csv-wave/*/.brainstorming/` | `brainstorm_dir`, `features` |
79
+ | `maestro-roadmap` | `.workflow/.csv-wave/*/specs/` | `spec_session_id` |
80
+ | `maestro-execute` | `.workflow/.csv-wave/*/results.csv` | `exec_status`, `completed_tasks`, `failed_tasks` |
81
+
82
+ **Non-barrier skills** (groupable into multi-task waves): `maestro-verify`, `quality-review`, `quality-test`, `quality-debug`, `quality-refactor`, `quality-sync`, `manage-*`
83
+
84
+ ### Barrier Analysis Logic
85
+
86
+ After each barrier skill completes, read its artifacts and update `state.context`:
87
+
88
+ | Barrier Skill | Read | Context Updates |
89
+ |---------------|------|-----------------|
90
+ | `maestro-analyze` | `{artifacts}/context.md` | `analysis_dir`, `gaps` (extracted), `phase` (if unset) |
91
+ | `maestro-plan` | `{artifacts}/plan.json` | `plan_dir`, `task_count`, `wave_count` from plan JSON |
92
+ | `maestro-brainstorm` | `{artifacts}/` | `brainstorm_dir` |
93
+ | `maestro-roadmap` | `{artifacts}/` | `spec_session_id` (extracted) |
94
+ | `maestro-execute` | `{artifacts}/results.csv` | `exec_completed`, `exec_failed` (counted by status) |
95
+ </barrier_skills>
96
+
97
+ <execution>
98
+
99
+ ### Phase 1: Resolve Intent and Chain
100
+
101
+ **`--continue`**: Glob `.workflow/.maestro/maestro-*/status.json` sorted desc; load most recent; resume from first pending wave.
102
+
103
+ **Fresh mode**:
104
+ 1. Read `.workflow/state.json` for project context (derive current phase from artifact registry, `workflow_name`)
105
+ 2. Classify intent via keyword heuristics (see chain_map)
106
+ 4. No match + not AUTO_YES → one clarifying question via `AskUserQuestion`
107
+ 5. Resolve chain's skill list
108
+ 6. Create session dir `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/` and write `status.json`:
109
+
110
+ ```json
111
+ {
112
+ "session_id": "maestro-{YYYYMMDD-HHMMSS}",
113
+ "source": "maestro",
114
+ "created_at": "ISO",
115
+ "updated_at": "ISO",
116
+ "intent": "...",
117
+ "task_type": "...",
118
+ "chain_name": "...",
119
+ "phase": null,
120
+ "milestone": null,
121
+ "auto_mode": false,
122
+ "exec_mode": "auto",
123
+ "cli_tool": "codex",
124
+ "lifecycle_position": null,
125
+ "target": null,
126
+ "context": {
127
+ "issue_id": null,
128
+ "milestone_num": null,
129
+ "spec_session_id": null,
130
+ "scratch_dir": null,
131
+ "plan_dir": null,
132
+ "analysis_dir": null,
133
+ "brainstorm_dir": null
134
+ },
135
+ "waves": [],
136
+ "steps": [{ "index": 0, "skill": "...", "args": "", "type": "skill", "status": "pending", "started_at": null, "completed_at": null, "error": null, "wave_n": null }],
137
+ "current_step": 0,
138
+ "status": "running"
139
+ }
140
+ ```
141
+
142
+ 7. **Initialize plan tracking** (dual-track: status.json + update_plan):
143
+
144
+ ```
145
+ functions.update_plan({
146
+ plan: steps.map((step, i) => ({
147
+ id: `step-${i}`,
148
+ title: `[${i + 1}/${steps.length}] ${step.skill}${barrier(step) ? ' [BARRIER]' : ''}`,
149
+ status: "open"
150
+ }))
151
+ })
152
+ ```
153
+
154
+ **`--dry-run`**: Display chain with `[BARRIER]` markers, stop.
155
+
156
+ **User confirmation** (skip if AUTO_YES): Display plan, prompt `Proceed? (yes/no)`.
157
+
158
+ **`--continue` plan rebuild**: When resuming, rebuild `update_plan` from status.json — completed steps → `"completed"`, current → `"in_progress"`, rest → `"open"`.
159
+
160
+ ### Phase 2: Wave Execution Loop
161
+
162
+ **While pending steps remain**, increment `waveNum` and repeat:
163
+
164
+ 1. **Build wave**: Select next wave steps via `buildNextWave` (barrier = solo, non-barriers = grouped)
165
+ 2. **Write CSV**: `{sessionDir}/wave-{N}.csv` with columns `id,skill_call,topic` — one row per step, skill_call assembled with resolved context
166
+ 3. **Spawn**:
167
+ ```
168
+ spawn_agents_on_csv({
169
+ csv_path: "{sessionDir}/wave-{N}.csv",
170
+ id_column: "id", instruction: WAVE_INSTRUCTION,
171
+ max_workers: <wave size>, max_runtime_seconds: 3600,
172
+ output_csv_path: "{sessionDir}/wave-{N}-results.csv",
173
+ output_schema: RESULT_SCHEMA
174
+ })
175
+ ```
176
+ 4. **Read results**: Update each step's `status`, `wave_n` from results CSV
177
+ 5. **Barrier check**: If wave was a barrier skill, run barrier analysis logic (read artifacts, update context)
178
+ 6. **Dual-track persist**:
179
+ - status.json: Append wave to `state.waves[]`, update step statuses, write `status.json`
180
+ - update_plan: Sync plan items from status.json step statuses:
181
+ ```
182
+ functions.update_plan({
183
+ plan: steps.map((step, i) => ({
184
+ id: `step-${i}`,
185
+ title: `[${i + 1}/${steps.length}] ${step.skill}`,
186
+ status: step.status === 'completed' ? 'completed'
187
+ : step.status === 'pending' && i === nextPendingIndex ? 'in_progress'
188
+ : step.status
189
+ }))
190
+ })
191
+ ```
192
+ 7. **Abort on failure**: If any result `status === 'failed'` → mark remaining steps `skipped` in both status.json and update_plan, set `state.status = 'aborted'`, break
193
+
194
+ ### Skill Call Assembly
195
+
196
+ **Barrier skills**: `maestro-analyze`, `maestro-plan`, `maestro-brainstorm`, `maestro-roadmap`, `maestro-execute`
197
+
198
+ **Auto-yes flag map** (appended when `status.auto_mode` is true):
199
+
200
+ | Skill | Flag |
201
+ |-------|------|
202
+ | `maestro-init`, `maestro-analyze`, `maestro-brainstorm`, `maestro-ui-design`, `maestro-roadmap` | `-y` |
203
+ | `maestro-plan`, `maestro-execute`, `maestro-milestone-complete` | `-y` |
204
+ | `quality-auto-test`, `quality-retrospective` | `-y` |
205
+ | `quality-test` | `-y --auto-fix` |
206
+
207
+ **`buildSkillCall(step, ctx)`**: Replace placeholders `{phase}`, `{description}`, `{issue_id}`, `{plan_dir}`, `{analysis_dir}`, `{brainstorm_dir}`, `{spec_session_id}` in `step.args` with corresponding `ctx` values. Append auto-yes flag if applicable. Return `$<skill> <args>`.
208
+
209
+ **`buildNextWave(steps)`**: Take first pending step. If it is a barrier skill, return it solo. Otherwise, collect consecutive non-barrier pending steps into one wave (stop at first barrier).
210
+
211
+ ### Sub-Agent Instruction Template
212
+
213
+ ```
214
+ 你是 CSV job 子 agent。
215
+
216
+ 先原样执行这一段技能调用:
217
+ {skill_call}
218
+
219
+ 然后基于结果完成这一行任务说明:
220
+ {topic}
221
+
222
+ 限制:
223
+ - 不要修改 .workflow/.maestro/ 下的 status 文件
224
+ - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
225
+
226
+ 最后必须调用 `report_agent_job_result`,返回 JSON:
227
+ {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
228
+ ```
229
+
230
+ ### Result Schema
231
+
232
+ Object with all fields required: `status` ("completed"|"failed"), `skill_call` (string), `summary` (string), `artifacts` (path or ""), `error` (reason or "").
233
+
234
+ ### Phase 3: Completion Report
235
+
236
+ Finalize dual tracking:
237
+ - status.json: `state.status = 'completed'`
238
+ - update_plan: all steps → `"completed"` (skipped steps also marked completed)
239
+
240
+ ```
241
+ === COORDINATE COMPLETE ===
242
+ Session: <sessionId>
243
+ Chain: <chain>
244
+ Waves: <N> executed
245
+ Steps: <completed>/<total>
246
+
247
+ WAVE RESULTS:
248
+ [W1] $maestro-analyze --gaps → ✓ found 3 gaps
249
+ [W2] $maestro-plan --gaps → ✓ 12 tasks in 3 waves
250
+ [W3] $maestro-execute → ✓ 12/12 tasks done
251
+ [W4] $maestro-verify → ✓ all criteria met
252
+
253
+ State: .workflow/.maestro/<sessionId>/status.json
254
+ Resume: $maestro --continue
255
+ ```
256
+ </execution>
257
+
258
+ <csv_schema>
259
+ ### wave-{N}.csv (Per-Wave Input)
260
+
261
+ ```csv
262
+ id,skill_call,topic
263
+ "1","$maestro-analyze --gaps \"fix auth\" -y","Chain \"quality-fix\" step 1/4"
264
+ ```
265
+
266
+ | Column | Description |
267
+ |--------|-------------|
268
+ | `id` | Step number from chain (string) |
269
+ | `skill_call` | Full skill invocation assembled by coordinator with resolved context |
270
+ | `topic` | Brief description for the agent |
271
+
272
+ ### tasks.csv (Master State)
273
+
274
+ ```csv
275
+ id,skill,args,wave_n,status,findings,artifacts,error
276
+ ```
277
+
278
+ Accumulated across all waves. Updated after each wave completes.
279
+ </csv_schema>
280
+
281
+ <error_codes>
282
+ | Code | Severity | Condition | Recovery |
283
+ |------|----------|-----------|----------|
284
+ | E001 | error | Intent unclassifiable after clarification | Default to `feature` chain |
285
+ | E002 | error | Intent unresolvable after retry | List available chains, abort |
286
+ | E003 | error | Wave timeout (max_runtime_seconds) | Mark step `failed`, abort chain |
287
+ | E004 | error | Barrier artifact not found | Retry wave once, then abort |
288
+ | E005 | error | `--continue`: no session found | List sessions, prompt |
289
+ | W001 | warning | Barrier artifact partial | Continue with available context |
290
+ </error_codes>
291
+
292
+ <success_criteria>
293
+ - [ ] Intent classified and chain resolved (keyword heuristics or `--chain`)
294
+ - [ ] Session dir initialized with `status.json` before first wave
295
+ - [ ] Every skill invocation goes through `spawn_agents_on_csv` — none executed in coordinator
296
+ - [ ] Barrier skills execute solo in their wave; coordinator only reads artifacts afterward
297
+ - [ ] Non-barrier skills grouped into parallel waves where possible
298
+ - [ ] Each wave: CSV built → spawned → results read → state updated
299
+ - [ ] Barrier artifacts read and context updated before assembling next wave's skill_call args
300
+ - [ ] Failed step → remaining marked skipped → abort reported
301
+ - [ ] Completion report with per-wave status written to `context.md`
302
+ - [ ] `--dry-run` shows chain with [BARRIER] markers, no execution
303
+ - [ ] `--continue` resumes from last incomplete wave
304
+ </success_criteria>