maestro-flow 0.5.38 → 0.5.40

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