maestro-flow 0.5.39 → 0.5.41

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 (139) hide show
  1. package/.agents/skills/odyssey-debug/SKILL.md +109 -143
  2. package/.agents/skills/odyssey-improve/SKILL.md +127 -141
  3. package/.agents/skills/odyssey-planex/SKILL.md +140 -231
  4. package/.agents/skills/odyssey-review-test-fix/SKILL.md +136 -90
  5. package/.agents/skills/odyssey-ui/SKILL.md +123 -143
  6. package/.agy/skills/odyssey-debug/SKILL.md +109 -143
  7. package/.agy/skills/odyssey-improve/SKILL.md +127 -141
  8. package/.agy/skills/odyssey-planex/SKILL.md +140 -231
  9. package/.agy/skills/odyssey-review-test-fix/SKILL.md +136 -90
  10. package/.agy/skills/odyssey-ui/SKILL.md +123 -143
  11. package/.claude/commands/odyssey-debug.md +109 -143
  12. package/.claude/commands/odyssey-improve.md +127 -141
  13. package/.claude/commands/odyssey-planex.md +140 -231
  14. package/.claude/commands/odyssey-review-test-fix.md +136 -90
  15. package/.claude/commands/odyssey-ui.md +123 -143
  16. package/.codex/agents/cli-explore-agent.toml +181 -0
  17. package/.codex/agents/cross-role-reviewer.toml +165 -0
  18. package/.codex/agents/impeccable-agent.toml +89 -0
  19. package/.codex/agents/role-design-author.toml +213 -0
  20. package/.codex/agents/team-worker.toml +4 -7
  21. package/.codex/agents/ui-design-agent.toml +260 -0
  22. package/.codex/agents/workflow-analyzer.toml +106 -0
  23. package/.codex/agents/workflow-codebase-mapper.toml +69 -0
  24. package/.codex/agents/workflow-collab-planner.toml +140 -0
  25. package/.codex/agents/workflow-debugger.toml +95 -0
  26. package/.codex/agents/workflow-executor.toml +124 -0
  27. package/.codex/agents/workflow-external-researcher.toml +80 -0
  28. package/.codex/agents/workflow-integration-checker.toml +76 -0
  29. package/.codex/agents/workflow-nyquist-auditor.toml +77 -0
  30. package/.codex/agents/workflow-phase-researcher.toml +76 -0
  31. package/.codex/agents/workflow-plan-checker.toml +93 -0
  32. package/.codex/agents/workflow-planner.toml +192 -0
  33. package/.codex/agents/workflow-project-researcher.toml +65 -0
  34. package/.codex/agents/workflow-research-synthesizer.toml +65 -0
  35. package/.codex/agents/workflow-reviewer.toml +75 -0
  36. package/.codex/agents/workflow-roadmapper.toml +75 -0
  37. package/.codex/agents/workflow-verifier.toml +113 -0
  38. package/.codex/skills/maestro/SKILL.md +1 -0
  39. package/.codex/skills/maestro-analyze/SKILL.md +33 -15
  40. package/.codex/skills/maestro-brainstorm/SKILL.md +13 -10
  41. package/.codex/skills/maestro-collab/SKILL.md +30 -75
  42. package/.codex/skills/maestro-execute/SKILL.md +19 -12
  43. package/.codex/skills/maestro-grill/SKILL.md +12 -11
  44. package/.codex/skills/maestro-next/SKILL.md +3 -3
  45. package/.codex/skills/maestro-overlay/SKILL.md +1 -1
  46. package/.codex/skills/maestro-plan/SKILL.md +17 -8
  47. package/.codex/skills/maestro-ralph/SKILL.md +3 -0
  48. package/.codex/skills/maestro-ralph-execute/SKILL.md +1 -0
  49. package/.codex/skills/maestro-roadmap/SKILL.md +14 -8
  50. package/.codex/skills/manage-learn/SKILL.md +1 -1
  51. package/.codex/skills/odyssey-debug/SKILL.md +176 -150
  52. package/.codex/skills/odyssey-improve/SKILL.md +210 -177
  53. package/.codex/skills/odyssey-planex/SKILL.md +162 -242
  54. package/.codex/skills/odyssey-review-test-fix/SKILL.md +96 -90
  55. package/.codex/skills/odyssey-ui/SKILL.md +211 -179
  56. package/.codex/skills/quality-review/SKILL.md +17 -10
  57. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +6 -12
  58. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +6 -14
  59. package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +2 -6
  60. package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +6 -14
  61. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +3 -7
  62. package/.codex/skills/team-quality-assurance/roles/scout/role.md +2 -5
  63. package/.codex/skills/team-review/roles/reviewer/role.md +2 -5
  64. package/.codex/skills/team-review/roles/scanner/role.md +2 -5
  65. package/.codex/skills/team-tech-debt/roles/executor/role.md +3 -7
  66. package/.codex/skills/team-tech-debt/roles/scanner/role.md +2 -5
  67. package/.codex/skills/team-tech-debt/roles/validator/role.md +3 -7
  68. package/.codex/skills/team-testing/roles/executor/role.md +3 -7
  69. package/.codex/skills/team-testing/roles/generator/role.md +3 -7
  70. package/dashboard/dist-server/src/commands/install-backend.js +19 -0
  71. package/dashboard/dist-server/src/commands/install-backend.js.map +1 -1
  72. package/dashboard/dist-server/src/core/manifest.d.ts +5 -0
  73. package/dashboard/dist-server/src/core/manifest.js.map +1 -1
  74. package/dashboard/dist-server/src/core/plugin-bridge.d.ts +59 -0
  75. package/dashboard/dist-server/src/core/plugin-bridge.js +355 -0
  76. package/dashboard/dist-server/src/core/plugin-bridge.js.map +1 -0
  77. package/dashboard/dist-server/src/tools/spec-loader.js +27 -19
  78. package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
  79. package/dashboard/dist-server/src/tools/spec-seeds.d.ts +8 -0
  80. package/dashboard/dist-server/src/tools/spec-seeds.js +114 -0
  81. package/dashboard/dist-server/src/tools/spec-seeds.js.map +1 -1
  82. package/dist/src/cli.js +19 -1
  83. package/dist/src/cli.js.map +1 -1
  84. package/dist/src/commands/install-backend.d.ts.map +1 -1
  85. package/dist/src/commands/install-backend.js +19 -0
  86. package/dist/src/commands/install-backend.js.map +1 -1
  87. package/dist/src/commands/install.d.ts.map +1 -1
  88. package/dist/src/commands/install.js +17 -1
  89. package/dist/src/commands/install.js.map +1 -1
  90. package/dist/src/commands/plugin.d.ts +3 -0
  91. package/dist/src/commands/plugin.d.ts.map +1 -0
  92. package/dist/src/commands/plugin.js +137 -0
  93. package/dist/src/commands/plugin.js.map +1 -0
  94. package/dist/src/commands/spec.d.ts.map +1 -1
  95. package/dist/src/commands/spec.js +13 -3
  96. package/dist/src/commands/spec.js.map +1 -1
  97. package/dist/src/commands/update.d.ts.map +1 -1
  98. package/dist/src/commands/update.js +23 -0
  99. package/dist/src/commands/update.js.map +1 -1
  100. package/dist/src/core/install-executor.d.ts +1 -1
  101. package/dist/src/core/install-executor.d.ts.map +1 -1
  102. package/dist/src/core/install-executor.js +27 -0
  103. package/dist/src/core/install-executor.js.map +1 -1
  104. package/dist/src/core/install-profile.d.ts +5 -0
  105. package/dist/src/core/install-profile.d.ts.map +1 -1
  106. package/dist/src/core/install-profile.js +8 -0
  107. package/dist/src/core/install-profile.js.map +1 -1
  108. package/dist/src/core/manifest.d.ts +5 -0
  109. package/dist/src/core/manifest.d.ts.map +1 -1
  110. package/dist/src/core/manifest.js.map +1 -1
  111. package/dist/src/core/plugin-bridge.d.ts +60 -0
  112. package/dist/src/core/plugin-bridge.d.ts.map +1 -0
  113. package/dist/src/core/plugin-bridge.js +355 -0
  114. package/dist/src/core/plugin-bridge.js.map +1 -0
  115. package/dist/src/tools/spec-init.d.ts +4 -3
  116. package/dist/src/tools/spec-init.d.ts.map +1 -1
  117. package/dist/src/tools/spec-init.js +9 -5
  118. package/dist/src/tools/spec-init.js.map +1 -1
  119. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  120. package/dist/src/tools/spec-loader.js +27 -19
  121. package/dist/src/tools/spec-loader.js.map +1 -1
  122. package/dist/src/tools/spec-seeds.d.ts +8 -0
  123. package/dist/src/tools/spec-seeds.d.ts.map +1 -1
  124. package/dist/src/tools/spec-seeds.js +114 -0
  125. package/dist/src/tools/spec-seeds.js.map +1 -1
  126. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  127. package/dist/src/tui/install-ui/InstallFlow.js +43 -14
  128. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  129. package/dist/src/tui/install-ui/types.d.ts +2 -0
  130. package/dist/src/tui/install-ui/types.d.ts.map +1 -1
  131. package/dist/src/tui/install-ui/types.js.map +1 -1
  132. package/dist/src/tui/install-ui/useInstallFlowState.d.ts.map +1 -1
  133. package/dist/src/tui/install-ui/useInstallFlowState.js +13 -1
  134. package/dist/src/tui/install-ui/useInstallFlowState.js.map +1 -1
  135. package/dist/src/utils/update-notices.js +11 -0
  136. package/dist/src/utils/update-notices.js.map +1 -1
  137. package/package.json +1 -1
  138. package/workflows/odyssey-base-codex.md +306 -0
  139. package/workflows/shell-exec-protocol.md +30 -0
