maestro-flow 0.5.38 → 0.5.39

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 (67) hide show
  1. package/.agents/skills/odyssey-debug/SKILL.md +90 -269
  2. package/.agents/skills/odyssey-improve/SKILL.md +39 -240
  3. package/.agents/skills/odyssey-planex/SKILL.md +21 -105
  4. package/.agents/skills/odyssey-review-test-fix/SKILL.md +98 -318
  5. package/.agents/skills/odyssey-ui/SKILL.md +82 -265
  6. package/.agy/skills/odyssey-debug/SKILL.md +90 -269
  7. package/.agy/skills/odyssey-improve/SKILL.md +39 -240
  8. package/.agy/skills/odyssey-planex/SKILL.md +21 -105
  9. package/.agy/skills/odyssey-review-test-fix/SKILL.md +98 -318
  10. package/.agy/skills/odyssey-ui/SKILL.md +82 -265
  11. package/.claude/commands/odyssey-debug.md +90 -269
  12. package/.claude/commands/odyssey-improve.md +39 -240
  13. package/.claude/commands/odyssey-planex.md +21 -105
  14. package/.claude/commands/odyssey-review-test-fix.md +98 -318
  15. package/.claude/commands/odyssey-ui.md +82 -265
  16. package/.codex/skills/odyssey-debug/SKILL.md +167 -338
  17. package/.codex/skills/odyssey-improve/SKILL.md +226 -395
  18. package/.codex/skills/odyssey-planex/SKILL.md +317 -159
  19. package/.codex/skills/odyssey-review-test-fix/SKILL.md +137 -255
  20. package/.codex/skills/odyssey-ui/SKILL.md +197 -338
  21. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +23 -2
  22. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +242 -26
  23. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
  24. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +2 -0
  25. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +92 -29
  26. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  27. package/dashboard/dist-server/src/commands/hooks.d.ts +2 -1
  28. package/dashboard/dist-server/src/commands/hooks.js +16 -9
  29. package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
  30. package/dashboard/dist-server/src/hooks/kg-sync-hook.js +5 -0
  31. package/dashboard/dist-server/src/hooks/kg-sync-hook.js.map +1 -1
  32. package/dashboard/dist-server/src/hooks/session-context.js +276 -3
  33. package/dashboard/dist-server/src/hooks/session-context.js.map +1 -1
  34. package/dashboard/dist-server/src/search/daemon-client.d.ts +8 -3
  35. package/dashboard/dist-server/src/search/daemon-client.js +20 -0
  36. package/dashboard/dist-server/src/search/daemon-client.js.map +1 -1
  37. package/dist/src/commands/domain.d.ts.map +1 -1
  38. package/dist/src/commands/domain.js +12 -3
  39. package/dist/src/commands/domain.js.map +1 -1
  40. package/dist/src/commands/hooks.d.ts +2 -1
  41. package/dist/src/commands/hooks.d.ts.map +1 -1
  42. package/dist/src/commands/hooks.js +16 -9
  43. package/dist/src/commands/hooks.js.map +1 -1
  44. package/dist/src/commands/install.js +33 -2
  45. package/dist/src/commands/install.js.map +1 -1
  46. package/dist/src/commands/search.d.ts.map +1 -1
  47. package/dist/src/commands/search.js +59 -6
  48. package/dist/src/commands/search.js.map +1 -1
  49. package/dist/src/commands/spec.d.ts.map +1 -1
  50. package/dist/src/commands/spec.js +15 -0
  51. package/dist/src/commands/spec.js.map +1 -1
  52. package/dist/src/hooks/kg-sync-hook.d.ts.map +1 -1
  53. package/dist/src/hooks/kg-sync-hook.js +5 -0
  54. package/dist/src/hooks/kg-sync-hook.js.map +1 -1
  55. package/dist/src/hooks/session-context.d.ts.map +1 -1
  56. package/dist/src/hooks/session-context.js +276 -3
  57. package/dist/src/hooks/session-context.js.map +1 -1
  58. package/dist/src/search/daemon-client.d.ts +8 -3
  59. package/dist/src/search/daemon-client.d.ts.map +1 -1
  60. package/dist/src/search/daemon-client.js +20 -0
  61. package/dist/src/search/daemon-client.js.map +1 -1
  62. package/dist/src/search/daemon.d.ts +3 -3
  63. package/dist/src/search/daemon.d.ts.map +1 -1
  64. package/dist/src/search/daemon.js +9 -3
  65. package/dist/src/search/daemon.js.map +1 -1
  66. package/package.json +1 -1
  67. package/workflows/odyssey-base.md +258 -0
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: odyssey-review-test-fix
3
3
  description: Deep review + fix cycle — archaeology, exploration, multi-dimensional review, targeted fix, generalization, discovery, and knowledge persistence
4
- argument-hint: "<target> [--dimensions <list>] [--fix-threshold critical|high|medium|low|all] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c]"
4
+ argument-hint: "<target> [--dimensions <list>] [--fix-threshold critical|high|medium|low|all] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c] [--heartbeat]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -12,6 +12,8 @@ allowed-tools:
12
12
  - Agent
13
13
  - AskUserQuestion
14
14
  ---
