maestro-flow 0.3.34 → 0.3.36
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-ralph-execute.md +136 -177
- package/.claude/commands/maestro-ralph.md +292 -326
- package/.codex/skills/maestro-ralph/SKILL.md +358 -454
- package/README.md +83 -221
- package/README.zh-CN.md +94 -241
- package/dashboard/dist-server/dashboard/src/server/routes/csv-waves.d.ts +2 -0
- package/dashboard/dist-server/dashboard/src/server/routes/csv-waves.js +244 -0
- package/dashboard/dist-server/dashboard/src/server/routes/csv-waves.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/server/routes/index.js +3 -0
- package/dashboard/dist-server/dashboard/src/server/routes/index.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js +7 -0
- package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/state/state-manager.js +84 -12
- package/dashboard/dist-server/dashboard/src/server/state/state-manager.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/state/state-manager.test.js +2 -1
- package/dashboard/dist-server/dashboard/src/server/state/state-manager.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/csv-wave-types.d.ts +48 -0
- package/dashboard/dist-server/dashboard/src/shared/csv-wave-types.js +5 -0
- package/dashboard/dist-server/dashboard/src/shared/csv-wave-types.js.map +1 -0
- package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
- package/dashboard/dist-server/src/config/cli-tools-config.js +21 -0
- package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
- package/dist/src/config/cli-tools-config.d.ts +6 -0
- package/dist/src/config/cli-tools-config.d.ts.map +1 -1
- package/dist/src/config/cli-tools-config.js +21 -0
- package/dist/src/config/cli-tools-config.js.map +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.d.ts +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.js +17 -2
- package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
- package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
- package/dist/src/tui/tools-ui/ToolsOverview.js +30 -1
- package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,591 +1,469 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: maestro-ralph
|
|
3
|
-
description: Closed-loop lifecycle decision engine — read state, infer position, build adaptive chain, execute via CSV waves,
|
|
3
|
+
description: Closed-loop lifecycle decision engine — read state, infer position, build adaptive chain, execute via CSV waves, delegate-evaluate at decision nodes
|
|
4
4
|
argument-hint: "\"intent\" [-y] | status | continue | execute"
|
|
5
5
|
allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<purpose>
|
|
9
9
|
Closed-loop decision engine for the maestro workflow lifecycle.
|
|
10
|
-
Coordinator assembles fully-resolved skill calls
|
|
11
|
-
|
|
10
|
+
Coordinator assembles fully-resolved skill calls → spawns via `spawn_agents_on_csv` →
|
|
11
|
+
delegates evaluation at decision nodes → dynamically expands/shrinks chain.
|
|
12
12
|
|
|
13
13
|
Entry points:
|
|
14
|
-
- **`$maestro-ralph "intent"`** —
|
|
15
|
-
- **`$maestro-ralph execute`** — Resume
|
|
14
|
+
- **`$maestro-ralph "intent"`** — New session: read state → infer → build → execute
|
|
15
|
+
- **`$maestro-ralph execute`** / **`continue`** — Resume: run next wave(s) until decision or completion
|
|
16
16
|
- **`$maestro-ralph status`** — Display session progress
|
|
17
|
-
- **`$maestro-ralph continue`** — Alias for `execute`
|
|
18
|
-
|
|
19
|
-
Key difference from maestro coordinator:
|
|
20
|
-
- maestro: static chain → run all waves to completion
|
|
21
|
-
- ralph: living chain → decision nodes pause execution → ralph re-evaluates → chain grows/shrinks dynamically
|
|
22
17
|
|
|
23
18
|
Two node types:
|
|
24
|
-
- **skill**: Executed via `spawn_agents_on_csv`. Barrier skills
|
|
25
|
-
- **decision**:
|
|
19
|
+
- **skill**: Executed via `spawn_agents_on_csv`. Barrier skills solo; non-barriers parallel.
|
|
20
|
+
- **decision**: Delegate evaluation via `maestro delegate --role analyze`, then expand/proceed/escalate.
|
|
21
|
+
|
|
22
|
+
Key difference from maestro coordinator:
|
|
23
|
+
- maestro: static chain → run all waves
|
|
24
|
+
- ralph: living chain → decision nodes delegate-evaluate → chain adapts dynamically
|
|
26
25
|
|
|
27
26
|
Session at `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json`.
|
|
28
27
|
</purpose>
|
|
29
28
|
|
|
30
29
|
<context>
|
|
31
|
-
$ARGUMENTS — intent text
|
|
30
|
+
$ARGUMENTS — intent text or keywords.
|
|
32
31
|
|
|
33
32
|
**Routing:**
|
|
34
33
|
```
|
|
35
34
|
"status" → handleStatus(). End.
|
|
36
|
-
"execute" | "continue"→
|
|
37
|
-
otherwise →
|
|
35
|
+
"execute" | "continue"→ Phase 2 (Wave Execution).
|
|
36
|
+
otherwise → Phase 1 (New Session).
|
|
38
37
|
```
|
|
39
38
|
|
|
40
39
|
**Flags:**
|
|
41
|
-
- `-y` / `--yes`
|
|
40
|
+
- `-y` / `--yes` → `session.auto_mode = true`
|
|
41
|
+
- Skip confirmation prompts
|
|
42
|
+
- Decision nodes: auto-follow delegate verdict (no STOP), except post-debug-escalate
|
|
43
|
+
- Failures: retry once then skip
|
|
42
44
|
|
|
43
|
-
**`-y`
|
|
44
|
-
```
|
|
45
|
-
ralph -y → session.auto_mode = true
|
|
46
|
-
→ buildSkillCall() 按传播表直接附加 auto flag 到最终 skill_call
|
|
47
|
-
→ CSV 写入完整命令: $maestro-plan 1 -y
|
|
48
|
-
```
|
|
45
|
+
**`-y` downstream propagation** (appended to skill_call in CSV):
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
| Skill | 附加 Flag | 效果 |
|
|
53
|
-
|-------|-----------|------|
|
|
47
|
+
| Skill | Flag | Effect |
|
|
48
|
+
|-------|------|--------|
|
|
54
49
|
| maestro-init | `-y` | 跳过交互提问 |
|
|
55
|
-
| maestro-analyze | `-y` |
|
|
50
|
+
| maestro-analyze | `-y` | 跳过 scoping 交互 |
|
|
56
51
|
| maestro-brainstorm | `-y` | 跳过交互提问 |
|
|
57
52
|
| maestro-roadmap | `-y` | 跳过交互选择 |
|
|
58
53
|
| maestro-plan | `-y` | 跳过确认和澄清 |
|
|
59
54
|
| maestro-execute | `-y` | 跳过确认,blocked 自动继续 |
|
|
60
|
-
| maestro-verify | *(none)* | 无交互,正常执行 |
|
|
61
55
|
| quality-auto-test | `-y` | 跳过计划确认 |
|
|
62
|
-
| quality-review | *(none)* | 无交互确认,自动检测级别 |
|
|
63
56
|
| quality-test | `-y --auto-fix` | 自动触发 gap-fix loop |
|
|
64
|
-
| quality-debug | *(none)* | 无交互确认,正常诊断 |
|
|
65
|
-
| maestro-milestone-audit | *(none)* | 无交互,正常执行 |
|
|
66
57
|
| maestro-milestone-complete | `-y` | 跳过 knowledge promotion 交互 |
|
|
67
58
|
|
|
68
59
|
未列出的命令无 auto flag,原样执行。
|
|
69
|
-
|
|
70
|
-
**Decision-node detection (for execute mode):**
|
|
71
|
-
If status.json has a pending decision node as next step → Phase 2b (evaluate), not Phase 2a (spawn).
|
|
72
60
|
</context>
|
|
73
61
|
|
|
74
62
|
<invariants>
|
|
75
|
-
1. **ALL skills via spawn_agents_on_csv
|
|
76
|
-
2. **Coordinator = prompt assembler
|
|
77
|
-
3. **Decision nodes
|
|
78
|
-
4. **
|
|
79
|
-
5. **
|
|
80
|
-
6. **
|
|
81
|
-
7. **Wave-by-wave
|
|
82
|
-
8. **Coordinator owns context
|
|
83
|
-
9. **Abort on failure
|
|
84
|
-
10. **Quality mode governs steps
|
|
85
|
-
11. **passed_gates skip
|
|
63
|
+
1. **ALL skills via spawn_agents_on_csv** — coordinator NEVER executes skill logic directly
|
|
64
|
+
2. **Coordinator = prompt assembler** — classify → enrich args → build CSV → spawn → read results → assemble next
|
|
65
|
+
3. **Decision nodes delegate-evaluate** — use `maestro delegate --role analyze` for quality-gate assessment; structural decisions (post-milestone, post-debug-escalate) evaluated directly
|
|
66
|
+
4. **Decision STOP behavior** — default: STOP after evaluation; `-y` mode: auto-continue (except post-debug-escalate always STOPs)
|
|
67
|
+
5. **Barrier = solo wave** — analyze, plan, execute, brainstorm, roadmap always run alone
|
|
68
|
+
6. **Non-barriers can parallel** — consecutive non-barrier, non-decision steps grouped into one wave
|
|
69
|
+
7. **Wave-by-wave** — never start wave N+1 before wave N results are read
|
|
70
|
+
8. **Coordinator owns context** — sub-agents never read prior results; coordinator assembles full skill_call
|
|
71
|
+
9. **Abort on failure** — `-y`: retry once then skip; non-`-y`: mark remaining skipped → pause
|
|
72
|
+
10. **Quality mode governs steps** — full/standard/quick determines which quality stages are included
|
|
73
|
+
11. **passed_gates skip** — already-passed gates not re-run in retry loops (unless code changed)
|
|
86
74
|
</invariants>
|
|
87
75
|
|
|
88
76
|
<execution>
|
|
89
77
|
|
|
90
|
-
## Phase 1:
|
|
91
|
-
|
|
92
|
-
### 1a: Read project state
|
|
78
|
+
## Phase 1: New Session
|
|
93
79
|
|
|
94
|
-
|
|
80
|
+
### 1.1: Read project state
|
|
95
81
|
|
|
82
|
+
Read `.workflow/state.json` schema:
|
|
96
83
|
```json
|
|
97
84
|
{
|
|
98
85
|
"current_milestone": "MVP",
|
|
99
86
|
"milestones": [{ "id": "M1", "name": "MVP", "status": "active", "phases": [1, 2] }],
|
|
100
|
-
"artifacts": [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"path": "phases/01-auth-multi-tenant", // relative to .workflow/scratch/
|
|
108
|
-
"status": "completed",
|
|
109
|
-
"depends_on": "PLN-001",
|
|
110
|
-
"harvested": true
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
"accumulated_context": {
|
|
114
|
-
"key_decisions": [...],
|
|
115
|
-
"deferred": [...]
|
|
116
|
-
}
|
|
87
|
+
"artifacts": [{
|
|
88
|
+
"id": "ANL-001", "type": "analyze|plan|execute|verify",
|
|
89
|
+
"milestone": "MVP", "phase": 1, "scope": "phase|milestone|adhoc|standalone",
|
|
90
|
+
"path": "phases/01-auth-multi-tenant", // relative to .workflow/scratch/
|
|
91
|
+
"status": "completed", "depends_on": "PLN-001", "harvested": true
|
|
92
|
+
}],
|
|
93
|
+
"accumulated_context": { "key_decisions": [], "deferred": [] }
|
|
117
94
|
}
|
|
118
95
|
```
|
|
119
96
|
|
|
120
|
-
|
|
97
|
+
### 1.2: Infer lifecycle position
|
|
121
98
|
|
|
122
|
-
|
|
123
|
-
Case A — No .workflow/ at all:
|
|
124
|
-
A1: No source files (empty project, 0→1)
|
|
125
|
-
→ position = "brainstorm", chain starts: brainstorm → init → roadmap → analyze → ...
|
|
126
|
-
A2: Has source files (existing code, first time using maestro)
|
|
127
|
-
→ position = "init", chain starts: init → roadmap → analyze → ...
|
|
99
|
+
**Bootstrap detection:**
|
|
128
100
|
|
|
129
|
-
|
|
130
|
-
|
|
101
|
+
| Condition | Position | Chain starts at |
|
|
102
|
+
|-----------|----------|-----------------|
|
|
103
|
+
| No `.workflow/` + no source files | `brainstorm` | brainstorm → init → roadmap → ... |
|
|
104
|
+
| No `.workflow/` + has source files | `init` | init → roadmap → ... |
|
|
105
|
+
| Has `.workflow/` but no state.json | `init` | init → roadmap → ... |
|
|
106
|
+
| Has state.json | → Artifact-based inference below |
|
|
131
107
|
|
|
132
|
-
|
|
133
|
-
→ artifact-based inference (see below)
|
|
134
|
-
```
|
|
108
|
+
**Artifact-based inference:**
|
|
135
109
|
|
|
136
|
-
|
|
110
|
+
Filter by `milestone == current_milestone`, target phase. Find latest completed artifact type:
|
|
137
111
|
|
|
138
|
-
|
|
112
|
+
| State | Position |
|
|
113
|
+
|-------|----------|
|
|
114
|
+
| No milestones[] or no roadmap.md | `roadmap` |
|
|
115
|
+
| No artifacts for target phase | `analyze` |
|
|
116
|
+
| Latest == "analyze" | `plan` |
|
|
117
|
+
| Latest == "plan" | `execute` |
|
|
118
|
+
| Latest == "execute" | `verify` |
|
|
119
|
+
| Latest == "verify" | → Refine by result files |
|
|
139
120
|
|
|
140
|
-
|
|
141
|
-
state.json exists, no milestones[] → "roadmap"
|
|
142
|
-
Has milestones, no roadmap.md → "roadmap"
|
|
143
|
-
Has roadmap, no artifacts for target phase → "analyze"
|
|
144
|
-
Latest artifact type == "analyze" → "plan"
|
|
145
|
-
Latest artifact type == "plan" → "execute"
|
|
146
|
-
Latest artifact type == "execute" → "verify"
|
|
147
|
-
Latest artifact type == "verify" → check result files (see below)
|
|
121
|
+
**Refine from verify results** (read `{artifact_dir}/`):
|
|
148
122
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
has uat.md with failures → "test-failed"
|
|
158
|
-
```
|
|
123
|
+
| Condition | Position |
|
|
124
|
+
|-----------|----------|
|
|
125
|
+
| verification.json: `passed==false` or `gaps[]` non-empty | `verify-failed` |
|
|
126
|
+
| verification.json: `passed==true`, no review.json | `post-verify` |
|
|
127
|
+
| review.json: `verdict=="BLOCK"` | `review-failed` |
|
|
128
|
+
| review.json: `verdict!="BLOCK"` | `test` |
|
|
129
|
+
| uat.md: all passed | `milestone-audit` |
|
|
130
|
+
| uat.md: has failures | `test-failed` |
|
|
159
131
|
|
|
160
132
|
**resolve_artifact_dir(artifact):**
|
|
161
133
|
```
|
|
162
|
-
artifact.path is relative path (e.g. "phases/01-auth-multi-tenant")
|
|
163
134
|
Full path = .workflow/scratch/{artifact.path}/
|
|
164
|
-
If path starts with "phases/": also try .workflow/scratch/{YYYYMMDD}-*-P{phase}-*/
|
|
165
135
|
Fallback: glob .workflow/scratch/*-P{phase}-*/ sorted by date DESC, take first
|
|
166
136
|
```
|
|
167
137
|
|
|
168
|
-
###
|
|
138
|
+
### 1.3: Determine quality mode
|
|
169
139
|
|
|
170
|
-
**
|
|
140
|
+
**Auto-inference (can be overridden by user to any mode):**
|
|
171
141
|
|
|
172
|
-
|
|
|
173
|
-
|
|
174
|
-
| `full` |
|
|
175
|
-
| `standard` |
|
|
176
|
-
|
|
|
142
|
+
| Condition | Mode | Pipeline |
|
|
143
|
+
|-----------|------|----------|
|
|
144
|
+
| Has requirements/REQ-*.md + phase scope | `full` | verify → business-test → review → test-gen → test |
|
|
145
|
+
| Default | `standard` | verify → review → test (test-gen conditional on coverage < 80%) |
|
|
146
|
+
| User explicit `--quality quick` | `quick` | verify → review --tier quick |
|
|
177
147
|
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
有 requirements/REQ-*.md 且 phase scope == "phase" → full
|
|
181
|
-
其他场景 → standard
|
|
182
|
-
用户显式指定 → 覆盖自动推断
|
|
183
|
-
```
|
|
148
|
+
User can specify `--quality full|standard|quick` to override auto-inference.
|
|
184
149
|
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
Stage Skill Barrier Decision After Condition
|
|
188
|
-
───────────────────────────────────────────────────────────────────────────────────────────────
|
|
189
|
-
brainstorm maestro-brainstorm "{intent}" yes — 0→1 only
|
|
190
|
-
init maestro-init no — always
|
|
191
|
-
roadmap maestro-roadmap "{intent}" yes — always
|
|
192
|
-
analyze maestro-analyze {phase} yes — always
|
|
193
|
-
plan maestro-plan {phase} yes — always
|
|
194
|
-
execute maestro-execute {phase} yes — always
|
|
195
|
-
verify maestro-verify {phase} no decision:post-verify always
|
|
196
|
-
business-test quality-auto-test {phase} no decision:post-biz-test full only ①
|
|
197
|
-
review quality-review {phase} no decision:post-review always ②
|
|
198
|
-
test-gen quality-auto-test {phase} no — full; standard 按条件 ③
|
|
199
|
-
test quality-test {phase} no decision:post-test full/standard ④
|
|
200
|
-
milestone-audit maestro-milestone-audit no — always
|
|
201
|
-
milestone-complete maestro-milestone-complete no decision:post-milestone always
|
|
202
|
-
```
|
|
150
|
+
### 1.4: Build command sequence
|
|
203
151
|
|
|
204
|
-
|
|
205
|
-
- ① `business-test`: 仅 full 模式
|
|
206
|
-
- ② `review`: 所有模式均通过 skill spawn;quick 模式附加 `--tier quick`
|
|
207
|
-
- ③ `test-gen`: full 模式始终执行;standard 模式仅在覆盖率 < 80% 时执行
|
|
208
|
-
- ④ `test`: full/standard 执行;quick 模式跳过
|
|
152
|
+
**Lifecycle stages:**
|
|
209
153
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
154
|
+
| Stage | Skill | Barrier | Decision after | Condition |
|
|
155
|
+
|-------|-------|---------|----------------|-----------|
|
|
156
|
+
| brainstorm | `maestro-brainstorm "{intent}"` | yes | — | 0→1 only |
|
|
157
|
+
| init | `maestro-init` | no | — | always |
|
|
158
|
+
| roadmap | `maestro-roadmap "{intent}"` | yes | — | always |
|
|
159
|
+
| analyze | `maestro-analyze {phase}` | yes | — | always |
|
|
160
|
+
| plan | `maestro-plan {phase}` | yes | — | always |
|
|
161
|
+
| execute | `maestro-execute {phase}` | yes | — | always |
|
|
162
|
+
| verify | `maestro-verify {phase}` | no | `post-verify` | always |
|
|
163
|
+
| business-test | `quality-auto-test {phase}` | no | `post-biz-test` | full only |
|
|
164
|
+
| review | `quality-review {phase}` | no | `post-review` | always (quick: +`--tier quick`) |
|
|
165
|
+
| test-gen | `quality-auto-test {phase}` | no | — | full; standard if coverage < 80% |
|
|
166
|
+
| test | `quality-test {phase}` | no | `post-test` | full/standard |
|
|
167
|
+
| milestone-audit | `maestro-milestone-audit` | no | — | always |
|
|
168
|
+
| milestone-complete | `maestro-milestone-complete` | no | `post-milestone` | always |
|
|
214
169
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
remove test + decision:post-test
|
|
222
|
-
if quality_mode == "standard":
|
|
223
|
-
mark test-gen as conditional: "check_coverage"
|
|
170
|
+
**Build rules:**
|
|
171
|
+
1. Start from inferred position, skip completed stages
|
|
172
|
+
2. Filter by quality_mode (remove inapplicable stages)
|
|
173
|
+
3. After each decision-triggering stage, insert decision node: `{ decision, retry_count: 0, max_retries: 2 }`
|
|
174
|
+
4. Conditional steps (test-gen in standard) use: `{ "condition": "check_coverage", "threshold": 80 }`
|
|
175
|
+
5. Args use placeholders resolved at wave build time by coordinator
|
|
224
176
|
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
Generate `steps[]` from current position to target. Decision nodes use:
|
|
229
|
-
```json
|
|
230
|
-
{ "type": "decision", "skill": "maestro-ralph", "args": "{\"decision\":\"post-verify\",\"retry_count\":0,\"max_retries\":2}" }
|
|
231
|
-
```
|
|
232
|
-
Conditional steps use:
|
|
233
|
-
```json
|
|
234
|
-
{ "type": "skill", "skill": "quality-auto-test", "args": "{phase}", "condition": "check_coverage", "threshold": 80 }
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### 1d: Create session
|
|
177
|
+
### 1.5: Create session
|
|
238
178
|
|
|
239
179
|
Write `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json`:
|
|
240
180
|
```json
|
|
241
181
|
{
|
|
242
182
|
"session_id": "ralph-{YYYYMMDD-HHmmss}",
|
|
243
183
|
"source": "ralph",
|
|
244
|
-
"created_at": "ISO",
|
|
184
|
+
"created_at": "ISO", "updated_at": "ISO",
|
|
245
185
|
"intent": "{user_intent}",
|
|
246
186
|
"status": "running",
|
|
247
187
|
"chain_name": "ralph-lifecycle",
|
|
248
|
-
"task_type": "lifecycle",
|
|
249
188
|
"lifecycle_position": "{position}",
|
|
250
189
|
"target": "milestone-complete",
|
|
251
|
-
"phase": null,
|
|
252
|
-
"milestone": null,
|
|
190
|
+
"phase": null | N,
|
|
191
|
+
"milestone": null | "{M}",
|
|
253
192
|
"auto_mode": false,
|
|
254
193
|
"quality_mode": "standard",
|
|
255
194
|
"passed_gates": [],
|
|
256
195
|
"context": {
|
|
257
|
-
"issue_id": null,
|
|
258
|
-
"
|
|
259
|
-
"spec_session_id": null,
|
|
260
|
-
"scratch_dir": null,
|
|
261
|
-
"plan_dir": null,
|
|
262
|
-
"analysis_dir": null,
|
|
263
|
-
"brainstorm_dir": null
|
|
196
|
+
"issue_id": null, "milestone_num": null, "spec_session_id": null,
|
|
197
|
+
"scratch_dir": null, "plan_dir": null, "analysis_dir": null, "brainstorm_dir": null
|
|
264
198
|
},
|
|
265
199
|
"steps": [...],
|
|
266
200
|
"waves": [],
|
|
267
|
-
"current_step": 0
|
|
268
|
-
"updated_at": "ISO"
|
|
201
|
+
"current_step": 0
|
|
269
202
|
}
|
|
270
203
|
```
|
|
271
204
|
|
|
272
|
-
###
|
|
205
|
+
### 1.6: Initialize plan + confirm
|
|
273
206
|
|
|
274
207
|
```
|
|
275
208
|
functions.update_plan({
|
|
276
209
|
explanation: "Ralph lifecycle: {position} → milestone-complete",
|
|
277
|
-
plan: steps.map((step
|
|
278
|
-
step: stepLabel(step),
|
|
279
|
-
status: "pending"
|
|
280
|
-
}))
|
|
210
|
+
plan: steps.map(step => ({ step: stepLabel(step), status: "pending" }))
|
|
281
211
|
})
|
|
282
212
|
```
|
|
283
213
|
|
|
284
|
-
|
|
285
|
-
- skill: `[{i+1}/{total}] ${step.skill} ${step.args}` + barrier 标 `[BARRIER]`
|
|
286
|
-
- decision: `[{i+1}/{total}] ◆ ${decision_type} [DECISION]`
|
|
287
|
-
|
|
288
|
-
Display plan:
|
|
214
|
+
Display:
|
|
289
215
|
```
|
|
290
216
|
============================================================
|
|
291
217
|
RALPH DECISION ENGINE
|
|
292
218
|
============================================================
|
|
293
219
|
Position: {position} (Phase {N}, {milestone})
|
|
294
220
|
Target: milestone-complete
|
|
295
|
-
Quality: {quality_mode}
|
|
221
|
+
Quality: {quality_mode}
|
|
296
222
|
Steps: {total} ({decision_count} decision points)
|
|
297
223
|
|
|
298
|
-
[ ] 0. maestro-plan {phase} [
|
|
299
|
-
[ ] 1. maestro-execute {phase} [
|
|
224
|
+
[ ] 0. maestro-plan {phase} [barrier]
|
|
225
|
+
[ ] 1. maestro-execute {phase} [barrier]
|
|
300
226
|
[ ] 2. maestro-verify {phase} [skill]
|
|
301
|
-
[ ] 3. ◆ post-verify [decision]
|
|
302
|
-
[ ] 4. quality-review {phase} [skill]
|
|
303
|
-
[ ] 5. ◆ post-review [decision] ← STOP
|
|
227
|
+
[ ] 3. ◆ post-verify [decision]
|
|
304
228
|
...
|
|
305
229
|
============================================================
|
|
306
230
|
```
|
|
307
231
|
|
|
308
|
-
If
|
|
309
|
-
|
|
232
|
+
- If `-y`: proceed directly
|
|
233
|
+
- Else: AskUserQuestion → Proceed / Cancel / Change quality mode
|
|
310
234
|
|
|
311
|
-
|
|
235
|
+
Fall through to Phase 2.
|
|
312
236
|
|
|
313
237
|
---
|
|
314
238
|
|
|
315
|
-
## Phase 2: Wave Execution Loop
|
|
239
|
+
## Phase 2: Wave Execution Loop
|
|
316
240
|
|
|
317
|
-
###
|
|
241
|
+
### 2.1: Load session + find next step
|
|
318
242
|
|
|
319
|
-
Read status.json. Rebuild `update_plan` from
|
|
243
|
+
Read status.json. Rebuild `update_plan` from step statuses.
|
|
320
244
|
Find first pending step.
|
|
321
245
|
|
|
322
|
-
If
|
|
323
|
-
|
|
246
|
+
- If decision node → Step 2.2 (Delegate Evaluation)
|
|
247
|
+
- If skill node → Step 2.3 (Wave Execution)
|
|
248
|
+
- If no pending → Phase 3 (Completion)
|
|
324
249
|
|
|
325
|
-
###
|
|
250
|
+
### 2.2: Delegate Evaluation (decision nodes)
|
|
326
251
|
|
|
327
|
-
|
|
252
|
+
**Route by decision type:**
|
|
253
|
+
- Quality-gate decisions (post-verify, post-biz-test, post-review, post-test) → delegate analysis
|
|
254
|
+
- Structural decisions (post-milestone, post-debug-escalate) → direct evaluation
|
|
328
255
|
|
|
329
|
-
|
|
330
|
-
```
|
|
331
|
-
Read .workflow/state.json
|
|
332
|
-
Filter artifacts: milestone == session.milestone, phase == session.phase
|
|
333
|
-
Sort by created_at DESC
|
|
256
|
+
#### 2.2a: Delegate quality-gate assessment
|
|
334
257
|
|
|
335
|
-
|
|
336
|
-
post-verify → latest type=="verify" artifact
|
|
337
|
-
post-biz-test → same dir as verify (business-test writes to same artifact dir)
|
|
338
|
-
post-review → latest artifact dir → review.json
|
|
339
|
-
post-test → latest artifact dir → uat.md + .tests/test-results.json
|
|
258
|
+
Read decision metadata: `{ decision, retry_count, max_retries }`
|
|
340
259
|
|
|
341
|
-
|
|
342
|
-
```
|
|
260
|
+
**Result file mapping:**
|
|
343
261
|
|
|
344
|
-
|
|
262
|
+
| Decision | Files to include |
|
|
263
|
+
|----------|-----------------|
|
|
264
|
+
| post-verify | `{artifact_dir}/verification.json` |
|
|
265
|
+
| post-biz-test | `{artifact_dir}/business-test-results.json` |
|
|
266
|
+
| post-review | `{artifact_dir}/review.json` |
|
|
267
|
+
| post-test | `{artifact_dir}/uat.md`, `{artifact_dir}/.tests/test-results.json` |
|
|
345
268
|
|
|
346
|
-
|
|
347
|
-
|
|
269
|
+
```
|
|
270
|
+
Bash({
|
|
271
|
+
command: `maestro delegate "PURPOSE: 评估 ${meta.decision} 质量门结果
|
|
272
|
+
TASK: 读取结果文件 | 分析通过/失败 | 评估严重性 | 给出建议
|
|
273
|
+
MODE: analysis
|
|
274
|
+
CONTEXT: @${result_files}
|
|
275
|
+
EXPECTED: 严格按格式输出:
|
|
276
|
+
---VERDICT---
|
|
277
|
+
STATUS: proceed | fix | escalate
|
|
278
|
+
REASON: 一句话解释
|
|
279
|
+
GAP_SUMMARY: 问题描述(fix/escalate 时填写)
|
|
280
|
+
CONFIDENCE: high | medium | low
|
|
281
|
+
---END---
|
|
282
|
+
CONSTRAINTS: 只评估 | STATUS 三选一 | retry ${meta.retry_count}/${meta.max_retries} 达上限必须 escalate" --role analyze --mode analysis`,
|
|
283
|
+
run_in_background: true
|
|
284
|
+
})
|
|
285
|
+
STOP — wait for callback.
|
|
286
|
+
```
|
|
348
287
|
|
|
349
|
-
**
|
|
288
|
+
**Parse verdict** (on callback):
|
|
289
|
+
```
|
|
290
|
+
Extract STATUS / REASON / GAP_SUMMARY / CONFIDENCE from output.
|
|
291
|
+
If parse fails → fallback: STATUS = "fix", GAP_SUMMARY = generic
|
|
350
292
|
```
|
|
351
|
-
Read {artifact_dir}/verification.json
|
|
352
|
-
Check: gaps[] array and passed field
|
|
353
293
|
|
|
354
|
-
|
|
355
|
-
If meta.retry_count >= meta.max_retries:
|
|
356
|
-
→ Insert: [quality-debug "{gap_summary}", decision:post-debug-escalate]
|
|
357
|
-
Else:
|
|
358
|
-
→ Insert: [quality-debug "{gap_summary}", maestro-plan --gaps {phase},
|
|
359
|
-
maestro-execute {phase}, maestro-verify {phase},
|
|
360
|
-
decision:post-verify(retry+1)]
|
|
294
|
+
**Apply verdict:**
|
|
361
295
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
If coverage < 80% or not found → activate conditional test-gen step
|
|
367
|
-
Else → skip test-gen step
|
|
368
|
-
→ No insertion, proceed
|
|
369
|
-
```
|
|
296
|
+
| Mode | Behavior |
|
|
297
|
+
|------|----------|
|
|
298
|
+
| `-y` (auto_mode) | Follow verdict directly, no user prompt |
|
|
299
|
+
| Interactive | Display recommendation, AskUserQuestion: "按建议执行 / 覆盖 / 取消" |
|
|
370
300
|
|
|
371
|
-
**
|
|
372
|
-
```
|
|
373
|
-
Read {artifact_dir}/business-test-results.json
|
|
374
|
-
Check: failures[] or passed field
|
|
301
|
+
**Verdict → action:**
|
|
375
302
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
→ Insert: [quality-debug --from-business-test {phase},
|
|
382
|
-
maestro-plan --gaps {phase}, maestro-execute {phase},
|
|
383
|
-
maestro-verify {phase}, decision:post-verify(retry:0),
|
|
384
|
-
quality-auto-test {phase}, decision:post-biz-test(retry+1)]
|
|
303
|
+
| Verdict | Action |
|
|
304
|
+
|---------|--------|
|
|
305
|
+
| `proceed` | Add gate to passed_gates, continue |
|
|
306
|
+
| `fix` | Clear passed_gates (code will change), insert fix-loop |
|
|
307
|
+
| `escalate` | Insert `[quality-debug "{gap_summary}", decision:post-debug-escalate]` |
|
|
385
308
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
309
|
+
#### 2.2b: Fix-loop templates
|
|
310
|
+
|
|
311
|
+
The delegate's `gap_summary` is passed as context to `quality-debug`.
|
|
389
312
|
|
|
390
|
-
**post-
|
|
313
|
+
**post-verify fix-loop:**
|
|
314
|
+
```
|
|
315
|
+
quality-debug "{gap_summary}"
|
|
316
|
+
maestro-plan --gaps {phase} [barrier]
|
|
317
|
+
maestro-execute {phase} [barrier]
|
|
318
|
+
maestro-verify {phase}
|
|
319
|
+
decision:post-verify {retry+1}
|
|
391
320
|
```
|
|
392
|
-
Read {artifact_dir}/review.json
|
|
393
|
-
Check: verdict field and issues[].severity
|
|
394
321
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
322
|
+
**post-biz-test fix-loop (full mode):**
|
|
323
|
+
```
|
|
324
|
+
quality-debug --from-business-test "{gap_summary}"
|
|
325
|
+
maestro-plan --gaps {phase} [barrier]
|
|
326
|
+
maestro-execute {phase} [barrier]
|
|
327
|
+
maestro-verify {phase}
|
|
328
|
+
decision:post-verify {retry: 0}
|
|
329
|
+
quality-auto-test {phase}
|
|
330
|
+
decision:post-biz-test {retry+1}
|
|
331
|
+
```
|
|
403
332
|
|
|
404
|
-
|
|
405
|
-
|
|
333
|
+
**post-review fix-loop:**
|
|
334
|
+
```
|
|
335
|
+
quality-debug "{gap_summary}"
|
|
336
|
+
maestro-plan --gaps {phase} [barrier]
|
|
337
|
+
maestro-execute {phase} [barrier]
|
|
338
|
+
quality-review {phase}
|
|
339
|
+
decision:post-review {retry+1}
|
|
406
340
|
```
|
|
407
341
|
|
|
408
|
-
**post-test
|
|
342
|
+
**post-test fix-loop:**
|
|
343
|
+
```
|
|
344
|
+
quality-debug --from-uat "{gap_summary}"
|
|
345
|
+
maestro-plan --gaps {phase} [barrier]
|
|
346
|
+
maestro-execute {phase} [barrier]
|
|
347
|
+
maestro-verify {phase}
|
|
348
|
+
decision:post-verify {retry: 0}
|
|
349
|
+
quality-test {phase}
|
|
350
|
+
decision:post-test {retry+1}
|
|
409
351
|
```
|
|
410
|
-
Read {artifact_dir}/uat.md + {artifact_dir}/.tests/test-results.json
|
|
411
352
|
|
|
412
|
-
|
|
413
|
-
If meta.retry_count >= meta.max_retries:
|
|
414
|
-
→ Insert: [quality-debug --from-uat {phase}, decision:post-debug-escalate]
|
|
415
|
-
Else:
|
|
416
|
-
→ Clear passed_gates (code will change)
|
|
417
|
-
→ Insert: [quality-debug --from-uat {phase},
|
|
418
|
-
maestro-plan --gaps {phase}, maestro-execute {phase},
|
|
419
|
-
maestro-verify {phase}, decision:post-verify(retry:0),
|
|
420
|
-
quality-test {phase}, decision:post-test(retry+1)]
|
|
353
|
+
#### 2.2c: Structural decisions (direct evaluation)
|
|
421
354
|
|
|
422
|
-
|
|
423
|
-
|
|
355
|
+
**post-milestone:**
|
|
356
|
+
```
|
|
357
|
+
Read .workflow/state.json — check next milestone (status "pending"/"active")
|
|
358
|
+
If found: update session (milestone, phase, reset passed_gates), re-infer quality_mode,
|
|
359
|
+
insert lifecycle via buildSteps() for next milestone
|
|
360
|
+
If none: proceed — session completes naturally
|
|
424
361
|
```
|
|
425
362
|
|
|
426
|
-
**post-
|
|
363
|
+
**post-debug-escalate:**
|
|
364
|
+
```
|
|
365
|
+
Set session status = "paused"
|
|
366
|
+
Display: ◆ 已达最大重试次数,debug 已执行。请人工介入检查结果。
|
|
367
|
+
STOP (always, regardless of -y)
|
|
427
368
|
```
|
|
428
|
-
Re-read .workflow/state.json.
|
|
429
|
-
Check: next milestone with status == "pending" or "active"
|
|
430
369
|
|
|
431
|
-
|
|
432
|
-
Update session: milestone, phase, reset passed_gates
|
|
433
|
-
Re-infer quality_mode
|
|
434
|
-
Insert lifecycle via buildSteps() for next milestone
|
|
370
|
+
#### 2.2d: Finalize decision
|
|
435
371
|
|
|
436
|
-
If no next milestone:
|
|
437
|
-
→ Session will complete naturally
|
|
438
372
|
```
|
|
373
|
+
Mark decision step "completed"
|
|
374
|
+
Reindex steps if commands inserted
|
|
375
|
+
Write status.json
|
|
376
|
+
Sync update_plan
|
|
439
377
|
|
|
440
|
-
|
|
378
|
+
Display: ◆ Decision: {type} → {verdict.status} ({verdict.reason})
|
|
379
|
+
|
|
380
|
+
STOP behavior:
|
|
381
|
+
post-debug-escalate → always STOP
|
|
382
|
+
auto_mode == true → no STOP, continue to 2.3
|
|
383
|
+
auto_mode == false → STOP. Display: ⏸ 使用 $maestro-ralph execute 继续
|
|
441
384
|
```
|
|
442
|
-
→ Set session status = "paused"
|
|
443
|
-
→ Display: ◆ 已达最大重试次数,debug 已执行。请人工介入检查结果。
|
|
444
|
-
→ STOP
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
After evaluation:
|
|
448
|
-
1. Mark decision step as "completed"
|
|
449
|
-
2. Reindex steps if inserted
|
|
450
|
-
3. Write status.json
|
|
451
|
-
4. Sync `update_plan` with current step statuses
|
|
452
|
-
5. Display: `◆ Decision: {type} → {outcome}`
|
|
453
|
-
6. **STOP 判定:**
|
|
454
|
-
- `post-debug-escalate` → 始终 STOP
|
|
455
|
-
- `auto_mode == true` → 不 STOP,fall through to Phase 2c
|
|
456
|
-
- `auto_mode == false` → STOP。Display: `⏸ 到达决策节点。使用 $maestro-ralph execute 继续。`
|
|
457
|
-
|
|
458
|
-
### 2c: Build and Execute Next Wave
|
|
459
|
-
|
|
460
|
-
**While pending non-decision steps remain:**
|
|
461
|
-
|
|
462
|
-
1. **buildNextWave**: Take first pending step.
|
|
463
|
-
- If conditional step with condition not met → mark "skipped", advance to next
|
|
464
|
-
- If barrier → solo wave
|
|
465
|
-
- If non-barrier → collect consecutive non-barrier, non-decision steps
|
|
466
|
-
- Stop at first decision node
|
|
467
|
-
|
|
468
|
-
2. **buildSkillCall(step, ctx)** — Assemble fully-resolved skill_call:
|
|
469
|
-
|
|
470
|
-
**Placeholder resolution:**
|
|
471
|
-
```
|
|
472
|
-
{phase} → ctx.phase
|
|
473
|
-
{intent} → ctx.intent
|
|
474
|
-
{scratch_dir} → from latest artifact path
|
|
475
|
-
{plan_dir} → ctx.plan_dir
|
|
476
|
-
{analysis_dir}→ ctx.analysis_dir
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
**Per-skill arg enrichment** (coordinator does this, not sub-agent):
|
|
480
|
-
```
|
|
481
|
-
maestro-brainstorm: args empty → '"{intent}"'
|
|
482
|
-
maestro-roadmap: args empty → '"{intent}"'
|
|
483
|
-
maestro-analyze: args empty → '{phase}'
|
|
484
|
-
maestro-plan: needs dir → resolve latest analyze artifact → --dir .workflow/scratch/{path}
|
|
485
|
-
maestro-execute: needs dir → resolve latest plan artifact → --dir .workflow/scratch/{path}
|
|
486
|
-
quality-debug: from verify → append gap summary from verification.json
|
|
487
|
-
from test → append --from-uat {phase}
|
|
488
|
-
from biz → append --from-business-test {phase}
|
|
489
|
-
quality-* (review, test, auto-test): args empty → '{phase}'
|
|
490
|
-
maestro-verify, milestone-*: args empty → '{phase}' or empty
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
**Auto flag 附加** (when `session.auto_mode == true`):
|
|
494
|
-
```
|
|
495
|
-
auto_flag_map = {
|
|
496
|
-
"maestro-init": "-y",
|
|
497
|
-
"maestro-analyze": "-y",
|
|
498
|
-
"maestro-brainstorm": "-y",
|
|
499
|
-
"maestro-roadmap": "-y",
|
|
500
|
-
"maestro-plan": "-y",
|
|
501
|
-
"maestro-execute": "-y",
|
|
502
|
-
"quality-auto-test": "-y",
|
|
503
|
-
"quality-test": "-y --auto-fix",
|
|
504
|
-
"quality-retrospective": "-y",
|
|
505
|
-
"maestro-milestone-complete": "-y"
|
|
506
|
-
}
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
**Result**: `$<skill-name> <enriched-args> [auto-flag]`
|
|
510
|
-
|
|
511
|
-
3. **Write wave CSV**: `{sessionDir}/wave-{N}.csv`
|
|
512
|
-
```csv
|
|
513
|
-
id,skill_call,topic
|
|
514
|
-
"3","$maestro-verify 1","Ralph step 3/14: verify phase 1"
|
|
515
|
-
"4","$quality-review 1","Ralph step 4/14: review phase 1"
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
4. **Update plan** (mark wave steps as in_progress):
|
|
519
|
-
```
|
|
520
|
-
functions.update_plan({
|
|
521
|
-
explanation: "Wave {N}: executing {skill_names}",
|
|
522
|
-
plan: steps.map((step, i) => ({
|
|
523
|
-
step: stepLabel(step),
|
|
524
|
-
status: mapStatus(step.status) // pending→pending, running→in_progress, completed→completed
|
|
525
|
-
}))
|
|
526
|
-
})
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
5. **Spawn**:
|
|
530
|
-
```
|
|
531
|
-
spawn_agents_on_csv({
|
|
532
|
-
csv_path: "{sessionDir}/wave-{N}.csv",
|
|
533
|
-
id_column: "id",
|
|
534
|
-
instruction: WAVE_INSTRUCTION,
|
|
535
|
-
max_workers: <wave_size>,
|
|
536
|
-
max_runtime_seconds: 3600,
|
|
537
|
-
output_csv_path: "{sessionDir}/wave-{N}-results.csv",
|
|
538
|
-
output_schema: RESULT_SCHEMA
|
|
539
|
-
})
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
6. **Read results**: Update step status from results CSV
|
|
543
|
-
|
|
544
|
-
7. **Barrier check**: If wave was a barrier skill, read artifacts, update context:
|
|
545
|
-
| Barrier | Read | Update |
|
|
546
|
-
|---------|------|--------|
|
|
547
|
-
| maestro-analyze | context.md, state.json | context.analysis_dir, context.gaps |
|
|
548
|
-
| maestro-plan | plan.json | context.plan_dir, context.task_count |
|
|
549
|
-
| maestro-execute | results.csv | context.exec_status |
|
|
550
|
-
| maestro-brainstorm | .brainstorming/ | context.brainstorm_dir |
|
|
551
|
-
| maestro-roadmap | specs/ | context.spec_session_id |
|
|
552
|
-
|
|
553
|
-
8. **Persist**: Write status.json + sync `update_plan`
|
|
554
|
-
|
|
555
|
-
9. **Failure check**: Any step failed → mark remaining skipped, pause session, STOP
|
|
556
|
-
|
|
557
|
-
10. **Decision check**: If next pending step is a decision node:
|
|
558
|
-
- `auto_mode == true` → 进入 Phase 2b 评估,然后继续循环
|
|
559
|
-
- `auto_mode == false` → STOP
|
|
560
|
-
|
|
561
|
-
11. **Continue**: If next pending is not decision, loop back to step 1
|
|
562
|
-
|
|
563
|
-
### Sub-Agent Instruction Template
|
|
564
385
|
|
|
386
|
+
### 2.3: Build and Execute Wave
|
|
387
|
+
|
|
388
|
+
**Loop while pending non-decision steps exist:**
|
|
389
|
+
|
|
390
|
+
**1. buildNextWave:**
|
|
391
|
+
- Conditional step → evaluate condition, skip if not met:
|
|
392
|
+
- `check_coverage`: read `{artifact_dir}/validation.json`, if `coverage >= threshold` → skip test-gen; else → include
|
|
393
|
+
- If validation.json not found → include (assume coverage insufficient)
|
|
394
|
+
- Barrier step → solo wave (single row CSV)
|
|
395
|
+
- Non-barrier → collect consecutive non-barrier, non-decision steps (multi-row CSV)
|
|
396
|
+
- Stop at first decision node
|
|
397
|
+
|
|
398
|
+
**2. buildSkillCall(step, session)** — assemble fully-resolved command:
|
|
399
|
+
|
|
400
|
+
Placeholder resolution:
|
|
401
|
+
```
|
|
402
|
+
{phase} → session.phase
|
|
403
|
+
{intent} → session.intent
|
|
404
|
+
{scratch_dir} → latest artifact path
|
|
405
|
+
{plan_dir} → session.context.plan_dir
|
|
406
|
+
{analysis_dir} → session.context.analysis_dir
|
|
565
407
|
```
|
|
566
|
-
你是 CSV job 子 agent。
|
|
567
408
|
|
|
568
|
-
|
|
569
|
-
|
|
409
|
+
Per-skill enrichment:
|
|
410
|
+
| Skill | Enrichment |
|
|
411
|
+
|-------|-----------|
|
|
412
|
+
| maestro-brainstorm | args empty → `"{intent}"` |
|
|
413
|
+
| maestro-roadmap | args empty → `"{intent}"` |
|
|
414
|
+
| maestro-analyze | args empty → `{phase}` |
|
|
415
|
+
| maestro-plan | resolve latest analyze artifact → `--dir .workflow/scratch/{path}` |
|
|
416
|
+
| maestro-execute | resolve latest plan artifact → `--dir .workflow/scratch/{path}` |
|
|
417
|
+
| quality-debug | append gap_summary or `--from-uat`/`--from-business-test` |
|
|
418
|
+
| quality-* / maestro-verify / milestone-* | args empty → `{phase}` or empty |
|
|
570
419
|
|
|
571
|
-
|
|
572
|
-
{topic}
|
|
420
|
+
Auto flag: append from propagation table if `auto_mode == true`.
|
|
573
421
|
|
|
574
|
-
|
|
575
|
-
- 不要修改 .workflow/.maestro/ 下的 status 文件
|
|
576
|
-
- skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
|
|
422
|
+
Result: `$<skill-name> <enriched-args> [auto-flag]`
|
|
577
423
|
|
|
578
|
-
|
|
579
|
-
|
|
424
|
+
**3. Write wave CSV:** `{sessionDir}/wave-{N}.csv`
|
|
425
|
+
|
|
426
|
+
**4. Update plan** (mark wave steps in_progress)
|
|
427
|
+
|
|
428
|
+
**5. Spawn:**
|
|
429
|
+
```
|
|
430
|
+
spawn_agents_on_csv({
|
|
431
|
+
csv_path: "{sessionDir}/wave-{N}.csv",
|
|
432
|
+
id_column: "id",
|
|
433
|
+
instruction: WAVE_INSTRUCTION,
|
|
434
|
+
max_workers: <wave_size>,
|
|
435
|
+
max_runtime_seconds: 3600,
|
|
436
|
+
output_csv_path: "{sessionDir}/wave-{N}-results.csv",
|
|
437
|
+
output_schema: RESULT_SCHEMA
|
|
438
|
+
})
|
|
580
439
|
```
|
|
581
440
|
|
|
582
|
-
|
|
441
|
+
**6. Read results** — update step statuses from results CSV
|
|
583
442
|
|
|
584
|
-
|
|
443
|
+
**7. Barrier context update:**
|
|
444
|
+
|
|
445
|
+
| Barrier | Read | Update |
|
|
446
|
+
|---------|------|--------|
|
|
447
|
+
| maestro-analyze | context.md, state.json | context.analysis_dir |
|
|
448
|
+
| maestro-plan | plan.json | context.plan_dir |
|
|
449
|
+
| maestro-execute | results | context.exec_status |
|
|
450
|
+
| maestro-brainstorm | .brainstorming/ | context.brainstorm_dir |
|
|
451
|
+
| maestro-roadmap | specs/ | context.spec_session_id |
|
|
452
|
+
|
|
453
|
+
**8. Persist** — write status.json + sync update_plan
|
|
454
|
+
|
|
455
|
+
**9. Failure check:**
|
|
456
|
+
- `-y`: retry once, then skip and continue
|
|
457
|
+
- Non-`-y`: mark remaining skipped → pause → STOP
|
|
458
|
+
|
|
459
|
+
**10. Next step check:**
|
|
460
|
+
- Decision node + auto_mode → loop to 2.2
|
|
461
|
+
- Decision node + non-auto → STOP
|
|
462
|
+
- Skill node → loop to step 1
|
|
585
463
|
|
|
586
464
|
---
|
|
587
465
|
|
|
588
|
-
## Phase 3: Completion
|
|
466
|
+
## Phase 3: Completion
|
|
589
467
|
|
|
590
468
|
```
|
|
591
469
|
status.status = "completed"
|
|
@@ -594,12 +472,12 @@ Write status.json
|
|
|
594
472
|
|
|
595
473
|
functions.update_plan({
|
|
596
474
|
explanation: "Ralph lifecycle complete",
|
|
597
|
-
plan: steps.map((step
|
|
598
|
-
step: stepLabel(step),
|
|
599
|
-
status: step.status === "skipped" ? "completed" : "completed"
|
|
600
|
-
}))
|
|
475
|
+
plan: steps.map(step => ({ step: stepLabel(step), status: "completed" }))
|
|
601
476
|
})
|
|
477
|
+
```
|
|
602
478
|
|
|
479
|
+
Display:
|
|
480
|
+
```
|
|
603
481
|
============================================================
|
|
604
482
|
RALPH COMPLETE
|
|
605
483
|
============================================================
|
|
@@ -612,12 +490,10 @@ functions.update_plan({
|
|
|
612
490
|
[✓] 0. maestro-plan 1 [W1]
|
|
613
491
|
[✓] 1. maestro-execute 1 [W2]
|
|
614
492
|
[✓] 2. maestro-verify 1 [W3]
|
|
615
|
-
[✓] 3. ◆ post-verify
|
|
493
|
+
[✓] 3. ◆ post-verify → proceed [decision]
|
|
616
494
|
[~] 4. quality-auto-test 1 [skipped: standard mode]
|
|
617
495
|
[✓] 5. quality-review 1 [W4]
|
|
618
496
|
...
|
|
619
|
-
|
|
620
|
-
Resume: $maestro-ralph execute
|
|
621
497
|
============================================================
|
|
622
498
|
```
|
|
623
499
|
|
|
@@ -626,7 +502,7 @@ functions.update_plan({
|
|
|
626
502
|
<csv_schema>
|
|
627
503
|
### wave-{N}.csv
|
|
628
504
|
|
|
629
|
-
|
|
505
|
+
Coordinator 已完成 arg 组装 + auto flag 附加:
|
|
630
506
|
|
|
631
507
|
```csv
|
|
632
508
|
id,skill_call,topic
|
|
@@ -634,11 +510,32 @@ id,skill_call,topic
|
|
|
634
510
|
"4","$quality-review 1 --tier quick","Ralph step 4/14: review phase 1"
|
|
635
511
|
```
|
|
636
512
|
|
|
637
|
-
|
|
638
|
-
- `
|
|
639
|
-
-
|
|
640
|
-
-
|
|
641
|
-
-
|
|
513
|
+
Rules:
|
|
514
|
+
- `skill_call`: complete `$<skill> <args> [auto-flag]` from `buildSkillCall()`
|
|
515
|
+
- `topic`: human-readable step description
|
|
516
|
+
- Non-barrier + non-decision → multi-row (parallel)
|
|
517
|
+
- Barrier → single-row (solo)
|
|
518
|
+
- Decision nodes NEVER appear in CSV — processed by coordinator directly
|
|
519
|
+
|
|
520
|
+
### Sub-Agent Instruction
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
你是 CSV job 子 agent。
|
|
524
|
+
|
|
525
|
+
执行技能调用:{skill_call}
|
|
526
|
+
任务说明:{topic}
|
|
527
|
+
|
|
528
|
+
限制:
|
|
529
|
+
- 不要修改 .workflow/.maestro/ 下的 status 文件
|
|
530
|
+
- skill 内部有自己的 session 管理,按 skill SKILL.md 执行
|
|
531
|
+
|
|
532
|
+
完成后调用 `report_agent_job_result`,返回:
|
|
533
|
+
{"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","artifacts":"产物路径","error":"失败原因"}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Result Schema
|
|
537
|
+
|
|
538
|
+
`{ status, skill_call, summary, artifacts, error }` — all string
|
|
642
539
|
</csv_schema>
|
|
643
540
|
|
|
644
541
|
<error_codes>
|
|
@@ -646,29 +543,36 @@ id,skill_call,topic
|
|
|
646
543
|
|------|----------|-------------|----------|
|
|
647
544
|
| E001 | error | No intent and no running session | Prompt for intent |
|
|
648
545
|
| E002 | error | Cannot infer lifecycle position | Show raw state, ask user |
|
|
649
|
-
| E003 | error | Artifact dir not found for decision
|
|
650
|
-
| E004 | error |
|
|
651
|
-
| E005 | error |
|
|
652
|
-
| E006 | error |
|
|
653
|
-
|
|
|
654
|
-
|
|
|
546
|
+
| E003 | error | Artifact dir not found for decision | Show glob results, ask user |
|
|
547
|
+
| E004 | error | Delegate verdict parse failed | Fallback: treat as "fix" |
|
|
548
|
+
| E005 | error | Delegate execution failed | Fallback: treat as "fix" with generic summary |
|
|
549
|
+
| E006 | error | Wave timeout (max_runtime_seconds) | Mark step failed, pause |
|
|
550
|
+
| E007 | error | No session found for execute/continue | Suggest $maestro-ralph "intent" |
|
|
551
|
+
| W001 | warning | Decision node expanded chain | Auto-handled, log expansion |
|
|
552
|
+
| W002 | warning | Max retries reached, escalating | Auto-handled |
|
|
655
553
|
| W003 | warning | Multiple running sessions found | Use latest, warn user |
|
|
554
|
+
| W004 | warning | Delegate confidence == "low" | Show warning in interactive mode |
|
|
656
555
|
</error_codes>
|
|
657
556
|
|
|
658
557
|
<success_criteria>
|
|
659
|
-
- [ ] state.json
|
|
660
|
-
- [ ] Lifecycle position inferred from
|
|
661
|
-
- [ ] Artifact dir resolved via resolve_artifact_dir() with fallback
|
|
662
|
-
- [ ] Quality mode (full/standard/quick)
|
|
663
|
-
- [ ]
|
|
664
|
-
- [ ]
|
|
665
|
-
- [ ]
|
|
666
|
-
- [ ]
|
|
667
|
-
- [ ]
|
|
558
|
+
- [ ] state.json parsed with actual schema (type, path, scope, milestone, depends_on)
|
|
559
|
+
- [ ] Lifecycle position inferred from bootstrap + artifact chain + result files
|
|
560
|
+
- [ ] Artifact dir resolved via resolve_artifact_dir() with fallback glob
|
|
561
|
+
- [ ] Quality mode (full/standard/quick) correctly inferred and governs step generation
|
|
562
|
+
- [ ] Conditional steps evaluated at decision time (coverage threshold)
|
|
563
|
+
- [ ] buildSkillCall() completes arg enrichment + auto flag, CSV contains full commands
|
|
564
|
+
- [ ] Quality-gate decisions delegate-evaluated via `maestro delegate --role analyze`
|
|
565
|
+
- [ ] Delegate verdict parsed: STATUS / REASON / GAP_SUMMARY / CONFIDENCE
|
|
566
|
+
- [ ] `-y` mode: auto-follow delegate verdict, no STOP (except post-debug-escalate)
|
|
567
|
+
- [ ] Interactive mode: display recommendation + AskUserQuestion with override
|
|
568
|
+
- [ ] Delegate failure fallback: treat as "fix" verdict
|
|
569
|
+
- [ ] passed_gates[] tracks passed quality gates, skips re-runs in retry loops
|
|
570
|
+
- [ ] passed_gates cleared when code changes (fix-loop inserts execute step)
|
|
571
|
+
- [ ] Fix-loop templates correctly use gap_summary from delegate
|
|
572
|
+
- [ ] retry_count tracked per decision, max_retries enforced → escalation
|
|
668
573
|
- [ ] ALL skills via spawn_agents_on_csv — coordinator never executes directly
|
|
669
|
-
- [ ]
|
|
670
|
-
- [ ]
|
|
671
|
-
- [ ]
|
|
672
|
-
- [ ]
|
|
673
|
-
- [ ] Command insertion + reindex works correctly after decision expansion
|
|
574
|
+
- [ ] Barrier skills solo wave, non-barriers parallel
|
|
575
|
+
- [ ] functions.update_plan() initialized in 1.6, synced per wave, finalized in Phase 3
|
|
576
|
+
- [ ] status.json persisted after every wave and decision
|
|
577
|
+
- [ ] Command insertion + reindex preserves step integrity
|
|
674
578
|
</success_criteria>
|