@@ -35,7 +35,7 @@ $ARGUMENTS -- requirement/idea text or @file reference, plus optional flags.
35
35
  </context>
36
36
 
37
37
  <interview_protocol>
38
- Interview the user relentlessly until shared understanding is reached. Active only in interactive mode; skip when `-y/--yes`, `--revise`, `--review`, `-c`, or input is already specific (clear requirement + mode).
38
+ Interview the user relentlessly until shared understanding is reached. Active only in interactive mode; skip ONLY when `-y/--yes`, `--revise`, `--review`, or `-c` is set. Text requirements always require at least scope + strategy confirmation — never auto-classify input as "specific enough" to skip.
39
39
 
40
40
  - One decision per turn via request_user_input with 2–4 options + a (Recommended) default. The user controls termination — keep interviewing until convergence; they can interrupt naturally at any time.
41
41
  - Search-first when uncertain: before asking, resolve via `state.json`, existing `roadmap.md`, `project.md`, `maestro load --type spec`, `maestro search`, `maestro explore` (preferred, fallback Glob/Grep/Read). Never ask what code or memory can verify; never bounce your own ambiguity back to the user — search first, then ask only what truly needs human judgment.
@@ -73,8 +73,8 @@ Wave 1: 3 analysis rows (parallel). Wave 2: 1 assembly row.
73
73
  2. **CSV is source of truth**: Master tasks.csv holds all state
74
74
  3. **Context propagation**: prev_context from master CSV, not memory
75
75
  4. **Discovery board append-only**: Never modify/delete discoveries.ndjson