15
+ <base>@~/.maestro/workflows/odyssey-base.md</base>
16
+
15
17
  <purpose>
16
18
  Deep code review with exhaustive fix: archaeology → explore → multi-dimensional review →
17
19
  fix ALL findings → confirm → generalize → discover → persist. Zero-residual philosophy.
@@ -19,35 +21,11 @@ fix ALL findings → confirm → generalize → discover → persist. Zero-resid
19
21
 
20
22
  <boundary>
21
23
  **范围内:** 目标代码的多维度深度审查 → 穷尽修复 ALL 发现(按 severity 递降)→ 泛化 pattern 到全项目
22
- **范围外:** 深度根因调查(根因不明时)→ `/odyssey-debug` | 需求实现 → `/odyssey-planex` | UI 视觉优化 → `/odyssey-ui`
23
- **探索自由度:** 边界内自由探索 — 可跨维度关联发现、追溯 git 历史、泛化扫描全项目。修复 ALL findings within fix_threshold(默认 all = 穷尽所有 severity)。
24
- **Zero-residual principle:** Every finding MUST have a concrete action (fix / issue / decision). "Report and shelve" is not allowed. "Pre-existing issue" is not a valid skip reason — if discovered within scope, it must be addressed.
24
+ **范围外:** 深度根因调查 `/odyssey-debug` | 需求实现 → `/odyssey-planex` | UI 视觉优化 → `/odyssey-ui`
25
+ **探索自由度:** 边界内自由探索 — 跨维度关联、追溯 git 历史、泛化扫描全项目。修复 ALL findings within fix_threshold(默认 all)。
26
+ **Zero-residual principle:** Every finding MUST have a concrete action (fix / issue / decision). "Report and shelve" and "pre-existing skip" are forbidden.
25
27
  </boundary>
26
28
 
27
- <execution_discipline>
28
- **三条铁律(所有阶段适用):**
29
-
30
- 1. **Phase auto-commit** — 每个阶段完成后**自动** `git commit`,无需用户确认
31
- - 代码变更 + understanding.md → `git add` → `git commit -m "odyssey-review({slug}): {phase} — {摘要}"`
32
- - session.json / evidence.ndjson 为运行时状态,不纳入 commit
33
-
34
- 2. **Confident edits only, but must attempt** — only modify what you're confident about; record decisions only when genuinely requiring human judgment
35
- - Confident → edit code directly, commit
36
- - Needs decision → record `evidence.ndjson {"phase":"decision","status":"pending"}`, don't touch code
37
- - No speculative changes
38
- - ⚠️ **Decision gate** — ONLY these qualify as decisions (not fixes):
39
- - Cross-module architectural tradeoffs requiring human direction
40
- - Ambiguous business semantics where the fix could alter intended behavior
41
- - Requires new dependency or breaking API change
42
- - ❌ "Unsure how to fix", "Large scope", "Pre-existing issue" are NOT valid decision reasons — either fix it, or explain specifically why it's unfixable
43
-
44
- 3. **多 CLI 辅助** — 利用 `maestro delegate` 调用多个 CLI 工具交叉验证
45
- - 关键判断用不同 `--role`(analyze / review / explore)获取多视角
46
- - 修复前后各做一次 CLI review 确认
47
-
48
- 4. **禁止以上下文消耗为由中断** — harness 自动处理 context compression,以"上下文不足"或"已执行 N 个阶段"为由中断属于纪律违反;必须完整走完状态机直到 S_RECORD → END
49
- </execution_discipline>
50
-
51
29
  <context>
52
30
  $ARGUMENTS — target and optional flags.
53
31
 
@@ -56,342 +34,160 @@ $ARGUMENTS — target and optional flags.
56
34
  |-------|-----------|
57
35
  | File/dir path | Review those files |
58
36
  | `HEAD` / `staged` | `git diff HEAD` / `git diff --staged` |
59
- | Phase number | Resolve via state.json → changed files |
37
+ | Phase number | state.json → changed files |
60
38
  | PR number | `git diff main...HEAD` |
61
39
 
62
40
  **Flags:**
63
41
  | Flag | Effect | Default |
64
42
  |------|--------|---------|
65
- | `--dimensions <list>` | Comma-separated subset | correctness,security,performance,architecture |
66
- | `--fix-threshold <severity>` | 修复到哪个 severity 为止(all = 全部修复)| `all` |
67
- | `--skip-fix` | Review-only — skip S_FIX and S_CONFIRM | false |
68
- | `--skip-generalize` | Skip S_GENERALIZE and S_DISCOVER | false |
69
- | `--auto` | CLI delegates without confirmation | false |
70
- | `-y` | Auto-confirm at decision points (see appendix) | false |
71
- | `-c` | Resume most recent session | — |
43
+ | `--dimensions` | Comma-separated subset | correctness,security,performance,architecture |
44
+ | `--fix-threshold` | 修复到哪个 severity 为止 | `all` |
45
+ | `--skip-fix` | Skip S_FIX + S_CONFIRM | false |
46
+ | `--skip-generalize` | Skip S_GENERALIZE + S_DISCOVER | false |
47
+ | `--auto` `-y` `-c` `--heartbeat` | CLI auto / auto-confirm / resume / heartbeat | false |
72
48
 
