maestro-flow-one 0.2.0 → 0.2.1

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 (96) hide show
  1. package/.ace-tool/index.json +108 -0
  2. package/bin/maestro-flow.js +30 -0
  3. package/claude/maestro-flow/agents/cli-explore-agent.md +187 -0
  4. package/claude/maestro-flow/agents/conceptual-planning-agent.md +245 -0
  5. package/claude/maestro-flow/agents/team-supervisor.md +143 -0
  6. package/claude/maestro-flow/agents/team-worker.md +237 -0
  7. package/claude/maestro-flow/agents/ui-design-agent.md +286 -0
  8. package/claude/maestro-flow/agents/workflow-analyzer.md +115 -0
  9. package/claude/maestro-flow/agents/workflow-codebase-mapper.md +77 -0
  10. package/claude/maestro-flow/agents/workflow-collab-planner.md +143 -0
  11. package/claude/maestro-flow/agents/workflow-debugger.md +103 -0
  12. package/claude/maestro-flow/agents/workflow-executor.md +129 -0
  13. package/claude/maestro-flow/agents/workflow-external-researcher.md +86 -0
  14. package/claude/maestro-flow/agents/workflow-integration-checker.md +83 -0
  15. package/claude/maestro-flow/agents/workflow-nyquist-auditor.md +85 -0
  16. package/claude/maestro-flow/agents/workflow-phase-researcher.md +85 -0
  17. package/claude/maestro-flow/agents/workflow-plan-checker.md +90 -0
  18. package/claude/maestro-flow/agents/workflow-planner.md +195 -0
  19. package/claude/maestro-flow/agents/workflow-project-researcher.md +74 -0
  20. package/claude/maestro-flow/agents/workflow-research-synthesizer.md +70 -0
  21. package/claude/maestro-flow/agents/workflow-reviewer.md +82 -0
  22. package/claude/maestro-flow/agents/workflow-roadmapper.md +81 -0
  23. package/claude/maestro-flow/agents/workflow-verifier.md +120 -0
  24. package/codex/maestro-flow/agents/team-supervisor.toml +40 -0
  25. package/codex/maestro-flow/agents/team-worker.toml +63 -0
  26. package/maestro-flow/agents/cli-explore-agent.md +187 -0
  27. package/maestro-flow/agents/conceptual-planning-agent.md +245 -0
  28. package/maestro-flow/agents/team-supervisor.md +143 -0
  29. package/maestro-flow/agents/team-worker.md +237 -0
  30. package/maestro-flow/agents/ui-design-agent.md +286 -0
  31. package/maestro-flow/agents/workflow-analyzer.md +115 -0
  32. package/maestro-flow/agents/workflow-codebase-mapper.md +77 -0
  33. package/maestro-flow/agents/workflow-collab-planner.md +143 -0
  34. package/maestro-flow/agents/workflow-debugger.md +103 -0
  35. package/maestro-flow/agents/workflow-executor.md +129 -0
  36. package/maestro-flow/agents/workflow-external-researcher.md +86 -0
  37. package/maestro-flow/agents/workflow-integration-checker.md +83 -0
  38. package/maestro-flow/agents/workflow-nyquist-auditor.md +85 -0
  39. package/maestro-flow/agents/workflow-phase-researcher.md +85 -0
  40. package/maestro-flow/agents/workflow-plan-checker.md +90 -0
  41. package/maestro-flow/agents/workflow-planner.md +195 -0
  42. package/maestro-flow/agents/workflow-project-researcher.md +74 -0
  43. package/maestro-flow/agents/workflow-research-synthesizer.md +70 -0
  44. package/maestro-flow/agents/workflow-reviewer.md +82 -0
  45. package/maestro-flow/agents/workflow-roadmapper.md +81 -0
  46. package/maestro-flow/agents/workflow-verifier.md +120 -0
  47. package/maestro-flow/commands/learn/decompose.md +176 -0
  48. package/maestro-flow/commands/learn/follow.md +167 -0
  49. package/maestro-flow/commands/learn/investigate.md +221 -0
  50. package/maestro-flow/commands/learn/retro.md +303 -0
  51. package/maestro-flow/commands/learn/second-opinion.md +167 -0
  52. package/maestro-flow/commands/lifecycle/amend.md +300 -0
  53. package/maestro-flow/commands/lifecycle/analyze.md +130 -0
  54. package/maestro-flow/commands/lifecycle/brainstorm.md +104 -0
  55. package/maestro-flow/commands/lifecycle/composer.md +354 -0
  56. package/maestro-flow/commands/lifecycle/execute.md +120 -0
  57. package/maestro-flow/commands/lifecycle/fork.md +86 -0
  58. package/maestro-flow/commands/lifecycle/init.md +78 -0
  59. package/maestro-flow/commands/lifecycle/learn.md +140 -0
  60. package/maestro-flow/commands/lifecycle/link-coordinate.md +71 -0
  61. package/maestro-flow/commands/lifecycle/merge.md +61 -0
  62. package/maestro-flow/commands/lifecycle/overlay.md +178 -0
  63. package/maestro-flow/commands/lifecycle/plan.md +154 -0
  64. package/maestro-flow/commands/lifecycle/player.md +404 -0
  65. package/maestro-flow/commands/lifecycle/quick.md +56 -0
  66. package/maestro-flow/commands/lifecycle/roadmap.md +164 -0
  67. package/maestro-flow/commands/lifecycle/ui-design.md +93 -0
  68. package/maestro-flow/commands/lifecycle/update.md +176 -0
  69. package/maestro-flow/commands/lifecycle/verify.md +96 -0
  70. package/maestro-flow/commands/manage/codebase-rebuild.md +75 -0
  71. package/maestro-flow/commands/manage/codebase-refresh.md +57 -0
  72. package/maestro-flow/commands/manage/harvest.md +94 -0
  73. package/maestro-flow/commands/manage/issue-discover.md +77 -0
  74. package/maestro-flow/commands/manage/issue.md +73 -0
  75. package/maestro-flow/commands/manage/knowhow-capture.md +193 -0
  76. package/maestro-flow/commands/manage/knowhow.md +77 -0
  77. package/maestro-flow/commands/manage/learn.md +67 -0
  78. package/maestro-flow/commands/manage/status.md +51 -0
  79. package/maestro-flow/commands/manage/wiki.md +62 -0
  80. package/maestro-flow/commands/milestone/audit.md +68 -0
  81. package/maestro-flow/commands/milestone/complete.md +75 -0
  82. package/maestro-flow/commands/milestone/release.md +96 -0
  83. package/maestro-flow/commands/quality/auto-test.md +128 -0
  84. package/maestro-flow/commands/quality/debug.md +125 -0
  85. package/maestro-flow/commands/quality/refactor.md +55 -0
  86. package/maestro-flow/commands/quality/retrospective.md +78 -0
  87. package/maestro-flow/commands/quality/review.md +114 -0
  88. package/maestro-flow/commands/quality/sync.md +51 -0
  89. package/maestro-flow/commands/quality/test.md +107 -0
  90. package/maestro-flow/commands/spec/add.md +49 -0
  91. package/maestro-flow/commands/spec/load.md +51 -0
  92. package/maestro-flow/commands/spec/remove.md +51 -0
  93. package/maestro-flow/commands/spec/setup.md +51 -0
  94. package/maestro-flow/commands/wiki/connect.md +62 -0
  95. package/maestro-flow/commands/wiki/digest.md +69 -0
  96. package/package.json +1 -1