76
- 5. **Graceful degradation**: Wave 1 fails -> Wave 2 proceeds with seed input only. When degradation activates, flag downstream outputs as LOW CONFIDENCE.
77
- 6. **Invariant violation = BLOCK** — violating any invariant above blocks the current operation.
76
+ 5. **Graceful degradation**: Wave 1 fails -> Wave 2 proceeds with seed input only. When degradation activates, flag downstream outputs as LOW CONFIDENCE. Record `degradation_event` in discoveries.ndjson. This is a defined degradation path, not a violation of invariant 6.
77
+ 6. **Invariant violation = BLOCK** — violating any invariant above blocks the current operation. Defined degradation paths (invariant 5) are not violations.
78
78
  7. **Requirement mapping completeness** — every Active requirement from project.md MUST be mapped to exactly one phase. No circular dependencies in phase ordering.
79
79
  8. **Artifact verification before completion** — .workflow/roadmap.md MUST exist with Milestone > Phase hierarchy and progress table. Artifact MUST be registered in state.json. If missing: DO NOT report completion.
80
80
  </invariants>
@@ -104,10 +104,13 @@ S_CSV_GEN:
104
104
  -> S_WAVE_1 DO: generate analysis CSV
105
105
 
106
106
  S_WAVE_1:
107
- -> S_WAVE_2 DO: A_SPAWN_WAVE_1
107
+ -> S_WAVE_2 WHEN: 1+ completed DO: A_SPAWN_WAVE_1. For failed analysis tasks: exclude from prev_context and append gap_note to W2 instruction listing missing angles.
108
+ -> S_WAVE_1 WHEN: all failed, retry available DO: retry once
109
+ -> S_WAVE_2 WHEN: all failed, retry exhausted DO: proceed with seed input only, flag LOW CONFIDENCE (invariant 5 degradation)
108
110
 
109
111
  S_WAVE_2:
110
- -> S_AGGREGATE DO: A_SPAWN_WAVE_2
112
+ -> S_AGGREGATE WHEN: completed DO: A_SPAWN_WAVE_2
113
+ -> ERROR WHEN: failed DO: abort "Roadmap generation failed"
111
114
 
112
115
  S_AGGREGATE:
113
116
  -> END DO: A_AGGREGATE_RESULTS