73
- **Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-review-odyssey-{slug}/`
74
-
75
- **Output 4 files:**
76
- ```
77
- SESSION_DIR/
78
- ├── session.json # state + review_result + confirmation + patterns + phase_goals
79
- ├── evidence.ndjson # ALL evidence (phase: archaeology|explore|review|fix|discovery|decision)
80
- ├── explore.json # CLI exploration snapshot
81
- └── understanding.md # 8-section evolving narrative (§1-§8, one per major phase)
82
- ```
83
-
84
- **session.json schema:**
85
- ```json
86
- {
87
- "session_id": "review-odyssey-{YYYYMMDD-HHmmss}",
88
- "target": "", "dimensions": [],
89
- "flags": { "skip_fix": false, "skip_generalize": false, "fix_threshold": "all", "auto": false, "auto_confirm": false },
90
- "current_state": "S_INTAKE",
91
- "review_result": { "dimensions_reviewed": [], "finding_count": 0, "severity_distribution": { "critical": 0, "high": 0, "medium": 0, "low": 0 }, "remaining_actionable": 0 },
92
- "patterns": [{ "id": "P1", "source_finding": "F1", "layer": "syntax|semantic|structural", "signature": "", "description": "", "risk": "", "fix_template": "", "confidence": "high|medium|low" }],
93
- "confirmation": { "test_result": {}, "cli_review": {}, "overall": "confirmed|needs_rework" },
94
- "generalization_stats": { "patterns_extracted": 0, "total_hits": 0, "true_positives": 0, "false_positives": 0, "uncertain": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {}, "deepening_triggered": false, "self_iteration_rounds": 0 },
95
- "phase_goals": [], "phase_goals_all_done": false,
96
- "self_iteration_log": [],
97
- "cross_phase_loops": 0, "max_loops": 5,
98
- "created_at": "", "updated_at": ""
99
- }
100
- ```
101
-
102
- **evidence.ndjson unified schema:** `{"ts":"","phase":"<phase>","type":"<type>","dimension":"","title":"","severity":"","file":"","line":0,"description":"","suggestion":"","files_modified":[]}`
49
+ **Session**: `.workflow/scratch/{YYYYMMDD}-review-odyssey-{slug}/`
50
+ **Output**: session.json, evidence.ndjson, explore.json, understanding.md (§1-§8)
51
+ **session.json unique fields**: `target`, `dimensions`, `review_result` (with `remaining_actionable`), `patterns[]`, `confirmation`, `generalization_stats`
52
+ **evidence.ndjson phases**: archaeology, explore, review, fix, discovery, decision, self-iteration
103
53
 
104
54
  **phase_goals[]:**
105
55
  | ID | Goal | Done When | Phase | skip_when |
106
56
  |----|------|-----------|-------|-----------|
107
- | G1 | Review completed | all dimensions reviewed, findings logged | S_REVIEW | — |
108
- | G2 | Explore context gathered | explore.json populated | S_EXPLORE | — |
109
- | G3 | Zero remaining: all findings fixed | `remaining_actionable == 0` within fix_threshold | S_CONFIRM | skip_fix |
110
- | G4 | Pattern generalized | patterns[] ≥1 entry | S_GENERALIZE | skip_generalize |
111
- | G5 | Discoveries triaged | all scan hits classified | S_DISCOVER | skip_generalize |
112
- | G6 | Learnings persisted | spec entries created OR no actionable | S_RECORD | — |
113
-
114
- Lifecycle: `pending → done | skipped | failed` (all set `completion_confirmed`)
115
-
116
- ### Pre-load(可选,缺失不阻塞)
117
-
118
- | 层级 | 命令 | 作用 |
119
- |------|------|------|
120
- | Codebase docs | Read `.workflow/codebase/ARCHITECTURE.md` | 模块边界,架构约束 |
121
- | Wiki search | `maestro search "<target keywords>" --json` | 先前 review、已知问题(取 top 5) |
122
- | Specs | `maestro load --type spec --category review` | review 标准、checklist、knowhow 工具 |
123
- | Role knowledge | `maestro search --category review` → 选相关 → `maestro load --type knowhow --id <id>` | 累积 review 领域知识 |
124
- | Prior sessions | `Glob(".workflow/scratch/*-review-odyssey-*")` | 相关 odyssey 会话 |
125
-
126
- ### Knowledge Persistence(S_RECORD 中写入产出文件)
127
-
128
- S_RECORD 阶段将可沉淀知识 **写入 understanding.md §8 Learnings**,按以下分类结构化:
129
-
130
- | 分类 | 写入内容 | 后续建议命令 |
131
- |------|---------|-------------|
132
- | 跨维度反复 pattern | 模式描述 + 出现维度 + 建议规范 | `/spec-add review "..."` |
133
- | 安全发现 | 漏洞类型 + 触发条件 + 修复方案 | `/spec-add debug "..."` |
134
- | 架构违反 pattern | 违反描述 + 正确边界 + 检查方法 | `/spec-add arch "..."` |
135
- | 可复用泛化 pattern | pattern 签名 + 风险说明 + fix 模板 | `/spec-add coding "..."` |
136
-
137
- **两步模式:** 执行中写入产出文件(临时记录)→ 任务完成后用户通过 next_step_routing 沉淀为永久知识。执行过程中不调用外部 Skill。
57
+ | G1 | Review completed | all dimensions reviewed | S_REVIEW | — |
58
+ | G2 | Explore context | explore.json populated | S_EXPLORE | — |
59
+ | G3 | Zero remaining | `remaining_actionable == 0` | S_CONFIRM | skip_fix |
60
+ | G4 | Pattern generalized | patterns[] ≥1 | S_GENERALIZE | skip_generalize |
61
+ | G5 | Discoveries triaged | all hits classified | S_DISCOVER | skip_generalize |
62
+ | G6 | Learnings persisted | spec entries or no actionable | S_RECORD | — |
63
+
64
+ ### Pre-load
65
+ Specs: `maestro load --type spec --category review`。其余按 base Pre-load。
66
+
67
+ ### Knowledge Persistence
68
+ | 分类 | 后续建议命令 |
69
+ |------|-------------|
70
+ | 跨维度反复 pattern | `/spec-add review "..."` |
71
+ | 安全发现 | `/spec-add debug "..."` |
72
+ | 架构违反 pattern | `/spec-add arch "..."` |
73
+ | 可复用泛化 pattern | `/spec-add coding "..."` |
138
74
  </context>
139
75
 
140
76
  <self_iteration>
141
- **Quality Gate** auto-evaluate after each analytical phase. Insufficient → re-enter (max 3 rounds).
142
-
143
- | Dimension | Sufficient | Insufficient |
144
- |-----------|-----------|-------------|
145
- | Coverage | All known related files analyzed | Missed targets discoverable via grep/git log |
146
- | Depth | ≥80% findings have file:line evidence | Most findings lack specifics |
147
- | Actionability | Each conclusion has concrete next action | "Consider reviewing" without action |
148
-
149
- **Expansion:** Round 1 = widen scope (more dirs, deeper git log, extra delegate angles). Round 2 = shift perspective (different CLI tool, reverse trace, manual reading). Round 3 = combine both + targeted deep-dive on remaining gaps.
150
-
151
- **Log:** `evidence.ndjson ← {"phase":"self-iteration","type":"quality-gate","stage":"S_XXX","round":N,"assessment":{},"expansion":""}`
152
-
153
- **Applicable stages:** S_ARCHAEOLOGY, S_EXPLORE, S_REVIEW, S_FIX, S_GENERALIZE
77
+ 适用阶段: S_ARCHAEOLOGY, S_EXPLORE, S_REVIEW, S_FIX, S_GENERALIZE
154
78
  </self_iteration>
155
79
 
156
80
  <state_machine>
157
-
158
81
  <states>
159
- S_INTAKE Parse target, load context, resume session PERSIST: session.json + understanding.md §1
160
- S_ARCHAEOLOGY — Git history of target files PERSIST: evidence.ndjson (archaeology) + understanding.md §2
161
- S_EXPLORE — CLI-assisted structure/call-chain exploration PERSIST: explore.json + evidence.ndjson (explore) + understanding.md §3
162
- S_REVIEW — Parallel multi-dimension review (4 Agents) PERSIST: evidence.ndjson (review) + understanding.md §4
163
- S_FIX — Targeted fix for critical/high (skip if --skip-fix) PERSIST: code changes + evidence.ndjson (fix)
164
- S_CONFIRM — Test + CLI review confirmation (skip if --skip-fix) PERSIST: session.json.confirmation + understanding.md §5
165
- S_GENERALIZE — Pattern extraction + 4-agent scan (skip if --skip-generalize) PERSIST: session.json.patterns + understanding.md §6
166
- S_DISCOVER — Classify hits, create issues (skip if --skip-generalize) PERSIST: evidence.ndjson (discovery|decision) + understanding.md §7
167
- S_RECORD — Knowledge persistence + final report PERSIST: understanding.md §8 + spec entries
82
+ S_INTAKE S_ARCHAEOLOGY S_EXPLORE S_REVIEW S_FIX S_CONFIRM → S_GENERALIZE → S_DISCOVER → S_RECORD → END
83
+ Skip: --skip-fix skips S_FIX+S_CONFIRM | --skip-generalize skips S_GENERALIZE+S_DISCOVER
168
84
  </states>
169
85
 
170
86
  <transitions>
171
- S_INTAKE:
172
- S_INTAKE WHEN -c + session found DO A_RESUME
173
- S_ARCHAEOLOGY WHEN target resolved DO A_INTAKE
174
- S_INTAKE WHEN no target DO AskUserQuestion
175
-
176
- S_ARCHAEOLOGY → S_EXPLORE DO A_ARCHAEOLOGY
177
- S_EXPLORE → S_REVIEW DO A_EXPLORE
178
-
179
- S_REVIEW:
180
- → S_FIX WHEN !skip_fix AND any findings within fix_threshold DO A_REVIEW
181
- → S_GENERALIZE WHEN (skip_fix OR no findings) AND !skip_gen DO A_REVIEW
182
- → S_RECORD WHEN (skip_fix OR no findings) AND skip_gen DO A_REVIEW
183
-
184
- S_FIX → S_CONFIRM DO A_FIX
185
-
186
- S_CONFIRM:
187
- → S_GENERALIZE WHEN confirmed AND !skip_gen DO A_CONFIRM
188
- → S_RECORD WHEN confirmed AND skip_gen DO A_CONFIRM
189
- → S_FIX WHEN needs_rework DO A_CONFIRM
190
-
191
- S_GENERALIZE:
192
- → S_DISCOVER WHEN hits found DO A_GENERALIZE
193
- → S_RECORD WHEN no hits DO A_GENERALIZE
194
-
195
- S_DISCOVER → S_FIX : discovery finds fixable sibling, !skip_fix → cross_phase_loops++
196
- S_DISCOVER → S_REVIEW : discovery opens new review target, loops < max_loops → cross_phase_loops++
197
- S_DISCOVER → S_RECORD : triage complete AND remaining_actionable == 0
198
- S_DISCOVER → S_RECORD : loops >= max_loops → MUST log each unfixed item with specific reason (blanket "pre-existing" is forbidden)
199
-
200
- S_RECORD → END DO A_RECORD
87
+ S_INTAKE → S_INTAKE (resume/-c) | S_ARCHAEOLOGY (target resolved) | AskUserQuestion (no target)
88
+ S_REVIEWS_FIX (!skip_fix AND findings) | S_GENERALIZE (skip_fix/no findings, !skip_gen) | S_RECORD (both skip)
89
+ S_CONFIRM S_GENERALIZE (confirmed, !skip_gen) | S_RECORD (confirmed, skip_gen) | S_FIX (needs_rework)
90
+ S_GENERALIZE S_DISCOVER (hits) | S_RECORD (no hits)
91
+ S_DISCOVER → S_FIX (fixable sibling) | S_REVIEW (new target, loops < max) | S_RECORD (done or max_loops)
201
92
  </transitions>
202
93
 
203
94
  <actions>
204
95
 
205
96
  ### A_INTAKE
206
- Parse target + flags → file list. Create `SESSION_DIR`, derive `phase_goals[]` from flags.
207
- Search prior knowledge: `maestro search`, prior sessions, ARCHITECTURE.md.
208
- Write `session.json` + `understanding.md` §1. Display Goal Prompt (appendix).
209
-
210
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): INTAKE — 目标解析与上下文加载"`
97
+ Parse target + flags → file list. Create SESSION_DIR, derive phase_goals[]. Search prior knowledge. Write session.json + §1. Display Goal Prompt.
98
+ 📌 `"odyssey-review({slug}): INTAKE 目标解析与上下文加载"`
211
99
 
