maestro-flow 0.3.25 → 0.3.27
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/.claude/commands/maestro.md +11 -13
- package/package.json +1 -1
- package/workflows/maestro-chain-execute.md +199 -0
- package/workflows/maestro.md +45 -127
|
@@ -11,6 +11,7 @@ allowed-tools:
|
|
|
11
11
|
- Grep
|
|
12
12
|
- Agent
|
|
13
13
|
- AskUserQuestion
|
|
14
|
+
- TodoWrite
|
|
14
15
|
---
|
|
15
16
|
<purpose>
|
|
16
17
|
Orchestrate all maestro commands automatically based on user intent and current project state.
|
|
@@ -26,11 +27,9 @@ Produces session directory at `.workflow/.maestro/{session_id}/` with status.jso
|
|
|
26
27
|
Executes commands sequentially with artifact propagation between steps.
|
|
27
28
|
</purpose>
|
|
28
29
|
|
|
29
|
-
<required_reading>
|
|
30
|
-
@~/.maestro/workflows/maestro.md
|
|
31
|
-
</required_reading>
|
|
32
|
-
|
|
33
30
|
<deferred_reading>
|
|
31
|
+
- [maestro.md](~/.maestro/workflows/maestro.md) — read at execution start (Steps 1-3: intent analysis, chain selection, session setup)
|
|
32
|
+
- [maestro-chain-execute.md](~/.maestro/workflows/maestro-chain-execute.md) — read when dispatching chain execution (Step 4) or resume mode
|
|
34
33
|
- [maestro-super.md](~/.maestro/workflows/maestro-super.md) — read when `--super` flag is active
|
|
35
34
|
</deferred_reading>
|
|
36
35
|
|
|
@@ -56,7 +55,9 @@ $ARGUMENTS — user intent text, or special keywords.
|
|
|
56
55
|
</context>
|
|
57
56
|
|
|
58
57
|
<execution>
|
|
59
|
-
|
|
58
|
+
**Resume mode (`-c`):** Skip selection workflow entirely — scan `.workflow/.maestro/` for latest session, then read `~/.maestro/workflows/maestro-chain-execute.md` and follow it with `$SESSION_PATH` = discovered session path. **End.**
|
|
59
|
+
|
|
60
|
+
**Normal mode:** Read `~/.maestro/workflows/maestro.md` from deferred_reading, then follow it completely.
|
|
60
61
|
|
|
61
62
|
**Auto mode (`-y`) propagation:**
|
|
62
63
|
|
|
@@ -83,12 +84,10 @@ When `-y` is active, maestro propagates auto flags to downstream commands. Only
|
|
|
83
84
|
Commands not listed (manage-*, spec-*, milestone-*) have no auto flags and execute as-is.
|
|
84
85
|
|
|
85
86
|
In auto mode, maestro also:
|
|
86
|
-
- Skips
|
|
87
|
-
- Skips chain confirmation (Step
|
|
87
|
+
- Skips intent clarification (workflow Step 2d)
|
|
88
|
+
- Skips chain confirmation (workflow Step 3d)
|
|
88
89
|
- Auto-skips on step errors (retry once, then skip and continue)
|
|
89
90
|
|
|
90
|
-
Context cleanup hints, context window reminders, and completion report format are defined in workflow maestro.md (Steps 7a-1, 7f).
|
|
91
|
-
|
|
92
91
|
**Super mode (`--super`):** Read `maestro-super.md` from deferred_reading, then follow it completely.
|
|
93
92
|
</execution>
|
|
94
93
|
|
|
@@ -111,11 +110,10 @@ Context cleanup hints, context window reminders, and completion report format ar
|
|
|
111
110
|
- [ ] Per-step engine selected (auto routes heavy steps to CLI, observable steps to internal)
|
|
112
111
|
- [ ] Auto flags correctly propagated to supporting commands only
|
|
113
112
|
- [ ] Session directory created at .workflow/.maestro/{session_id}/
|
|
114
|
-
- [ ] status.json
|
|
115
|
-
- [ ]
|
|
113
|
+
- [ ] status.json created with steps[], context, and tracking fields
|
|
114
|
+
- [ ] Low-complexity intents routed to maestro-quick
|
|
115
|
+
- [ ] All chains dispatched via execution workflow (maestro-chain-execute.md) with status.json tracking
|
|
116
116
|
- [ ] Phase numbers auto-detected and passed to downstream commands
|
|
117
|
-
- [ ] Error handling: retry/skip/abort per step (auto-skip in -y mode)
|
|
118
|
-
- [ ] Session summary displayed on completion
|
|
119
117
|
- [ ] (super mode) Requirements expanded and validated via Gemini before roadmap creation
|
|
120
118
|
- [ ] (super mode) Each milestone scored ≥ 80% before advancing
|
|
121
119
|
- [ ] (super mode) All milestones completed with no user intervention
|
package/package.json
CHANGED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Workflow: maestro-chain-execute
|
|
2
|
+
|
|
3
|
+
Upgraded version of maestro's original direct execution strategy.
|
|
4
|
+
Reads session status.json, loops through steps with per-step engine selection,
|
|
5
|
+
context propagation, post-step Gemini analysis, and error handling.
|
|
6
|
+
Tracks all progress via status.json (the JSON file created during selection).
|
|
7
|
+
|
|
8
|
+
**Prerequisites:**
|
|
9
|
+
- Session directory with valid status.json (status: "running", pending steps)
|
|
10
|
+
- $SESSION_PATH passed from maestro.md dispatch
|
|
11
|
+
|
|
12
|
+
## Step 1: Load Session
|
|
13
|
+
|
|
14
|
+
Read status.json from `$SESSION_PATH`.
|
|
15
|
+
|
|
16
|
+
Extract: `session_id`, `chain_name`, `steps[]`, `context`, `auto_mode`, `exec_mode`, `cli_tool`, `gemini_session_id`.
|
|
17
|
+
|
|
18
|
+
Set `$STEP_INDEX` = `current_step` (first pending step).
|
|
19
|
+
|
|
20
|
+
Validate: `status == "running"` and at least one pending step exists.
|
|
21
|
+
|
|
22
|
+
Display banner:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
============================================================
|
|
26
|
+
CHAIN EXECUTOR
|
|
27
|
+
============================================================
|
|
28
|
+
Session: {session_id}
|
|
29
|
+
Chain: {chain_name}
|
|
30
|
+
Steps: {completed}/{total} done, starting from step {$STEP_INDEX}
|
|
31
|
+
Auto: {auto_mode}
|
|
32
|
+
Exec: {exec_mode}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Step 2: Context & Argument Assembly
|
|
36
|
+
|
|
37
|
+
Initialize context object from `status.json.context`:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
context = {
|
|
41
|
+
current_phase, // from status.json.context or top-level phase
|
|
42
|
+
user_intent, // from status.json.context or top-level intent
|
|
43
|
+
issue_id,
|
|
44
|
+
milestone_num,
|
|
45
|
+
spec_session_id,
|
|
46
|
+
scratch_dir
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### assembleArgs(step)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
1. Substitute placeholders in step.args:
|
|
54
|
+
{phase} → context.current_phase
|
|
55
|
+
{description} → context.user_intent (chainMap uses {description} as alias for user intent)
|
|
56
|
+
{issue_id} → context.issue_id
|
|
57
|
+
{spec_session_id} → context.spec_session_id
|
|
58
|
+
{scratch_dir} → context.scratch_dir
|
|
59
|
+
{milestone_num} → context.milestone_num
|
|
60
|
+
|
|
61
|
+
2. In auto_mode, append per-command flag if not already present:
|
|
62
|
+
maestro-analyze / maestro-brainstorm / maestro-roadmap / maestro-ui-design → -y
|
|
63
|
+
maestro-plan → --auto
|
|
64
|
+
quality-test → --auto-fix
|
|
65
|
+
quality-retrospective → --auto-yes
|
|
66
|
+
|
|
67
|
+
3. Shell-escape strings with single quotes for CLI delegate calls.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Step 3: Step Loop
|
|
71
|
+
|
|
72
|
+
For each step starting at `$STEP_INDEX`:
|
|
73
|
+
|
|
74
|
+
### 3a. Select engine & display banner
|
|
75
|
+
|
|
76
|
+
Read `step.engine` from status.json (pre-computed by selection workflow Step 3e).
|
|
77
|
+
|
|
78
|
+
If `step.engine` is missing or null, fallback to auto selection:
|
|
79
|
+
```
|
|
80
|
+
CLI: maestro-plan, maestro-execute, maestro-analyze, maestro-brainstorm,
|
|
81
|
+
maestro-roadmap, maestro-ui-design, quality-refactor
|
|
82
|
+
Internal: everything else (current-session Skill() call)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Display: `[Step {N}/{total}] /{step.skill} [{engine}] — {args}`
|
|
86
|
+
|
|
87
|
+
Update status.json: step `status = "running"`, `engine`, `started_at`.
|
|
88
|
+
|
|
89
|
+
Context window hint:
|
|
90
|
+
- Step >= 4 and not autoYes: hint user about `/maestro -c` for fresh context resume.
|
|
91
|
+
- autoYes and step >= 5: log warning to status.json.
|
|
92
|
+
|
|
93
|
+
### 3b. Execute (engine-dependent)
|
|
94
|
+
|
|
95
|
+
**Internal engine** — current-session Skill() call (synchronous, visible):
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Skill({ skill: step.skill, args: assembledArgs })
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**CLI engine** — template-driven, async, context-isolated:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
1. Load template ~/.maestro/templates/cli/prompts/coordinate-step.txt
|
|
105
|
+
2. Build analysisHints from previous step's next_step_hints
|
|
106
|
+
(prompt_additions, cautions, context_to_carry)
|
|
107
|
+
3. Substitute template placeholders:
|
|
108
|
+
{{COMMAND}}, {{ARGS}}, {{STEP_N}}, {{AUTO_DIRECTIVE}},
|
|
109
|
+
{{CHAIN_NAME}}, {{ANALYSIS_HINTS}}
|
|
110
|
+
4. Run:
|
|
111
|
+
Bash(maestro delegate "<prompt>" --to {cli_tool} --mode write,
|
|
112
|
+
run_in_background: true, timeout: 600000)
|
|
113
|
+
5. **STOP** — wait for background callback
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 3c. Parse output & update context
|
|
117
|
+
|
|
118
|
+
Scan step output for context propagation:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
PHASE: N → context.current_phase
|
|
122
|
+
SPEC-xxx → context.spec_session_id
|
|
123
|
+
scratch_dir: path → context.scratch_dir
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
CLI: capture `exec_id` from stderr `[MAESTRO_EXEC_ID=<id>]`.
|
|
127
|
+
|
|
128
|
+
**Persist context back to status.json** after each step — write updated `context` field and `current_step`. This enables resume via `/maestro -c`.
|
|
129
|
+
|
|
130
|
+
### 3d. Handle result
|
|
131
|
+
|
|
132
|
+
**Success:** mark step `status = "completed"`, set `completed_at` in status.json.
|
|
133
|
+
CLI: save output to `step-{N}-output.txt` in session directory.
|
|
134
|
+
|
|
135
|
+
**Failure:**
|
|
136
|
+
- `auto_mode` → retry once, then skip (mark `"skipped"`).
|
|
137
|
+
- Interactive → offer: Retry (max 2) / Skip / Abort.
|
|
138
|
+
- Abort → **Error E003** — update status.json `status = "aborted"`, display resume hint: `/maestro -c`.
|
|
139
|
+
|
|
140
|
+
### 3e. Post-step analysis (CLI steps only)
|
|
141
|
+
|
|
142
|
+
Skip if: step failed/skipped, or `engine == 'internal'`.
|
|
143
|
+
|
|
144
|
+
Delegate to gemini (analysis mode, `--resume` if `gemini_session_id` exists) with prompt containing:
|
|
145
|
+
- Step command, args, chain name, intent
|
|
146
|
+
- Last 200 lines of step output
|
|
147
|
+
- Next step info (command, args) if any
|
|
148
|
+
|
|
149
|
+
Expected JSON response:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"quality_score": "<0-100>",
|
|
154
|
+
"execution_assessment": {
|
|
155
|
+
"success": "<bool>",
|
|
156
|
+
"completeness": "<full|partial|minimal>",
|
|
157
|
+
"key_outputs": [],
|
|
158
|
+
"missing_outputs": []
|
|
159
|
+
},
|
|
160
|
+
"issues": [
|
|
161
|
+
{ "severity": "critical|high|medium|low", "description": "" }
|
|
162
|
+
],
|
|
163
|
+
"next_step_hints": {
|
|
164
|
+
"prompt_additions": "<extra context for next step>",
|
|
165
|
+
"cautions": ["<things to watch out for>"],
|
|
166
|
+
"context_to_carry": "<key facts from this step>"
|
|
167
|
+
},
|
|
168
|
+
"step_summary": ""
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
On callback:
|
|
173
|
+
1. Capture gemini `exec_id` → store as `gemini_session_id` in status.json for session continuity.
|
|
174
|
+
2. Store analysis in `step_analyses[]` and `step-{N}-analysis.json` in session directory.
|
|
175
|
+
3. Advance to next step (**3a**).
|
|
176
|
+
|
|
177
|
+
## Step 4: Completion Report
|
|
178
|
+
|
|
179
|
+
Update status.json: `status = "completed"`.
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
============================================================
|
|
183
|
+
MAESTRO SESSION COMPLETE
|
|
184
|
+
============================================================
|
|
185
|
+
Session: {session_id}
|
|
186
|
+
Chain: {chain_name}
|
|
187
|
+
Steps: {completed}/{total} completed
|
|
188
|
+
Phase: {context.current_phase}
|
|
189
|
+
|
|
190
|
+
Results:
|
|
191
|
+
[✓] 1. maestro-plan — completed [cli] (quality: 85/100)
|
|
192
|
+
[✓] 2. maestro-verify — completed [internal]
|
|
193
|
+
[—] 3. quality-review — skipped [internal]
|
|
194
|
+
|
|
195
|
+
CLI Avg Quality: {avgScore}/100 (based on {cliStepCount} cli steps)
|
|
196
|
+
|
|
197
|
+
Next: /maestro continue | /manage-status
|
|
198
|
+
============================================================
|
|
199
|
+
```
|
package/workflows/maestro.md
CHANGED
|
@@ -7,7 +7,7 @@ Default `auto` mode selects engine based on chain complexity.
|
|
|
7
7
|
**Prerequisites:**
|
|
8
8
|
- None for initial invocation (can bootstrap)
|
|
9
9
|
- `continue`/`next`: `.workflow/state.json` must exist
|
|
10
|
-
- `-c` (resume):
|
|
10
|
+
- `-c` (resume): handled by command file before this workflow loads — not applicable here
|
|
11
11
|
|
|
12
12
|
## Step 1: Parse & Initialize
|
|
13
13
|
|
|
@@ -15,21 +15,12 @@ Default `auto` mode selects engine based on chain complexity.
|
|
|
15
15
|
|
|
16
16
|
```
|
|
17
17
|
Parse $ARGUMENTS → extract flags, remainder is intent text.
|
|
18
|
-
Flags: autoYes (-y/--yes),
|
|
19
|
-
Valued:
|
|
18
|
+
Flags: autoYes (-y/--yes), dryRun (--dry-run)
|
|
19
|
+
Valued: execMode (--exec auto|cli|internal, default 'auto'), cliTool (--tool X, default 'claude')
|
|
20
20
|
intent = arguments with all flags/valued options stripped, trimmed
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
### 1b:
|
|
24
|
-
|
|
25
|
-
If `resumeMode`:
|
|
26
|
-
1. Scan `.workflow/.maestro/` for latest session (or session ID if specified)
|
|
27
|
-
2. Read `status.json` → find last completed step, remaining steps
|
|
28
|
-
3. Set `$CHAIN` from status.json, `$STEP_INDEX` = last_completed + 1
|
|
29
|
-
4. If no session found: **Error E004** — list available sessions
|
|
30
|
-
5. Jump to **Step 4** at resume point
|
|
31
|
-
|
|
32
|
-
### 1c: Read project state
|
|
23
|
+
### 1b: Read project state
|
|
33
24
|
|
|
34
25
|
Check `.workflow/state.json` existence.
|
|
35
26
|
|
|
@@ -54,15 +45,15 @@ Check `.workflow/state.json` existence.
|
|
|
54
45
|
|
|
55
46
|
**If missing:** `$PROJECT_STATE = { initialized: false }`. If intent also empty → **Error E001** (suggest `maestro-init`).
|
|
56
47
|
|
|
57
|
-
###
|
|
48
|
+
### 1c: Display banner
|
|
58
49
|
|
|
59
50
|
```
|
|
60
51
|
============================================================
|
|
61
52
|
MAESTRO COORDINATOR
|
|
62
53
|
============================================================
|
|
63
|
-
Mode: {intent-based | state-based
|
|
54
|
+
Mode: {intent-based | state-based}
|
|
64
55
|
Auto: {yes | no}
|
|
65
|
-
Exec: {auto | cli |
|
|
56
|
+
Exec: {auto | cli | internal}
|
|
66
57
|
Input: {intent or "continue"}
|
|
67
58
|
```
|
|
68
59
|
|
|
@@ -70,16 +61,13 @@ Check `.workflow/state.json` existence.
|
|
|
70
61
|
|
|
71
62
|
### 2a: Fast path — forced chain or exact match
|
|
72
63
|
|
|
73
|
-
**Forced chain (`--chain`):**
|
|
74
|
-
- Validate against known chains (see [Chain Reference](#chain-reference))
|
|
75
|
-
- If valid: skip intent analysis, jump to **Step 3**
|
|
76
|
-
- If invalid: display valid chains, ask user to choose
|
|
77
|
-
|
|
78
64
|
**Exact-match keywords:**
|
|
79
65
|
```
|
|
80
66
|
Keyword → taskType (skip to Step 3):
|
|
81
67
|
continue/next/go/继续/下一步 → 'state_continue'
|
|
82
|
-
|
|
68
|
+
|
|
69
|
+
Short-circuit (execute immediately, no chain):
|
|
70
|
+
status/状态/dashboard → Skill({ skill: "manage-status" }). **End.**
|
|
83
71
|
```
|
|
84
72
|
|
|
85
73
|
### 2b: Structured intent extraction (LLM-native)
|
|
@@ -169,7 +157,7 @@ Route priority:
|
|
|
169
157
|
test: feature/code→test; default→test
|
|
170
158
|
debug: default→debug
|
|
171
159
|
refactor: default→refactor
|
|
172
|
-
manage: issue→issue, milestone→milestone_audit, phase→milestone_close, memory→
|
|
160
|
+
manage: issue→issue, milestone→milestone_audit, phase→milestone_close, memory→knowhow, doc→sync, codebase→codebase_refresh, config→spec_setup, team→team_coordinate; default→status
|
|
173
161
|
transition: phase→milestone_close, milestone→milestone_complete; default→milestone_close
|
|
174
162
|
continue: default→state_continue
|
|
175
163
|
sync: doc→sync, codebase→codebase_refresh; default→sync
|
|
@@ -196,10 +184,9 @@ Display intent analysis: action, object, scope, issue_id, phase_ref, task_type,
|
|
|
196
184
|
### 3a: Map task_type → chain
|
|
197
185
|
|
|
198
186
|
**Resolution order:**
|
|
199
|
-
1. `
|
|
200
|
-
2.
|
|
201
|
-
3.
|
|
202
|
-
4. `chainMap[taskType]` → direct lookup
|
|
187
|
+
1. `state_continue` → `detectNextAction(projectState)` → `{ chain, argsOverride? }`. Apply argsOverride before template substitution.
|
|
188
|
+
2. Task-type aliases → named chain: `spec_generate`→`spec-driven`, `brainstorm`→`brainstorm-driven`, `issue_execute`→`issue-full`
|
|
189
|
+
3. `chainMap[taskType]` → direct lookup
|
|
203
190
|
|
|
204
191
|
Full `chainMap` and `detectNextAction` are in the [Reference Data](#reference-data) section.
|
|
205
192
|
|
|
@@ -237,21 +224,31 @@ When executing issue chains, replace `{issue_id}` in step args with resolved ID.
|
|
|
237
224
|
|
|
238
225
|
**If `dryRun`:** Display chain visualization and exit.
|
|
239
226
|
**If not `autoYes`:** Confirm with user — show numbered steps, offer: Execute / Execute from step N / Cancel.
|
|
227
|
+
If user chooses "Execute from step N": set `$START_STEP = N` (used in 3f to set `current_step`).
|
|
240
228
|
|
|
241
229
|
### 3e: Step-level engine selection
|
|
242
230
|
|
|
243
|
-
Engine is selected **per step**, not per chain.
|
|
231
|
+
Engine is selected **per step**, not per chain. Pre-compute and write to each step's `engine` field in status.json (execution workflow reads this, does not re-compute).
|
|
244
232
|
|
|
245
233
|
```
|
|
246
|
-
If execMode is 'cli' or '
|
|
234
|
+
If execMode is 'cli' or 'internal' → force that engine for all steps.
|
|
247
235
|
In 'auto' mode, select per step:
|
|
248
236
|
CLI steps (heavy, context-isolated): maestro-plan, maestro-execute, maestro-analyze, maestro-brainstorm, maestro-roadmap, maestro-ui-design, quality-refactor
|
|
249
|
-
|
|
237
|
+
Internal steps (everything else): current-session Skill() call — verify, review, test, debug, milestone-*, manage-*, spec-*, quick, etc.
|
|
250
238
|
```
|
|
251
239
|
|
|
252
|
-
**Trade-off:** CLI = context isolation + template prompts + gemini analysis.
|
|
240
|
+
**Trade-off:** CLI = context isolation + template prompts + gemini analysis. Internal = current-session Skill() call, direct visibility + synchronous + user can intervene.
|
|
241
|
+
|
|
242
|
+
### 3f: Low-complexity fast path (before session creation)
|
|
243
|
+
|
|
244
|
+
If ALL conditions met:
|
|
245
|
+
- clarity >= 2
|
|
246
|
+
- task_type == `'quick'` or (action == `'create'` && object == `'feature'`)
|
|
247
|
+
- NOT `state_continue`
|
|
253
248
|
|
|
254
|
-
|
|
249
|
+
Then: `Skill({ skill: "maestro-quick", args: '"{description}"' })`. **End.** (no session created, no status.json)
|
|
250
|
+
|
|
251
|
+
### 3g: Setup session
|
|
255
252
|
|
|
256
253
|
Create session directory `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/` and write `status.json`:
|
|
257
254
|
```json
|
|
@@ -267,105 +264,26 @@ Create session directory `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/` and wri
|
|
|
267
264
|
"cli_tool": "{cliTool}",
|
|
268
265
|
"gemini_session_id": null,
|
|
269
266
|
"step_analyses": [],
|
|
270
|
-
"
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
### Shared: context & argument assembly
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
Context object tracks: current_phase, user_intent, issue_id, spec_session_id, scratch_dir, auto_mode.
|
|
282
|
-
|
|
283
|
-
assembleArgs: substitute placeholders {phase}, {description}, {issue_id}, {spec_session_id}, {scratch_dir} in step.args.
|
|
284
|
-
In auto_mode, append per-command flag if not already present:
|
|
285
|
-
maestro-analyze/brainstorm/roadmap/ui-design → -y
|
|
286
|
-
maestro-plan → --auto
|
|
287
|
-
quality-test → --auto-fix
|
|
288
|
-
quality-retrospective → --auto-yes
|
|
289
|
-
|
|
290
|
-
Shell-escape strings with single quotes for CLI delegate calls.
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### Step loop — for each step starting at `$STEP_INDEX` (default 0):
|
|
294
|
-
|
|
295
|
-
**4a. Select engine & display banner:**
|
|
296
|
-
|
|
297
|
-
Select engine per step (see 3e). Display step banner with index, command name, engine, args.
|
|
298
|
-
- Step >= 4 and not autoYes: hint user about `/maestro -c` for fresh context resume.
|
|
299
|
-
- autoYes and step >= 5: log warning to status.json.
|
|
300
|
-
- Update status.json: step status = `"running"`, engine, started_at.
|
|
301
|
-
|
|
302
|
-
**4b. Execute (engine-dependent):**
|
|
303
|
-
|
|
304
|
-
**Skill** — invoke `Skill({ skill: step.cmd, args: assembledArgs })` directly (synchronous, visible).
|
|
305
|
-
|
|
306
|
-
**CLI** — template-driven, async, context-isolated:
|
|
307
|
-
1. Load template `~/.maestro/templates/cli/prompts/coordinate-step.txt`
|
|
308
|
-
2. Build `analysisHints` from previous step's `next_step_hints` (prompt_additions, cautions, context_to_carry)
|
|
309
|
-
3. Substitute template placeholders: `{{COMMAND}}`, `{{ARGS}}`, `{{STEP_N}}`, `{{AUTO_DIRECTIVE}}`, `{{CHAIN_NAME}}`, `{{ANALYSIS_HINTS}}`
|
|
310
|
-
4. Run `maestro delegate <prompt> --to {cliTool} --mode write` via `Bash(run_in_background: true, timeout: 600000)`
|
|
311
|
-
5. **STOP** — wait for background callback
|
|
312
|
-
|
|
313
|
-
**4c. Parse output & update context:**
|
|
314
|
-
|
|
315
|
-
Scan step output for context propagation: `PHASE: N` → current_phase, `SPEC-xxx` → spec_session_id, `scratch_dir: path` → scratch_dir. CLI: capture exec_id from stderr.
|
|
316
|
-
|
|
317
|
-
**4d. Handle result:**
|
|
318
|
-
|
|
319
|
-
Success: mark `"completed"` in status.json. CLI: save output to `step-{N}-output.txt`.
|
|
320
|
-
Failure: autoYes → retry once then skip. Interactive → Retry (max 2) / Skip / Abort. Abort → **Error E003** with resume hint.
|
|
321
|
-
|
|
322
|
-
**4e. Post-step analysis (CLI steps only, multi-step chains):**
|
|
323
|
-
|
|
324
|
-
Skip if: step failed/skipped, single-step chain, or `stepEngine === 'skill'`.
|
|
325
|
-
|
|
326
|
-
Delegate to gemini (analysis mode, `--resume` if prior gemini_session_id exists) with prompt containing:
|
|
327
|
-
- Step command, args, chain name, intent
|
|
328
|
-
- Last 200 lines of step output
|
|
329
|
-
- Next step info (if any)
|
|
330
|
-
|
|
331
|
-
Expected JSON response:
|
|
332
|
-
```json
|
|
333
|
-
{
|
|
334
|
-
"quality_score": "<0-100>",
|
|
335
|
-
"execution_assessment": { "success": "<bool>", "completeness": "<full|partial|minimal>", "key_outputs": [], "missing_outputs": [] },
|
|
336
|
-
"issues": [{ "severity": "critical|high|medium|low", "description": "" }],
|
|
337
|
-
"next_step_hints": {
|
|
338
|
-
"prompt_additions": "<extra context for next step>",
|
|
339
|
-
"cautions": ["<things to watch out for>"],
|
|
340
|
-
"context_to_carry": "<key facts from this step>"
|
|
267
|
+
"context": {
|
|
268
|
+
"current_phase": "{resolved_phase}",
|
|
269
|
+
"user_intent": "{original_intent}",
|
|
270
|
+
"issue_id": "{resolved_issue_id or null}",
|
|
271
|
+
"milestone_num": "{current_milestone_num or null}",
|
|
272
|
+
"spec_session_id": null,
|
|
273
|
+
"scratch_dir": null
|
|
341
274
|
},
|
|
342
|
-
"
|
|
275
|
+
"steps": [{ "index": 0, "skill": "{skill_name}", "args": "{args}", "engine": "{cli|internal from 3e}", "status": "pending", "started_at": null, "completed_at": null }],
|
|
276
|
+
"current_step": "{$START_STEP or 0}",
|
|
277
|
+
"status": "running"
|
|
343
278
|
}
|
|
344
279
|
```
|
|
345
280
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
**4f. Completion report:**
|
|
349
|
-
|
|
350
|
-
```
|
|
351
|
-
============================================================
|
|
352
|
-
MAESTRO SESSION COMPLETE
|
|
353
|
-
============================================================
|
|
354
|
-
Session: {session_id}
|
|
355
|
-
Chain: {chain_name}
|
|
356
|
-
Steps: {completed}/{total} completed
|
|
357
|
-
Phase: {current_phase}
|
|
358
|
-
|
|
359
|
-
Results:
|
|
360
|
-
[✓] 1. maestro-plan — completed [cli] (quality: 85/100)
|
|
361
|
-
[✓] 2. maestro-verify — completed [skill]
|
|
362
|
-
[—] 3. quality-review — skipped [skill]
|
|
281
|
+
## Step 4: Dispatch to execution workflow
|
|
363
282
|
|
|
364
|
-
|
|
283
|
+
status.json already created in Step 3g with `steps[]` and `context`.
|
|
365
284
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
```
|
|
285
|
+
1. Read `~/.maestro/workflows/maestro-chain-execute.md`
|
|
286
|
+
2. Follow it with `$SESSION_PATH` = session directory from Step 3g
|
|
369
287
|
|
|
370
288
|
---
|
|
371
289
|
|
|
@@ -554,8 +472,8 @@ detectNextAction(state):
|
|
|
554
472
|
1. **Semantic Routing** — LLM-native `action × object` extraction; disambiguates "问题" by context
|
|
555
473
|
2. **State-Aware** — Reads `.workflow/state.json` before routing
|
|
556
474
|
3. **Quality Gates** — Issue chains auto-include review; `issue-full` is default for issue execution
|
|
557
|
-
4. **Per-Step Engine** — Each step independently selects
|
|
558
|
-
5. **CLI Analysis Chain** — Gemini evaluates each CLI step's output, generates `next_step_hints` via `{{ANALYSIS_HINTS}}`.
|
|
475
|
+
4. **Per-Step Engine** — Each step independently selects internal or CLI. Heavy steps (plan, execute, analyze, brainstorm) → CLI for context isolation. Observable steps (verify, review, test, debug, manage-*) → internal (current-session Skill()) for direct visibility. `--exec cli|internal` forces all steps.
|
|
476
|
+
5. **CLI Analysis Chain** — Gemini evaluates each CLI step's output, generates `next_step_hints` via `{{ANALYSIS_HINTS}}`. Internal steps skip analysis (output already visible). Sessions chained via `--resume`
|
|
559
477
|
6. **Phase Propagation** — Auto-detects and passes phase numbers to downstream commands
|
|
560
478
|
7. **Auto Mode** — `-y` propagates through chain, skipping all confirmations
|
|
561
479
|
8. **Resumable** — Session state in `.workflow/.maestro/` enables `-c` resume
|