@@ -178,7 +181,7 @@ Assembly agent produces roadmap.md with Milestone > Phase hierarchy (goal, depen
178
181
  2. Interactive refinement (max 3 rounds, skip if -y): Approve / Refine / Regenerate
179
182
  3. Generate context.md (summary + analysis findings + roadmap stats)
180
183
  4. Write .workflow/roadmap.md with Milestone > Phase hierarchy
181
- 5. Update state.json milestones + current_milestone
184
+ 5. Update state.json milestones + current_milestone + register RDM artifact
182
185
  6. **Generate context-package.json** (schema `context-package/1.0`):
183
186
  ```jsonc
184
187
  {
@@ -194,7 +197,11 @@ Assembly agent produces roadmap.md with Milestone > Phase hierarchy (goal, depen
194
197
  }
195
198
  ```
196
199
  Register `context_package` path in RDM artifact entry so downstream `--from roadmap:ID` can resolve.
197
- 7. Next-step routing: need analysis -> maestro-analyze; ready to plan -> maestro-plan; UI first -> maestro-impeccable build; need formal specs -> maestro-blueprint
200
+ 7. **Next-step suggestion** (suggest only, NEVER auto-execute): display the recommended next command. The user decides whether to proceed.
201
+ - Need analysis → `maestro-analyze`
202
+ - Ready to plan → `maestro-plan`
203
+ - UI first → `maestro-impeccable build`
204
+ - Need formal specs → `maestro-blueprint`
198
205
 
199
206
  </actions>
200
207
 
@@ -243,4 +250,3 @@ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
243
250
  ```
244
251
  Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
245
252
  </ralph_completion>
246
- </output>
@@ -47,7 +47,7 @@ $manage-learn "\"Zod v4 breaks z.object().strict() API\" --category gotcha --tag
47
47
  </context>
48
48
 
49
49
  <invariants>
50
- 1. **No LLM or CLI calls**: This skill is pure file I/O — parse, infer, append, confirm. No `exec_command`, no `spawn_agent`.
50
+ 1. **No LLM or CLI calls**: This skill is pure file I/O — parse, infer, append, confirm. No `shell_exec`, no `spawn_agent`.
51
51
  2. **Bootstrap on demand**: Create `.workflow/knowhow/` structure on first use; do not require it to exist.
52
52
  3. **Append-only learnings.md**: Never rewrite or delete existing entries.
53
53
  4. **Stable INS-ids**: `INS-{8hex}` from `hash(insightText + timestamp)` — same text at different times gets different ids.
@@ -4,54 +4,41 @@ description: "Long-running debug cycle — archaeology, diagnosis, fix, confirma
4
4
  argument-hint: "<issue> [--skip-fix] [--skip-generalize] [--auto] [-y] [-c] [--heartbeat]"
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
- <base>@~/.maestro/workflows/odyssey-base.md</base>
7
+ <base>@~/.maestro/workflows/odyssey-base-codex.md</base>
8
8
 
9
9
  <purpose>
10
- Closed-loop deep debugging: archaeology → explore → diagnose → fix & confirm → generalize → discover siblings → persist.
11
- Treats every bug as a learning signal with exhaustive iteration until root cause confirmed or INCONCLUSIVE.
12
-
13
- Core philosophy:
14
- - **Archaeology before hypothesis** — look at what changed before guessing why
15
- - **Fix one, find many** — a single bug reveals a class of bugs
16
- - **Decision journal** — human-judgment items recorded, not lost
17
- - **CLI-assisted review** — delegate for second-opinion analysis
18
-
19
- **三句哲学约束(穷尽迭代):**
20
- 1. **零遗留** — 根因必须确认到底,修复必须验证通过,泛化必须扫描穷尽
21
- 2. **穷尽迭代** — 假设失败不放弃:扩范围 → 换视角 → 升级工具,直到根因确认或明确 INCONCLUSIVE
22
- 3. **改进即标准** — 修复后重新确认同区域无新问题,泛化发现的同类 bug 全部处理
10
+ archaeology → explore → diagnose → fix & confirm → generalize → discover siblings → persist.
11
+ Exhaustive iteration until root cause confirmed or INCONCLUSIVE.
23
12
  </purpose>
24
13
 
25
14
  <boundary>
26
- **范围内:** 单一 bug/issue 的完整闭环 — 考古 → 探索 → 诊断 → 修复 → 确认 → 泛化同类 → 沉淀
27
- **范围外:** 新功能开发 → `$odyssey-planex` | 代码质量审查 → `$odyssey-review-test-fix` | UI 视觉优化 → `$odyssey-ui` | 架构重设计 → `/maestro-plan`
28
- **探索自由度:** 边界内自由探索 — 可追踪任意调用链、分析任意历史、测试任意假设。泛化阶段可扫描全项目寻找同类问题。
29
- **Zero-residual principle:** Every finding MUST have a concrete action (fix / issue / decision). "Pre-existing issue" is not a valid skip reason.
30
- **模板支持:** `--template <name>` 从预定义调查策略启动:
31
-
32
- | Template | 调查策略 | 适用场景 |
33
- |----------|---------|---------|
34
- | `performance` | profilinghot pathallocation cache | 性能劣化 |
35
- | `memory-leak` | heap snapshot retention chainlifecycle | 内存泄漏 |
36
- | `race-condition` | timelineconcurrent accesslock analysis | 竞态条件 |
37
- | `regression` | git bisectdiff analysisboundary check | 回归问题 |
38
- | `crash` | stack trace → null chain → error propagation | 崩溃/异常 |
15
+ **In scope:** Single bug/issue full loop.
16
+ **Out of scope:** Features → `$odyssey-planex` | Quality review → `$odyssey-review-test-fix` | UI → `$odyssey-ui` | Architecture → `/maestro-plan`
17
+
18
+ **`--template <name>`:**
19
+
20
+ | Template | Strategy | Use case |
21
+ |----------|----------|----------|
22
+ | `performance` | profiling → hot path → allocation → cache | Performance degradation |
23
+ | `memory-leak` | heap snapshot retention chainlifecycle | Memory leaks |
24
+ | `race-condition` | timelineconcurrent accesslock analysis | Race conditions |
25
+ | `regression` | git bisect diff analysisboundary check | Regressions |
26
+ | `crash` | stack tracenull chainerror propagation | Crashes / exceptions |
39
27
  </boundary>
40
28
 
41
29
  <context>
42
- $ARGUMENTS — issue description and optional flags.
30
+ $ARGUMENTS
43
31
 
44
- **Flags:** `--skip-fix` analysis-only | `--skip-generalize` quick fix | `--template <name>` 预定义策略 | `--auto` no delegate confirmation | `-y` auto-confirm all decisions | `-c` resume last session | `--heartbeat` enable /loop heartbeat
32
+ **Flags:** `--skip-fix` analysis-only | `--skip-generalize` quick fix | `--template <name>` | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
45
33
 
46
- **Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-debug-odyssey-{slug}/`
34
+ **Session**: `.workflow/scratch/{YYYYMMDD}-debug-odyssey-{slug}/`
47
35
  **Output**: `session.json` | `evidence.ndjson` | `explore.json` | `understanding.md`
48
36
 
49
- **session.json unique fields:**
37
+ **session.json debug-specific fields:**
50
38
  ```json
51
39
  { "issue": "", "diagnosis_retries": 0, "root_cause": null, "confirmation": null,
52
- "patterns": [], "generalization_stats": null, "cross_phase_loops": 0, "max_loops": 5 }
40
+ "patterns": [], "generalization_stats": null }
53
41
  ```
54
- 共有字段(`progress_metrics`, `directions_tried` 等)见 base。
55
42
 
56
43
  **evidence.ndjson phases:** `archaeology|explore|diagnosis|discovery|decision|self-iteration`
57
44
  - `archaeology`: `sha`, `author`, `date`, `message`, `relevance`
@@ -79,27 +66,54 @@ $ARGUMENTS — issue description and optional flags.
79
66
  4. Hypotheses ← S_DIAGNOSE | 5. Root Cause ← S_DIAGNOSE | 6. Fix & Confirmation ← S_FIX+S_CONFIRM
80
67
  7. Generalization ← S_GENERALIZE | 8. Discoveries ← S_DISCOVER | 9. Learnings ← S_RECORD
81
68
 
82
- ### Pre-load(可选,缺失不阻塞)
69
+ **Knowledge Persistence categories (§9):**
83
70
 
84
- | 命令 | 作用 |
85
- |------|------|
86
- | Read `.workflow/codebase/ARCHITECTURE.md` | 模块边界 |
87
- | `maestro search "<issue keywords>" --json` | 先前调查(top 5) |
88
- | `maestro load --type spec --category debug --keyword "<symptom>"` | 已知 issue/workaround |
89
- | `Glob(".workflow/scratch/*-debug-odyssey-*")` | 相关 odyssey 会话 |
71
+ | Category | Content | Follow-up |
72
+ |----------|---------|-----------|
73
+ | Recurring root cause pattern | Type + triggers + fix + detection | `/spec-add debug` |
74
+ | Non-obvious workaround | Problem + steps + why obvious fix fails | `/spec-add learning` |
75
+ | Architecture boundary violation | Violation + correct boundary + verification | `/spec-add arch` |
76
+ | Reusable generalization pattern | Signature + risk + fix template + scope | `/spec-add coding` |
77
+ </context>
90
78
 
91
- ### Knowledge Persistence(S_RECORD → understanding.md §9)
79
+ <csv_schema>
80
+ ### Shared Output Schema (all waves)
81
+ ```json
82
+ {
83
+ "type": "object",
84
+ "properties": {
85
+ "id": {"type":"string"}, "result_status": {"type":"string","enum":["completed","failed"]},
86
+ "findings": {"type":"string","maxLength":500}, "evidence": {"type":"string"}, "error": {"type":"string"}
87
+ },
88
+ "required": ["id","result_status","findings"]
89
+ }
90
+ ```
92
91
 
93
- | 分类 | 后续建议命令 |
94
- |------|-------------|
95
- | 反复根因模式 | `/spec-add debug "..."` |
96
- | 非显而易见 workaround | `/spec-add learning "..."` |
97
- | 架构边界违反 | `/spec-add arch "..."` |
98
- | 可复用泛化 pattern | `/spec-add coding "..."` |
99
- </context>
92
+ **Termination Contract** (embed in every instruction):
93
+ ```
94
+ You MUST call report_agent_job_result EXACTLY ONCE before exiting.
95
+ Success → result_status=completed | Failure result_status=failed with error | Timeout completed with partial.
96
+ NEVER continue indefinitely. NEVER exit silently. Read-only do NOT modify source files.
97
+ Do NOT write to tasks.csv, wave-*.csv, results.csv. Do NOT call spawn_agents_on_csv.
98
+ ```
99
+
100
+ ### tasks.csv
101
+ ```csv
102
+ id,title,description,task_type,deps,wave,status,findings,evidence,error
103
+ ```
104
+ - Wave 1: Archaeology (git-timeline, git-blame) — parallel
105
+ - Wave 2: Generalization (syntax-grep, semantic-scan, structural-match, historical-grep) — parallel, depends on root cause
106
+ - Single-agent stages (explore, diagnose, fix, confirm) remain inline
107
+ </csv_schema>
108
+
109
+ <invariants>
110
+ Base execution_discipline applies. Debug additions:
111
+ 1. **Evidence append-only** — never delete or overwrite evidence.ndjson entries
112
+ 2. **Phase goal tracking** — mark goal done/failed before transition; no silent skips
113
+ </invariants>
100
114
 
101
115
  <self_iteration>
102
- 适用阶段: S_ARCHAEOLOGY, S_EXPLORE, S_DIAGNOSE, S_GENERALIZE
116
+ Applies to: **S_ARCHAEOLOGY, S_EXPLORE, S_DIAGNOSE, S_GENERALIZE**. Logic in base.
103
117
  </self_iteration>
104
118
 
105
119
  <state_machine>
@@ -113,14 +127,14 @@ S_INTAKE → S_INTAKE : -c + session found → A_RESUME_SESSION
113
127
  S_INTAKE → S_ARCHAEOLOGY : issue parsed → A_INTAKE
114
128
  S_INTAKE → S_INTAKE : no issue, no session → request_user_input
115
129
 
116
- S_ARCHAEOLOGY → S_EXPLORE : A_ARCHAEOLOGY complete
117
- S_EXPLORE → S_DIAGNOSE : A_EXPLORE complete
130
+ S_ARCHAEOLOGY → S_EXPLORE : complete
131
+ S_EXPLORE → S_DIAGNOSE : complete
118
132
 
119
- S_DIAGNOSE → S_FIX : root cause confirmed, !skip_fix
120
- S_DIAGNOSE → S_GENERALIZE : root cause confirmed, skip_fix, !skip_generalize
121
- S_DIAGNOSE → S_RECORD : root cause confirmed, skip_fix, skip_generalize
133
+ S_DIAGNOSE → S_FIX : confirmed, !skip_fix
134
+ S_DIAGNOSE → S_GENERALIZE : confirmed, skip_fix, !skip_generalize
135
+ S_DIAGNOSE → S_RECORD : confirmed, skip_fix, skip_generalize
122
136
  S_DIAGNOSE → S_DIAGNOSE : all hypotheses failed, retries < 3 → A_ESCALATE_DIAGNOSIS
123
- S_DIAGNOSE → S_RECORD : retries >= 3 → mark INCONCLUSIVE
137
+ S_DIAGNOSE → S_RECORD : retries >= 3 → INCONCLUSIVE
124
138
 
125
139
  S_FIX → S_CONFIRM : fix implemented
126
140
  S_CONFIRM → S_GENERALIZE : confirmed, !skip_generalize
@@ -130,140 +144,151 @@ S_CONFIRM → S_FIX : needs_rework
130
144
  S_GENERALIZE → S_DISCOVER : similar code found
131
145
  S_GENERALIZE → S_RECORD : no similar code
132
146
 
133
- S_DISCOVER → S_DIAGNOSE : new bug worth investigating → cross_phase_loops++
134
- S_DISCOVER → S_FIX : same-pattern bug, fix template applies, !skip_fix → cross_phase_loops++
135
- S_DISCOVER → S_RECORD : triage complete, remaining_actionable == 0
136
- S_DISCOVER → S_RECORD : loops >= max_loops → log each unfixed item with specific reason
147
+ S_DISCOVER → S_DIAGNOSE : new bug → cross_phase_loops++
148
+ S_DISCOVER → S_FIX : same-pattern bug + fix_template, !skip_fix → cross_phase_loops++
149
+ S_DISCOVER → S_RECORD : remaining_actionable == 0
150
+ S_DISCOVER → S_RECORD : loops >= max_loops → log per-item reasons
137
151
 
138
- S_RECORD → END : A_RECORD complete
152
+ S_RECORD → END : complete
139
153
  </transitions>
140
154
 
141
155
  <actions>
142
156
 
143
157
  ### A_INTAKE
144
- 1. Parse arguments, generate slug, create `SESSION_DIR`
145
- 2. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + Grep keywords
146
- 3. Derive `phase_goals[]` from flags (apply `skip_when`)
158
+ 1. Parse arguments, generate slug, create SESSION_DIR
159
+ 2. `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + Grep keywords
160
+ 3. Derive `phase_goals[]` from flags
147
161
  4. Write `session.json` + `understanding.md` §1, emit Goal Prompt
148
162
 
149
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): INTAKE — 目标解析与上下文加载"`
163
+ Commit: `"odyssey-debug({slug}): INTAKE — parse target and load context"`
150
164
 
151
165
  ### A_RESUME_SESSION
152
- Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
166
+ Glob latest session → read `session.json` → jump to `current_state`.
153
167
 
154
168
  ### A_ARCHAEOLOGY
155
- **2 parallel agents (spawn_agents_on_csv):** Timeline (`git log --oneline -20 -- {files}`) + Blame (top 3 suspicious files `git blame -L {region}`). Append evidence (phase: "archaeology").
169
+ **Step 1 Git archaeology (spawn_agents_on_csv, Wave 1):**
170
+
171
+ Write `tasks.csv` with Wave 1 rows:
172
+ ```csv
173
+ id,title,description,task_type,deps,wave,status,findings,evidence,error
174
+ "arch-timeline","Git Timeline","Run git log --oneline -20 -- {files}. Return [{sha,date,author,message,files_changed}] as JSON.","archaeology","","1","pending","","",""
175
+ "arch-blame","Git Blame","Top 3 suspicious files: git blame -L {region}. Return [{file,line_range,sha,author,date,content}] as JSON.","archaeology","","1","pending","","",""
176
+ ```
177
+
178
+ ```javascript
179
+ spawn_agents_on_csv({ csv_path:"tasks.csv", id_column:"id",
180
+ instruction: ARCHAEOLOGY_INSTRUCTION + TERMINATION_CONTRACT,
181
+ max_concurrency:2, max_runtime_seconds:300,
182
+ output_csv_path:"wave-1-results.csv", output_schema: SHARED_OUTPUT_SCHEMA })
183
+ ```
184
+
185
+ Merge results → evidence.ndjson (phase: "archaeology").
156
186
 
157
- **CLI change review** via `maestro delegate --role analyze --mode analysis` (`run_in_background: true`):
187
+ **Step 2 — CLI change review** via `maestro delegate --role analyze --mode analysis` (`run_in_background: true`):
158
188
  - PURPOSE: Review recent modifications related to {issue}
159
189
  - EXPECTED: JSON [{commit_sha, risk_level, analysis, could_cause_issue, explanation}]
160
190
 
161
- Update §2.
162
-
163
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): ARCHAEOLOGY — git 考古分析"`
191
+ Update §2. Commit: `"odyssey-debug({slug}): ARCHAEOLOGY — git history analysis"`
164
192
 
