maestro-flow 0.3.36 → 0.3.38

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.
@@ -257,7 +257,7 @@ For parallel groups show fan-out/fan-in:
257
257
  ```
258
258
  N-003a [skill] quality-review ─┐
259
259
  ├─ N-004 [skill] quality-test
260
- N-003b [cli] gemini analysis ─┘
260
+ N-003b [cli] cli analysis ─┘
261
261
  ```
262
262
 
263
263
  **Step 4.2** — AskUserQuestion:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-execute
3
3
  description: Execute plan with wave-based parallel execution and atomic commits
4
- argument-hint: "[phase] [--auto-commit] [--method agent|codex|gemini|cli|auto] [--executor <tool>] [--dir <path>] [-y]"
4
+ argument-hint: "[phase] [--auto-commit] [--method agent|cli|auto] [--executor <tool>] [--dir <path>] [-y]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: maestro-ralph-execute
3
- description: Single-step executor — find next pending step in 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/internal/external), hand off to next iteration
4
4
  argument-hint: "[-y] [session-id]"
5
5
  allowed-tools:
6
6
  - Read
@@ -19,12 +19,12 @@ Each invocation: find next pending step → execute → update status → hand o
19
19
 
20
20
  Three node types:
21
21
  - **decision** (ralph-only): `Skill("maestro-ralph")` — ralph re-evaluates, may expand chain
22
- - **skill**: `Skill({ skill, args })` — synchronous in-session → self-invoke next
23
- - **cli**: `maestro delegate` background → STOP → callback → self-invoke next
22
+ - **internal**: `Skill({ skill, args })` — synchronous in-session → self-invoke next
23
+ - **external**: `maestro delegate --to claude` new Claude Code session executing `/{skill} {args}` → STOP → callback → self-invoke next
24
24
 
25
25
  Session sources:
26
26
  - **source: "ralph"** — Adaptive chain with decision nodes. Primary use case.
27
- - **source: "maestro"** — Static chain, skill/cli only. No decision callbacks.
27
+ - **source: "maestro"** — Static chain, internal/external only. No decision callbacks.
28
28
 
29
29
  Mutual invocation with `/maestro-ralph` forms a self-perpetuating work loop.
30
30
  </purpose>
@@ -149,9 +149,9 @@ Ralph will: detect running decision → evaluate results → optionally expand s
149
149
 
150
150
  **After Skill("maestro-ralph") returns, this execution ends.** Ralph handles the handoff.
151
151
 
152
- ### 5b. skill node
152
+ ### 5b. internal node
153
153
 
154
- HARD RULE: Every skill step MUST be executed via `Skill({ skill, args })`.
154
+ HARD RULE: Every internal step MUST be executed via `Skill({ skill, args })`.
155
155
  Never "simulate" or "inline" a skill's work. If Skill() is not called, the step has NOT been executed.
156
156
 
157
157
  **Auto flag propagation** (when `auto == true`):
@@ -180,20 +180,22 @@ Skill({ skill: next.skill, args: effective_args })
180
180
  **On success** → Step 5d (Mark Complete).
181
181
  **On failure** → Step 5e (Handle Failure).
182
182
 
183
- ### 5c. cli node
183
+ ### 5c. external node
184
184
 
185
- Background delegate execution with stop-and-wait pattern.
185
+ Context-isolated skill execution via new Claude Code session.
186
186
 
187
- ```
188
- cli_tool = session.cli_tool
187
+ HARD RULE: external nodes ALWAYS delegate to `claude` — only Claude Code can execute slash-command skills.
188
+ `session.cli_tool` is for analysis-mode delegates (e.g., decision evaluation in ralph), NOT for external node execution.
189
189
 
190
+ ```
190
191
  Bash({
191
- command: `maestro delegate "PURPOSE: 执行 /${next.skill} ${next.args}
192
- TASK: 运行 /${next.skill} ${next.args}
193
- MODE: write
194
- CONTEXT: @**/*
195
- EXPECTED: 产出写入 .workflow/scratch/,artifact 注册到 state.json
196
- CONSTRAINTS: 严格按照 /${next.skill} 的正常流程执行" --to ${cli_tool} --mode write`,
192
+ command: `maestro delegate "Execute: /${next.skill} ${next.args}
193
+
194
+ You are a delegate session within a ralph/maestro pipeline.
195
+ Your task: invoke the slash command /${next.skill} with args: ${next.args}
196
+ Use Skill({ skill: \"${next.skill}\", args: \"${next.args}\" }) to execute it.
197
+ Do NOT reimplement the skill logic manually invoke the actual command.
198
+ All artifact outputs follow the skill's own conventions." --to claude --mode write`,
197
199
  run_in_background: true,
198
200
  timeout: 600000
199
201
  })
@@ -218,7 +220,7 @@ Scan output for context propagation signals:
218
220
  SPEC-xxx → context.spec_session_id
219
221
 
220
222
  Write status.json
221
- Display: [{next.index}/{total}] ✓ {next.skill} completed {next.type == "cli" ? "[cli]" : ""}
223
+ Display: [{next.index}/{total}] ✓ {next.skill} completed {next.type == "external" ? "[external]" : ""}
222
224
  ```
223
225
 
224
226
  Then hand off:
@@ -277,17 +279,17 @@ Display completion report:
277
279
  Phase: {phase}
278
280
  Steps: {completed}/{total}
279
281
 
280
- [✓] 0. maestro-plan 1 [skill]
281
- [✓] 1. ⚡ maestro-execute 1 [cli]
282
- [✓] 2. maestro-verify 1 [skill]
282
+ [✓] 0. maestro-plan 1 [internal]
283
+ [✓] 1. ⚡ maestro-execute 1 [external]
284
+ [✓] 2. maestro-verify 1 [internal]
283
285
  [✓] 3. ◆ post-verify [decision]
284
- [—] 4. quality-auto-test 1 [skill] (skipped)
286
+ [—] 4. quality-auto-test 1 [internal] (skipped)
285
287
  ...
286
288
  ============================================================
287
289
  ```
288
290
 
289
291
  Status icons: `✓` completed, `—` skipped, `✗` failed, ` ` pending.
290
- Type badges: `◆` decision, `⚡` cli, (none) skill.
292
+ Type badges: `◆` decision, `⚡` external, (none) internal.
291
293
 
292
294
  **End.**
293
295
 
@@ -310,8 +312,8 @@ Type badges: `◆` decision, `⚡` cli, (none) skill.
310
312
  - [ ] Per-skill enrichment provides correct args when empty/minimal
311
313
  - [ ] Artifact dir resolution finds latest artifact for --dir args
312
314
  - [ ] decision nodes hand off to maestro-ralph via Skill() (ralph sessions only)
313
- - [ ] skill nodes execute via Skill() with auto flag propagation
314
- - [ ] cli nodes use maestro delegate with run_in_background + STOP pattern
315
+ - [ ] internal nodes execute via Skill() with auto flag propagation
316
+ - [ ] external nodes use maestro delegate --to claude with run_in_background + STOP pattern
315
317
  - [ ] Context propagation: output signals update status.json.context