@@ -0,0 +1,354 @@
1
+ ---
2
+ name: maestro-composer
3
+ description: Compose reusable workflow templates from natural language
4
+ argument-hint: "\"workflow description\" [--resume] [--edit <template-path>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Interactive workflow template composer. Parses natural language into a reusable DAG template
17
+ via 5 phases with user confirmation at each boundary. Templates saved globally at
18
+ `~/.maestro/templates/workflows/`. Progressive disclosure — specs loaded only when phase needs them.
19
+
20
+ Three entry modes:
21
+ 1. **New design**: Parse → [confirm] → Resolve → [confirm] → Enrich → Confirm pipeline → Persist
22
+ 2. **Resume design**: Load in-progress draft from `.workflow/templates/design-drafts/`
23
+ 3. **Edit template**: Load existing template, modify, re-save
24
+ </purpose>
25
+
26
+ <deferred_reading>
27
+ - [node-catalog](~/.maestro/templates/workflows/specs/node-catalog.md) — read at Phase 2 (Resolve) when mapping steps to executors
28
+ - [template-schema](~/.maestro/templates/workflows/specs/template-schema.md) — read at Phase 5 (Persist) when assembling final JSON
29
+ </deferred_reading>
30
+
31
+ <context>
32
+ $ARGUMENTS — natural language workflow description, or flags.
33
+
34
+ **Flags:**
35
+ - `--resume` — Resume in-progress design session
36
+ - `--edit <template-path>` — Edit an existing template
37
+
38
+ **Shared constants:**
39
+
40
+ | Constant | Value |
41
+ |----------|-------|
42
+ | Session prefix | `WFD` |
43
+ | Template dir (global) | `~/.maestro/templates/workflows/` |
44
+ | Template index (global) | `~/.maestro/templates/workflows/index.json` |
45
+ | Design drafts dir (local) | `.workflow/templates/design-drafts/` |
46
+ | Template ID format | `wft-<slug>-<YYYYMMDD>` |
47
+ | Node ID format | `N-<seq>` (e.g. N-001), `CP-<seq>` for checkpoints |
48
+ | Max nodes | 20 |
49
+
50
+ **Entry routing:**
51
+
52
+ | Detection | Condition | Handler |
53
+ |-----------|-----------|---------|
54
+ | Resume design | `--resume` flag or existing WFD session | Phase 0: Resume |
55
+ | Edit template | `--edit <template-path>` | Phase 0: Load + Edit |
56
+ | New design | Default | Phase 1: Parse |
57
+ </context>
58
+
59
+ <execution>
60
+
61
+ ### Phase 0: Resume / Edit (conditional)
62
+
63
+ **Resume design session** (if `--resume`):
64
+ 1. Scan `.workflow/templates/design-drafts/WFD-*/` for in-progress designs
65
+ 2. Multiple found → AskUserQuestion for selection
66
+ 3. Load draft → skip to last incomplete phase
67
+
68
+ **Edit existing template** (if `--edit <path>`):
69
+ 1. Load template from `--edit` path
70
+ 2. Show current pipeline visualization (Phase 4 format)
71
+ 3. AskUserQuestion: which nodes to modify/add/remove
72
+ 4. Re-enter at Phase 3 with edits applied
73
+
74
+ ---
75
+
76
+ ### Phase 1: Parse — Semantic Intent Extraction
77
+
78
+ **Step 1.1** — Parse `$ARGUMENTS` as description. If empty, AskUserQuestion:
79
+ ```
80
+ "Describe the workflow you want to automate.
81
+ Include: what steps to run, in what order, and what varies each time (inputs).
82
+ Example: 'analyze the code, then plan, implement, and test the feature'"
83
+ ```
84
+
85
+ **Step 1.2** — Extract sequential actions as candidate nodes using semantic understanding:
86
+
87
+ | Signal | Candidate Type |
88
+ |--------|---------------|
89
+ | "analyze", "review", "explore" | analysis (cli) |
90
+ | "plan", "design", "spec" | planning (skill) |
91
+ | "implement", "build", "code", "fix" | execution (skill) |
92
+ | "test", "validate", "verify" | testing (skill) |
93
+ | "brainstorm", "ideate" | brainstorm (skill) |
94
+ | "review code" | review (skill) |
95
+ | "then", "next", "after" | sequential edge |
96
+ | "parallel", "simultaneously" | parallel edge |
97
+
98
+ **Step 1.3** — Extract variables (inputs that vary per run). Detect from: direct mentions, `{var}` patterns, implicit from task type.
99
+
100
+ **Step 1.4** — Classify task type: `bugfix | feature | tdd | review | brainstorm | spec-driven | roadmap | refactor | auto-test | quick-task | custom`
101
+
102
+ **Step 1.5** — Assess complexity: `simple` (1-3 nodes), `medium` (4-7), `complex` (8+)
103
+
104
+ **Step 1.6** — Write `intent.json` to `.workflow/templates/design-drafts/WFD-<slug>-<date>/`.
105
+
106
+ **Step 1.7 — Interactive confirmation**:
107
+
108
+ Display parsed intent summary:
109
+ ```
110
+ ============================================================
111
+ COMPOSER — Intent Parsed
112
+ ============================================================
113
+ Description: "<original input>"
114
+ Task type: <type>
115
+ Complexity: <level>
116
+
117
+ Detected steps:
118
+ 1. <description> → <type_hint>
119
+ 2. <description> → <type_hint>
120
+ 3. <description> → <type_hint>
121
+
122
+ Variables:
123
+ - goal (required): <inferred description>
124
+
125
+ Draft: .workflow/templates/design-drafts/WFD-<slug>-<date>/
126
+ ============================================================
127
+ ```
128
+
129
+ AskUserQuestion:
130
+ ```
131
+ options:
132
+ - "Looks good, continue to resolution" → Phase 2
133
+ - "Edit steps" → re-describe, re-parse
134
+ - "Add a step" → append, re-parse
135
+ - "Cancel" → save draft, exit
136
+ ```
137
+
138
+ ---
139
+
140
+ ### Phase 2: Resolve — Map Steps to Executor Nodes
141
+
142
+ **Read deferred**: `~/.maestro/templates/workflows/specs/node-catalog.md` — load node catalog for executor mapping.
143
+
144
+ If the spec file does not exist, use the built-in fallback mapping:
145
+
146
+ | type_hint | Default executor type | Default executor |
147
+ |-----------|----------------------|------------------|
148
+ | `planning` | skill | `maestro-plan` |
149
+ | `execution` | skill | `maestro-execute` |
150
+ | `testing` | skill | `quality-test` |
151
+ | `review` | skill | `quality-review` |
152
+ | `brainstorm` | skill | `maestro-brainstorm` |
153
+ | `analysis` | cli | `maestro delegate --role analyze --mode analysis` |
154
+ | `verify` | skill | `maestro-verify` |
155
+ | `refactor` | skill | `quality-refactor` |
156
+ | `debug` | skill | `quality-debug` |
157
+ | `spec` | skill | `maestro-roadmap --mode full` |
158
+ | `checkpoint` | checkpoint | — |
159
+
160
+ **Step 2.1** — Load `intent.json`.
161
+
162
+ **Step 2.2** — Map each step to executor. Resolution: match `type_hint` → catalog → semantic fit → fallback `cli`.
163
+
164
+ **Step 2.3** — Build `args_template` with variable placeholders. Context injection:
165
+ - Planning after analysis → `--context {prev_output_path}`
166
+ - Execution after planning → `--resume-session {prev_session_id}`
167
+ - Testing after execution → `--session {prev_session_id}`
168
+
169
+ **Step 2.4** — Assign `parallel_group` for steps with `parallel_with` set.
170
+
171
+ **Step 2.5** — Write `nodes.json`.
172
+
173
+ **Step 2.6 — Interactive confirmation**:
174
+
175
+ Display resolved nodes:
176
+ ```
177
+ ============================================================
178
+ COMPOSER — Nodes Resolved
179
+ ============================================================
180
+ N-001 [skill] maestro-plan "{goal}"
181
+ N-002 [skill] maestro-execute {phase}
182
+ N-003 [skill] quality-test {phase}
183
+
184
+ Parallel groups: none
185
+ ============================================================
186
+ ```
187
+
188
+ AskUserQuestion:
189
+ ```
190
+ options:
191
+ - "Continue to checkpoint injection" → Phase 3
192
+ - "Change executor for a node" → select node, pick new executor
193
+ - "Change node type" → skill/cli/agent/command
194
+ - "Back to intent" → Phase 1
195
+ - "Cancel" → save draft, exit
196
+ ```
197
+
198
+ ---
199
+
200
+ ### Phase 3: Enrich — Inject Checkpoints + Build DAG
201
+
202
+ **Step 3.1** — Load `nodes.json`.
203
+
204
+ **Step 3.2** — Build sequential edges (N-001 → N-002 → ...). For parallel groups: fan-out/fan-in.
205
+
206
+ **Step 3.3** — Auto-inject checkpoint nodes. Inject if ANY rule triggers:
207
+
208
+ | Rule | Condition |
209
+ |------|-----------|
210
+ | Artifact boundary | Source output_ports: plan, spec, analysis, review-findings |
211
+ | Execution gate | Target executor contains `execute` |
212
+ | Agent spawn | Target type is `agent` |
213
+ | Long-running | Target is maestro-plan, maestro-roadmap --mode full |
214
+ | User-defined | Step had `type_hint: checkpoint` |
215
+ | Post-testing | Source executor contains `test` or `auto-test` |
216
+
217
+ Set `auto_continue: false` for checkpoints before user-facing deliverables.
218
+
219
+ **Step 3.4** — Insert checkpoint edges (A → B becomes A → CP-X → B).
220
+
221
+ **Step 3.5** — Finalize `context_schema` from all `{variable}` references.
222
+
223
+ **Step 3.6** — Validate: no cycles, no orphans, all nodes reachable.
224
+
225
+ **Step 3.7** — Write `dag.json`.
226
+
227
+ → Proceed directly to Phase 4 (confirm is the pipeline visualization).
228
+
229
+ ---
230
+
231
+ ### Phase 4: Confirm — Visualize + User Approval
232
+
233
+ **Step 4.1** — Render ASCII pipeline from `dag.json`:
234
+ ```
235
+ ============================================================
236
+ COMPOSER — Pipeline Review
237
+ ============================================================
238
+ Pipeline: <template-name>
239
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
240
+ N-001 [skill] maestro-plan "{goal}"
241
+ |
242
+ CP-01 [checkpoint] After Plan auto-continue
243
+ |
244
+ N-002 [skill] maestro-execute {phase}
245
+ |
246
+ CP-02 [checkpoint] Before Tests pause-for-user
247
+ |
248
+ N-003 [skill] quality-test {phase}
249
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
250
+ Variables (required): goal
251
+ Checkpoints: 2 (1 auto, 1 pause)
252
+ Nodes: 3 work + 2 checkpoints
253
+ ============================================================
254
+ ```
255
+
256
+ For parallel groups show fan-out/fan-in:
257
+ ```
258
+ N-003a [skill] quality-review ─┐
259
+ ├─ N-004 [skill] quality-test
260
+ N-003b [cli] cli analysis ─┘
261
+ ```
262
+
263
+ **Step 4.2** — AskUserQuestion:
264
+ ```
265
+ options:
266
+ - "Confirm & Save" → Phase 5
267
+ - "Edit a node" → select node ID, modify executor/args, re-render
268
+ - "Add a node" → insert position + description, re-resolve + re-enrich, re-render
269
+ - "Remove a node" → select node, re-wire edges, re-render
270
+ - "Rename template" → new name
271
+ - "Re-run checkpoint injection" → back to Phase 3.3
272
+ - "Cancel" → save draft, output resume command
273
+ ```
274
+
275
+ **Step 4.3** — On edit: apply change, re-render, re-ask. Loop until Confirm or Cancel.
276
+
277
+ **Step 4.4** — On Confirm: freeze dag.json, proceed to Phase 5. On Cancel: save draft, output `/maestro-composer --resume`.
278
+
279
+ ---
280
+
281
+ ### Phase 5: Persist — Assemble + Save Template
282
+
283
+ **Read deferred**: `~/.maestro/templates/workflows/specs/template-schema.md` — load full JSON schema for template assembly.
284
+
285
+ If the spec file does not exist, use the built-in template structure:
286
+ ```json
287
+ {
288
+ "template_id": "wft-<slug>-<YYYYMMDD>",
289
+ "name": "<name>", "description": "<desc>", "version": "1.0",
290
+ "created_at": "<ISO>", "source_session": "WFD-<slug>-<date>",
291
+ "tags": [], "context_schema": {},
292
+ "nodes": [], "edges": [], "checkpoints": [],
293
+ "execution_mode": "serial",
294
+ "metadata": { "node_count": 0, "checkpoint_count": 0 }
295
+ }
296
+ ```
297
+
298
+ **Step 5.1** — Load `intent.json` + `dag.json`.
299
+
300
+ **Step 5.2** — Determine template name (from Phase 4 or derive from task_type + description). Slug = kebab-case. If file exists with different content, append `-v2`, `-v3`.
301
+
302
+ **Step 5.3** — Assemble template JSON.
303
+
304
+ **Step 5.4** — Ensure `~/.maestro/templates/workflows/` exists. Write `<slug>.json`.
305
+
306
+ **Step 5.5** — Update `~/.maestro/templates/workflows/index.json`.
307
+
308
+ **Step 5.6** — Output summary:
309
+ ```
310
+ ============================================================
311
+ COMPOSER — Template Saved
312
+ ============================================================
313
+ Path: ~/.maestro/templates/workflows/<slug>.json
314
+ ID: wft-<slug>-<date>
315
+ Nodes: <n> work + <n> checkpoints
316
+ Variables: <required vars>
317
+
318
+ To execute:
319
+ /maestro-player <slug> --context goal="<your goal>"
320
+
321
+ To edit later:
322
+ /maestro-composer --edit ~/.maestro/templates/workflows/<slug>.json
323
+
324
+ To list all templates:
325
+ /maestro-player --list
326
+ ============================================================
327
+ ```
328
+
329
+ **Step 5.7** — Clean up design draft directory.
330
+ </execution>
331
+
332
+ <error_codes>
333
+ | Code | Severity | Description | Recovery |
334
+ |------|----------|-------------|----------|
335
+ | E001 | error | Empty description and no flags | AskUserQuestion for workflow description |
336
+ | E002 | error | Step extraction found 0 steps | Ask user to rephrase with action verbs |
337
+ | E003 | error | Node count exceeds max (20) | Suggest splitting into sub-workflows |
338
+ | E004 | error | DAG cycle detected | Show cycle, ask user to resolve |
339
+ | E005 | error | Resume session not found | Show available design drafts |
340
+ | E006 | error | Edit template not found | Show available templates |
341
+ | W001 | warning | Ambiguous step-to-executor mapping | Show candidates, let user choose |
342
+ | W002 | warning | No checkpoint injection rules triggered | Warn user, offer to add manually |
343
+ | W003 | warning | Deferred spec file not found | Use built-in fallback, continue |
344
+ </error_codes>
345
+
346
+ <success_criteria>
347
+ - [ ] Intent parsed and confirmed by user (Phase 1 interactive gate)
348
+ - [ ] Nodes resolved and confirmed by user (Phase 2 interactive gate)
349
+ - [ ] DAG built with auto-injected checkpoints
350
+ - [ ] Pipeline visualized and confirmed by user (Phase 4 interactive gate)
351
+ - [ ] Template JSON written to `~/.maestro/templates/workflows/<slug>.json`
352
+ - [ ] Template index updated at `~/.maestro/templates/workflows/index.json`
353
+ - [ ] Deferred specs loaded only when phase needs them (not upfront)
354
+ </success_criteria>
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: maestro-execute
3
+ description: Execute plan with parallel waves and atomic commits
4
+ argument-hint: "[phase] [--auto-commit] [--method agent|cli|auto] [--executor <tool>] [--dir <path>] [-y]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Execute all tasks in a plan using wave-based parallel execution with dependency-aware ordering. Each plan is executed independently (plans串行, plan内wave并行). Task summaries are written to the plan's scratch directory under `.summaries/`. Registers EXC artifact in state.json.
17
+
18
+ Invoked after /maestro-plan produces a confirmed plan. When called without args on a milestone, finds all pending plans and executes them sequentially.
19
+ </purpose>
20
+
21
+ <required_reading>
22
+ @~/.maestro/workflows/execute.md
23
+ </required_reading>
24
+
25
+ <deferred_reading>
26
+ - [task.json](~/.maestro/templates/task.json) — read when reading task definitions
27
+ - [state.json](~/.maestro/templates/state.json) — read when registering artifact
28
+ </deferred_reading>
29
+
30
+ <context>
31
+ $ARGUMENTS — phase number, or no args for milestone-wide execution, with optional flags.
32
+
33
+ Scope routing, flags, resolution logic, output directory format, artifact registration schema, and incremental learning extraction are defined in workflow `execute.md`.
34
+
35
+ ### Pre-load context (before task execution)
36
+
37
+ 1. **Codebase docs**: If `.workflow/codebase/doc-index.json` exists, read `ARCHITECTURE.md` for module boundaries. Pass as shared context to executor agents.
38
+ 2. **Wiki knowledge**: Run `maestro wiki search "<phase keywords>" --json 2>/dev/null`. If results found, extract top 5 entries as prior knowledge context for agents.
39
+ 3. Both are optional — proceed without if unavailable (log warning).
40
+ </context>
41
+
42
+ <execution>
43
+ ### Pre-flight: team conflict check
44
+
45
+ Before any task execution, run:
46
+ ```
47
+ Bash("maestro collab preflight --phase <phase-number>")
48
+ ```
49
+ If exit code is 1, present warnings and ask whether to proceed.
50
+
51
+ Follow '~/.maestro/workflows/execute.md' completely.
52
+
53
+ ### Post-task Knowledge Inquiry
54
+
55
+ After each task completes, evaluate inquiry triggers:
56
+
57
+ 1. **Execution deviation**: If task summary mentions approach change, dependency swap, or plan deviation:
58
+ → Ask: "TASK-{NNN} deviated from the plan. Should this decision be recorded as an architecture constraint? (`/spec-add arch`)"
59
+
60
+ 2. **Retry success**: If task required ≥2 retries before completion:
61
+ → Ask: "TASK-{NNN} succeeded after {N} retries. Should this fix pattern be documented? (`/spec-add debug`)"
62
+
63
+ 3. **Implicit knowledge**: If task summary contains design rationale ("chose X because", "rejected Y due to"):
64
+ → Ask: "Design decision detected. Should it be recorded as a learning? (`/spec-add learning`)"
65
+
66
+ If user confirms, invoke `Skill({ skill: "spec-add", args: "<category> <content>" })` with extracted content.
67
+
68
+ ### Issue Status Sync
69
+
70
+ On each task completion, if `task.issue_id` exists, sync status back to the issue in `.workflow/issues/issues.jsonl`:
71
+
72
+ ```
73
+ For each completed/failed TASK with issue_id:
74
+ Read issue from issues.jsonl by issue_id
75
+ Collect all task_refs[] statuses for that issue:
76
+ all task_refs completed → issue.status = "resolved"
77
+ any task_ref failed → issue.status = "in_progress"
78
+ Append history entry: { action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }
79
+ Write updated issue back to issues.jsonl
80
+ ```
81
+
82
+ **Report format on completion:**
83
+
84
+ ```
85
+ === EXECUTION COMPLETE ===
86
+ Plans executed: {plans_count}
87
+ Completed: {completed_count}/{total_count} tasks
88
+ Failed: {failed_count} tasks
89
+
90
+ Summaries: {plan_dir}/.summaries/
91
+ Tasks: {plan_dir}/.task/
92
+
93
+ Next steps:
94
+ /maestro-verify -- Verify execution results
95
+ /maestro-verify --dir {dir} -- Verify specific plan
96
+ /manage-status -- View project dashboard
97
+ ```
98
+
99
+ If failed tasks exist, suggest /quality-debug for investigation.
100
+ </execution>
101
+
102
+ <error_codes>
103
+ | Code | Severity | Condition | Recovery |
104
+ |------|----------|-----------|----------|
105
+ | E001 | error | No pending plans found | Verify plans exist, run maestro-plan first |
106
+ | E002 | error | Plan directory not found | Check --dir path |
107
+ | E003 | error | plan.json not found in directory | Verify plan.json exists, run maestro-plan first |
108
+ | E004 | error | No pending tasks, all tasks already completed | Check task statuses, reset if needed |
109
+ | W001 | warning | Executor completed with partial failures | Check task dependencies, retry failed wave |
110
+ </error_codes>
111
+
112
+ <success_criteria>
113
+ - [ ] All pending plans identified and executed sequentially
114
+ - [ ] Within each plan: waves executed in parallel, waves串行
115
+ - [ ] `.summaries/TASK-{NNN}-summary.md` written for each completed task
116
+ - [ ] `.task/TASK-{NNN}.json` statuses updated (completed|blocked)
117
+ - [ ] EXC artifact registered in state.json for each plan executed
118
+ - [ ] Incremental learnings extracted to specs/learnings.md
119
+ - [ ] state.json updated with execution progress
120
+ </success_criteria>
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: maestro-fork
3
+ description: Create or sync milestone worktree for parallel dev
4
+ argument-hint: "-m <milestone-number> [--base <branch>] [--sync]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Create a git worktree for an entire milestone, enabling inter-milestone parallel development. The worktree scope is milestone-level — all scratch artifacts for that milestone are owned by the worktree.
17
+
18
+ Since `.workflow/` is gitignored, this command explicitly copies project context and existing milestone scratch artifacts into the worktree. Per-phase parallelism within a milestone is NOT supported.
19
+
20
+ Also supports `--sync` mode to pull latest main branch changes and shared artifacts into an active worktree (prevents source and artifact drift for long-lived worktrees).
21
+
22
+ Produces `.workflow/worktrees.json` registry in the main worktree and `.workflow/worktree-scope.json` marker in the worktree.
23
+ </purpose>
24
+
25
+ <required_reading>
26
+ @~/.maestro/workflows/fork.md
27
+ </required_reading>
28
+
29
+ <deferred_reading>
30
+ - [worktrees.json](~/.maestro/templates/worktrees.json) — read when updating registry
31
+ - [worktree-scope.json](~/.maestro/templates/worktree-scope.json) — read when writing scope marker
32
+ </deferred_reading>
33
+
34
+ <context>
35
+ $ARGUMENTS -- milestone number and optional flags.
36
+
37
+ Modes (`Fork` / `Sync`), flags (`-m`, `--base`, `--sync`), milestone resolution, worktree layout, and artifact scoping are defined in workflow `fork.md`.
38
+ </context>
39
+
40
+ <execution>
41
+ Follow '~/.maestro/workflows/fork.md' completely.
42
+
43
+ Fork and sync algorithm steps are defined in workflow `fork.md`.
44
+
45
+ **Next-step routing on completion:**
46
+
47
+ Fork mode:
48
+ - Enter worktree → `cd {wt.path} && /maestro-analyze`
49
+ - Automated → `maestro delegate "run full lifecycle for milestone" --cd {wt.path} --mode write`
50
+ - Status → Skill({ skill: "manage-status" })
51
+
52
+ Sync mode:
53
+ - Sync complete → resume work in worktree
54
+ - Conflicts found → resolve manually, then retry
55
+ </execution>
56
+
57
+ <error_codes>
58
+ | Code | Severity | Condition | Recovery |
59
+ |------|----------|-----------|----------|
60
+ | E001 | error | Project not initialized | Run maestro-init first |
61
+ | E002 | error | No roadmap found | Run maestro-roadmap first |
62
+ | E003 | error | Running inside a worktree | Run from main worktree |
63
+ | E004 | error | No milestone number provided | Provide `-m <N>` |
64
+ | E005 | error | No milestones defined in state.json | Run maestro-roadmap first |
65
+ | E006 | error | Milestone number out of range | Check available milestones |
66
+ | E007 | error | No active worktree for milestone (--sync) | Check worktrees.json |
67
+ | E008 | error | Milestone already has active worktree | Merge or cleanup first |
68
+ </error_codes>
69
+
70
+ <success_criteria>
71
+ Fork mode:
72
+ - [ ] Milestone resolved from state.json.milestones[]
73
+ - [ ] Git worktree created with branch (`milestone/{slug}`)
74
+ - [ ] Shared `.workflow/` files copied (project.md, roadmap.md, config.json, specs/)
75
+ - [ ] Milestone scratch artifacts copied (filtered from artifact registry)
76
+ - [ ] `worktree-scope.json` written with milestone scope
77
+ - [ ] Scoped `state.json` written (only this milestone's artifacts)
78
+ - [ ] `worktrees.json` registry updated in main worktree
79
+ - [ ] Milestone marked as `"forked"` in main `state.json.milestones[]`
80
+ - [ ] Summary displayed with next-step commands
81
+
82
+ Sync mode:
83
+ - [ ] Git merge main into worktree branch
84
+ - [ ] Shared artifacts re-copied (project.md, roadmap.md, config.json, specs/)
85
+ - [ ] Conflicts reported if any
86
+ </success_criteria>
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: maestro-init
3
+ description: Initialize project with auto state detection
4
+ argument-hint: "[-y] [--from-brainstorm SESSION-ID]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Agent
12
+ - AskUserQuestion
13
+ ---
14
+ <purpose>
15
+ Initialize a new project through auto state detection and unified flow. Invoked when starting a fresh project or onboarding an existing codebase into workflow management. Produces the `.workflow/` directory structure with project.md, state.json, config.json, and specs. Does NOT create roadmap — use maestro-roadmap (light mode, default) or maestro-roadmap --mode full (spec package) as the next step.
16
+ </purpose>
17
+
18
+ <required_reading>
19
+ @~/.maestro/workflows/init.md
20
+ @~/.maestro/templates/project.md
21
+ @~/.maestro/templates/state.json
22
+ @~/.maestro/templates/config.json
23
+ </required_reading>
24
+
25
+ <context>
26
+ **Flags:**
27
+ - `-y` -- Automatic mode. After config questions, runs research without further interaction. Expects idea document via @ reference.
28
+ - `--from-brainstorm SESSION-ID` -- Import from a brainstorm session. Reads guidance-specification.md to pre-fill project vision, goals, constraints, and terminology. Skips interactive questioning.
29
+
30
+ **Load project state if exists:**
31
+ Check for `.workflow/state.json` -- loads context if project already initialized.
32
+ </context>
33
+
34
+ <execution>
35
+ Follow '~/.maestro/workflows/init.md' completely.
36
+
37
+ **Report format on completion:**
38
+
39
+ ```
40
+ === WORKFLOW INITIALIZED ===
41
+ Project: {project_name}
42
+ State: .workflow/state.json (active)
43
+
44
+ Created:
45
+ .workflow/project.md
46
+ .workflow/state.json
47
+ .workflow/config.json
48
+ .workflow/specs/
49
+
50
+ Next steps (choose one path to create roadmap):
51
+ /maestro-roadmap <requirement> -- Direct interactive roadmap (light, default)
52
+ /maestro-roadmap --mode full <idea> -- Full spec package + roadmap (heavy)
53
+
54
+ Other commands:
55
+ /manage-status -- View project dashboard
56
+ /maestro-brainstorm <topic> -- Explore ideas first
57
+ /maestro-quick <task> -- Quick ad-hoc task
58
+ ```
59
+ </execution>
60
+
61
+ <error_codes>
62
+ | Code | Severity | Condition | Recovery |
63
+ |------|----------|-----------|----------|
64
+ | E001 | error | No arguments provided when -y requires @ reference | Check arguments format, re-run with correct input |
65
+ | E002 | error | .workflow/ already exists for greenfield init | Check .workflow/ directory state, resolve conflicts |
66
+ | E003 | error | Brainstorm session not found (--from-brainstorm) | Check arguments format, re-run with correct input |
67
+ | W001 | warning | Research agent failed, continuing with partial results | Retry research or proceed with partial results |
68
+ </error_codes>
69
+
70
+ <success_criteria>
71
+ - [ ] Deep questioning completed (threads followed, not rushed) — or extracted from document/brainstorm
72
+ - [ ] `.workflow/project.md` created with Core Value, Requirements (Validated/Active/Out of Scope), Key Decisions
73
+ - [ ] `.workflow/state.json` created with artifacts[] array, initialized to idle state
74
+ - [ ] `.workflow/config.json` created with user-selected granularity, workflow agents, gate preferences
75
+ - [ ] `.workflow/specs/` initialized with convention files
76
+ - [ ] Research completed (if enabled) — 4 parallel agents spawned
77
+ - [ ] User knows next step is `/maestro-roadmap` (light) or `/maestro-roadmap --mode full` (spec package)
78
+ </success_criteria>