165
193
  ### A_EXPLORE
166
- Skip if no enabled CLI tools (W006).
194
+ Skip if no CLI tools (W006).
167
195
 
168
196
  `maestro delegate --role explore --mode analysis` (`run_in_background: true`):
169
- - PURPOSE: Gather codebase evidence — call chains, recent changes, error gaps, similar patterns
197
+ - PURPOSE: Call chains, recent changes, error gaps, similar patterns
170
198
  - EXPECTED: JSON {call_chains, recent_changes, error_gaps, similar_patterns}
171
199
 
172
- Parse → write `explore.json` + evidence (phase: "explore"). Update §3. Mark G2 done.
173
-
174
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): EXPLORE — 代码探索完成"`
200
+ Write `explore.json` + evidence phase=explore. Update §3. Mark G2. Commit: `"odyssey-debug({slug}): EXPLORE — codebase exploration"`
175
201
 
176
202
  ### A_DIAGNOSE
177
- 1. Form hypotheses from evidence, ranked [HIGH]/[MEDIUM]/[LOW] → §4
178
- 2. Test each: design test execute → evidence (phase: "diagnosis")
179
- 3. Decision journal: ambiguity → evidence (phase: "decision"); Normal: request_user_input | `-y`: defer
180
- 4. Root cause confirmed → `session.json.root_cause` + §5. Mark G1 done.
203
+ 1. Hypotheses from evidence, ranked [HIGH]/[MEDIUM]/[LOW] → §4
204
+ 2. Test each → evidence phase=diagnosis
205
+ 3. Ambiguity → evidence phase=decision; Normal: request_user_input | `-y`: defer
206
+ 4. Confirmed → `session.json.root_cause` + §5. Mark G1.
181
207
 
