maestro-flow 0.3.30 → 0.3.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.claude/agents/cli-explore-agent.md +1 -1
  2. package/.claude/agents/workflow-verifier.md +1 -1
  3. package/.claude/commands/maestro-ralph-execute.md +77 -48
  4. package/.claude/commands/maestro-ralph.md +32 -15
  5. package/.claude/commands/maestro.md +10 -11
  6. package/.claude/skills/team-quality-assurance/roles/executor/role.md +1 -1
  7. package/.codex/skills/maestro/SKILL.md +15 -5
  8. package/.codex/skills/maestro-analyze/SKILL.md +4 -0
  9. package/.codex/skills/maestro-execute/SKILL.md +5 -1
  10. package/.codex/skills/maestro-init/SKILL.md +7 -1
  11. package/.codex/skills/maestro-plan/SKILL.md +5 -0
  12. package/.codex/skills/maestro-ralph/SKILL.md +27 -15
  13. package/.codex/skills/maestro-ralph-execute/SKILL.md +30 -4
  14. package/.codex/skills/maestro-roadmap/SKILL.md +0 -1
  15. package/.codex/skills/maestro-verify/SKILL.md +1 -1
  16. package/.codex/skills/manage-codebase-rebuild/SKILL.md +2 -2
  17. package/.codex/skills/spec-add/SKILL.md +2 -0
  18. package/.codex/skills/spec-setup/SKILL.md +2 -0
  19. package/.codex/skills/team-quality-assurance/roles/executor/role.md +1 -1
  20. package/dashboard/dist-server/src/hooks/constants.d.ts +0 -6
  21. package/dashboard/dist-server/src/hooks/constants.js +0 -7
  22. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  23. package/dist/src/commands/hooks.d.ts +1 -1
  24. package/dist/src/commands/hooks.d.ts.map +1 -1
  25. package/dist/src/commands/hooks.js +10 -21
  26. package/dist/src/commands/hooks.js.map +1 -1
  27. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  28. package/dist/src/commands/install-ui/InstallFlow.js +17 -4
  29. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  30. package/dist/src/commands/spec.d.ts.map +1 -1
  31. package/dist/src/commands/spec.js +96 -0
  32. package/dist/src/commands/spec.js.map +1 -1
  33. package/dist/src/hooks/constants.d.ts +0 -6
  34. package/dist/src/hooks/constants.d.ts.map +1 -1
  35. package/dist/src/hooks/constants.js +0 -7
  36. package/dist/src/hooks/constants.js.map +1 -1
  37. package/dist/src/hooks/coordinator-tracker.d.ts +14 -2
  38. package/dist/src/hooks/coordinator-tracker.d.ts.map +1 -1
  39. package/dist/src/hooks/coordinator-tracker.js +25 -6
  40. package/dist/src/hooks/coordinator-tracker.js.map +1 -1
  41. package/dist/src/hooks/index.d.ts +1 -2
  42. package/dist/src/hooks/index.d.ts.map +1 -1
  43. package/dist/src/hooks/index.js +1 -2
  44. package/dist/src/hooks/index.js.map +1 -1
  45. package/dist/src/hooks/skill-context.js +2 -2
  46. package/dist/src/hooks/skill-context.js.map +1 -1
  47. package/dist/src/hooks/statusline.d.ts.map +1 -1
  48. package/dist/src/hooks/statusline.js +29 -6
  49. package/dist/src/hooks/statusline.js.map +1 -1
  50. package/dist/src/i18n/locales/en.js +1 -1
  51. package/dist/src/i18n/locales/en.js.map +1 -1
  52. package/dist/src/i18n/locales/zh.js +1 -1
  53. package/dist/src/i18n/locales/zh.js.map +1 -1
  54. package/dist/src/tools/spec-writer.d.ts +24 -0
  55. package/dist/src/tools/spec-writer.d.ts.map +1 -0
  56. package/dist/src/tools/spec-writer.js +60 -0
  57. package/dist/src/tools/spec-writer.js.map +1 -0
  58. package/package.json +1 -1
  59. package/workflows/codebase-rebuild.md +6 -6
  60. package/workflows/init.md +10 -12
  61. package/workflows/maestro-chain-execute.md +6 -2
  62. package/workflows/maestro.md +27 -19
  63. package/workflows/plan.md +1 -1
  64. package/workflows/verify.md +1 -1
  65. package/dist/src/hooks/context-monitor.d.ts +0 -33
  66. package/dist/src/hooks/context-monitor.d.ts.map +0 -1
  67. package/dist/src/hooks/context-monitor.js +0 -128
  68. package/dist/src/hooks/context-monitor.js.map +0 -1