212
100
  ### A_ARCHAEOLOGY
213
- `git log --oneline -20 -- {target_files}` + `git blame` on key regions.
214
- CLI delegate `--role analyze --mode analysis` to review past changes.
215
- Append evidence.ndjson (phase: "archaeology"). Update `understanding.md` §2.
216
-
217
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): ARCHAEOLOGY — git 考古分析"`
101
+ `git log --oneline -20` + `git blame` on key regions. CLI delegate `--role analyze`. Append evidence (archaeology). Update §2.
102
+ 📌 `"odyssey-review({slug}): ARCHAEOLOGY git 考古分析"`
218
103
 
219
104
  ### A_EXPLORE
220
- CLI delegate `--role explore --mode analysis` — call chains, error gaps, similar patterns.
221
- Write `explore.json`, append evidence.ndjson (phase: "explore").
222
- Update `understanding.md` §3. Mark G2 done.
223
-
224
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): EXPLORE — 代码探索完成"`
105
+ CLI delegate `--role explore` — call chains, error gaps, similar patterns. Write explore.json. Update §3. Mark G2.
106
+ 📌 `"odyssey-review({slug}): EXPLORE 代码探索完成"`
225
107
 
226
108
  ### A_REVIEW
227
- Spawn N parallel Agents (one per dimension, default 4):
109
+ Spawn N parallel Agents (one per dimension):
110
+ - **Correctness**: logic errors, boundary conditions, null/undefined, race conditions
111
+ - **Security**: injection, XSS, CSRF, data exposure, auth bypass
112
+ - **Performance**: hot paths, N+1, memory leaks, unnecessary recomputation
113
+ - **Architecture**: layer violations, circular deps, interface contracts, SoC
228
114
 