182
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): DIAGNOSE — 根因确认"`
208
+ Commit: `"odyssey-debug({slug}): DIAGNOSE — root cause confirmed"`
183
209
 
184
210
  ### A_ESCALATE_DIAGNOSIS
185
- Increment `diagnosis_retries`. < 3: broaden via `maestro delegate --role analyze`, new hypotheses, return S_DIAGNOSE. >= 3: Normal → request_user_input | `-y` → auto INCONCLUSIVE → S_RECORD.
211
+ `diagnosis_retries++`. < 3: `maestro delegate --role analyze`, new hypotheses, S_DIAGNOSE. >= 3: Normal → request_user_input | `-y` → INCONCLUSIVE → S_RECORD.
186
212
 
187
213
  ### A_FIX
188
214
  1. Present root cause + proposed fix. Normal: request_user_input | `-y`: auto proceed
189
- 2. Implement fix, record evidence (phase: "decision")
215
+ 2. Implement fix, evidence phase=decision
190
216
 
191
- 📌 **Auto-commit**: `git add -A && git commit -m "odyssey-debug({slug}): FIX — {修复摘要}"`
217
+ Commit: `"odyssey-debug({slug}): FIX — {summary}"`
192
218
 
193
219
  ### A_CONFIRM
194
- 1. Run covering tests (auto-detect framework)
195
- 2. CLI fix review via `maestro delegate --role review --mode analysis` (`run_in_background: true`):
220
+ 1. Run covering tests
221
+ 2. `maestro delegate --role review --mode analysis` (`run_in_background: true`):
196
222
  - EXPECTED: JSON {verdict, findings [{severity, description, suggestion}], regression_risk}
