maestro-flow-one 0.1.2 → 0.2.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.
package/README.md CHANGED
@@ -2,37 +2,45 @@
2
2
 
3
3
  All 49 Maestro workflow commands as a single skill with dual-variant support (Codex + Claude Code).
4
4
 
5
+ ## Prerequisites
6
+
7
+ Install [Maestro Flow](https://github.com/catlog22/maestro-flow) CLI first:
8
+
9
+ ```bash
10
+ npm install -g maestro-flow
11
+ ```
12
+
5
13
  ## Install
6
14
 
7
15
  ```bash
8
16
  npm install -g maestro-flow-one
9
17
  ```
10
18
 
11
- > **Important:** The CLI must be globally installed (`maestro-flow` command available in PATH) to ensure delegate sessions can correctly invoke `/maestro-flow --cmd ...` during wave/step execution. Without global install, external steps and cross-command calls will fail.
19
+ > **Important:** Both `maestro-flow` and `maestro-flow-one` must be globally installed to ensure delegate sessions can correctly invoke `/maestro-flow --cmd ...` during wave/step execution. Without global install, external steps and cross-command calls will fail.
12
20
 
13
21
  ### Install skill
14
22
 
15
23
  ```bash
16
- # Default: install both variants
24
+ # Default: global install, both variants
17
25
  maestro-flow install
18
- # .codex/skills/maestro-flow/ -> codex (spawn_agents_on_csv)
19
- # .claude/skills/maestro-flow/ -> claude (Skill + delegate)
26
+ # ~/.codex/skills/maestro-flow/ -> codex (spawn_agents_on_csv)
27
+ # ~/.claude/skills/maestro-flow/ -> claude (Skill + delegate)
20
28
 
21
29
  # Single variant
22
- maestro-flow install --variant codex
23
- maestro-flow install --variant claude
30
+ maestro-flow install --variant codex # codex only -> ~/.codex/skills/
31
+ maestro-flow install --variant claude # claude only -> ~/.claude/skills/
24
32
 
25
- # Project-level (instead of global ~/.)
26
- maestro-flow install --project ./my-project
27
- maestro-flow install --variant codex --project .
33
+ # Project-level install (instead of global)
34
+ maestro-flow install --project .
35
+ maestro-flow install --variant codex --project ./my-project
28
36
  ```
29
37
 
30
38
  ### Uninstall
31
39
 
32
40
  ```bash
33
- maestro-flow uninstall # Remove both from global
41
+ maestro-flow uninstall # Remove both from global (~/)
34
42
  maestro-flow uninstall --variant codex # Remove codex only
35
- maestro-flow uninstall --project . # Remove from current project
43
+ maestro-flow uninstall --project . # Remove from current project only
36
44
  npm uninstall -g maestro-flow-one # Remove global CLI
37
45
  ```
38
46
 
@@ -30,11 +30,34 @@ Session path: `.workflow/.maestro/flow-{YYYYMMDD-HHmmss}/status.json`
30
30
  <context>
31
31
  $ARGUMENTS -- intent text, flags, or special keywords.
32
32
 
33
+ **Skill directory structure** (relative to this SKILL.md):
34
+ ```
35
+ maestro-flow/
36
+ SKILL.md <- this file (router)
37
+ executor.md <- step execution loop (deferred read)
38
+ commands/
39
+ lifecycle/ <- 17 commands: init, analyze, plan, execute, verify, ...
40
+ quality/ <- 7 commands: debug, review, test, auto-test, ...
41
+ manage/ <- 10 commands: status, issue, wiki, harvest, ...
42
+ learn/ <- 5 commands: decompose, follow, investigate, ...
43
+ milestone/ <- 3 commands: audit, complete, release
44
+ spec/ <- 4 commands: add, load, remove, setup
45
+ wiki/ <- 2 commands: connect, digest
46
+ chains/
47
+ templates.json <- 14 chain templates + decision types
48
+ ```
49
+
33
50
  **State files:**
34
51
  - `.workflow/state.json` -- project artifact registry (optional)
35
52
  - `.workflow/.maestro/flow-*/status.json` -- flow session state
53
+
54
+ **CLI prerequisite:** `maestro-flow` command must be globally available (`npm install -g maestro-flow-one`)
36
55
  </context>
37
56
 
57
+ <deferred_reading>
58
+ - [executor.md](executor.md) -- read when entering Phase 2 (step execution loop)
59
+ </deferred_reading>
60
+
38
61
  <execution>
39
62
 
40
63
  ## Step 1: Parse & Route
@@ -59,9 +82,9 @@ Parse $ARGUMENTS:
59
82
  -> End.
60
83
 
61
84
  execute | continue
62
- -> Find latest running flow session
63
- -> If not found: "No running flow session." End.
64
- -> Phase 2 (Step Execution Loop)
85
+ -> Read executor.md from deferred_reading
86
+ -> Follow executor.md completely
87
+ -> End.
65
88
 
66
89
  --chain <name> [-y] <remaining>
67
90
  -> Force chain selection, go to Step 4
@@ -134,98 +157,9 @@ Fall through to Phase 2.
134
157
 
135
158
  ## Phase 2: Step Execution Loop
136
159
 
137
- ### 2.1: Load next step
138
-
139
- ```
140
- Bash: maestro-flow next
141
- ```
142
-
143
- Parse output:
144
- - `NO_SESSION` -> End.
145
- - `SESSION_COMPLETE` -> Display summary. End.
146
- - `STEP: idx/total` + `TYPE` + `SKILL` + `ARGS` + `PATH` + `---COMMAND---` -> continue
147
-
148
- ### 2.2: Route by type
149
-
150
- ```
151
- If TYPE == "decision" -> Step 2.3 (Decision Evaluation)
152
- If TYPE == "internal" -> Step 2.4 (Internal Execution)
153
- If TYPE == "external" -> Step 2.5 (External Execution)
154
- ```
155
-
156
- ### 2.3: Decision Evaluation
157
-
158
- **Quality-gate decisions** (post-verify, post-review, post-test, post-business-test):
159
-
160
- ```
161
- Resolve artifact dir from .workflow/state.json
162
-
163
- Bash({
164
- command: `maestro delegate "evaluate ${decision} quality gate
165
- CONTEXT: @${result_files}
166
- ---VERDICT---
167
- STATUS: proceed | fix | escalate
168
- REASON: one-line
169
- GAP_SUMMARY: details
170
- CONFIDENCE: high | medium | low
171
- ---END---" --role analyze --mode analysis`,
172
- run_in_background: true
173
- })
174
- STOP -- wait for callback.
175
- ```
176
-
177
- On callback: parse verdict, apply (proceed/fix-loop/escalate).
178
-
179
- **Structural decisions** (post-milestone): evaluate directly.
180
-
181
- After decision: `Bash: maestro-flow done` -> loop to 2.1.
160
+ Read [executor.md](executor.md) from deferred_reading and follow it completely.
182
161
 
183
- ### 2.4: Internal Execution
184
-
185
- The command content was loaded by `maestro-flow next` (after `---COMMAND---`).
186
-
187
- ```
188
- 1. Parse loaded command .md
189
- 2. Set $ARGUMENTS = ARGS (with auto-flag if session.auto_mode)
190
- 3. Follow <execution> section completely
191
-
192
- Auto flags: maestro-init -y, maestro-plan -y, maestro-execute -y,
193
- quality-test -y --auto-fix, etc.
194
-
195
- On complete: Bash: maestro-flow done -> loop to 2.1
196
- On failure: -> Step 2.6
197
- ```
198
-
199
- ### 2.5: External Execution
200
-
201
- ```
202
- Bash({
203
- command: `maestro delegate --to claude "Execute: /maestro-flow --cmd {SKILL} {ARGS}" --mode write`,
204
- run_in_background: true,
205
- timeout: 600000
206
- })
207
- STOP -- wait for callback.
208
-
209
- On callback:
210
- On success: Bash: maestro-flow done -> loop to 2.1
211
- On failure: -> Step 2.6
212
- ```
213
-
214
- ### 2.6: Handle Failure
215
-
216
- ```
217
- Auto mode: retry once (maestro-flow step {id} {idx} pending), then skip
218
- Interactive: AskUserQuestion retry/skip/abort
219
- ```
220
-
221
- ---
222
-
223
- ## Phase 3: Completion
224
-
225
- ```
226
- Display session summary with step statuses.
227
- End.
228
- ```
162
+ Executor loop: `maestro-flow next` -> route by type -> execute -> `maestro-flow done` -> `Skill({ skill: "maestro-flow", args: "execute" })` until SESSION_COMPLETE.
229
163
 
230
164
  </execution>
231
165
 
@@ -0,0 +1,328 @@
1
+ # Flow Executor -- CLI-Driven Step Execution (Claude Variant)
2
+
3
+ Single-step executor for flow sessions. Each invocation: `maestro-flow next` -> execute -> `maestro-flow done` -> self-invoke.
4
+
5
+ **Core loop:**
6
+ ```
7
+ maestro-flow next -> route by type -> execute -> maestro-flow done -> self-invoke
8
+ ```
9
+
10
+ ## Execution
11
+
12
+ ### Step 1: Load Next Step
13
+
14
+ ```
15
+ Bash: maestro-flow next [session-id]
16
+
17
+ Parse output lines:
18
+ "NO_SESSION" -> "No running flow session." End.
19
+ "SESSION_COMPLETE" -> Display completion summary. End.
20
+ Otherwise parse structured output:
21
+ STEP: {idx}/{total}
22
+ TYPE: internal | external | decision
23
+ SKILL: {command-name}
24
+ ARGS: {arguments}
25
+ DECISION: {post-verify|post-review|...} (decision only)
26
+ RETRY: {N}/{M} (decision only)
27
+ PATH: {/absolute/path/to/command.md} (internal/external only)
28
+ ---COMMAND---
29
+ {full .md file content follows}
30
+ ```
31
+
32
+ Display step banner:
33
+ ```
34
+ ------------------------------------------------------------
35
+ [{idx}/{total}] {SKILL} [{TYPE}]
36
+ ------------------------------------------------------------
37
+ Args: {ARGS}
38
+ ```
39
+
40
+ Context weight hint (after 4+ completed steps):
41
+ ```
42
+ Note: {completed} steps done. Use /maestro-flow execute in fresh context to resume.
43
+ ```
44
+
45
+ ### Step 2: Route by Type
46
+
47
+ ```
48
+ TYPE == "decision" -> Step 3 (Decision Evaluation)
49
+ TYPE == "internal" -> Step 4 (Internal Execution)
50
+ TYPE == "external" -> Step 5 (External Execution)
51
+ ```
52
+
53
+ ---
54
+
55
+ ### Step 3: Decision Evaluation
56
+
57
+ #### 3.1: Parse decision metadata
58
+
59
+ ```
60
+ decision_type = DECISION field // e.g., "post-verify"
61
+ retry_count / max_retries = from RETRY field
62
+ ```
63
+
64
+ #### 3.2: Resolve artifact directory
65
+
66
+ ```
67
+ Read .workflow/state.json
68
+ Filter artifacts: milestone == session.milestone, phase == session.phase
69
+ Sort by created_at DESC -> take first
70
+
71
+ artifact_dir = .workflow/scratch/{artifact.path}/
72
+ Fallback: glob .workflow/scratch/*-P{phase}-*/ sorted by date DESC
73
+ ```
74
+
75
+ #### 3.3: Structural vs Quality-gate
76
+
77
+ **Structural decisions (post-milestone)** -- evaluate directly:
78
+
79
+ ```
80
+ post-milestone:
81
+ Read .workflow/state.json -> check next milestone (status "pending"/"active")
82
+ If found:
83
+ Read session status.json
84
+ Update: milestone, phase, reset passed_gates
85
+ Insert full-lifecycle steps for next milestone after current position
86
+ Reindex all steps, write status.json
87
+ Display: post-milestone: advancing to {next_milestone}
88
+ If none:
89
+ Display: post-milestone: all milestones complete
90
+ -> proceed (mark done, continue)
91
+ ```
92
+
93
+ **Quality-gate decisions** -- delegate to external analyzer:
94
+
95
+ Result file mapping:
96
+
97
+ | Decision | Files |
98
+ |----------|-------|
99
+ | post-verify | `{artifact_dir}/verification.json` |
100
+ | post-business-test | `{artifact_dir}/business-test-results.json` |
101
+ | post-review | `{artifact_dir}/review.json` |
102
+ | post-test | `{artifact_dir}/uat.md`, `{artifact_dir}/.tests/test-results.json` |
103
+
104
+ ```
105
+ Bash({
106
+ command: `maestro delegate "PURPOSE: evaluate ${decision_type} quality gate result
107
+ TASK: read result files | analyze pass/fail status | assess severity | recommend
108
+ MODE: analysis
109
+ CONTEXT: @${result_files}
110
+ EXPECTED: strict format:
111
+ ---VERDICT---
112
+ STATUS: proceed | fix | escalate
113
+ REASON: one-line explanation
114
+ GAP_SUMMARY: problem details (fix/escalate only)
115
+ CONFIDENCE: high | medium | low
116
+ ---END---
117
+ CONSTRAINTS: evaluate only | STATUS must be one of three | if retry ${retry_count}/${max_retries} at max and still failing, must escalate" --role analyze --mode analysis`,
118
+ run_in_background: true
119
+ })
120
+ STOP -- wait for background callback.
121
+ ```
122
+
123
+ #### 3.4: Parse verdict
124
+
125
+ ```
126
+ On callback: maestro delegate output <exec_id>
127
+
128
+ Extract between ---VERDICT--- and ---END---:
129
+ verdict.status = "proceed" | "fix" | "escalate"
130
+ verdict.reason = string
131
+ verdict.gap_summary = string
132
+ verdict.confidence = "high" | "medium" | "low"
133
+
134
+ If parse fails -> fallback: status = "fix", gap_summary = "verdict parse failed"
135
+ ```
136
+
137
+ #### 3.5: Confirm (interactive mode)
138
+
139
+ ```
140
+ Display: Decision: {decision_type} -> {verdict.status} ({verdict.reason})
141
+ Confidence: {verdict.confidence}
142
+
143
+ Auto mode (session.auto_mode == true):
144
+ Follow verdict directly, no confirmation.
145
+
146
+ Interactive mode:
147
+ AskUserQuestion: "Follow recommendation / Override proceed / Override fix / Cancel"
148
+ - Cancel -> session status = "paused", write status.json. End.
149
+ ```
150
+
151
+ #### 3.6: Apply verdict
152
+
153
+ | Verdict | Action |
154
+ |---------|--------|
155
+ | proceed | Add gate to session.passed_gates[], mark decision completed |
156
+ | fix | Clear session.passed_gates[], insert fix-loop commands |
157
+ | escalate | Set session.status = "paused". Display escalation message. End. |
158
+
159
+ #### 3.7: Fix-loop insertion
160
+
161
+ When verdict == "fix", insert commands after current position based on decision type:
162
+
163
+ **post-verify fix-loop:**
164
+ ```
165
+ quality-debug "{gap_summary}" [internal]
166
+ maestro-plan {phase} --gaps [internal]
167
+ maestro-execute {phase} [external]
168
+ maestro-verify {phase} [internal]
169
+ decision:post-verify {retry_count + 1} [decision]
170
+ ```
171
+
172
+ **post-review fix-loop:**
173
+ ```
174
+ quality-debug "{gap_summary}" [internal]
175
+ maestro-plan {phase} --gaps [internal]
176
+ maestro-execute {phase} [external]
177
+ quality-review {phase} [internal]
178
+ decision:post-review {retry_count + 1} [decision]
179
+ ```
180
+
181
+ **post-test fix-loop:**
182
+ ```
183
+ quality-debug --from-uat "{gap_summary}" [internal]
184
+ maestro-plan {phase} --gaps [internal]
185
+ maestro-execute {phase} [external]
186
+ maestro-verify {phase} [internal]
187
+ decision:post-verify {retry: 0} [decision]
188
+ quality-test {phase} [internal]
189
+ decision:post-test {retry_count + 1} [decision]
190
+ ```
191
+
192
+ **post-business-test fix-loop:**
193
+ ```
194
+ quality-debug --from-business-test "{gap_summary}" [internal]
195
+ maestro-plan {phase} --gaps [internal]
196
+ maestro-execute {phase} [external]
197
+ maestro-verify {phase} [internal]
198
+ decision:post-verify {retry: 0} [decision]
199
+ quality-auto-test {phase} [internal]
200
+ decision:post-business-test {retry_count + 1} [decision]
201
+ ```
202
+
203
+ ```
204
+ Read session status.json
205
+ Insert new steps at position (current_step + 1)
206
+ Reindex all steps: step.index = array position
207
+ Mark current decision node: status = "completed"
208
+ Write status.json
209
+
210
+ Display: Decision: {decision_type} -> fix (+{N} commands inserted)
211
+ ```
212
+
213
+ #### 3.8: Continue
214
+
215
+ ```
216
+ Bash: maestro-flow done
217
+ -> Skill({ skill: "maestro-flow", args: "execute" })
218
+ End.
219
+ ```
220
+
221
+ ---
222
+
223
+ ### Step 4: Internal Execution
224
+
225
+ The command .md content was loaded by `maestro-flow next` (after `---COMMAND---`).
226
+
227
+ ```
228
+ 1. The command content is already in context from Step 1 output
229
+ 2. Set $ARGUMENTS = ARGS from step output
230
+ 3. Apply auto-flag if session.auto_mode == true (see table below)
231
+ 4. Follow the command's <execution> section completely
232
+ - Respect <required_reading> and <deferred_reading> references
233
+ ```
234
+
235
+ **Auto flag propagation:**
236
+
237
+ | Skill | Flag appended |
238
+ |-------|---------------|
239
+ | maestro-init | -y |
240
+ | maestro-analyze | -y |
241
+ | maestro-brainstorm | -y |
242
+ | maestro-roadmap | -y |
243
+ | maestro-plan | -y |
244
+ | maestro-execute | -y |
245
+ | quality-auto-test | -y |
246
+ | quality-test | -y --auto-fix |
247
+ | maestro-milestone-complete | -y |
248
+ | (all others) | (none) |
249
+
250
+ ```
251
+ On success -> Step 6 (Mark Done)
252
+ On failure -> Step 7 (Handle Failure)
253
+ ```
254
+
255
+ ---
256
+
257
+ ### Step 5: External Execution
258
+
259
+ Delegate to a new Claude Code session via maestro delegate:
260
+
261
+ ```
262
+ Bash({
263
+ command: `maestro delegate --to claude "Execute: /maestro-flow --cmd {SKILL} {ARGS}
264
+
265
+ You are a delegate session executing a flow pipeline step.
266
+ Use Skill() to invoke: /maestro-flow --cmd {SKILL} {ARGS}
267
+ Do NOT reimplement the command logic -- invoke through the skill." --mode write`,
268
+ run_in_background: true,
269
+ timeout: 600000
270
+ })
271
+
272
+ STOP -- wait for background callback.
273
+ ```
274
+
275
+ **On callback:**
276
+ - Retrieve output: `maestro delegate output <exec_id>`
277
+ - On success -> Step 6 (Mark Done)
278
+ - On failure -> Step 7 (Handle Failure)
279
+
280
+ ---
281
+
282
+ ### Step 6: Mark Done & Advance
283
+
284
+ ```
285
+ Bash: maestro-flow done [session-id]
286
+
287
+ Parse output:
288
+ "COMPLETED: {idx} {skill}" -> display confirmation
289
+ "NEXT: {idx} {skill} [{type}]" -> more steps remain
290
+ "SESSION_COMPLETE" -> all done, display summary. End.
291
+ ```
292
+
293
+ If more steps, self-invoke:
294
+ ```
295
+ Skill({ skill: "maestro-flow", args: "execute" })
296
+ End.
297
+ ```
298
+
299
+ ---
300
+
301
+ ### Step 7: Handle Failure
302
+
303
+ ```
304
+ Bash: maestro-flow step {session_id} {idx} failed
305
+ Display: [{idx}/{total}] FAIL {SKILL}: {error}
306
+ ```
307
+
308
+ **Auto mode (session.auto_mode == true):**
309
+ ```
310
+ If not already retried:
311
+ Bash: maestro-flow step {session_id} {idx} pending
312
+ -> Skill({ skill: "maestro-flow", args: "execute" }) // retry once
313
+
314
+ If already retried:
315
+ Bash: maestro-flow step {session_id} {idx} skipped
316
+ Display: [{idx}] skipped after retry
317
+ -> Skill({ skill: "maestro-flow", args: "execute" }) // continue to next
318
+ ```
319
+
320
+ **Interactive mode:**
321
+ ```
322
+ AskUserQuestion: "retry / skip / abort"
323
+ retry -> maestro-flow step {session_id} {idx} pending
324
+ -> Skill({ skill: "maestro-flow", args: "execute" })
325
+ skip -> maestro-flow step {session_id} {idx} skipped
326
+ -> Skill({ skill: "maestro-flow", args: "execute" })
327
+ abort -> set session status = "paused" via status.json. End.
328
+ ```
@@ -21,9 +21,27 @@ Session path: `.workflow/.maestro/flow-{YYYYMMDD-HHmmss}/status.json`
21
21
  <context>
22
22
  $ARGUMENTS -- intent text, flags, or special keywords.
23
23
 
24
+ **Skill directory structure** (relative to this SKILL.md):
25
+ ```
26
+ maestro-flow/
27
+ SKILL.md <- this file (router + wave executor)
28
+ commands/
29
+ lifecycle/ <- 17 commands: init, analyze, plan, execute, verify, ...
30
+ quality/ <- 7 commands: debug, review, test, auto-test, ...
31
+ manage/ <- 10 commands: status, issue, wiki, harvest, ...
32
+ learn/ <- 5 commands: decompose, follow, investigate, ...
33
+ milestone/ <- 3 commands: audit, complete, release
34
+ spec/ <- 4 commands: add, load, remove, setup
35
+ wiki/ <- 2 commands: connect, digest
36
+ chains/
37
+ templates.json <- 14 chain templates + decision types
38
+ ```
39
+
24
40
  **State files:**
25
41
  - `.workflow/state.json` -- project artifact registry (optional)
26
42
  - `.workflow/.maestro/flow-*/status.json` -- flow session state
43
+
44
+ **CLI prerequisite:** `maestro-flow` command must be globally available (`npm install -g maestro-flow-one`)
27
45
  </context>
28
46
 
29
47
  <invariants>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow-one",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "All Maestro workflow commands as a single Claude Code skill — intent routing, decision gates, minimal closed-loop chains",
5
5
  "bin": {
6
6
  "maestro-flow": "bin/maestro-flow.js"