@@ -54,7 +54,7 @@ Phase 4: Output Generation
54
54
  - Read schema file and memorize requirements BEFORE any analysis begins
55
55
 
56
56
  3. **Project Context Loading** (from spec system):
57
- - Load exploration specs: `maestro spec load --category exploration`
57
+ - Load exploration specs: `maestro spec load --category arch`
58
58
  - Extract: tech_stack, architecture, key_components, overview
59
59
  - If no specs returned, proceed with fresh analysis
60
60
 
@@ -47,7 +47,7 @@ You perform goal-backward verification of completed work using a three-layer che
47
47
  - `.task/TASK-{NNN}.json` files with `convergence.criteria` to validate
48
48
  - Completed code/artifacts to verify
49
49
  - Task summaries from `.summaries/`
50
- - **Project specs** — `maestro spec load --category validation`: verification criteria, acceptance standards. Must verify code complies with loaded constraints.
50
+ - **Project specs** — `maestro spec load --category quality`: verification criteria, acceptance standards. Must verify code complies with loaded constraints.
51
51
 
52
52
  ## Output
53
53
  `verification.json`:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: maestro-ralph-execute
3
- description: Single-step executor — find next pending command in ralph session, execute by type (decision/skill/cli), hand off to next iteration
3
+ description: Single-step executor — find next pending step in session, execute by type (decision/skill/cli), hand off to next iteration
4
4
  argument-hint: "[-y] [session-id]"
5
5
  allowed-tools:
6
6
  - Read
@@ -12,34 +12,42 @@ allowed-tools:
12
12
  - Skill
13
13
  ---
14
14
  <purpose>
15
- Single-step executor for ralph command chains. Each invocation:
16
- 1. Finds the next pending command in the ralph session JSON
15
+ Unified single-step executor for both maestro and ralph sessions.
16
+ All sessions stored at `.workflow/.maestro/*/status.json` with unified JSON schema.
17
+
18
+ Each invocation:
19
+ 1. Finds the next pending step in the session
17
20
  2. Executes it based on node type (decision → ralph, skill → Skill(), cli → delegate)
18
21
  3. Updates status.json
19
22
  4. Hands off to next iteration via self-invocation or ralph callback
20
23
 
24
+ Two session sources:
25
+ - **source: "maestro"** — Static chain, no decision nodes. Steps are `type: "skill"|"cli"` only.
26
+ - **source: "ralph"** — Adaptive chain with decision nodes. Steps include `type: "decision"`.
27
+
21
28
  Three node types drive different execution + handoff patterns:
22
- - **decision**: `Skill("maestro-ralph")` — ralph re-evaluates state, may expand chain
29
+ - **decision**: `Skill("maestro-ralph")` — ralph re-evaluates state, may expand chain (ralph-only)
23
30
  - **skill**: `Skill({ skill, args })` — synchronous in-session → `Skill("maestro-ralph-execute")`
24
31
  - **cli**: `maestro delegate` background → STOP → callback → `Skill("maestro-ralph-execute")`
25
32
 
26
- Mutual invocation with `/maestro-ralph` forms a persistent self-perpetuating work loop.
33
+ Mutual invocation with `/maestro-ralph` forms a persistent self-perpetuating work loop (ralph sessions).
34
+ For maestro sessions, execution is purely sequential with no decision callbacks.
27
35
  </purpose>
28
36
 
29
37
  <context>
30
- $ARGUMENTS — optional `-y` flag + optional session ID. If session ID omitted, finds latest running ralph session.
38
+ $ARGUMENTS — optional `-y` flag + optional session ID. If session ID omitted, finds latest running session.
31
39
 
32
40
  **Flag parsing:**
33
41
  ```
34
42
  Parse $ARGUMENTS:
35
43
  Contains "-y" or "--yes" → auto = true, remove flag from remaining args
36
- Remaining → session_id (if matches ralph-* pattern)
44
+ Remaining → session_id (if matches maestro-* or ralph-* pattern)
37
45
  ```
38
46
 
39
47
  **Session discovery:**
40
- Scan `.workflow/.ralph/ralph-*/status.json` for `status == "running"`, sorted by `created_at` descending.
48
+ Scan `.workflow/.maestro/*/status.json` for `status == "running"`, sorted by `updated_at` or dir mtime descending.
41
49
  If remaining args match a session ID pattern, use that specific session.