229
- | Agent | Dimension | Focus |
230
- |-------|-----------|-------|
231
- | Correctness | correctness | Logic errors, boundary conditions, null/undefined, race conditions |
232
- | Security | security | Injection, XSS, CSRF, data exposure, auth bypass |
233
- | Performance | performance | Hot paths, N+1, memory leaks, unnecessary recomputation |
234
- | Architecture | architecture | Layer violations, circular deps, interface contracts, SoC |
235
-
236
- Each returns `[{title, severity, file, line, description, suggestion, cwe}]`.
237
- Merge → evidence.ndjson (phase: "review"). Write `session.json.review_result`.
238
- Update `understanding.md` §4 (findings by dimension + severity matrix). Mark G1 done.
239
-
240
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): REVIEW — 多维度审查完成"`
115
+ Each returns `[{title, severity, file, line, description, suggestion, cwe}]`. Merge → evidence (review). Write review_result + §4 (severity matrix). Mark G1.
116
+ 📌 `"odyssey-review({slug}): REVIEW — 多维度审查完成"`
241
117
 
242
118
  ### A_FIX
243
-
244
- **穷尽迭代修复** — 按 severity 递降逐轮修复,直到 `remaining_actionable == 0`。
245
-
246
- #### Fix Loop (severity tiers)
119
+ **穷尽迭代修复** — 按 severity 递降,直到 `remaining_actionable == 0`。
247
120
 