197
- 3. Write `session.json.confirmation`: `{test_result, cli_review, overall: "confirmed|needs_rework"}`
198
- 4. Update §6. `needs_rework` → S_FIX. `confirmed` → mark G3 done.
223
+ 3. `session.json.confirmation`: `{test_result, cli_review, overall: "confirmed|needs_rework"}`
224
+ 4. Update §6. `needs_rework` → S_FIX. `confirmed` → mark G3.
199
225
 
200
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): CONFIRM — 修复验证"`
226
+ Commit: `"odyssey-debug({slug}): CONFIRM — fix verified"`
201
227
 
202
228
  ### A_GENERALIZE
203
- base A_GENERALIZE 执行。Pattern 来源: root cause + fix。统计写入 `session.json.generalization_stats`。Mark G4 done.
229
+ Skip if `--skip-generalize`. Pattern source: root cause + fix.
230
+ Base shared_actions for 3-layer extraction + cross-layer dedup + iterative deepening.
231
+
232
+ **Wave 2 — 4-agent scan (spawn_agents_on_csv):**
233
+
234
+ Append Wave 2 rows to `tasks.csv`:
235
+ ```csv
236
+ "gen-syntax","Syntax Grep","Grep syntax-layer signatures '${signature}' across project. Return [{file,line,context,risk_level,layer:'syntax',confidence}].","generalization","","2","pending","","",""
237
+ "gen-semantic","Semantic Scan","Check related modules for anti-pattern: ${description}. Return [{file,line,context,risk_level,layer:'semantic',confidence}].","generalization","","2","pending","","",""
238
+ "gen-structural","Structural Match","Find structurally similar files to ${buggy_files}, check for anti-pattern. Return [{file,line,description,risk,layer:'structural',confidence}].","generalization","","2","pending","","",""
239
+ "gen-historical","Historical Grep","Run git log -S '${signature}' --oneline. Return [{sha,file,date,type:'introduced|fixed',context}].","generalization","","2","pending","","",""
240
+ ```
204
241
 
205
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): GENERALIZE — 泛化扫描完成"`
242
+ ```javascript
243
+ spawn_agents_on_csv({ csv_path:"tasks.csv", id_column:"id",
244
+ instruction: GENERALIZATION_INSTRUCTION + TERMINATION_CONTRACT,
245
+ max_concurrency:4, max_runtime_seconds:300,
246
+ output_csv_path:"wave-2-results.csv", output_schema: SHARED_OUTPUT_SCHEMA })
247
+ ```
206
248
 
207
- ### A_DISCOVER
208
- 按 base A_DISCOVER 执行。Mark G5 done.
249
+ Update §7. Mark G4. Commit: `"odyssey-debug({slug}): GENERALIZE — pattern scan complete"`
209
250
 
210
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): DISCOVER — 发现分类完成"`
251
+ ### A_DISCOVER, A_RECORD
252
+ Base shared_actions. Debug overrides:
253
+ - **A_DISCOVER** routes scan hits per csv_schema wave results. Commit: `"odyssey-debug({slug}): DISCOVER — triage complete"`
254
+ - **A_RECORD** learnings per Knowledge Persistence table
211
255
 
212
- ### A_RECORD
213
- 1. Finalize `understanding.md` §9,按 Knowledge Persistence 表分类记录
214
- 2. Mark G6 done. Pending decisions: Normal → request_user_input | `-y` → skip (show deferred count)
215
- 3. 其余按 base A_RECORD 执行
216
- 4. **Completion summary**:
256
+ **Completion summary:**
217
257
  ```
218
258
  --- DEBUG ODYSSEY COMPLETE ---
219
259
  Issue: {issue}
220
260
  Root cause: {root_cause.hypothesis}
221
261
  Fix: {applied|skipped|inconclusive}
222
- Patterns: {patterns_extracted} ({by_layer} distribution)
223
- Scan hits: {total_hits} ({cross_layer_confirmed} cross-layer confirmed)
262
+ Patterns: {patterns_extracted} ({by_layer})
263
+ Scan hits: {total_hits} ({cross_layer_confirmed} confirmed)
224
264
  Issues: {N} created
225
265
  Decisions: {N} resolved, {M} pending, {K} deferred
226
- Learnings: {N} spec entries persisted
227
- Self-iter: {N} quality gate rounds across {M} stages
228
- Goals: {done}/{total} confirmed ({skipped} skipped)
266
+ Learnings: {N} persisted
267
+ Self-iter: {N} rounds across {M} stages
268
+ Goals: {done}/{total} ({skipped} skipped)
229
269
  ---
230
270
  ```
231
271
 
232
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): RECORD — 会话总结与知识沉淀"`
233
-
234
272
  </actions>
235
273
 
236
274
  <appendix>
237
275
 
238
- ### Goal Prompt Template
276
+ ### `-y` debug-specific points
239
277
 