42
- Also read `session.auto` from status.json — if `true`, treat as `-y` even if flag not passed(ralph 已写入)。
50
+ Also read `session.auto_mode` from status.json — if `true`, treat as `-y` even if flag not passed.
43
51
  </context>
44
52
 
45
53
  <execution>
@@ -47,27 +55,27 @@ Also read `session.auto` from status.json — if `true`, treat as `-y` even if f
47
55
  ## Step 1: Locate Session
48
56
 
49
57
  ```
50
- If $ARGUMENTS matches ralph-* pattern:
51
- session_path = .workflow/.ralph/{$ARGUMENTS}/status.json
58
+ If $ARGUMENTS matches maestro-* or ralph-* pattern:
59
+ session_path = .workflow/.maestro/{$ARGUMENTS}/status.json
52
60
  Else:
53
- Scan .workflow/.ralph/ralph-*/status.json
61
+ Scan .workflow/.maestro/*/status.json
54
62
  Filter: status == "running"
55
- Sort: created_at DESC
63
+ Sort: mtime DESC (or updated_at DESC)
56
64
  Take first
57
65
 
58
66
  If no session found:
59
- Output: "无运行中的 ralph 会话。使用 /maestro-ralph 创建新会话。"
67
+ Output: "无运行中的会话。使用 /maestro /maestro-ralph 创建新会话。"
60
68
  End.
61
69
  ```
62
70
 
63
- Read status.json → extract: `id`, `steps[]`, `current_step`, `status`, `phase`.
71
+ Read status.json → extract: `session_id`, `source`, `steps[]`, `current_step`, `status`, `phase`, `auto_mode`.
64
72
 
65
- ## Step 2: Find Next Pending Command
73
+ ## Step 2: Find Next Pending Step
66
74
 
67
75
  ```
68
76
  next = steps.find(step => step.status == "pending")
69
77
 
70
- If no pending command:
78
+ If no pending step:
71
79
  → Step 5 (Complete)
72
80
  ```
73
81
 
@@ -79,21 +87,27 @@ Before execution, enrich `next.args` with context from session and prior outputs
79
87
  1. `status.json.intent` — user's original input text
80
88
  2. `status.json.phase` — current phase number
81
89
  3. `status.json.milestone` — current milestone name
82
- 4. `.workflow/state.json.artifacts[]` — latest artifacts for path resolution
83
- 5. Previous completed command outputs scratch dirs, session IDs
90
+ 4. `status.json.context` — nested context object (plan_dir, analysis_dir, scratch_dir, etc.)
91
+ 5. `.workflow/state.json.artifacts[]` latest artifacts for path resolution
92
+ 6. Previous completed step outputs — scratch dirs, session IDs
84
93
 
85
94
  **Placeholder substitution in args:**
86
95
  ```
87
- {phase} → status.phase
88
- {milestone} → status.milestone
89
- {intent} → status.intent
90
- {scratch_dir} latest artifact path for current phase from state.json
96
+ {phase} → status.phase
97
+ {milestone} → status.milestone
98
+ {intent} → status.intent
99
+ {description} status.intent (alias)
100
+ {scratch_dir} → status.context.scratch_dir or latest artifact path
101
+ {plan_dir} → status.context.plan_dir
102
+ {analysis_dir} → status.context.analysis_dir
103
+ {issue_id} → status.context.issue_id
104
+ {milestone_num}→ status.context.milestone_num
91
105
  ```
92
106
 
93
- **Per-command enrichment** (when args is empty or only has phase number):
107
+ **Per-skill enrichment** (when args is empty or only has phase number):
94
108
 
95
- | Command | Required context | Source |
96
- |---------|-----------------|--------|
109
+ | Skill | Required context | Source |
110
+ |-------|-----------------|--------|
97
111
  | maestro-brainstorm | topic description | `status.intent` — pass as `"{intent}"` |
98
112
  | maestro-roadmap | description + context | `status.intent` — pass as `"{intent}"` |
99
113
  | maestro-analyze | phase or topic | `{phase}` or `"{intent}"` if no phase |
@@ -122,7 +136,7 @@ Write status.json
122
136
  ```
123
137
  next.status = "running"
124
138
  next.started_at = new Date().toISOString()
125
- status.current = next.index
139
+ status.current_step = next.index
126
140
  status.updated_at = new Date().toISOString()
127
141
 
128
142
  Write status.json
@@ -133,19 +147,20 @@ Display step banner:
133
147
  ------------------------------------------------------------
134
148
  [{next.index}/{steps.length - 1}] {next.skill} [{next.type}]
135
149
  ------------------------------------------------------------
150
+ Session: {session_id} [{source}]
136
151
  Args: {next.args}
137
152
  {next.type == "decision" ? "Retry: " + JSON.parse(next.args).retry_count + "/" + JSON.parse(next.args).max_retries : ""}
138
153
  ```
