maestro-flow-one 0.1.0

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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +173 -0
  3. package/bin/maestro-flow.js +730 -0
  4. package/claude/maestro-flow/SKILL.md +239 -0
  5. package/claude/maestro-flow/chains/templates.json +256 -0
  6. package/claude/maestro-flow/commands/learn/decompose.md +176 -0
  7. package/claude/maestro-flow/commands/learn/follow.md +167 -0
  8. package/claude/maestro-flow/commands/learn/investigate.md +221 -0
  9. package/claude/maestro-flow/commands/learn/retro.md +303 -0
  10. package/claude/maestro-flow/commands/learn/second-opinion.md +167 -0
  11. package/claude/maestro-flow/commands/lifecycle/amend.md +300 -0
  12. package/claude/maestro-flow/commands/lifecycle/analyze.md +126 -0
  13. package/claude/maestro-flow/commands/lifecycle/brainstorm.md +100 -0
  14. package/claude/maestro-flow/commands/lifecycle/composer.md +354 -0
  15. package/claude/maestro-flow/commands/lifecycle/execute.md +114 -0
  16. package/claude/maestro-flow/commands/lifecycle/fork.md +86 -0
  17. package/claude/maestro-flow/commands/lifecycle/init.md +78 -0
  18. package/claude/maestro-flow/commands/lifecycle/learn.md +140 -0
  19. package/claude/maestro-flow/commands/lifecycle/link-coordinate.md +71 -0
  20. package/claude/maestro-flow/commands/lifecycle/merge.md +61 -0
  21. package/claude/maestro-flow/commands/lifecycle/overlay.md +178 -0
  22. package/claude/maestro-flow/commands/lifecycle/plan.md +138 -0
  23. package/claude/maestro-flow/commands/lifecycle/player.md +404 -0
  24. package/claude/maestro-flow/commands/lifecycle/quick.md +56 -0
  25. package/claude/maestro-flow/commands/lifecycle/roadmap.md +164 -0
  26. package/claude/maestro-flow/commands/lifecycle/ui-design.md +93 -0
  27. package/claude/maestro-flow/commands/lifecycle/update.md +176 -0
  28. package/claude/maestro-flow/commands/lifecycle/verify.md +90 -0
  29. package/claude/maestro-flow/commands/manage/codebase-rebuild.md +75 -0
  30. package/claude/maestro-flow/commands/manage/codebase-refresh.md +57 -0
  31. package/claude/maestro-flow/commands/manage/harvest.md +94 -0
  32. package/claude/maestro-flow/commands/manage/issue-discover.md +77 -0
  33. package/claude/maestro-flow/commands/manage/issue.md +73 -0
  34. package/claude/maestro-flow/commands/manage/knowhow-capture.md +193 -0
  35. package/claude/maestro-flow/commands/manage/knowhow.md +77 -0
  36. package/claude/maestro-flow/commands/manage/learn.md +67 -0
  37. package/claude/maestro-flow/commands/manage/status.md +51 -0
  38. package/claude/maestro-flow/commands/manage/wiki.md +62 -0
  39. package/claude/maestro-flow/commands/milestone/audit.md +68 -0
  40. package/claude/maestro-flow/commands/milestone/complete.md +75 -0
  41. package/claude/maestro-flow/commands/milestone/release.md +96 -0
  42. package/claude/maestro-flow/commands/quality/auto-test.md +124 -0
  43. package/claude/maestro-flow/commands/quality/debug.md +115 -0
  44. package/claude/maestro-flow/commands/quality/refactor.md +55 -0
  45. package/claude/maestro-flow/commands/quality/retrospective.md +78 -0
  46. package/claude/maestro-flow/commands/quality/review.md +108 -0
  47. package/claude/maestro-flow/commands/quality/sync.md +51 -0
  48. package/claude/maestro-flow/commands/quality/test.md +103 -0
  49. package/claude/maestro-flow/commands/spec/add.md +49 -0
  50. package/claude/maestro-flow/commands/spec/load.md +51 -0
  51. package/claude/maestro-flow/commands/spec/remove.md +51 -0
  52. package/claude/maestro-flow/commands/spec/setup.md +51 -0
  53. package/claude/maestro-flow/commands/wiki/connect.md +62 -0
  54. package/claude/maestro-flow/commands/wiki/digest.md +69 -0
  55. package/codex/maestro-flow/SKILL.md +505 -0
  56. package/codex/maestro-flow/chains/templates.json +256 -0
  57. package/codex/maestro-flow/commands/learn/decompose.md +113 -0
  58. package/codex/maestro-flow/commands/learn/follow.md +83 -0
  59. package/codex/maestro-flow/commands/learn/investigate.md +83 -0
  60. package/codex/maestro-flow/commands/learn/retro.md +83 -0
  61. package/codex/maestro-flow/commands/learn/second-opinion.md +86 -0
  62. package/codex/maestro-flow/commands/lifecycle/amend.md +300 -0
  63. package/codex/maestro-flow/commands/lifecycle/analyze.md +483 -0
  64. package/codex/maestro-flow/commands/lifecycle/brainstorm.md +397 -0
  65. package/codex/maestro-flow/commands/lifecycle/composer.md +213 -0
  66. package/codex/maestro-flow/commands/lifecycle/execute.md +318 -0
  67. package/codex/maestro-flow/commands/lifecycle/fork.md +98 -0
  68. package/codex/maestro-flow/commands/lifecycle/init.md +134 -0
  69. package/codex/maestro-flow/commands/lifecycle/learn.md +80 -0
  70. package/codex/maestro-flow/commands/lifecycle/link-coordinate.md +257 -0
  71. package/codex/maestro-flow/commands/lifecycle/merge.md +69 -0
  72. package/codex/maestro-flow/commands/lifecycle/overlay.md +119 -0
  73. package/codex/maestro-flow/commands/lifecycle/plan.md +460 -0
  74. package/codex/maestro-flow/commands/lifecycle/player.md +323 -0
  75. package/codex/maestro-flow/commands/lifecycle/quick.md +124 -0
  76. package/codex/maestro-flow/commands/lifecycle/roadmap.md +468 -0
  77. package/codex/maestro-flow/commands/lifecycle/ui-design.md +135 -0
  78. package/codex/maestro-flow/commands/lifecycle/update.md +176 -0
  79. package/codex/maestro-flow/commands/lifecycle/verify.md +468 -0
  80. package/codex/maestro-flow/commands/manage/codebase-rebuild.md +347 -0
  81. package/codex/maestro-flow/commands/manage/codebase-refresh.md +66 -0
  82. package/codex/maestro-flow/commands/manage/harvest.md +91 -0
  83. package/codex/maestro-flow/commands/manage/issue-discover.md +431 -0
  84. package/codex/maestro-flow/commands/manage/issue.md +75 -0
  85. package/codex/maestro-flow/commands/manage/knowhow-capture.md +110 -0
  86. package/codex/maestro-flow/commands/manage/knowhow.md +95 -0
  87. package/codex/maestro-flow/commands/manage/learn.md +137 -0
  88. package/codex/maestro-flow/commands/manage/status.md +76 -0
  89. package/codex/maestro-flow/commands/manage/wiki.md +55 -0
  90. package/codex/maestro-flow/commands/milestone/audit.md +87 -0
  91. package/codex/maestro-flow/commands/milestone/complete.md +91 -0
  92. package/codex/maestro-flow/commands/milestone/release.md +70 -0
  93. package/codex/maestro-flow/commands/quality/auto-test.md +547 -0
  94. package/codex/maestro-flow/commands/quality/debug.md +334 -0
  95. package/codex/maestro-flow/commands/quality/refactor.md +151 -0
  96. package/codex/maestro-flow/commands/quality/retrospective.md +292 -0
  97. package/codex/maestro-flow/commands/quality/review.md +364 -0
  98. package/codex/maestro-flow/commands/quality/sync.md +111 -0
  99. package/codex/maestro-flow/commands/quality/test.md +498 -0
  100. package/codex/maestro-flow/commands/spec/add.md +101 -0
  101. package/codex/maestro-flow/commands/spec/load.md +77 -0
  102. package/codex/maestro-flow/commands/spec/remove.md +69 -0
  103. package/codex/maestro-flow/commands/spec/setup.md +75 -0
  104. package/codex/maestro-flow/commands/wiki/connect.md +73 -0
  105. package/codex/maestro-flow/commands/wiki/digest.md +87 -0
  106. package/package.json +24 -0
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: maestro-brainstorm
3
+ description: Unified brainstorming with dual-mode operation - auto pipeline and single role analysis
4
+ argument-hint: "[topic|role-name] [--yes] [--count N] [--session ID] [--update] [--skip-questions] [--include-questions] [--style-skill PKG]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Agent
12
+ - AskUserQuestion
13
+ ---
14
+ <purpose>
15
+ Unified brainstorming combining interactive framework generation, multi-role parallel analysis, and cross-role synthesis. Two modes: Auto (full pipeline with guidance-specification → parallel role analysis → synthesis) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in .brainstorming/ directory ready for downstream planning.
16
+ </purpose>
17
+
18
+ <required_reading>
19
+ @~/.maestro/workflows/brainstorm.md
20
+ </required_reading>
21
+
22
+ <deferred_reading>
23
+ - [scratch-index.json](~/.maestro/templates/scratch-index.json) — read when operating in scratch mode
24
+ - [index.json](~/.maestro/templates/index.json) — read when operating in phase mode
25
+ - [brainstorm-visualize.md](~/.maestro/workflows/brainstorm-visualize.md) — read when html-prototypes/ produced and user wants to browse them
26
+ </deferred_reading>
27
+
28
+ <context>
29
+ $ARGUMENTS -- topic text for auto mode, or role name for single role mode.
30
+
31
+ **Auto mode**: topic text (e.g., "Build real-time collaboration platform") triggers full pipeline.
32
+ **Single role mode**: valid role name (e.g., "system-architect") runs one role analysis.
33
+ **All output** goes to `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/`.
34
+ **Artifact registration**: On completion, registers artifact (type=brainstorm) in state.json.
35
+ **Output boundary**: ALL file writes MUST target `{output_dir}/` or `.workflow/state.json` only. NEVER modify source code or files outside these paths.
36
+
37
+ **Valid roles**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
38
+
39
+ **Flags**:
40
+ - `--yes` / `-y`: Auto mode, skip interactive questions, use defaults
41
+ - `--count N`: Number of roles to select (default 3, max 9)
42
+ - `--session ID`: Use existing session
43
+ - `--update`: Update existing analysis (single role)
44
+ - `--skip-questions`: Skip context gathering questions
45
+ - `--include-questions`: Force context gathering even if analysis exists
46
+ - `--style-skill PKG`: Style package for ui-designer role
47
+ </context>
48
+
49
+ <execution>
50
+ Follow '~/.maestro/workflows/brainstorm.md' completely.
51
+
52
+ **Next-step routing on completion:**
53
+
54
+ Auto mode:
55
+ - Project not initialized → Skill({ skill: "maestro-flow", args: "--cmd maestro-init" })
56
+ - Project initialized, need spec package → Skill({ skill: "maestro-flow", args: "--cmd maestro-roadmap --mode full --from-brainstorm {session_id}" })
57
+ - Project initialized, quick roadmap → Skill({ skill: "maestro-flow", args: "--cmd maestro-roadmap --from-brainstorm {session_id}" })
58
+ - Need deeper analysis first → Skill({ skill: "maestro-flow", args: "--cmd maestro-analyze {topic}" })
59
+ - `html-prototypes/` produced with 2+ files and user wants to browse → load `~/.maestro/workflows/brainstorm-visualize.md` and launch visualizer server (optional, user-triggered)
60
+
61
+ Single role mode:
62
+ - More roles needed → Skill({ skill: "maestro-flow", args: "--cmd maestro-brainstorm {next_role} --session {session_id}" })
63
+ - All roles done, run synthesis → Skill({ skill: "maestro-flow", args: "--cmd maestro-brainstorm {topic} --session {session_id}" })
64
+ </execution>
65
+
66
+ <error_codes>
67
+ | Code | Severity | Condition | Recovery |
68
+ |------|----------|-----------|----------|
69
+ | E001 | error | Topic or role argument required | Prompt user for topic text or role name |
70
+ | E002 | error | No active session for single role mode | Guide user to run auto mode first |
71
+ | E003 | error | Invalid role name | Show valid roles list |
72
+ | W001 | warning | Fewer than 10 ideas in divergent phase | Proceed with available ideas |
73
+ | W002 | warning | Project context (.workflow/) not found | Continue without project context |
74
+ | W003 | warning | Role template not found | Use generic analysis structure |
75
+ | W004 | warning | Validation score < 60 | Log warning, suggest manual review |
76
+ | W005 | warning | External research agent failed | Continue without designResearchContext |
77
+ </error_codes>
78
+
79
+ <success_criteria>
80
+ **Auto mode**:
81
+ - [ ] guidance-specification.md with RFC 2119 keywords, terminology, non-goals, feature decomposition
82
+ - [ ] design-research.md persisted when Step 1.7 external research ran (fail-soft: absence not a failure)
83
+ - [ ] Spec Review Gate passed (Step 3.5) or `--yes` bypassed
84
+ - [ ] Role analysis files for each selected NON-UI role in `.brainstorming/{role}/`
85
+ - [ ] If `ui-designer` in selected_roles: `ui-designer/analysis.md` exists AND exactly one of `html-prototypes/` / `ascii-mockups/` / `api-sketches/` exists with `README.md` + ≥1 prototype file
86
+ - [ ] ui-designer/analysis.md references each prototype via `@-notation`
87
+ - [ ] HTML prototypes are self-contained (no external `<link>`/`<script src>` URLs — warn only)
88
+ - [ ] Feature specs in `.brainstorming/feature-specs/` (or synthesis-specification.md)
89
+ - [ ] UI-bearing feature specs reference the corresponding prototype in Section 3 (Interface Contract)
90
+ - [ ] feature-index.json and synthesis-changelog.md
91
+ - [ ] Final Output Gate passed (Step 5.5) or `--yes` bypassed
92
+ - [ ] All user decisions captured with Decision Recording Protocol
93
+ - [ ] Session metadata updated with completion status
94
+
95
+ **Single role mode**:
96
+ - [ ] analysis.md written to `{output_dir}/{role}/`
97
+ - [ ] Feature-point organization used when feature list available
98
+ - [ ] Framework reference included when guidance-specification.md exists
99
+ - [ ] Session metadata updated
100
+ </success_criteria>
@@ -0,0 +1,354 @@
1
+ ---
2
+ name: maestro-composer
3
+ description: Semantic workflow composer — parse natural language into DAG of skill/CLI/agent nodes, auto-inject checkpoints, persist as reusable JSON template
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,114 @@
1
+ ---
2
+ name: maestro-execute
3
+ description: Execute plan with wave-based parallel execution 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
+ </context>
35
+
36
+ <execution>
37
+ ### Pre-flight: team conflict check
38
+
39
+ Before any task execution, run:
40
+ ```
41
+ Bash("maestro collab preflight --phase <phase-number>")
42
+ ```
43
+ If exit code is 1, present warnings and ask whether to proceed.
44
+
45
+ Follow '~/.maestro/workflows/execute.md' completely.
46
+
47
+ ### Post-task Knowledge Inquiry
48
+
49
+ After each task completes, evaluate inquiry triggers:
50
+
51
+ 1. **Execution deviation**: If task summary mentions approach change, dependency swap, or plan deviation:
52
+ → Ask: "TASK-{NNN} deviated from the plan. Should this decision be recorded as an architecture constraint? (`/spec-add arch`)"
53
+
54
+ 2. **Retry success**: If task required ≥2 retries before completion:
55
+ → Ask: "TASK-{NNN} succeeded after {N} retries. Should this fix pattern be documented? (`/spec-add debug`)"
56
+
57
+ 3. **Implicit knowledge**: If task summary contains design rationale ("chose X because", "rejected Y due to"):
58
+ → Ask: "Design decision detected. Should it be recorded as a learning? (`/spec-add learning`)"
59
+
60
+ If user confirms, invoke `Skill({ skill: "maestro-flow", args: "--cmd spec-add <category> <content>" })` with extracted content.
61
+
62
+ ### Issue Status Sync
63
+
64
+ On each task completion, if `task.issue_id` exists, sync status back to the issue in `.workflow/issues/issues.jsonl`:
65
+
66
+ ```
67
+ For each completed/failed TASK with issue_id:
68
+ Read issue from issues.jsonl by issue_id
69
+ Collect all task_refs[] statuses for that issue:
70
+ all task_refs completed → issue.status = "resolved"
71
+ any task_ref failed → issue.status = "in_progress"
72
+ Append history entry: { action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }
73
+ Write updated issue back to issues.jsonl
74
+ ```
75
+
76
+ **Report format on completion:**
77
+
78
+ ```
79
+ === EXECUTION COMPLETE ===
80
+ Plans executed: {plans_count}
81
+ Completed: {completed_count}/{total_count} tasks
82
+ Failed: {failed_count} tasks
83
+
84
+ Summaries: {plan_dir}/.summaries/
85
+ Tasks: {plan_dir}/.task/
86
+
87
+ Next steps:
88
+ /maestro-verify -- Verify execution results
89
+ /maestro-verify --dir {dir} -- Verify specific plan
90
+ /manage-status -- View project dashboard
91
+ ```
92
+
93
+ If failed tasks exist, suggest /quality-debug for investigation.
94
+ </execution>
95
+
96
+ <error_codes>
97
+ | Code | Severity | Condition | Recovery |
98
+ |------|----------|-----------|----------|
99
+ | E001 | error | No pending plans found | Verify plans exist, run maestro-plan first |
100
+ | E002 | error | Plan directory not found | Check --dir path |
101
+ | E003 | error | plan.json not found in directory | Verify plan.json exists, run maestro-plan first |
102
+ | E004 | error | No pending tasks, all tasks already completed | Check task statuses, reset if needed |
103
+ | W001 | warning | Executor completed with partial failures | Check task dependencies, retry failed wave |
104
+ </error_codes>
105
+
106
+ <success_criteria>
107
+ - [ ] All pending plans identified and executed sequentially
108
+ - [ ] Within each plan: waves executed in parallel, waves串行
109
+ - [ ] `.summaries/TASK-{NNN}-summary.md` written for each completed task
110
+ - [ ] `.task/TASK-{NNN}.json` statuses updated (completed|blocked)
111
+ - [ ] EXC artifact registered in state.json for each plan executed
112
+ - [ ] Incremental learnings extracted to specs/learnings.md
113
+ - [ ] state.json updated with execution progress
114
+ </success_criteria>
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: maestro-fork
3
+ description: Create a worktree for milestone-level parallel development, or sync existing worktree with main
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: "maestro-flow", args: "--cmd 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>