316
318
  - [ ] status.json updated after every status change (resume-safe)
317
319
  - [ ] Auto mode: retry once then skip; interactive: AskUserQuestion retry/skip/abort
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: maestro-ralph
3
- description: Closed-loop lifecycle decision engine — read project state, infer position, build adaptive command chain with decision/skill/cli nodes
3
+ description: Closed-loop lifecycle decision engine — read project state, infer position, build adaptive command chain with decision/internal/external nodes
4
4
  argument-hint: "[-y] \"intent\" | status | continue"
5
5
  allowed-tools:
6
6
  - Read
@@ -18,8 +18,8 @@ Closed-loop decision engine for the maestro workflow lifecycle.
18
18
  Reads project state → infers lifecycle position → builds adaptive command chain → delegates execution.
19
19
 
20
20
  Three node types:
21
- - **skill**: In-session `Skill()` call (synchronous, lightweight)
22
- - **cli**: `maestro delegate` (context-isolated, heavy computation)
21
+ - **internal**: In-session `Skill()` call (synchronous, lightweight)
22
+ - **external**: New Claude Code session via `maestro delegate --to claude` executing `/{skill} {args}` (context-isolated, heavy computation)
23
23
  - **decision**: Hand back to ralph for re-evaluation (adaptive branching)
24
24
 
25
25
  Key difference from maestro coordinator:
@@ -73,9 +73,9 @@ Display:
73
73
  Current: [{current_step}] {steps[current_step].skill} [{type}]
74
74
 
75
75
  Commands:
76
- [✓] 0. maestro-analyze 1 [skill]
77
- [▸] 1. maestro-plan 1 [skill]
78
- [ ] 2. maestro-execute 1 [cli]
76
+ [✓] 0. maestro-analyze 1 [external]
77
+ [▸] 1. maestro-plan 1 [internal]
78
+ [ ] 2. maestro-execute 1 [external]
79
79
  ...
80
80
  End.
81
81
  ```
@@ -164,23 +164,25 @@ Generate steps from `lifecycle_position` to target (default: `milestone-complete
164
164
 
165
165
  | Stage | Skill command | Type | Decision after |
166
166
  |-------|--------------|------|----------------|
167
- | brainstorm | `maestro-brainstorm "{intent}"` | cli | — (0→1 only) |
168
- | init | `maestro-init` | skill | — |
169
- | roadmap | `maestro-roadmap "{intent}"` | skill | — |
170
- | analyze | `maestro-analyze {phase}` | cli | — |
171
- | plan | `maestro-plan {phase}` | skill | — |
172
- | execute | `maestro-execute {phase}` | cli | — |
173
- | verify | `maestro-verify {phase}` | skill | `post-verify` |
174
- | business-test | `quality-auto-test {phase}` | skill | `post-business-test` |
175
- | review | `quality-review {phase}` | skill | `post-review` |
176
- | test-gen | `quality-auto-test {phase}` | skill | — |
177
- | test | `quality-test {phase}` | skill | `post-test` |
178
- | milestone-audit | `maestro-milestone-audit` | skill | — |
179
- | milestone-complete | `maestro-milestone-complete` | skill | `post-milestone` |
167
+ | brainstorm | `maestro-brainstorm "{intent}"` | external | — (0→1 only) |
168
+ | init | `maestro-init` | internal | — |
169
+ | roadmap | `maestro-roadmap "{intent}"` | internal | — |
170
+ | analyze | `maestro-analyze {phase}` | external | — |
171
+ | plan | `maestro-plan {phase}` | internal | — |
172
+ | execute | `maestro-execute {phase}` | external | — |
173
+ | verify | `maestro-verify {phase}` | internal | `post-verify` |
174
+ | business-test | `quality-auto-test {phase}` | internal | `post-business-test` |
175
+ | review | `quality-review {phase}` | internal | `post-review` |
176
+ | test-gen | `quality-auto-test {phase}` | internal | — |
177
+ | test | `quality-test {phase}` | internal | `post-test` |
178
+ | milestone-audit | `maestro-milestone-audit` | internal | — |
179
+ | milestone-complete | `maestro-milestone-complete` | internal | `post-milestone` |
180
180
 
181
181
  **Type rationale:**
182
- - `cli` = heavy computation needing isolated context (analyze, execute, brainstorm)
183
- - `skill` = needs user interaction or is lightweight (plan, verify, quality-*, milestone-*)
182
+ - `internal` = in-session `Skill()` call, needs user interaction or is lightweight (plan, verify, quality-*, milestone-*)
183
+ - `external` = new Claude Code session via `maestro delegate --to claude` executing `/{skill} {args}`, context-isolated heavy computation (analyze, execute, brainstorm)
184
+
185
+ IMPORTANT: `external` ≠ single CLI tool call. It spawns a full Claude Code session that executes the skill command — the delegate session has complete skill access.
184
186
 
185
187
  **Build rules:**
186
188
  1. Start from inferred position, skip completed stages