139
154
 
140
- **Context weight hint** (after 4+ completed steps):
155
+ **Context weight hint** (after 4+ completed steps, skip if auto):
141
156
  ```
142
- If completed_count >= 4:
157
+ If completed_count >= 4 && !auto:
143
158
  Display: ⚡ 已执行 {completed_count} 步,上下文较重。可 /maestro-ralph continue 在新上下文恢复。
144
159
  ```
145
160
 
146
161
  ## Step 4: Execute by Type
147
162
 
148
- ### 4a. decision node
163
+ ### 4a. decision node (ralph-only)
149
164
 
150
165
  Decision nodes hand control back to ralph for re-evaluation.
151
166
 
@@ -173,10 +188,12 @@ auto_flag_map = {
173
188
  "maestro-analyze": "-y",
174
189
  "maestro-brainstorm": "-y",
175
190
  "maestro-roadmap": "-y",
191
+ "maestro-ui-design": "-y",
176
192
  "maestro-plan": "-y",
177
193
  "maestro-execute": "-y",
178
194
  "quality-business-test": "-y",
179
195
  "quality-test": "-y --auto-fix",
196
+ "quality-retrospective": "-y",
180
197
  "maestro-milestone-complete": "-y"
181
198
  }
182
199
  flag = auto_flag_map[next.skill] || ""
@@ -191,6 +208,12 @@ On success:
191
208
  ```
192
209
  next.status = "completed"
193
210
  next.completed_at = new Date().toISOString()
211
+
212
+ Scan output for context propagation signals:
213
+ PHASE: N → status.phase
214
+ scratch_dir: path → context.scratch_dir
215
+ SPEC-xxx → context.spec_session_id
216
+
194
217
  Write status.json
195
218
 
196
219
  Display: [N/total] ✓ {next.skill} completed
@@ -229,7 +252,7 @@ Background delegate execution with stop-and-wait pattern.
229
252
 
230
253
  Resolve CLI tool from session or default config:
231
254
  ```
232
- cli_tool = session.cli_tool || "gemini" // from ralph status.json or fallback
255
+ cli_tool = session.cli_tool || "gemini"
233
256
  ```
234
257
 
235
258
  ```
@@ -254,6 +277,9 @@ Retrieve output: maestro delegate output <exec_id>
254
277
 
255
278
  next.status = "completed"
256
279
  next.completed_at = new Date().toISOString()
280
+
281
+ Scan output for context propagation (same as 4b).
282
+
257
283
  Write status.json
258
284
 
259
285
  Display: [N/total] ✓ {next.skill} completed [cli]
@@ -286,19 +312,20 @@ Write status.json
286
312
  Display completion report:
287
313
  ```
288
314
  ============================================================
289
- RALPH COMPLETE
315
+ SESSION COMPLETE
290
316
  ============================================================
291
- Session: {id}
317
+ Session: {session_id} [{source}]
318
+ Chain: {chain_name}
292
319
  Phase: {phase}
293
320
  Steps: {completed}/{total}
294
321
 
295
- {steps.map(cmd => {
296
- icon = cmd.status == "completed" ? "✓" :
297
- cmd.status == "skipped" ? "—" :
298
- cmd.status == "failed" ? "✗" : " "
299
- type_badge = cmd.type == "decision" ? "◆" :
300
- cmd.type == "cli" ? "⚡" : " "
301
- return ` [${icon}] ${cmd.index}. ${type_badge} ${cmd.skill} ${cmd.args} [${cmd.type}]`
322
+ {steps.map(step => {
323
+ icon = step.status == "completed" ? "✓" :
324
+ step.status == "skipped" ? "—" :
325
+ step.status == "failed" ? "✗" : " "
326
+ type_badge = step.type == "decision" ? "◆" :
327
+ step.type == "cli" ? "⚡" : " "
328
+ return ` [${icon}] ${step.index}. ${type_badge} ${step.skill} ${step.args} [${step.type}]`
302
329
  })}
303
330
  ============================================================
304
331
  ```
@@ -310,23 +337,25 @@ Display completion report:
310
337
  <error_codes>
311
338
  | Code | Severity | Description | Recovery |
312
339
  |------|----------|-------------|----------|