248
121
  ```
249
- fix_tiers = [critical, high, medium, low].filter(s => severity_order(s) >= severity_order(fix_threshold))
250
- for tier in fix_tiers:
251
- candidates = evidence.filter(phase=="review" AND severity==tier AND status!="fixed")
252
- if candidates.empty: continue
253
- for each candidate:
254
- read context (file:line ±20) → implement fix → append evidence (phase: "fix")
255
- run local re-review on modified area ("改进即标准"):
256
- new_findings in same region? → append to current tier, continue loop
257
- tier complete → auto-commit
122
+ for tier in [critical, high, medium, low].filter(>= threshold):
123
+ for each unfixed candidate: read ±20 → fix → evidence (fix)
124
+ re-review modified area ("改进即标准"): new append, continue (max 2/tier)
125
+ tier done → auto-commit
258
126
  ```
259
127
 
260
- **Re-review gate** ("改进即标准"): 每轮修复后,对修改区域执行轻量 re-review(同维度)。若发现新问题,追加到当前轮继续修复。单轮最多 re-review 2 次,防止无限循环。
261
-
262
- **Normal**: AskUserQuestion 确认每个 tier 的 candidates。**`-y`**: auto-fix all, record `deferred`.
263
-
264
- **Remaining check**: 所有 tiers 完成后,count unfixed findings within fix_threshold → 写入 `review_result.remaining_actionable`。
265
- - If > 0 → retry from tier 1 (NOT limited by max_loops — max_loops only limits cross-phase loops, not FIX-internal retries)
266
- - If remaining unchanged for 2 consecutive rounds (same findings stuck) → classify each stuck finding individually: record as decision (if meets Decision gate criteria) or issue (with fix suggestion)
267
- - ❌ Blanket "N remaining items are pre-existing" is forbidden — each item must have individual classification and reason
268
-
269
- 📌 **Auto-commit per tier**: `git add -A && git commit -m "odyssey-review({slug}): FIX-{tier} — {N}项修复"`
128
+ Normal: AskUserQuestion per tier. `-y`: auto-fix all.
129
+ Remaining > 0 → retry (no max_loops limit). Unchanged 2 rounds → classify each individually.
130
+ Blanket "pre-existing" forbidden.
131
+ 📌 per tier: `"odyssey-review({slug}): FIX-{tier} — {N}项修复"`
270
132
 
271
133
  ### A_CONFIRM
272
- Run tests covering modified files. CLI delegate fix review:
273
- ```
274
- maestro delegate "PURPOSE: Verify ALL fixes and confirm zero remaining improvements
275
- TASK: Verify fix correctness | Check regressions | Count remaining unfixed findings | Confirm zero-residual
276
- MODE: analysis
277
- CONTEXT: @{modified_files} | Findings: {all_findings_summary} | Diff: {git_diff}
278
- EXPECTED: JSON {verdict, findings_addressed, remaining_unfixed, regression_risk, new_findings_in_modified_area}
279
- CONSTRAINTS: Focus on correctness AND completeness — flag ANY remaining actionable improvement
280
- " --role review --mode analysis
281
- ```
282
- 以 `run_in_background: true` 执行 delegate,等待回调后继续(不中断 Odyssey 流程)。
283
-
284
- **Zero-residual gate:**
285
- - `remaining_unfixed == 0 AND new_findings == 0` → `confirmed`, mark G3 done
286
- - `remaining_unfixed > 0 OR new_findings > 0` → `needs_rework` → S_FIX(追加新发现)
287
- - Regression detected → `needs_rework` → S_FIX
288
-
289
- Write `session.json.confirmation` + update `review_result.remaining_actionable`.
290
- Update `understanding.md` §5.
291
-
292
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): CONFIRM — 零遗留验证"`
134
+ Run tests + CLI delegate zero-residual review (`--role review`).
135
+ - `remaining == 0 AND new == 0` → confirmed, mark G3
136
+ - Otherwise needs_rework S_FIX
137
+ Update confirmation + remaining_actionable + §5.
138
+ 📌 `"odyssey-review({slug}): CONFIRM — 零遗留验证"`
293
139
 
294
140
  ### A_GENERALIZE