@@ -195,19 +197,19 @@ Generate steps from `lifecycle_position` to target (default: `milestone-complete
195
197
  **Example — from "plan" position:**
196
198
  ```json
197
199
  [
198
- { "index": 0, "type": "skill", "skill": "maestro-plan", "args": "{phase}" },
199
- { "index": 1, "type": "cli", "skill": "maestro-execute", "args": "{phase}" },
200
- { "index": 2, "type": "skill", "skill": "maestro-verify", "args": "{phase}" },
200
+ { "index": 0, "type": "internal", "skill": "maestro-plan", "args": "{phase}" },
201
+ { "index": 1, "type": "external", "skill": "maestro-execute", "args": "{phase}" },
202
+ { "index": 2, "type": "internal", "skill": "maestro-verify", "args": "{phase}" },
201
203
  { "index": 3, "type": "decision", "skill": "maestro-ralph", "args": "{\"decision\":\"post-verify\",\"retry_count\":0,\"max_retries\":2}" },
202
- { "index": 4, "type": "skill", "skill": "quality-auto-test", "args": "{phase}" },
204
+ { "index": 4, "type": "internal", "skill": "quality-auto-test", "args": "{phase}" },
203
205
  { "index": 5, "type": "decision", "skill": "maestro-ralph", "args": "{\"decision\":\"post-business-test\",\"retry_count\":0,\"max_retries\":2}" },
204
- { "index": 6, "type": "skill", "skill": "quality-review", "args": "{phase}" },
206
+ { "index": 6, "type": "internal", "skill": "quality-review", "args": "{phase}" },
205
207
  { "index": 7, "type": "decision", "skill": "maestro-ralph", "args": "{\"decision\":\"post-review\",\"retry_count\":0,\"max_retries\":2}" },
206
- { "index": 8, "type": "skill", "skill": "quality-auto-test", "args": "{phase}" },
207
- { "index": 9, "type": "skill", "skill": "quality-test", "args": "{phase}" },
208
+ { "index": 8, "type": "internal", "skill": "quality-auto-test", "args": "{phase}" },
209
+ { "index": 9, "type": "internal", "skill": "quality-test", "args": "{phase}" },
208
210
  { "index": 10, "type": "decision", "skill": "maestro-ralph", "args": "{\"decision\":\"post-test\",\"retry_count\":0,\"max_retries\":2}" },
209
- { "index": 11, "type": "skill", "skill": "maestro-milestone-audit", "args": "" },
210
- { "index": 12, "type": "skill", "skill": "maestro-milestone-complete", "args": "" },
211
+ { "index": 11, "type": "internal", "skill": "maestro-milestone-audit", "args": "" },
212
+ { "index": 12, "type": "internal", "skill": "maestro-milestone-complete", "args": "" },
211
213
  { "index": 13, "type": "decision", "skill": "maestro-ralph", "args": "{\"decision\":\"post-milestone\"}" }
212
214
  ]
213
215
  ```
@@ -253,9 +255,9 @@ Write to `.workflow/.maestro/{session_id}/status.json`.
253
255
  Target: {target}
254
256
  Commands: {total} steps ({decision_count} decision points)
255
257
 
256
- [ ] 0. maestro-plan 1 [skill]
257
- [ ] 1. maestro-execute 1 [cli]
258
- [ ] 2. maestro-verify 1 [skill]
258
+ [ ] 0. maestro-plan 1 [internal]
259
+ [ ] 1. maestro-execute 1 [external]
260
+ [ ] 2. maestro-verify 1 [internal]
259
261
  [ ] 3. ◆ post-verify [decision]
260
262
  ...
261
263
  ============================================================
@@ -383,7 +385,7 @@ The delegate's `gap_summary` is passed as context to `quality-debug`.
383
385
  ```
384
386
  quality-debug "{gap_summary}"
385
387
  maestro-plan --gaps {phase}
386
- maestro-execute {phase} [cli]
388
+ maestro-execute {phase} [external]
387
389
  maestro-verify {phase}
388
390
  decision:post-verify {retry_count + 1}
389
391
  ```
@@ -392,7 +394,7 @@ decision:post-verify {retry_count + 1}
392
394
  ```
393
395
  quality-debug --from-business-test "{gap_summary}"
394
396
  maestro-plan --gaps {phase}
395
- maestro-execute {phase} [cli]
397
+ maestro-execute {phase} [external]
396
398
  maestro-verify {phase}
397
399
  decision:post-verify {retry: 0}
398
400
  quality-auto-test {phase}
@@ -403,7 +405,7 @@ decision:post-business-test {retry_count + 1}
403
405
  ```
404
406
  quality-debug "{gap_summary}"
405
407
  maestro-plan --gaps {phase}
406
- maestro-execute {phase} [cli]
408
+ maestro-execute {phase} [external]
407
409
  quality-review {phase}
408
410
  decision:post-review {retry_count + 1}
409
411
  ```
@@ -412,7 +414,7 @@ decision:post-review {retry_count + 1}
412
414
  ```
413
415
  quality-debug --from-uat "{gap_summary}"
414
416
  maestro-plan --gaps {phase}
415
- maestro-execute {phase} [cli]
417
+ maestro-execute {phase} [external]
416
418
  maestro-verify {phase}
417
419
  decision:post-verify {retry: 0}
418
420
  quality-auto-test {phase}
@@ -114,7 +114,7 @@ In auto mode, maestro also:
114
114
  - [ ] Low-complexity intents routed to maestro-quick
115
115
  - [ ] All chains dispatched via unified executor (maestro-ralph-execute) with status.json tracking
116
116
  - [ ] Phase numbers auto-detected and passed to downstream commands
117
- - [ ] (super mode) Requirements expanded and validated via Gemini before roadmap creation
117
+ - [ ] (super mode) Requirements expanded and validated via CLI delegate before roadmap creation
118
118
  - [ ] (super mode) Each milestone scored ≥ 80% before advancing
119
119
  - [ ] (super mode) All milestones completed with no user intervention
120
120
  - [ ] (super mode) Final system builds, starts, and passes all tests
@@ -16,7 +16,7 @@ Automated issue discovery via multi-perspective codebase analysis (8 perspective
16
16
 
17
17
  - **Default (no args)**: Interactive mode selection — choose multi-perspective or prompt-driven.
18
18
  - **`multi-perspective`**: 8-perspective parallel agent scan — security, performance, reliability, maintainability, scalability, UX, accessibility, compliance.
19
- - **`by-prompt "..."`**: Prompt-driven — Gemini plans exploration strategy, agents explore iteratively with cross-dimension analysis.
19
+ - **`by-prompt "..."`**: Prompt-driven — CLI delegate plans exploration strategy, agents explore iteratively with cross-dimension analysis.
20
20
 
21
21
  For CRUD operations (create, list, update, close, link), use `/manage-issue`.
22
22
 
@@ -38,7 +38,7 @@ $ARGUMENTS -- optional. Parse first token to determine mode.
38
38
  **Modes:**
39
39
  - _(empty)_ -- interactive mode selection (AskUserQuestion)
40
40
  - `multi-perspective` -- 8-perspective parallel agent scan
41
- - `by-prompt "..."` -- prompt-driven iterative agent exploration (Gemini-planned)
41
+ - `by-prompt "..."` -- prompt-driven iterative agent exploration (CLI-planned)
42
42
 
43
43
  **Flags:**
44
44
  - `-y` / `--yes` -- auto mode, skip confirmations
@@ -210,14 +210,14 @@ Create both directories.
210
210
 
211
211
  3. **Quick mode routing**: If QUICK_MODE, generate only wave 3 (synthesis/decide) task in CSV. Skip exploration and scoring.
212
212
 
213
- 3b. **Gaps mode routing** (if GAPS_MODE):
213
+ 3b. **Gaps mode routing** (if GAPS_MODE) — follow `~/.maestro/workflows/issue-gaps-analyze.codex.md` for full CSV wave pipeline:
214
214
  - Load issues from `.workflow/issues/issues.jsonl`
215
215
  - If `gapsIssueId`: load single issue, validate existence
216
216
  - If no ISS-ID: filter `status == "open" || status == "registered"`
217
- - For each issue, generate an exploration task (wave 1) focused on issue context
218
- - Generate a synthesis task (wave 2) that writes analysis records back to issues.jsonl
219
- - Skip standard dimension scoring (wave 2 in normal mode)
220
- - Pipeline: Load Issues → CLI Exploration per issueRoot Cause Synthesis → Write issue.analysis → Output context.md
217
+ - Classify & group issues by location/component overlap
218
+ - Generate tasks.csv: wave 1 = one exploration row per issue, wave 2 = one synthesis row per group
219
+ - Execute via spawn_agents_on_csv (wave 1 parallel per issue, wave 2 parallel per group)
220
+ - Pipeline: Load Issues → Classify & Group CSV Generation Wave 1: ExploreWave 2: Synthesize → Write issue.analysis → Output context.md
221
221
  - On completion: append history entry `{ action: "analyzed", at: <ISO>, by: "maestro-analyze --gaps" }` per issue
222
222
 
223
223
  4. **Dimension and perspective selection** (full mode):
@@ -16,7 +16,7 @@ Entry points:
16
16
  - **`$maestro-ralph status`** — Display session progress
17
17
 
18
18
  Two node types:
19
- - **skill**: Executed via `spawn_agents_on_csv`. Barrier skills solo; non-barriers parallel.
19
+ - **external**: Executed via `spawn_agents_on_csv`. Barrier steps solo; non-barriers parallel.
20
20
  - **decision**: Delegate evaluation via `maestro delegate --role analyze`, then expand/proceed/escalate.
21
21
 
22
22
  Key difference from maestro coordinator:
@@ -60,12 +60,12 @@ otherwise → Phase 1 (New Session).
60
60
  </context>
61
61
 
62
62
  <invariants>
63
- 1. **ALL skills via spawn_agents_on_csv** — coordinator NEVER executes skill logic directly
63
+ 1. **ALL external steps via spawn_agents_on_csv** — coordinator NEVER executes skill logic directly
64
64
  2. **Coordinator = prompt assembler** — classify → enrich args → build CSV → spawn → read results → assemble next
65
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
66
  4. **Decision STOP behavior** — default: STOP after evaluation; `-y` mode: auto-continue (except post-debug-escalate always STOPs)
67
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
68
+ 6. **Non-barriers can parallel** — consecutive non-barrier, non-decision external steps grouped into one wave
69
69
  7. **Wave-by-wave** — never start wave N+1 before wave N results are read
70
70
  8. **Coordinator owns context** — sub-agents never read prior results; coordinator assembles full skill_call
71
71
  9. **Abort on failure** — `-y`: retry once then skip; non-`-y`: mark remaining skipped → pause
@@ -223,7 +223,7 @@ Display:
223
223
 
224
224
  [ ] 0. maestro-plan {phase} [barrier]
225
225
  [ ] 1. maestro-execute {phase} [barrier]
226
- [ ] 2. maestro-verify {phase} [skill]
226
+ [ ] 2. maestro-verify {phase} [external]
227
227
  [ ] 3. ◆ post-verify [decision]
228
228
  ...
229
229
  ============================================================
@@ -244,7 +244,7 @@ Read status.json. Rebuild `update_plan` from step statuses.
244
244
  Find first pending step.
245
245
 
246
246
  - If decision node → Step 2.2 (Delegate Evaluation)
247
- - If skill node → Step 2.3 (Wave Execution)
247
+ - If external node → Step 2.3 (Wave Execution)
248
248
  - If no pending → Phase 3 (Completion)
249
249
 
250
250
  ### 2.2: Delegate Evaluation (decision nodes)
@@ -459,7 +459,7 @@ spawn_agents_on_csv({
459
459
  **10. Next step check:**
460
460
  - Decision node + auto_mode → loop to 2.2
461
461
  - Decision node + non-auto → STOP
462
- - Skill node → loop to step 1
462
+ - External node → loop to step 1
463
463
 
464
464
  ---
465
465
 
@@ -513,8 +513,8 @@ id,skill_call,topic
513
513
  Rules:
514
514
  - `skill_call`: complete `$<skill> <args> [auto-flag]` from `buildSkillCall()`
515
515
  - `topic`: human-readable step description
516
- - Non-barrier + non-decision → multi-row (parallel)
517
- - Barrier → single-row (solo)
516
+ - Non-barrier external + non-decision → multi-row (parallel)
517
+ - Barrier external → single-row (solo)
518
518
  - Decision nodes NEVER appear in CSV — processed by coordinator directly
519
519
 
520
520
  ### Sub-Agent Instruction
@@ -570,8 +570,8 @@ Rules:
570
570
  - [ ] passed_gates cleared when code changes (fix-loop inserts execute step)
571
571
  - [ ] Fix-loop templates correctly use gap_summary from delegate
572
572
  - [ ] retry_count tracked per decision, max_retries enforced → escalation
573
- - [ ] ALL skills via spawn_agents_on_csv — coordinator never executes directly
574
- - [ ] Barrier skills solo wave, non-barriers parallel
573
+ - [ ] ALL external steps via spawn_agents_on_csv — coordinator never executes directly
574
+ - [ ] Barrier steps solo wave, non-barriers parallel
575
575
  - [ ] functions.update_plan() initialized in 1.6, synced per wave, finalized in Phase 3
576
576
  - [ ] status.json persisted after every wave and decision
577
577
  - [ ] Command insertion + reindex preserves step integrity
package/README.md CHANGED
@@ -209,6 +209,12 @@ Join the WeChat group for discussion and feedback:
209
209
 
210
210
  <img src="assets/wechat-group-qr.png" width="200" alt="WeChat Group: Claude Code Workflow交流群 2" />
211
211
 
212
+ ## Buy Me a Coffee
213
+
214
+ If this project helps you, consider buying me a coffee:
215
+
216
+ <img src="assets/wechat-reward-qr.png" width="200" alt="WeChat Reward QR" />
217
+
212
218
  ## Links
213
219
 
214
220
  - [Linux DO:学AI,上L站!](https://linux.do/)
package/README.zh-CN.md CHANGED
@@ -199,6 +199,12 @@ maestro/
199
199
 
200
200
  <img src="assets/wechat-group-qr.png" width="200" alt="微信群: Claude Code Workflow交流群 2" />
201
201
 
202
+ ## 打赏
203
+
204
+ 如果这个项目对你有帮助,欢迎请作者喝杯咖啡:
205
+
206
+ <img src="assets/wechat-reward-qr.png" width="200" alt="微信赞赏码" />
207
+
202
208
  ## 友情链接
203
209
 
204
210
  - [Linux DO:学AI,上L站!](https://linux.do/)
@@ -3,6 +3,9 @@
3
3
  // ---------------------------------------------------------------------------
4
4
  import { spawn } from 'node:child_process';
5
5
  import { createInterface } from 'node:readline';
6
+ import { existsSync } from 'node:fs';
7
+ import { join, dirname } from 'node:path';
8
+ import { createRequire } from 'node:module';
6
9
  import { BaseAgentAdapter } from './base-adapter.js';
7
10
  import { EntryNormalizer } from './entry-normalizer.js';
8
11
  import { loadEnvFile } from './env-file-loader.js';
@@ -13,6 +16,87 @@ import { cleanSpawnEnv } from './env-cleanup.js';
13
16
  // ---------------------------------------------------------------------------
14
17
  const STDERR_ERROR_RE = /\b(error|fatal)\b/i;
15
18
  // ---------------------------------------------------------------------------
19
+ // Native binary resolution — bypass shell/shim layers on Windows
20
+ // ---------------------------------------------------------------------------
21
+ /**
22
+ * Resolve the native codex binary path by replicating the logic from
23
+ * `@openai/codex/bin/codex.js`. On Windows, `shell: true` creates a
24
+ * fragile process chain (cmd.exe → codex.cmd → node codex.js → codex.exe)
25
+ * where intermediate processes can exit before the native binary finishes,
26
+ * breaking the stdout pipe. Resolving the native binary directly and spawning
27
+ * without `shell: true` eliminates this race condition.
28
+ *
29
+ * Returns the absolute path to the native binary, or null if not found
30
+ * (in which case the adapter falls back to shell-based spawn).
31
+ */
32
+ function resolveCodexNativeBinary() {
33
+ const isWin = process.platform === 'win32';
34
+ const binaryName = isWin ? 'codex.exe' : 'codex';
35
+ const targetTriples = {
36
+ win32: { x64: 'x86_64-pc-windows-msvc', arm64: 'aarch64-pc-windows-msvc' },
37
+ linux: { x64: 'x86_64-unknown-linux-musl', arm64: 'aarch64-unknown-linux-musl' },
38
+ darwin: { x64: 'x86_64-apple-darwin', arm64: 'aarch64-apple-darwin' },
39
+ };
40
+ const triple = targetTriples[process.platform]?.[process.arch];
41
+ if (!triple)
42
+ return null;
43
+ const platformPackages = {
44
+ 'x86_64-pc-windows-msvc': '@openai/codex-win32-x64',
45
+ 'aarch64-pc-windows-msvc': '@openai/codex-win32-arm64',
46
+ 'x86_64-unknown-linux-musl': '@openai/codex-linux-x64',
47
+ 'aarch64-unknown-linux-musl': '@openai/codex-linux-arm64',
48
+ 'x86_64-apple-darwin': '@openai/codex-darwin-x64',
49
+ 'aarch64-apple-darwin': '@openai/codex-darwin-arm64',
50
+ };
51
+ const platformPkg = platformPackages[triple];
52
+ if (!platformPkg)
53
+ return null;
54
+ // Strategy 1: resolve via npm global install (most common)
55
+ try {
56
+ const npmGlobal = isWin
57
+ ? join(process.env.APPDATA ?? '', 'npm', 'node_modules', '@openai', 'codex')
58
+ : '';
59
+ // Use createRequire from the codex package location
60
+ const codexPkgPaths = [
61
+ npmGlobal ? join(npmGlobal, 'package.json') : '',
62
+ // Also try resolving from cwd
63
+ ].filter(Boolean);
64
+ for (const basePath of codexPkgPaths) {
65
+ try {
66
+ const req = createRequire(basePath);
67
+ const pkgJsonPath = req.resolve(`${platformPkg}/package.json`);
68
+ const vendorRoot = join(dirname(pkgJsonPath), 'vendor');
69
+ const candidate = join(vendorRoot, triple, 'codex', binaryName);
70
+ if (existsSync(candidate))
71
+ return candidate;
72
+ }
73
+ catch { /* continue */ }
74
+ }
75
+ }
76
+ catch { /* continue */ }
77
+ // Strategy 2: look for local vendor directory relative to codex shim
78
+ try {
79
+ const shimPath = isWin
80
+ ? join(process.env.APPDATA ?? '', 'npm', 'node_modules', '@openai', 'codex', 'vendor')
81
+ : '';
82
+ if (shimPath) {
83
+ const candidate = join(shimPath, triple, 'codex', binaryName);
84
+ if (existsSync(candidate))
85
+ return candidate;
86
+ }
87
+ }
88
+ catch { /* continue */ }
89
+ return null;
90
+ }
91
+ // Cache the resolved binary path (or null) to avoid repeated filesystem lookups
92
+ let _cachedCodexBinary;
93
+ function getCodexBinary() {
94
+ if (_cachedCodexBinary === undefined) {
95
+ _cachedCodexBinary = resolveCodexNativeBinary();
96
+ }
97
+ return _cachedCodexBinary;
98
+ }
99
+ // ---------------------------------------------------------------------------
16
100
  // Adapter implementation
17
101
  // ---------------------------------------------------------------------------
18
102
  export class CodexCliAdapter extends BaseAgentAdapter {
@@ -39,13 +123,24 @@ export class CodexCliAdapter extends BaseAgentAdapter {
39
123
  if (config.apiKey)
40
124
  envOverrides.OPENAI_API_KEY = config.apiKey;
41
125
  const childEnv = cleanSpawnEnv(envOverrides);
42
- const child = spawn('codex', args, {
43
- cwd: config.workDir,
44
- env: childEnv,
45
- stdio: ['pipe', 'pipe', 'pipe'],
46
- shell: true,
47
- windowsHide: true,
48
- });
126
+ // Prefer the resolved native binary to avoid the fragile shell process
127
+ // chain on Windows (cmd.exe → codex.cmd → node codex.js → codex.exe).
128
+ // When the native binary is found, spawn directly without shell: true.
129
+ const nativeBinary = getCodexBinary();
130
+ const child = nativeBinary
131
+ ? spawn(nativeBinary, args, {
132
+ cwd: config.workDir,
133
+ env: childEnv,
134
+ stdio: ['pipe', 'pipe', 'pipe'],
135
+ windowsHide: true,
136
+ })
137
+ : spawn('codex', args, {
138
+ cwd: config.workDir,
139
+ env: childEnv,
140
+ stdio: ['pipe', 'pipe', 'pipe'],
141
+ shell: true,
142
+ windowsHide: true,
143
+ });
49
144
  if (!child.stdout || !child.stdin || !child.stderr) {
50
145
  throw new Error('Failed to spawn Codex CLI: stdio streams not available');
51
146
  }
@@ -181,6 +276,16 @@ export class CodexCliAdapter extends BaseAgentAdapter {
181
276
  }
182
277
  break;
183
278
  }
279
+ case 'error': {
280
+ const errorMsg = msg.message ?? 'Unknown codex error';
281
+ this.emitEntry(processId, EntryNormalizer.error(processId, errorMsg, 'codex_error'));
282
+ break;
283
+ }
284
+ case 'turn.failed': {
285
+ const failedMsg = msg.error?.message ?? 'Turn failed';
286
+ this.emitEntry(processId, EntryNormalizer.error(processId, failedMsg, 'turn_failed'));
287
+ break;
288
+ }
184
289
  // turn.started and unknown types are silently skipped
185
290
  default:
186
291
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"codex-cli-adapter.js","sourceRoot":"","sources":["../../../../../src/server/agents/codex-cli-adapter.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kEAAkE;AAClE,8EAA8E;AAE9E,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAuC,MAAM,eAAe,C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,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;YAC/B,IAAI,CAAC,SAAS,CACZ,SAAS,EACT,eAAe,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAC7D,CAAC;YAEF,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YACxC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,OAAO,CAAC,SAAiB;QAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,EAAE,EAAE,CAAC;YACP,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtC,2EAA2E;QAC3E,2EAA2E;IAC7E,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow",
3
- "version": "0.3.36",
3
+ "version": "0.3.38",
4
4
  "description": "Workflow orchestration CLI with MCP endpoint support and extensible architecture",
5
5
  "type": "module",
6
6
  "imports": {
@@ -1,8 +1,7 @@
1
1
  # Workflow: Issue Analysis
2
2
 
3
- > **DEPRECATED**: This workflow was used by the deleted `manage-issue-analyze` command.
4
- > Use `maestro-analyze --gaps [ISS-ID]` instead, which integrates issue root cause analysis
5
- > into the unified analyze pipeline. See `~/.maestro/workflows/issue-gaps-analyze.md`.
3
+ > **DEPRECATED**: Superseded by `issue-gaps-analyze.md` which adds batch support and context.md output.
4
+ > Use `maestro-analyze --gaps [ISS-ID]` instead.
6
5
 
7
6
  Root cause analysis for a specific issue using CLI exploration and codebase context gathering.
8
7
 
@@ -0,0 +1,260 @@
1
+ # Workflow: Issue Gaps Analysis (Codex — CSV Wave)
2
+
3
+ Root cause analysis for issues via `spawn_agents_on_csv` wave execution.
4
+ Supports single issue (ISS-ID) or batch with classification and parallel analysis.
5
+ Produces analysis records in issues.jsonl and context.md for downstream `plan --gaps`.
6
+
7
+ **Invoked by**: `maestro-analyze --gaps [ISS-ID]` (codex SKILL.md)
8
+
9
+ ## Pipeline
10
+
11
+ ```
12
+ Load Issues → Classify & Group → Generate tasks.csv → Wave 1: Explore (parallel per issue) → Wave 2: Synthesize (per group) → Write issue.analysis → Output context.md
13
+ ```
14
+
15
+ ---
16
+
17
+ ### Step 1: Load Issues
18
+
19
+ ```
20
+ If ISS-ID provided:
21
+ Load single issue from .workflow/issues/issues.jsonl
22
+ → fatal if file missing or ID not found (E_ISSUE_NOT_FOUND)
23
+ → skip Step 2 (single issue = single group)
24
+
25
+ If no ISS-ID:
26
+ Load all issues where status == "open" || status == "registered"
27
+ → fatal if none found (E_NO_ISSUES)
28
+ ```
29
+
30
+ ---
31
+
32
+ ### Step 2: Classify & Group (batch mode only)
33
+
34
+ ```
35
+ Group loaded issues by affected area overlap:
36
+
37
+ Classification dimensions:
38
+ - location: file path prefix (first 2 segments, e.g. src/auth/)
39
+ - component: affected_components field overlap
40
+ - category: issue.category or severity
41
+
42
+ Grouping rules:
43
+ 1. Same location prefix → same group
44
+ 2. Shared affected_components → same group
45
+ 3. Remaining ungrouped → individual groups (1 issue each)
46
+
47
+ Output: GROUPS[] = { group_id, label, issues[], shared_keywords[] }
48
+
49
+ Display group breakdown (skip if AUTO_YES).
50
+ ```
51
+
52
+ ---
53
+
54
+ ### Step 3: Generate tasks.csv
55
+
56
+ Generate CSV with two waves:
57
+ - **Wave 1**: One exploration row per issue (parallel within wave)
58
+ - **Wave 2**: One synthesis row per group (parallel across groups, depends on its issues in wave 1)
59
+
60
+ ```csv
61
+ id,title,description,iss_id,group_id,group_label,deps,context_from,wave,status,findings,analysis_json,error
62
+ ```
63
+
64
+ **Wave 1 rows** — one per issue:
65
+
66
+ ```csv
67
+ "1","Explore: ISS-xxx {title}","Root cause exploration for ISS-xxx: {description}. Location: {location}. Severity: {severity}. Fix hint: {fix_direction}. Search keywords: {keywords from title+description+components}. TASK: grep keywords → read top matches → trace call chain → identify root cause (file:line) → assess impact → list related files → rate confidence → suggest fix. EXPECTED: JSON { root_cause, impact, related_files[], confidence, suggested_approach }. CONSTRAINTS: Evidence-only, use file reads to verify.","ISS-xxx","G1","src/auth","","","1","","","",""
68
+ ```
69
+
70
+ **Wave 2 rows** — one per group:
71
+
72
+ ```csv
73
+ "N","Synthesize: {group_label}","Compile exploration findings for group [{group_label}]. For each issue: validate root cause evidence, identify cross-issue relationships, build analysis record. Output: JSON array [{ iss_id, root_cause, affected_files, impact_scope, fix_direction, confidence, cross_refs }]. Note shared root causes and dependency chains across issues in this group.","","G1","src/auth","1;2;3","1;2;3","2","","","",""
74
+ ```
75
+
76
+ **Column definitions**:
77
+
78
+ | Column | Phase | Description |
79
+ |--------|-------|-------------|
80
+ | `id` | Input | Unique task identifier |
81
+ | `title` | Input | Short task title |
82
+ | `description` | Input | Full exploration/synthesis instructions |
83
+ | `iss_id` | Input | Issue ID (wave 1 only, empty for wave 2) |
84
+ | `group_id` | Input | Group identifier |
85
+ | `group_label` | Input | Group label for display |
86
+ | `deps` | Input | Semicolon-separated dependency task IDs |
87
+ | `context_from` | Input | Task IDs whose findings this task needs |
88
+ | `wave` | Input | 1 = explore, 2 = synthesize |
89
+ | `status` | Output | `pending` → `completed` / `failed` |
90
+ | `findings` | Output | Key findings summary (max 500 chars) |
91
+ | `analysis_json` | Output | Structured analysis JSON (wave 2 only) |
92
+ | `error` | Output | Error message if failed |
93
+
94
+ Write `tasks.csv` to session folder.
95
+
96
+ ---
97
+
98
+ ### Step 4: Wave 1 — Explore (parallel per issue)
99
+
100
+ Filter `wave == 1 && status == pending`. Write `wave-1.csv`.
101
+
102
+ ```javascript
103
+ spawn_agents_on_csv({
104
+ csv_path: `${sessionFolder}/wave-1.csv`,
105
+ id_column: "id",
106
+ instruction: `You are analyzing a specific issue for root cause. Read the 'description' column for full instructions. Use file reads and grep to gather evidence. Write findings as a concise summary with file:line references. Write analysis_json as a JSON object: { root_cause, impact, related_files[], confidence, suggested_approach }.`,
107
+ max_concurrency: maxConcurrency,
108
+ max_runtime_seconds: 3600,
109
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
110
+ output_schema: { id, status: ["completed"|"failed"], findings, analysis_json, error }
111
+ })
112
+ ```
113
+
114
+ Merge results into master `tasks.csv`, delete `wave-1.csv`.
115
+
116
+ **Per-issue agent responsibilities**:
117
+ 1. **Keyword Search** — grep issue keywords in source, find top 20 relevant paths
118
+ 2. **Context Read** — read top 5 matches with 10 lines surrounding context
119
+ 3. **Call Chain Trace** — trace 2-3 levels from issue location
120
+ 4. **Root Cause Identification** — pinpoint file:line with evidence
121
+ 5. **Impact Assessment** — scope of affected functionality
122
+
123
+ ---
124
+
125
+ ### Step 5: Wave 2 — Synthesize (parallel per group)
126
+
127
+ Filter `wave == 2 && status == pending`. Build `prev_context` from wave 1 findings of issues in same group. Write `wave-2.csv` with `prev_context` column.
128
+
129
+ ```javascript
130
+ spawn_agents_on_csv({
131
+ csv_path: `${sessionFolder}/wave-2.csv`,
132
+ id_column: "id",
133
+ instruction: `You are synthesizing root cause analysis for a group of related issues. Read prev_context for per-issue exploration findings. Validate evidence, identify cross-issue relationships and shared root causes. Output analysis_json as a JSON array: [{ iss_id, root_cause, affected_files, impact_scope, fix_direction, confidence, cross_refs }].`,
134
+ max_concurrency: maxConcurrency,
135
+ max_runtime_seconds: 3600,
136
+ output_csv_path: `${sessionFolder}/wave-2-results.csv`,
137
+ output_schema: { id, status: ["completed"|"failed"], findings, analysis_json, error }
138
+ })
139
+ ```
140
+
141
+ Merge results into master `tasks.csv`, delete `wave-2.csv`.
142
+
143
+ **Synthesis agent responsibilities**:
144
+ 1. Parse per-issue findings from prev_context
145
+ 2. Validate root cause evidence (file:line exists, logic holds)
146
+ 3. Identify cross-issue relationships within group
147
+ 4. Build consolidated analysis array with cross_refs
148
+ 5. Flag shared root causes that affect multiple issues
149
+
150
+ ---
151
+
152
+ ### Step 6: Write Analysis to issues.jsonl
153
+
154
+ ```
155
+ Parse analysis_json from wave 2 results.
156
+
157
+ For each issue in the analysis array:
158
+ Build IssueAnalysis record:
159
+ {
160
+ root_cause,
161
+ affected_files,
162
+ impact_scope,
163
+ fix_direction,
164
+ confidence,
165
+ cross_refs,
166
+ analyzed_at: NOW_ISO,
167
+ tool: "spawn_agents_on_csv",
168
+ depth: DEPTH
169
+ }
170
+
171
+ Read-modify-write issues.jsonl (single pass):
172
+ Set issue.analysis = ANALYSIS, updated_at = NOW_ISO
173
+ Append issue.history: { action: "analyzed", at: NOW_ISO, by: "maestro-analyze --gaps" }
174
+ Status unchanged (non-destructive enrichment).
175
+
176
+ Verify: re-read, confirm analysis field present for all updated issues.
177
+ ```
178
+
179
+ ---
180
+
181
+ ### Step 7: Output context.md
182
+
183
+ ```
184
+ Aggregate results organized by group:
185
+
186
+ # Context: Issue Gaps Analysis
187
+
188
+ **Date**: {date}
189
+ **Issues analyzed**: {count}
190
+ **Groups**: {group_count}
191
+ **Session**: {sessionFolder}
192
+
193
+ ## Group: {group.label}
194
+
195
+ ### ISS-{id}: {title}
196
+ - **Root cause**: {root_cause}
197
+ - **Affected files**: {affected_files}
198
+ - **Impact scope**: {impact_scope}
199
+ - **Fix direction**: {fix_direction}
200
+ - **Confidence**: {confidence}
201
+ - **Cross-refs**: {related ISS-IDs}
202
+
203
+ (repeat per issue, per group)
204
+
205
+ ## Cross-Group Dependencies
206
+ {issues sharing root causes across groups}
207
+
208
+ ## Constraints
209
+
210
+ ### Locked
211
+ {constraints from root cause evidence}
212
+
213
+ ### Free
214
+ {implementation choices left to planner}
215
+
216
+ Write context.md to session folder + copy to scratchDir.
217
+ Register artifact in state.json.
218
+ ```
219
+
220
+ ---
221
+
222
+ ### Step 8: Display Summary and Next Steps
223
+
224
+ ```
225
+ Display: group breakdown, per-issue root cause, confidence, cross-refs.
226
+
227
+ Next steps:
228
+ - maestro-plan --gaps (plan fix tasks linked to analyzed issues)
229
+ - maestro-analyze --gaps {ISS-ID} (re-analyze specific issue)
230
+ - manage-issue list (review all issues)
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Session Structure
236
+
237
+ ```
238
+ .workflow/.csv-wave/{YYYYMMDD}-analyze-{slug}/
239
+ ├── tasks.csv # master state
240
+ ├── results.csv # final export
241
+ ├── wave-1.csv # temporary (deleted after merge)
242
+ ├── wave-2.csv # temporary (deleted after merge)
243
+ ├── discoveries.ndjson # shared board (append-only)
244
+ ├── context.md # decisions for plan --gaps
245
+ ```
246
+
247
+ ## Output
248
+
249
+ - **Updated**: `.workflow/issues/issues.jsonl` — enriched with `analysis` field per issue
250
+ - **Created**: `context.md` — grouped root causes for downstream `plan --gaps`
251
+ - **Created**: `results.csv` — full task execution results
252
+
253
+ ## Quality Criteria
254
+
255
+ - Issues classified into groups before CSV generation
256
+ - Wave 1 agents run parallel (one per issue, bounded by maxConcurrency)
257
+ - Wave 2 agents run parallel (one per group, after wave 1 deps met)
258
+ - Cross-issue relationships captured via cross_refs
259
+ - Single-pass JSONL update preserves integrity
260
+ - context.md organized by group with cross-group section
@@ -0,0 +1,214 @@
1
+ # Workflow: Issue Gaps Analysis
2
+
3
+ Root cause analysis for issues using CLI exploration and codebase context gathering.
4
+ Supports single issue (ISS-ID) or batch (all open/registered) with classification and parallel analysis.
5
+ Produces analysis records in issues.jsonl and context.md for downstream `plan --gaps`.
6
+
7
+ **Invoked by**: `maestro-analyze --gaps [ISS-ID]`
8
+
9
+ ## Input
10
+
11
+ - `ISS-ID` (optional): Specific issue to analyze. If omitted, analyze all open/registered issues.
12
+ - `TOOL`: CLI tool for exploration (default: gemini)
13
+ - `DEPTH`: `standard` or `deep` (default: standard)
14
+
15
+ ## Pipeline
16
+
17
+ ```
18
+ Load Issues → Classify & Group → Parallel Analysis (per group) → Write issue.analysis → Output context.md
19
+ ```
20
+
21
+ ---
22
+
23
+ ### Step 1: Load Issues
24
+
25
+ ```
26
+ If ISS-ID provided:
27
+ Load single issue from .workflow/issues/issues.jsonl
28
+ → fatal if file missing or ID not found (E_ISSUE_NOT_FOUND)
29
+ → skip Step 2 (classification), go directly to Step 3
30
+
31
+ If no ISS-ID:
32
+ Load all issues where status == "open" || status == "registered"
33
+ → fatal if none found (E_NO_ISSUES)
34
+
35
+ Validate: at least 1 issue loaded.
36
+ ```
37
+
38
+ ---
39
+
40
+ ### Step 2: Classify & Group (batch mode only)
41
+
42
+ ```
43
+ Group loaded issues by overlap in affected area:
44
+
45
+ Classification dimensions:
46
+ - location: file path prefix (e.g. src/auth/, src/api/)
47
+ - component: affected_components field overlap
48
+ - category: issue.category or severity level
49
+
50
+ Grouping rules:
51
+ 1. Same location prefix (first 2 path segments) → same group
52
+ 2. Shared affected_components → same group
53
+ 3. Remaining ungrouped → individual groups (1 issue each)
54
+
55
+ Output: GROUPS[] where each group = { group_id, label, issues[], shared_context_keywords[] }
56
+
57
+ Display group breakdown to user (skip if AUTO_YES).
58
+ ```
59
+
60
+ ---
61
+
62
+ ### Step 3: Gather Codebase Context (per group)
63
+
64
+ ```
65
+ For each group:
66
+ Merge keywords from all issues in group: title, description, location, affected_components.
67
+ Deduplicate keywords.
68
+
69
+ Standard depth: grep keywords in source files → top 20 paths, read 10 lines around
70
+ top 5 matches.
71
+ Deep depth: standard grep + semantic Agent search (error handling, data flow, deps),
72
+ merge results.
73
+
74
+ Build GROUP_CONTEXT: related files, key snippets (max 50 lines), dependency chain.
75
+ Shared context benefits co-located issues — avoids redundant exploration.
76
+ ```
77
+
78
+ ---
79
+
80
+ ### Step 4: Run Analysis (per group, parallel across groups)
81
+
82
+ ```
83
+ Launch analysis for each group in parallel using Agent tool:
84
+
85
+ Agent({
86
+ subagent_type: "general-purpose",
87
+ prompt: "Root cause analysis for issues in group [{group.label}]:
88
+ {for each issue in group}
89
+ ISS-{id}: {title} — {description}, severity: {severity}, location: {location}
90
+ {end}
91
+ CODEBASE CONTEXT: {GROUP_CONTEXT}
92
+ TASK: For EACH issue — identify root cause (file:line) → assess impact → list related files → rate confidence → suggest fix direction. Note cross-issue relationships within this group.
93
+ EXPECTED: JSON array [{ iss_id, root_cause, impact, related_files[], confidence, suggested_approach, cross_refs[] }]
94
+ CONSTRAINTS: Evidence-only, no speculation. Use Read/Grep to verify before concluding."
95
+ })
96
+
97
+ Alternatively, attempt CLI delegate first per group:
98
+
99
+ maestro delegate "<same prompt>" --role analyze --mode analysis
100
+
101
+ If delegate fails (timeout, unavailable, parse error):
102
+ Fall back to Agent tool with same prompt.
103
+ Record fallback in analysis metadata: { tool: "agent-fallback", reason: "<error>" }
104
+
105
+ Validate response per issue: all required fields present.
106
+ Parse failure → save raw output to issue feedback for review.
107
+ ```
108
+
109
+ ---
110
+
111
+ ### Step 5: Build Analysis Record (per issue)
112
+
113
+ ```
114
+ For each issue from Step 4 results:
115
+
116
+ Construct IssueAnalysis:
117
+ {
118
+ root_cause,
119
+ affected_files: related_files,
120
+ impact_scope: impact,
121
+ fix_direction: suggested_approach,
122
+ confidence,
123
+ cross_refs: [ISS-IDs of related issues in same group],
124
+ analyzed_at: NOW_ISO,
125
+ tool: TOOL or "agent-fallback",
126
+ depth: DEPTH
127
+ }
128
+ ```
129
+
130
+ ---
131
+
132
+ ### Step 6: Update Issues in JSONL
133
+
134
+ ```
135
+ Read-modify-write issues.jsonl (single pass for all analyzed issues):
136
+ For each issue:
137
+ Set issue.analysis = ANALYSIS, updated_at = NOW_ISO
138
+ Append issue.history: { action: "analyzed", at: NOW_ISO, by: "maestro-analyze --gaps" }
139
+ Status unchanged (analysis is metadata enrichment).
140
+ Verify: re-read file, confirm analysis field present for all updated issues.
141
+ ```
142
+
143
+ ---
144
+
145
+ ### Step 7: Output context.md
146
+
147
+ ```
148
+ Aggregate all analyzed issues into context.md, organized by group:
149
+
150
+ # Context: Issue Gaps Analysis
151
+
152
+ **Date**: {date}
153
+ **Issues analyzed**: {count}
154
+ **Groups**: {group_count}
155
+
156
+ ## Group: {group.label}
157
+
158
+ ### ISS-{id}: {title}
159
+ - **Root cause**: {root_cause}
160
+ - **Affected files**: {affected_files}
161
+ - **Impact scope**: {impact_scope}
162
+ - **Fix direction**: {fix_direction}
163
+ - **Confidence**: {confidence}
164
+ - **Cross-refs**: {related ISS-IDs}
165
+
166
+ (repeat per issue, per group)
167
+
168
+ ## Cross-Group Dependencies
169
+ {issues that span multiple groups or share root causes}
170
+
171
+ ## Constraints
172
+
173
+ ### Locked
174
+ {constraints derived from root cause evidence}
175
+
176
+ ### Free
177
+ {implementation choices left to planner}
178
+
179
+ Write context.md to session output directory.
180
+ ```
181
+
182
+ ---
183
+
184
+ ### Step 8: Display Summary and Next Steps
185
+
186
+ ```
187
+ Display: group breakdown, per-issue root cause, confidence, cross-refs.
188
+
189
+ Next steps:
190
+ - maestro-plan --gaps (plan fix tasks linked to analyzed issues)
191
+ - maestro-analyze --gaps {ISS-ID} (re-analyze specific issue with deeper context)
192
+ - manage-issue list (review all issues)
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Output
198
+
199
+ - **Updated**: `.workflow/issues/issues.jsonl` -- issue records enriched with `analysis` field
200
+ - **Created**: `context.md` -- aggregated root causes grouped for downstream `plan --gaps`
201
+ - **Analysis fields**: root_cause, affected_files, impact_scope, fix_direction, confidence, cross_refs, analyzed_at, tool, depth
202
+
203
+ ## Quality Criteria
204
+
205
+ - Issues classified by location/component overlap before analysis
206
+ - Groups analyzed in parallel (Agent or delegate per group)
207
+ - CLI delegate attempted first; Agent fallback on failure
208
+ - Analysis grounded in actual codebase evidence (file:line references)
209
+ - Cross-issue relationships captured within groups (cross_refs)
210
+ - JSON result validated before writing to JSONL
211
+ - Issue status unchanged (analysis is non-destructive enrichment)
212
+ - Single-pass read-modify-write preserves JSONL integrity
213
+ - context.md organized by group with cross-group dependencies
214
+ - Next-step routing guides to plan --gaps