313
- | E001 | error | No running ralph session found | Suggest /maestro-ralph to create |
340
+ | E001 | error | No running session found | Suggest /maestro or /maestro-ralph to create |
314
341
  | E002 | error | Session status.json corrupt or unreadable | Show path, suggest manual check |
315
- | E003 | error | CLI delegate failed + user chose abort | Mark paused, suggest /maestro-ralph continue |
342
+ | E003 | error | CLI delegate failed + user chose abort | Mark paused, suggest resume |
316
343
  | W001 | warning | Step completed with warnings | Log and continue |
317
- | W002 | warning | Context getting heavy (step >= 4) | Hint: /maestro-ralph continue for fresh context |
344
+ | W002 | warning | Context getting heavy (step >= 4) | Hint: fresh context resume |
318
345
  </error_codes>
319
346
 
320
347
  <success_criteria>
321
- - [ ] Session discovery finds latest running ralph session
322
- - [ ] `-y` flag parsed from args OR inherited from session.auto
348
+ - [ ] Session discovery scans .workflow/.maestro/ (covers both maestro-* and ralph-* sessions)
349
+ - [ ] Reads unified JSON: steps[], current_step, session_id, auto_mode, source
350
+ - [ ] `-y` flag parsed from args OR inherited from session.auto_mode
323
351
  - [ ] Pending step correctly identified from steps[]
324
- - [ ] decision nodes hand off to maestro-ralph via Skill()
352
+ - [ ] decision nodes hand off to maestro-ralph via Skill() (ralph sessions only)
325
353
  - [ ] skill nodes execute synchronously via Skill() and self-invoke next
326
- - [ ] `-y` auto flag 按传播表附加到目标 skill args
327
354
  - [ ] cli nodes use maestro delegate with run_in_background + stop pattern
355
+ - [ ] `-y` auto flag 按传播表附加到目标 skill args
356
+ - [ ] Context propagation: output signals update status.json.context
328
357
  - [ ] status.json updated after every status change (resume-safe)
329
358
  - [ ] auto 模式:失败重试一次后 auto-skip;非 auto:AskUserQuestion retry/skip/abort
330
- - [ ] Completion report shows all steps with status icons
359
+ - [ ] Completion report shows all steps with status icons and type badges
331
360
  - [ ] Self-invocation chain continues until all steps complete
332
361
  </success_criteria>
@@ -26,7 +26,7 @@ Key difference from maestro coordinator:
26
26
  - maestro: static chainMap → one-time selection → chain-execute runs all steps
27
27
  - ralph: living chain → decision nodes re-evaluate after each critical step → chain grows/shrinks dynamically
28
28
 
29
- Produces session at `.workflow/.ralph/ralph-{YYYYMMDD-HHmmss}/status.json`.
29
+ Produces session at `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json` using unified JSON schema (source: "ralph").
30
30
  Mutual invocation with `/maestro-ralph-execute` forms a persistent self-perpetuating work loop.
31
31
  </purpose>
32
32
 
@@ -38,13 +38,13 @@ $ARGUMENTS — user intent text, or keywords.
38
38
  - `continue` — Find latest running session → `Skill({ skill: "maestro-ralph-execute" })`. **End.**
39
39
 
40
40
  **Decision-node trigger detection:**
41
- If a running ralph session exists AND `commands[current].type == "decision"` AND `commands[current].status == "running"`:
41
+ If a running ralph session exists AND `steps[current_step].type == "decision"` AND `steps[current_step].status == "running"`:
42
42
  → Enter **Decision Evaluation Mode** (Step 2b) instead of New Session Mode.
43
43
 
44
44
  **State files read:**
45
45
  - `.workflow/state.json` — artifact registry, milestone, phase status
46
46
  - `.workflow/roadmap.md` — milestone/phase structure
47
- - `.workflow/.ralph/ralph-*/status.json` — ralph session state
47
+ - `.workflow/.maestro/ralph-*/status.json` — ralph session state
48
48
  </context>
49
49
 
50
50
  <execution>
@@ -57,8 +57,8 @@ Parse $ARGUMENTS:
57
57
  "continue" → handleContinue(). End.
58
58
 
59
59
  Check running ralph session:
60
- Scan .workflow/.ralph/ralph-*/status.json for status == "running"
61
- If found AND commands[current].type == "decision" AND commands[current].status == "running":
60
+ Scan .workflow/.maestro/ralph-*/status.json for status == "running"
61
+ If found AND steps[current_step].type == "decision" AND steps[current_step].status == "running":
62
62
  → Step 2b (Decision Evaluation Mode)
63
63
  Else if $ARGUMENTS is non-empty:
64
64
  → Step 2a (New Session Mode)