295
- **Multi-layer pattern extraction** from findings (severity >= medium):
296
-
297
- | Layer | Method | Example |
298
- |-------|--------|---------|
299
- | Syntax | Regex → direct Grep | `eval(`, `innerHTML =` |
300
- | Semantic | Agent understands anti-pattern → scans | Missing error handling on async |
301
- | Structural | File/module structure similarity | Same base class missing override |
302
-
303
- Write `session.json.patterns[]`.
304
-
305
- **4-agent parallel scan** (single message):
306
- 1. **Syntax grep** — Grep syntax-layer signatures across project
307
- 2. **Semantic scan** — Check related modules for same anti-patterns
308
- 3. **Structural match** — Find structurally similar files, check for same issues
309
- 4. **Historical grep** — `git log -S "{pattern}"` for introduction/fix history
310
-
311
- **Cross-layer dedup**: Multi-layer hit → boost confidence. Single-layer → `needs_review`. Historical match on fixed code → `regression_risk`.
312
-
313
- **Iterative deepening** (conditional): High-density cluster (≥3 hits in same module) → targeted deep scan on that module. Max 1 round.
314
-
315
- **CLI validation** (optional): Delegate to validate true/false positives.
316
-
317
- Update `understanding.md` §6 (per-pattern summary, cross-layer matrix, risk heatmap).
318
- Write `session.json.generalization_stats`. Mark G4 done.
319
-
320
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): GENERALIZE — 泛化扫描完成"`
141
+ base A_GENERALIZE 执行。Pattern 来源: findings (severity >= medium)。Mark G4.
142
+ 📌 `"odyssey-review({slug}): GENERALIZE — 泛化扫描完成"`
321
143
 
322
144
  ### A_DISCOVER
323
- Classify each hit: `bug` / `risk` / `safe`.
324
- - `bug` + directly fixable → **fix immediately** (not just log an issue) back to S_FIX
325
- - `bug` + requires cross-module/architectural decision → create issue (with fix suggestion + impact analysis)
326
- - `risk` → evaluate if guard/validation can mitigate directly; if yes, fix it
327
- - `safe` → mark skip
328
-
329
- **Normal**: AskUserQuestion for routing ambiguity. **`-y`**: auto-fix what's fixable, create issue for rest.
330
- Append evidence (phase: discovery + decision). Update `understanding.md` §7. Mark G5 done.
331
-
332
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): DISCOVER — 发现分类完成"`
145
+ base A_DISCOVER 执行。Mark G5.
146
+ 📌 `"odyssey-review({slug}): DISCOVER 发现分类完成"`
333
147
 
334
148
  ### A_RECORD
335
- Finalize `understanding.md` §8: per-dimension summary, top findings with file:line, generalization results, open decisions.
336
- Write learnings to understanding.md §8: 按 Knowledge Persistence 表分类记录(临时),completion summary 列出建议的 `/spec-add` 命令。
337
- Pending decisions: **Normal** → AskUserQuestion. **`-y`** → skip, display deferred count.
338
- Goal audit: check all `phase_goals[*].completion_confirmed`. Mark G6 done.
149
+ Write learnings to §8 Knowledge Persistence 表分类。其余按 base A_RECORD。Mark G6.
339
150
 
340
- Completion summary:
341
151
  ```
342
152
  --- REVIEW-TEST-FIX ODYSSEY COMPLETE ---
343
- Target: {target}
344
- Dimensions: {dimensions_reviewed}
345
- Findings: {C}C {H}H {M}M {L}L
346
- Fix: {fixed} applied, confirmed={confirmed|skipped}
347
- Patterns: {extracted} ({by_layer} distribution)
348
- Scan hits: {total} ({cross_layer} cross-layer confirmed)
349
- Issues: {N} created
350
- Decisions: {N} resolved, {M} pending, {K} deferred
351
- Learnings: {N} spec entries
352
- Self-iter: {N} rounds across {M} stages
353
- Goals: {done}/{total} ({skipped} skipped)
153
+ Target: {target} Dimensions: {dims}
154
+ Findings: {C}C {H}H {M}M {L}L Fix: {fixed}, confirmed={yes|skip}
155
+ Patterns: {N} ({by_layer}) Scan hits: {total} ({cross} cross-layer)
156
+ Issues: {N} Decisions: {N}r/{M}p/{K}d Learnings: {N} Self-iter: {N}×{M}
157
+ Goals: {done}/{total} ({skipped} skipped)
354
158
  ---
355
159
  ```
356
-
357
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-review({slug}): RECORD — 会话总结与知识沉淀"`
160
+ 📌 `"odyssey-review({slug}): RECORD — 会话总结与知识沉淀"`
358
161
 
359
162
  </actions>
360
163
 
361
164
  <appendix>
362
165
 
363
- ### Goal Prompt Template
364
- **⚠️ 时机守卫:仅在 A_INTAKE 完成后显示一次(session 创建后、开始考古前)。A_RECORD 完成时禁止重新显示。**
365
-
166
+ ### Goal Prompt
366
167
  ```
367
- 📋 Review-Test-Fix Odyssey 会话已创建。可随时复制以下 /goal 设定终止条件(执行过程中输入即可):
168
+ 📋 Review-Test-Fix Odyssey 会话已创建。可随时复制以下 /goal
368
169
 
369
170
  /goal 完成以下目标:
370
171
  {for each G in phase_goals where status != "skipped":}
371
- - {G.id}: {G.goal} — 完成条件: {G.done_when}
172
+ - {G.id}: {G.goal} — {G.done_when}
372
173
  {end for}
373
- 穷尽迭代:直到 session.json 的 review_result.remaining_actionable == 0
374
- confirmation.verdict == "confirmed" 且 phase_goals_all_done == true 才停。
375
- 修复按 severity 逐轮迭代(critical→high→medium→low),每轮修复后 re-review 修改区域。
376
- 发现新问题追加到当前轮继续。遇到 phase=decision 的 pending 必须 AskUserQuestion。
377
- 不允许"只报告不处理",每个 finding 必须有 action(fix/issue/decision)。
174
+ 穷尽迭代:review_result.remaining_actionable == 0 且 confirmation == confirmed 且 phase_goals_all_done。
175
+ 修复按 severity 逐轮迭代,每轮 re-review 修改区域,新问题追加继续。
176
+ 每个 finding 必须有 action(fix/issue/decision),decision pending 必须 AskUserQuestion。
378
177
  ```