240
- **时机守卫:仅在 A_INTAKE 完成后显示一次。** 机制见 base。
278
+ | Decision Point | Normal | `-y` |
279
+ |---------------|--------|------|
280
+ | A_DIAGNOSE ambiguity | request_user_input | deferred |
281
+ | A_ESCALATE 3-strike | request_user_input | INCONCLUSIVE |
282
+ | A_FIX direction | request_user_input | auto proceed |
283
+
284
+ ### Goal Prompt convergence rules
241
285
 
242
286
  ```
243
- 📋 Debug Odyssey 会话已创建。可随时复制以下 /goal 设定终止条件:
244
-
245
- /goal 完成以下目标:
246
- {for each G in phase_goals where status != "skipped":}
247
- - {G.id}: {G.goal} — 完成条件: {G.done_when}
248
- {end for}
249
- 穷尽迭代:直到根因确认(或明确 INCONCLUSIVE)且修复验证通过
250
- 且泛化扫描穷尽且 phase_goals_all_done=true 才停。
251
- 泛化发现的同类 bug 全部修复或创建 issue,不允许遗留。
252
- 遇到 phase=decision 的 pending 必须 request_user_input,不得自行 resolve。
287
+ Stop when root cause confirmed (or INCONCLUSIVE), fix verified,
288
+ generalization exhausted, phase_goals_all_done=true.
289
+ All sibling bugs fixed or issued — no leftovers.
253
290
  ```
254
291
 
255
- ### `-y` Auto-Confirm Behavior
256
-
257
- | Decision Point | Normal | `-y` mode |
258
- |---------------|--------|-----------|
259
- | A_DIAGNOSE ambiguity | request_user_input | `deferred`, best-effort continue |
260
- | A_ESCALATE 3-strike | request_user_input 3-way | auto INCONCLUSIVE |
261
- | A_FIX direction | request_user_input | auto proceed with suggested fix |
262
- | A_DISCOVER bug triage | request_user_input | auto create issue |
263
- | A_DISCOVER ambiguous | request_user_input batch | all `deferred` |
264
- | A_RECORD decisions | request_user_input per-item | skip, show deferred count |
265
- | A_RECORD goal audit | request_user_input 3-way | auto accept current state |
266
-
267
292
  </appendix>
268
293
 
269
294
  </state_machine>
@@ -271,33 +296,34 @@ Goals: {done}/{total} confirmed ({skipped} skipped)
271
296
  <error_codes>
272
297
  | Code | Severity | Condition | Recovery |
273
298
  |------|----------|-----------|----------|
274
- | E001 | error | No issue and no session to resume | Provide issue or use -c |
275
- | W001 | warning | No relevant git history | Proceed with limited context |
276
- | W002 | warning | All hypotheses inconclusive after 3 retries | INCONCLUSIVE |
277
- | W005 | warning | Pending decisions unresolved | Filter evidence.ndjson phase=decision |
278
- | W006 | warning | CLI exploration skipped (no tools) | Proceed without explore.json |
299
+ | E001 | error | No issue, no session | Provide issue or -c |
300
+ | E002 | error | Target path not found | Check path |
301
+ | W001 | warning | No relevant git history | Proceed |
302
+ | W002 | warning | 3 retries exhausted | INCONCLUSIVE |
303
+ | W005 | warning | Pending decisions | Filter evidence phase=decision |
304
+ | W006 | warning | No CLI tools | Skip explore |
279
305
  </error_codes>
280
306
 
281
307
  <success_criteria>
282
- - [ ] Session created with 4 output files, prior knowledge searched
283
- - [ ] Git archaeology + CLI change review → evidence phase=archaeology
308
+ - [ ] Session + 4 output files + prior knowledge searched
309
+ - [ ] Archaeology + CLI review → evidence phase=archaeology
284
310
  - [ ] CLI exploration → explore.json + evidence phase=explore
285
- - [ ] Hypotheses tested, root cause declared with evidence refs
286
- - [ ] understanding.md tracks all 9 sections progressively
287
- - [ ] Fix implemented + confirmed (unless --skip-fix)
288
- - [ ] Multi-layer generalization + scan (unless --skip-generalize)
289
- - [ ] Discoveries classified and routed; every unfixed finding individually justified
290
- - [ ] phase_goals derived, goal audit in A_RECORD, state resumable via -c
291
- - [ ] Completion summary with all stats
311
+ - [ ] Hypotheses tested, root cause with evidence refs
312
+ - [ ] understanding.md 9 sections progressive
313
+ - [ ] Fix + confirmed (unless --skip-fix)
314
+ - [ ] Generalization + scan (unless --skip-generalize)
315
+ - [ ] Discoveries classified; unfixed findings individually justified
316
+ - [ ] phase_goals + goal audit + resumable via -c
317
+ - [ ] Completion summary
292
318
  </success_criteria>
293
319
 
294
320
  <next_step_routing>
295
- | Condition | Next step |
296
- |-----------|-----------|
297
- | Issues from discoveries | `/manage-issue list --source debug-odyssey` |
298
- | Pattern worth documenting | `/learn-decompose <module>` |
299
- | Fix needs formal review | `/quality-review <phase>` |
300
- | Second opinion on root cause | `/learn-second-opinion <understanding.md>` |
321
+ | Condition | Next |
322
+ |-----------|------|
323
+ | Discovery issues | `/manage-issue list --source debug-odyssey` |
324
+ | Document pattern | `/learn-decompose <module>` |
325
+ | Formal review | `/quality-review <phase>` |
326
+ | Second opinion | `/learn-second-opinion <understanding.md>` |
301
327
  | Related question | `/learn-investigate "<question>"` |
302
- | Decisions still pending | Filter evidence.ndjson phase=decision status=pending |
328
+ | Pending decisions | Filter evidence phase=decision status=pending |
303
329
  </next_step_routing>