@@ -68,13 +68,13 @@ Check running ralph session:
68
68
 
69
69
  ### handleStatus()
70
70
  ```
71
- Scan .workflow/.ralph/ralph-*/status.json (latest by created_at)
71
+ Scan .workflow/.maestro/ralph-*/status.json (latest by created_at)
72
72
  Display:
73
73
  Session: {id}
74
74
  Status: {status}
75
75
  Position: {lifecycle_position}
76
76
  Progress: {completed}/{total} commands
77
- Current: [{current}] {commands[current].skill} [{commands[current].type}]
77
+ Current: [{current}] {steps[current_step].skill} [{steps[current_step].type}]
78
78
 
79
79
  Commands:
80
80
  [✓] 0. maestro-analyze 1 [skill]
@@ -264,21 +264,38 @@ milestone-complete maestro-milestone-complete skill decision:post-milestone
264
264
 
265
265
  ```
266
266
  session_id = "ralph-{YYYYMMDD-HHmmss}"
267
- session_dir = ".workflow/.ralph/{session_id}/"
267
+ session_dir = ".workflow/.maestro/{session_id}/"
268
268
 
269
269
  Write status.json:
270
270
  {
271
- "id": "{session_id}",
271
+ "session_id": "{session_id}",
272
+ "source": "ralph",
272
273
  "created_at": "{ISO}",
274
+ "updated_at": "{ISO}",
273
275
  "intent": "{user_intent}",
274
276
  "status": "running",
277
+ "chain_name": "ralph-lifecycle",
278
+ "task_type": "lifecycle",
275
279
  "lifecycle_position": "{position}",
276
280
  "target": "milestone-complete",
277
281
  "phase": {N},
278
282
  "milestone": "{M}",
279
- "commands": [...],
280
- "current": 0,
281
- "updated_at": "{ISO}"
283
+ "auto_mode": false,
284
+ "cli_tool": "gemini",
285
+ "quality_mode": "standard",
286
+ "passed_gates": [],
287
+ "context": {
288
+ "issue_id": null,
289
+ "milestone_num": null,
290
+ "spec_session_id": null,
291
+ "scratch_dir": null,
292
+ "plan_dir": null,
293
+ "analysis_dir": null,
294
+ "brainstorm_dir": null
295
+ },
296
+ "steps": [...],
297
+ "waves": [],
298
+ "current_step": 0
282
299
  }
283
300
  ```
284
301
 
@@ -324,7 +341,7 @@ Triggered when ralph-execute encounters a decision node and hands back to ralph.
324
341
 
325
342
  ### 2b.1: Load session + locate results
326
343
 
327
- Read ralph session status.json. Identify the decision node at `commands[current]`.
344
+ Read ralph session status.json. Identify the decision node at `steps[current_step]`.
328
345
 
329
346
  **Locate result files** — find the artifact dir for current phase:
330
347
  ```
@@ -478,7 +495,7 @@ When inserting new commands after current position:
478
495
 
479
496
  ```
480
497
  new_commands = buildInsertionCommands(...) // each with appropriate type/skill/args
481
- splice commands[] at position (current + 1), insert new_commands
498
+ splice steps[] at position (current_step + 1), insert new_commands
482
499
  Reindex: commands.forEach((cmd, i) => cmd.index = i)
483
500
  ```
484
501
 
@@ -486,7 +503,7 @@ Reindex: commands.forEach((cmd, i) => cmd.index = i)
486
503
 