379
178
 
380
- 完成时仅输出 completion summary,不重复此提示。
381
-
382
- ### `-y` Auto-Confirm (6 decision points)
179
+ ### `-y` (7 decision points)
383
180
  | Decision Point | Normal | `-y` |
384
181
  |----------------|--------|------|
385
- | S_FIX tier candidates | AskUserQuestion per tier | auto-fix ALL tiers, `deferred` |
386
- | S_FIX re-review new findings | AskUserQuestion | auto-append and fix |
387
- | S_CONFIRM needs_rework | Display, proceed to S_FIX | auto proceed |
388
- | S_DISCOVER bug routing | AskUserQuestion | auto create issue, `deferred` |
182
+ | S_FIX tier candidates | AskUserQuestion | auto-fix, `deferred` |
183
+ | S_FIX re-review new | AskUserQuestion | auto-append |
184
+ | S_CONFIRM needs_rework | Display S_FIX | auto proceed |
185
+ | S_DISCOVER bug routing | AskUserQuestion | auto issue, `deferred` |
389
186
  | S_DISCOVER ambiguous | AskUserQuestion | all `deferred` |
390
- | S_RECORD pending decisions | AskUserQuestion | skip |
187
+ | S_RECORD decisions | AskUserQuestion | skip |
391
188
  | S_RECORD goal audit | AskUserQuestion | auto accept |
392
189
 
393
190
  </appendix>
394
-
395
191
  </state_machine>
396
192
 
397
193
  <error_codes>
@@ -399,38 +195,22 @@ Goals: {done}/{total} ({skipped} skipped)
399
195
  |------|----------|-----------|----------|
400
196
  | E001 | error | No target specified | Provide target |
401
197
  | E002 | error | Target path not found | Check path |
402
- | E003 | error | Resume but no session | Start new |
403
- | W001 | warning | No git history for target | Proceed |
198
+ | W001 | warning | No git history | Proceed |
404
199
  | W002 | warning | Some dimension agents failed | Partial coverage |
405
- | W003 | warning | Generalization 0 hits | Skip discovery |
406
- | W004 | warning | Delegate parse failed | Raw output |
407
200
  </error_codes>
408
201
 
409
202
  <success_criteria>
410
- - [ ] Target resolved and session created
411
- - [ ] Git archaeology on target files
412
- - [ ] CLI exploration executed, explore.json written
413
- - [ ] All dimensions reviewed with structured findings
414
- - [ ] Severity matrix produced
415
- - [ ] **ALL findings within fix_threshold fixed** — remaining_actionable == 0 (unless --skip-fix)
416
- - [ ] Per-tier fix with re-review gate: modified area re-reviewed, new findings appended
417
- - [ ] Zero-residual confirmed by CLI external model
418
- - [ ] **Every unfixed finding has individual classification and reason** — blanket "pre-existing" labels are forbidden
419
- - [ ] Pattern generalized with multi-layer scan + deepening (unless --skip-generalize)
420
- - [ ] Quality Gate self-iteration triggered when insufficient
421
- - [ ] Discoveries classified and routed
422
- - [ ] understanding.md §8 finalized
423
- - [ ] phase_goals G1-G6 tracked and audited (G3 = zero remaining)
424
- - [ ] Goal Prompt displayed once
425
- - [ ] `-y`: no blocking prompts, deferred counted
426
- - [ ] Session resumable via -c
203
+ - [ ] All dimensions reviewed, ALL findings fixed (remaining_actionable == 0), zero-residual confirmed
204
+ - [ ] Per-tier re-review gate; every unfixed finding individually classified
205
+ - [ ] Generalized with multi-layer scan (unless --skip-generalize); self-iteration on insufficient
206
+ - [ ] understanding.md §1-§8, phase_goals G1-G6 audited, Goal Prompt once, `-y` no blocking, -c resumable
427
207
  </success_criteria>
428
208
 
429
209
  <next_step_routing>
430
210
  | Condition | Next step |
431
211
  |-----------|-----------|
432
- | Finding needs deeper debug | `/odyssey-debug "<finding>"` |
212
+ | Deeper debug needed | `/odyssey-debug "<finding>"` |
433
213
  | Issues created | `/manage-issue list --source review-odyssey` |
434
214
  | Pattern to document | `/learn-decompose <module>` |
435
- | Plan fixes for findings | `/maestro-plan --gaps` |
215
+ | Plan fixes | `/maestro-plan --gaps` |
436
216
  </next_step_routing>