487
504
  ```
488
505
  Mark current decision node status = "completed", completed_at = now
489
- Update status.json: commands[], current, updated_at
506
+ Update status.json: steps[], current_step, updated_at
490
507
 
491
508
  If commands were inserted:
492
509
  Display: ◆ Decision: {type} → {outcome}, +{N} commands inserted
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: maestro
3
- description: Intelligent coordinator - analyze intent + read project state → select optimal command chain → execute via internal or CLI delegate
3
+ description: Intelligent coordinator - analyze intent + read project state → select optimal command chain → dispatch to unified executor
4
4
  argument-hint: "\"intent text\" [-y] [-c] [--dry-run] [--exec auto|cli|internal] [--tool <name>] [--super]"
5
5
  allowed-tools:
6
6
  - Read
@@ -19,17 +19,16 @@ Two routing modes:
19
19
  1. **Intent-based**: User describes a goal → classify task type → select/compose command chain → confirm → execute
20
20
  2. **State-based**: Read .workflow/state.json → determine next logical step → suggest/execute (triggered by `continue`/`next`)
21
21
 
22
- Per-step execution engine (default: auto):
23
- - **internal**: Execute via Skill() in current session — output visible in conversation, synchronous, user can intervene
24
- - **CLI delegate**: Heavy execution steps — context isolation, template-driven prompts, gemini quality analysis
22
+ Per-step type selection (default: auto):
23
+ - **skill**: Execute via Skill() in current session — output visible in conversation, synchronous, user can intervene
24
+ - **cli**: Heavy execution steps via CLI delegate — context isolation, template-driven prompts
25
25
 
26
26
  Produces session directory at `.workflow/.maestro/{session_id}/` with status.json tracking chain progress.
27
- Executes commands sequentially with artifact propagation between steps.
27
+ Dispatches to unified executor (`maestro-ralph-execute`) for sequential step execution with artifact propagation.
28
28
  </purpose>
29
29
 
30
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
31
+ - [maestro.md](~/.maestro/workflows/maestro.md) — read at execution start (Steps 1-3: intent analysis, chain selection, session setup; Step 4 dispatches to unified executor)
33
32
  - [maestro-super.md](~/.maestro/workflows/maestro-super.md) — read when `--super` flag is active
34
33
  </deferred_reading>
35
34
 
@@ -55,7 +54,7 @@ $ARGUMENTS — user intent text, or special keywords.
55
54
  </context>
56
55
 
57
56
  <execution>
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.**
57
+ **Resume mode (`-c`):** Skip selection workflow entirely — scan `.workflow/.maestro/` for latest session, then `Skill({ skill: "maestro-ralph-execute" })`. The unified executor discovers the running session and resumes from the next pending step. **End.**
59
58
 
60
59
  **Normal mode:** Read `~/.maestro/workflows/maestro.md` from deferred_reading, then follow it completely.
61
60
 
@@ -109,12 +108,12 @@ In auto mode, maestro also:
109
108
  - [ ] Intent classified with task_type, complexity, clarity_score
110
109
  - [ ] Project state read and incorporated into routing
111
110
  - [ ] Command chain selected and confirmed (or auto-confirmed with -y)
112
- - [ ] Per-step engine selected (auto routes heavy steps to CLI, observable steps to internal)
111
+ - [ ] Per-step type selected (auto routes heavy steps to "cli", observable steps to "skill")
113
112
  - [ ] Auto flags correctly propagated to supporting commands only
114
113
  - [ ] Session directory created at .workflow/.maestro/{session_id}/
115
- - [ ] status.json created with steps[], context, and tracking fields
114
+ - [ ] status.json created with unified schema (source: "maestro", steps[] with type field)
116
115
  - [ ] Low-complexity intents routed to maestro-quick
117
- - [ ] All chains dispatched via execution workflow (maestro-chain-execute.md) with status.json tracking
116
+ - [ ] All chains dispatched via unified executor (maestro-ralph-execute) with status.json tracking
118
117
  - [ ] Phase numbers auto-detected and passed to downstream commands
119
118
  - [ ] (super mode) Requirements expanded and validated via Gemini before roadmap creation
120
119
  - [ ] (super mode) Each milestone scored ≥ 80% before advancing
@@ -26,7 +26,7 @@ Run test suites, collect coverage data, and perform automatic fix cycles when te
26
26
  | Target layer | task description `layer: L1/L2/L3` | Yes |
27
27
 
28
28
  1. Extract session path and target layer from task description
29
- 2. Load validation specs: Run `ccw spec load --category validation` for verification rules and acceptance criteria
29
+ 2. Load validation specs: Run `ccw spec load --category quality` for verification rules and acceptance criteria
30
30
  3. Read .msg/meta.json for strategy and generated test file list
31
31
  3. Detect test command by framework:
32
32
 
@@ -110,20 +110,30 @@ After each barrier skill completes, read its artifacts and update `state.context
110
110
  ```json
111
111
  {
112
112
  "session_id": "maestro-{YYYYMMDD-HHMMSS}",
113
+ "source": "maestro",
113
114
  "created_at": "ISO",
115
+ "updated_at": "ISO",
114
116
  "intent": "...",
115
117
  "task_type": "...",
116
118
  "chain_name": "...",
117
119
  "phase": null,
120
+ "milestone": null,
118
121
  "auto_mode": false,
119
122
  "exec_mode": "auto",
120
123
  "cli_tool": "codex",
121
- "gemini_session_id": null,
122
- "step_analyses": [],
123
- "context": { "plan_dir": null, "analysis_dir": null,
124
- "brainstorm_dir": null, "spec_session_id": null, "gaps": null },
124
+ "lifecycle_position": null,
125
+ "target": null,
126
+ "context": {
127
+ "issue_id": null,
128
+ "milestone_num": null,
129
+ "spec_session_id": null,
130
+ "scratch_dir": null,
131
+ "plan_dir": null,
132
+ "analysis_dir": null,
133
+ "brainstorm_dir": null
134
+ },
125
135
  "waves": [],
126
- "steps": [{ "index": 0, "skill": "...", "args": "", "engine": null, "status": "pending", "started_at": null, "completed_at": null, "wave_n": null }],
136
+ "steps": [{ "index": 0, "skill": "...", "args": "", "type": "skill", "status": "pending", "started_at": null, "completed_at": null, "error": null, "wave_n": null }],
127
137
  "current_step": 0,
128
138
  "status": "running"
129
139
  }
@@ -409,6 +409,10 @@ Write wave CSV with `prev_context`, execute `spawn_agents_on_csv` for synthesis
409
409
 
410
410
  6. **Auto-create issues from Deferred items**: Filter decisions with `classification == "Deferred"`, append each as issue to `.workflow/issues/issues.jsonl`.
411
411
 
412
+ 7b. **Spec Enrichment**: For each Locked decision in context.md, persist via CLI:
413
+ - `maestro spec add arch "<decision.title>" "<decision.rationale>" --keywords ... --source analyze:{sessionId}`
414
+ - For non-trivial code patterns discovered during exploration → `maestro spec add coding ...`
415
+
412
416
  7. **Register artifact in state.json**: Append `{ id: "ANL-{next_id}", type: "analyze", milestone, phase, scope, path: scratchDir, status: "completed", depends_on: null, harvested: false, created_at, completed_at }`.
413
417
  8. Copy final outputs (context.md, analysis.md, conclusions.json) from CSV session folder to `scratchDir`
414
418
  9. Display summary
@@ -249,7 +249,11 @@ Blocked/failed tasks cascade: mark all downstream dependents as `skipped` with e
249
249
 
250
250
  4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`
251
251
 
252
- 5. **Extract incremental learnings**: Read `.summaries/`, dedup against existing specs, append to `.workflow/specs/learnings.md` as `<spec-entry>` (category=learning), mark artifact `harvested: true`
252
+ 5. **Extract incremental specs**: Read `.summaries/`, use `maestro spec add` CLI:
253
+ - Learnings/pitfalls → `maestro spec add learning "<title>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
254
+ - Design rationale → `maestro spec add coding "<title>" "<content>" --keywords ...`
255
+ - Root cause/workaround → `maestro spec add debug "<title>" "<content>" --keywords ...`
256
+ Mark artifact `harvested: true`
253
257
 
254
258
  6. **Post-task Knowledge Inquiry**: Prompt user to capture knowledge when:
255
259
  - Execution deviation detected (plan change) -> `/spec-add arch`
@@ -98,7 +98,13 @@ Configuration questions (or defaults for -y): granularity (fine/medium/coarse),
98
98
 
99
99
  ### Step 9: Initialize specs/
100
100
 
101
- Create in `.workflow/specs/`: `conventions.md` (detected coding conventions), `learnings.md` (empty placeholder).
101
+ Run `Bash("maestro spec init")` to create empty seed files in `.workflow/specs/`.
102
+
103
+ If project state is **code** (existing source files detected):
104
+ - Auto-trigger `Skill({ skill: "spec-setup" })` to scan codebase and populate specs with detected conventions.
105
+
106
+ If project state is **empty** (greenfield):
107
+ - Skip spec-setup. Specs are populated progressively by analyze, plan, and execute stages via `maestro spec add`.
102
108
 
103
109
  ### Step 10: Completion Report
104
110
 
@@ -312,6 +312,11 @@ spawn_agents_on_csv({
312
312
 
313
313
  2. **Revision loop** (max 3 rounds): If critical issues found, regenerate affected tasks.
314
314
 
315
+ 2b. **Spec Enrichment**: Persist cross-task reusable design decisions:
316
+ - `maestro spec add coding|arch "<decision.title>" "<rationale>" --keywords ... --source plan:{sessionId}`
317
+ - Test strategy decisions → `maestro spec add test ...`
318
+ - Typical: 0-3 entries per plan session
319
+
315
320
  3. **Export results**:
316
321
  - Export `results.csv` from master `tasks.csv`
317
322
  - Generate `context.md`: summary (phase, task count, wave count, complexity, exploration count), exploration findings per angle, plan overview (approach, task IDs, waves), next steps