maestro-flow 0.5.40 → 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 (41) 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/skills/odyssey-debug/SKILL.md +114 -169
  17. package/.codex/skills/odyssey-improve/SKILL.md +144 -188
  18. package/.codex/skills/odyssey-planex/SKILL.md +162 -242
  19. package/.codex/skills/odyssey-review-test-fix/SKILL.md +96 -90
  20. package/.codex/skills/odyssey-ui/SKILL.md +128 -173
  21. package/dashboard/dist-server/src/tools/spec-loader.js +27 -19
  22. package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
  23. package/dashboard/dist-server/src/tools/spec-seeds.d.ts +8 -0
  24. package/dashboard/dist-server/src/tools/spec-seeds.js +114 -0
  25. package/dashboard/dist-server/src/tools/spec-seeds.js.map +1 -1
  26. package/dist/src/commands/spec.d.ts.map +1 -1
  27. package/dist/src/commands/spec.js +13 -3
  28. package/dist/src/commands/spec.js.map +1 -1
  29. package/dist/src/tools/spec-init.d.ts +4 -3
  30. package/dist/src/tools/spec-init.d.ts.map +1 -1
  31. package/dist/src/tools/spec-init.js +9 -5
  32. package/dist/src/tools/spec-init.js.map +1 -1
  33. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  34. package/dist/src/tools/spec-loader.js +27 -19
  35. package/dist/src/tools/spec-loader.js.map +1 -1
  36. package/dist/src/tools/spec-seeds.d.ts +8 -0
  37. package/dist/src/tools/spec-seeds.d.ts.map +1 -1
  38. package/dist/src/tools/spec-seeds.js +114 -0
  39. package/dist/src/tools/spec-seeds.js.map +1 -1
  40. package/package.json +1 -1
  41. package/workflows/odyssey-base-codex.md +306 -0
@@ -4,33 +4,21 @@ description: "Long-running codebase improvement cycle — multi-dimensional audi
4
4
  argument-hint: '"<target>" [--dimensions <list>] [--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
- Deep codebase improvement: survey → 6-dimension audit → diagnose → fix → verify → generalize → discover → persist.
11
- Baseline-first approach with exhaustive iteration until zero remaining actionable findings.
12
-
13
- Core philosophy:
14
- - **Measure before improving** — baseline first, then optimize
15
- - **Root cause over symptom** — trace each issue to its origin
16
- - **Fix one, improve many** — every improvement reveals a class of opportunities
17
- - **Verify improvement** — measure after fix, compare with baseline
18
-
19
- **三句哲学约束(穷尽迭代):**
20
- 1. **零遗留** — 每个 finding 必须是 action item(修复 / issue / 决策),不允许只报告不处理
21
- 2. **穷尽迭代** — 按 severity 从高到低逐轮修复,直到 0 remaining actionable findings 才退出 fix loop
22
- 3. **改进即标准** — 每次修复后重审同区域,发现新问题继续修,直到该区域无可改善
10
+ survey → 6-dimension audit → diagnose → fix → verify → generalize → discover → persist.
11
+ Baseline-first, exhaustive iteration until zero remaining actionable findings.
23
12
  </purpose>
24
13
 
25
14
  <boundary>
26
- **范围内:** 目标代码的运行质量提升性能/安全/架构/可靠性/可观测性/可维护性多维度审查诊断修复泛化
27
- **范围外:** UI 视觉优化 → `$odyssey-ui` | 新功能实现 → `$odyssey-planex` | 单一 bug 调查 → `$odyssey-debug` | 代码风格审查 → `$odyssey-review-test-fix`
28
- **探索自由度:** 边界内自由探索 profiling、安全扫描、架构分析、依赖审计。在约束下尽可能发现深层问题。
29
- **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.
15
+ **In scope:** Target code quality performance/security/architecture/reliability/observability/maintainability audit diagnosefixgeneralize.
16
+ **Out of scope:** UI → `$odyssey-ui` | Features → `$odyssey-planex` | Single bug → `$odyssey-debug` | Style review → `$odyssey-review-test-fix`
17
+ **Zero-residual:** Every finding MUST have action (fix/issue/decision). "Report and shelve" is forbidden.
30
18
  </boundary>
31
19
 
32
20
  <context>
33
- $ARGUMENTS — target and optional flags.
21
+ $ARGUMENTS
34
22
 
35
23
  **Target resolution:**
36
24
  | Input | Resolution |
@@ -38,19 +26,9 @@ $ARGUMENTS — target and optional flags.
38
26
  | Module/dir path | Audit that module |
39
27
  | `HEAD` / `staged` | Review changes in diff |
40
28
  | Feature area keyword | Resolve to related files |
41
- | `--all` | Full project scan (use with caution) |
42
-
43
- **Flags:**
44
- | Flag | Effect | Default |
45
- |------|--------|---------|
46
- | `--dimensions <list>` | Comma-separated subset of 6 dimensions | all 6 |
47
- | `--fix-threshold <severity>` | 修复到哪个 severity 为止(all = 全部修复)| all |
48
- | `--skip-fix` | Audit + diagnose only, no code changes | false |
49
- | `--skip-generalize` | Skip S_GENERALIZE and S_DISCOVER | false |
50
- | `--auto` | CLI delegates without confirmation | false |
51
- | `-y` | Auto-confirm all decisions (see appendix) | false |
52
- | `-c` | Resume most recent session | — |
53
- | `--heartbeat` | Enable /loop heartbeat protocol (see base) | false |
29
+ | `--all` | Full project scan |
30
+
31
+ **Flags:** `--dimensions <list>` subset of 6 | `--fix-threshold <severity>` fix cutoff (default: all) | `--skip-fix` audit+diagnose only | `--skip-generalize` skip generalize+discover | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
54
32
 
55
33
  **Dimensions (6):**
56
34
  1. **performance** — hot paths, N+1 queries, memory allocation, cache efficiency, bundle size, lazy loading
@@ -58,21 +36,25 @@ $ARGUMENTS — target and optional flags.
58
36
  3. **architecture** — layer violations, circular dependencies, coupling metrics, interface contracts, SRP violations
59
37
  4. **reliability** — error handling gaps, retry logic, timeout handling, graceful degradation, resource cleanup
60
38
  5. **observability** — logging coverage, metric gaps, trace propagation, error reporting, health checks
61
- 6. **maintainability** — code complexity (cyclomatic), dead code, test coverage gaps, documentation debt
62
-
63
- **Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
39
+ 6. **maintainability** — code complexity, dead code, test coverage gaps, documentation debt
64
40
 
65
- **Output:** `session.json` (state + audit + diagnoses + patterns + goals) | `evidence.ndjson` (append-only) | `understanding.md` (9-section narrative)
41
+ **Session**: `.workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
42
+ **Output**: `session.json` | `evidence.ndjson` | `understanding.md`
66
43
 
67
- **session.json unique fields:** `target`, `dimensions`, `baseline_metrics`, `audit_result`, `diagnoses`, `confirmation`, `generalization_stats` (`progress_metrics`, `directions_tried` from base)
44
+ **session.json improve-specific fields:**
45
+ ```json
46
+ { "target": "", "dimensions": [], "baseline_metrics": {},
47
+ "audit_result": null, "diagnoses": [], "confirmation": null,
48
+ "generalization_stats": null }
49
+ ```
68
50
 
69
- **evidence.ndjson phase-specific fields:**
51
+ **evidence.ndjson phases:**
70
52
  - `survey`: `category` (dependency|complexity|coverage|error_pattern), `detail`
71
53
  - `audit`: `dimension`, `severity`, `measurement`
72
54
  - `diagnosis`: `finding_ref`, `hypothesis`, `result` (confirmed|disproved|inconclusive), `root_cause`
73
55
  - `fix`: `finding_ref`, `change_summary`, `risk`
74
56
  - `discovery`: `file`, `line`, `classification` (safe|risk|issue), `action` (fix|issue|decision|skip)
75
- - `decision`: `question`, `options`, `context`, `status` (pending|resolved|deferred), `resolution`
57
+ - `decision`: `question`, `options`, `context`, `status`, `resolution`
76
58
  - `self-iteration`: `stage`, `round`, `assessment`, `expansion`
77
59
 
78
60
  **phase_goals[]:**
@@ -81,32 +63,25 @@ $ARGUMENTS — target and optional flags.
81
63
  | G1 | Survey completed | S_SURVEY | — |
82
64
  | G2 | Audit completed | S_AUDIT | — |
83
65
  | G3 | Diagnosis completed | S_DIAGNOSE | — |
84
- | G4 | Zero remaining: all findings fixed and verified | `remaining_actionable == 0` within fix_threshold | S_VERIFY | skip_fix |
66
+ | G4 | Zero remaining: all findings fixed and verified | S_VERIFY | skip_fix |
85
67
  | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
86
68
  | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
87
69
  | G7 | Learnings persisted | S_RECORD | — |
88
70
 
89
- **understanding.md — 9 sections (written by owning phase):**
71
+ **understanding.md — 9 sections:**
90
72
  1. Target & Baseline ← S_INTAKE | 2. Current State Survey ← S_SURVEY | 3. Audit Findings ← S_AUDIT
91
73
  4. Root Cause Diagnosis ← S_DIAGNOSE | 5. Fix & Verification ← S_FIX+S_VERIFY
92
74
  6. Generalization ← S_GENERALIZE | 7. Discoveries ← S_DISCOVER
93
- 8. Improvement Metrics ← S_RECORD (before/after) | 9. Engineering Learnings ← S_RECORD
75
+ 8. Improvement Metrics ← S_RECORD | 9. Engineering Learnings ← S_RECORD
94
76
 
95
- ### Pre-load(可选,缺失不阻塞)
96
- - ARCHITECTURE.md → 模块边界 | `maestro search "<target>" --json` → 先前优化(top 5)
97
- - `maestro load --type spec --category coding` + `--category debug` → 编码规范 + 已知模式
98
- - `maestro search --category coding` → knowhow | `Glob(".workflow/scratch/*-improve-odyssey-*")` → 先前会话
77
+ **Knowledge Persistence categories (written to understanding.md section 9):**
99
78
 
100
- ### Knowledge Persistence(S_RECORD 中写入产出文件)
101
-
102
- S_RECORD 阶段将可沉淀知识 **写入 understanding.md §9 Learnings**,按以下分类结构化:
103
-
104
- | 分类 | 写入内容 | 后续建议命令 |
105
- |------|---------|-------------|
106
- | 性能 pattern | 瓶颈类型 + 修复方案 + 度量方法 | `/spec-add coding "..."` |
107
- | 安全规则 | 漏洞类别 + 修复 + 预防方法 | `/spec-add debug "..."` |
108
- | 架构约束 | 违反描述 + 正确边界 + 检查方法 | `/spec-add arch "..."` |
109
- | 可靠性 pattern | 故障模式 + 处理策略 + 验证手段 | `/spec-add coding "..."` |
79
+ | Category | Content | Follow-up |
80
+ |----------|---------|-----------|
81
+ | Performance pattern | Bottleneck type + fix + measurement | `/spec-add coding` |
82
+ | Security rule | Vulnerability class + fix + prevention | `/spec-add debug` |
83
+ | Architecture constraint | Violation + correct boundary + verification | `/spec-add arch` |
84
+ | Reliability pattern | Failure mode + handling strategy + validation | `/spec-add coding` |
110
85
  </context>
111
86
 
112
87
  <csv_schema>
@@ -141,76 +116,68 @@ id,title,description,task_type,dimension,deps,wave,status,findings,evidence,erro
141
116
  | 3 | Generalization (syntax-grep, semantic-scan, structural-match, historical-grep) | 4 agents |
142
117
  </csv_schema>
143
118
 
144
- Self-iteration 适用阶段: S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE
119
+ <invariants>
120
+ Base invariants apply. Additional: baseline metrics captured before any fix; every fix re-verified against baseline.
121
+ </invariants>
122
+
123
+ <self_iteration>
124
+ Applies to: **S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE**. Logic in base.
125
+ </self_iteration>
145
126
 
146
127
  <state_machine>
147
128
 
148
129
  <states>
149
- S_INTAKE Parse target, load context, establish baseline metrics PERSIST: session.json + understanding.md §1
150
- S_SURVEY — Current state: dependency audit, complexity scan, coverage PERSIST: evidence.ndjson (survey) + understanding.md §2
151
- S_AUDIT — 6-dimension parallel deep audit PERSIST: evidence.ndjson (audit) + understanding.md §3
152
- S_DIAGNOSE — Root cause analysis for critical/high findings PERSIST: evidence.ndjson (diagnosis|decision) + understanding.md §4
153
- S_FIX — Implement improvements (skip if --skip-fix) PERSIST: code changes + evidence.ndjson (fix)
154
- S_VERIFY — Tests + measurement comparison (skip if --skip-fix) PERSIST: session.json.confirmation + understanding.md §5
155
- S_GENERALIZE — Pattern extraction + 4-agent scan (skip if --skip-gen) PERSIST: session.json.patterns + understanding.md §6
156
- S_DISCOVER — Classify hits, create issues (skip if --skip-gen) PERSIST: evidence.ndjson (discovery|decision) + understanding.md §7
157
- S_RECORD — Persist metrics + learnings + final report PERSIST: understanding.md §8-9 + spec entries
130
+ S_INTAKE S_SURVEY S_AUDIT S_DIAGNOSE S_FIX S_VERIFY → S_GENERALIZE → S_DISCOVER → S_RECORD → END
158
131
  </states>
159
132
 
160
133
  <transitions>
161
- S_INTAKE:
162
- S_INTAKE WHEN -c + session found DO A_RESUME
163
- S_SURVEY WHEN target resolved DO A_INTAKE
164
- → S_INTAKE WHEN no target DO request_user_input
165
-
166
- S_SURVEY → S_AUDIT DO A_SURVEY
167
-
168
- S_AUDIT:
169
- S_DIAGNOSE WHEN critical/high findings exist DO A_AUDIT
170
- → S_GENERALIZE WHEN no critical/high AND !skip_gen DO A_AUDIT
171
- S_RECORD WHEN no findings OR skip_gen DO A_AUDIT
172
-
173
- S_DIAGNOSE:
174
- S_FIX WHEN root causes identified AND !skip_fix DO A_DIAGNOSE
175
- S_GENERALIZE WHEN root causes identified AND skip_fix AND !skip_gen DO A_DIAGNOSE
176
- → S_RECORD WHEN root causes identified AND skip_fix AND skip_gen DO A_DIAGNOSE
177
- S_DIAGNOSE WHEN hypotheses failed AND retries < 3 DO A_ESCALATE_DIAGNOSIS
178
- → S_RECORD WHEN hypotheses failed AND retries >= 3 DO mark INCONCLUSIVE
179
-
180
- S_FIX S_VERIFY DO A_FIX
181
-
182
- S_VERIFY:
183
- S_GENERALIZE WHEN verified AND !skip_gen DO A_VERIFY
184
- → S_RECORD WHEN verified AND skip_gen DO A_VERIFY
185
- → S_FIX WHEN needs_rework DO A_VERIFY
186
-
187
- S_GENERALIZE:
188
- S_DISCOVER WHEN hits found DO A_GENERALIZE
189
- → S_RECORD WHEN no hits DO A_GENERALIZE
190
-
191
- S_DISCOVER S_DIAGNOSE : new critical issue found → cross_phase_loops++
192
- S_DISCOVER → S_FIX : same-pattern fix, !skip_fix → cross_phase_loops++
193
- S_DISCOVER → S_RECORD : triage complete AND remaining_actionable == 0
194
- S_DISCOVER → S_RECORD : loops >= max_loops → MUST log each unfixed item with specific reason (blanket "pre-existing" is forbidden)
195
-
196
- S_RECORD → END DO A_RECORD
134
+ S_INTAKE → S_INTAKE : -c + session found → A_RESUME
135
+ S_INTAKE S_SURVEY : target resolved A_INTAKE
136
+ S_INTAKE S_INTAKE : no target request_user_input
137
+
138
+ S_SURVEY → S_AUDIT : complete
139
+
140
+ S_AUDIT → S_DIAGNOSE : critical/high findings exist
141
+ S_AUDIT → S_GENERALIZE : no critical/high, !skip_generalize
142
+ S_AUDIT S_RECORD : no findings OR skip_generalize
143
+
144
+ S_DIAGNOSE S_FIX : root causes identified, !skip_fix
145
+ S_DIAGNOSE → S_GENERALIZE : root causes identified, skip_fix, !skip_generalize
146
+ S_DIAGNOSE → S_RECORD : root causes identified, skip_fix, skip_generalize
147
+ S_DIAGNOSE S_DIAGNOSE : hypotheses failed, retries < 3 → A_ESCALATE_DIAGNOSIS
148
+ S_DIAGNOSE S_RECORD : retries >= 3 INCONCLUSIVE
149
+
150
+ S_FIX S_VERIFY : fix implemented
151
+
152
+ S_VERIFY → S_GENERALIZE : verified, !skip_generalize
153
+ S_VERIFY S_RECORD : verified, skip_generalize
154
+ S_VERIFY → S_FIX : needs_rework
155
+
156
+ S_GENERALIZE S_DISCOVER : hits found
157
+ S_GENERALIZE → S_RECORD : no hits
158
+
159
+ S_DISCOVER → S_DIAGNOSE : new critical issue → cross_phase_loops++
160
+ S_DISCOVER → S_FIX : same-pattern fix, !skip_fix → cross_phase_loops++
161
+ S_DISCOVER S_RECORD : remaining_actionable == 0
162
+ S_DISCOVER → S_RECORD : loops >= max_loops → log per-item reasons
163
+
164
+ S_RECORD END : complete
197
165
  </transitions>
198
166
 
199
167
  <actions>
200
168
 
201
169
  ### A_INTAKE
202
- 1. Parse arguments: target description, flags, `--dimensions` subset
203
- 2. Generate slug, create `SESSION_DIR`
204
- 3. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load coding/debug
170
+ 1. Parse arguments: target, flags, `--dimensions` subset
171
+ 2. Generate slug, create SESSION_DIR
172
+ 3. `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load coding/debug
205
173
  4. **Baseline capture**: Record current metrics (test pass rate, bundle size, dependency count, complexity hotspots) to `session.json.baseline_metrics`
206
- 5. Derive `phase_goals[]` from flags (apply `skip_when`)
207
- 6. Write `session.json` + `understanding.md` §1 (Target & Baseline)
208
- 7. Emit Goal Prompt (see Appendix)
174
+ 5. Derive `phase_goals[]` from flags
175
+ 6. Write `session.json` + `understanding.md` section 1, emit Goal Prompt
209
176
 
210
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): INTAKE — 目标解析与基线采集"`
177
+ Commit: `"odyssey-improve({slug}): INTAKE — target parsed and baseline captured"`
211
178
 
212
179
  ### A_RESUME
213
- Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
180
+ Glob latest session → read `session.json` → jump to `current_state`.
214
181
 
215
182
  ### A_SURVEY
216
183
  **spawn_agents_on_csv (Wave 1):**
@@ -222,9 +189,9 @@ Write `tasks.csv` with Wave 1 rows:
222
189
  ```
223
190
  `spawn_agents_on_csv({ csv_path:"tasks.csv", max_concurrency:2, max_runtime_seconds:300, output_csv_path:"wave-1-results.csv", output_schema:SHARED_OUTPUT_SCHEMA })`
224
191
 
225
- Merge → evidence.ndjson (phase: "survey"). Extract `baseline_metrics` from survey results. Update `understanding.md` §2. Mark G1 done.
192
+ Merge → evidence.ndjson (phase: "survey"). Extract `baseline_metrics`. Update section 2. Mark G1.
226
193
 
227
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): SURVEY — 现状调查"`
194
+ Commit: `"odyssey-improve({slug}): SURVEY — current state survey"`
228
195
 
229
196
  ### A_AUDIT
230
197
  **spawn_agents_on_csv (Wave 2)** — 6 agents (one per dimension, or `--dimensions` subset):
@@ -240,57 +207,45 @@ Append Wave 2 rows to `tasks.csv`:
240
207
  ```
241
208
  `spawn_agents_on_csv({ csv_path:"tasks.csv", max_concurrency:6, max_runtime_seconds:600, output_csv_path:"wave-2-results.csv", output_schema:SHARED_OUTPUT_SCHEMA })`
242
209
 
243
- Merge → evidence.ndjson (phase: "audit"). Write `session.json.audit_result` with dimensions audited, finding count, severity distribution.
244
- Update `understanding.md` §3 (findings by dimension + severity matrix). Mark G2 done.
210
+ Merge → evidence.ndjson (phase: "audit"). Write `session.json.audit_result` with dimensions, finding count, severity distribution.
211
+ Update section 3. Mark G2.
245
212
 
246
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): AUDIT — 多维审查"`
213
+ Commit: `"odyssey-improve({slug}): AUDIT — multi-dimensional audit"`
247
214
 
248
215
  ### A_DIAGNOSE
249
- Root cause analysis for critical/high findings — don't fix symptoms.
216
+ Root cause analysis for critical/high findings.
250
217
 
251
- 1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence.ndjson (phase: "diagnosis")
252
- 2. **Decision journal**: ambiguity → evidence (phase: "decision"); Normal: request_user_input | `-y`: defer
253
- 3. **CLI-assisted** for complex findings: `maestro delegate --role analyze --mode analysis` to trace code path, check systemic pattern, identify fix approach. Execute `run_in_background: true`.
254
- 4. Write `session.json.diagnoses[]`. Update `understanding.md` §4. Mark G3 done.
218
+ 1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence (phase: "diagnosis")
219
+ 2. Ambiguity → evidence (phase: "decision"); Normal: request_user_input | `-y`: defer
220
+ 3. Complex findings: `maestro delegate --role analyze --mode analysis` (`run_in_background: true`)
221
+ 4. Write `session.json.diagnoses[]`. Update section 4. Mark G3.
255
222
 
256
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): DIAGNOSE — 根因诊断"`
223
+ Commit: `"odyssey-improve({slug}): DIAGNOSE — root cause analysis"`
257
224
 
258
225
  ### A_ESCALATE_DIAGNOSIS
259
- Increment retries. If < 3: broaden scope via `maestro delegate --role analyze`, form new hypotheses, return to S_DIAGNOSE. If >= 3: Normal → request_user_input (broaden/new/INCONCLUSIVE) | `-y` → auto INCONCLUSIVE, proceed to S_RECORD.
226
+ `retries++`. < 3: `maestro delegate --role analyze`, new hypotheses, S_DIAGNOSE. >= 3: Normal → request_user_input | `-y` → INCONCLUSIVE S_RECORD.
260
227
 
261
228
  ### A_FIX
262
- Skip if `--skip-fix`. Implement improvements for diagnosed root causes.
229
+ Fix ALL diagnosed issues by severity tier (critical → high → medium → low within fix_threshold), one dimension at a time. After each tier, re-verify modified area new findings append to current tier.
263
230
 
264
- 1. **穷尽修复**: Fix ALL diagnosed issues by severity tier (critical → high → medium → low within fix_threshold), one dimension at a time. After each tier, re-verify modified area new findings append to current tier.
265
- 2. For each fix: implement → record evidence.ndjson (phase: "fix")
266
- 3. **Normal**: request_user_input per-fix confirmation. **`-y`**: auto-proceed, record `deferred`.
231
+ For each fix: implement evidence (phase: "fix"). Normal: request_user_input per-fix confirmation | `-y`: auto-proceed.
267
232
 
268
- 📌 **Auto-commit**: `git add -A && git commit -m "odyssey-improve({slug}): FIX — 改进实现"`
233
+ Commit: `"odyssey-improve({slug}): FIX — improvements implemented"`
269
234
 
270
235
  ### A_VERIFY
271
236
  1. Run tests covering modified areas
272
237
  2. Re-capture metrics, compare with `session.json.baseline_metrics`
273
- 3. **CLI-assisted**: `maestro delegate --role review --mode analysis` to check fix correctness, test regressions, measure impact vs baseline. Execute `run_in_background: true`.
274
- 4. `needs_rework` → S_FIX. `verified` → mark G4 done, advance.
275
- 5. Write `session.json.confirmation`. Update `understanding.md` §5 (before/after metrics table).
238
+ 3. `maestro delegate --role review --mode analysis` (`run_in_background: true`) — check fix correctness, regressions, impact vs baseline
239
+ 4. `needs_rework` → S_FIX. `verified` → mark G4.
240
+ 5. Write `session.json.confirmation`. Update section 5.
276
241
 
277
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): VERIFY — 改进验证"`
242
+ Commit: `"odyssey-improve({slug}): VERIFY — improvements verified"`
278
243
 
279
244
  ### A_GENERALIZE
280
- Skip if `--skip-generalize`. Pattern 来源: diagnoses + fixes。
245
+ Base shared_actions. Improve overrides:
246
+ - Pattern source: diagnoses + fixes
281
247
 
282
- **Step 1Multi-layer pattern extraction:**
283
-
284
- | Layer | Method | Example |
285
- |-------|--------|---------|
286
- | Syntax | Regex patterns (direct Grep) | Missing `await`, unclosed resources, `catch {}` empty |
287
- | Semantic | Agent anti-pattern scan | Unvalidated input, missing error boundary, no timeout |
288
- | Structural | Architecture-level similarity | Same import structure, identical anti-pattern |
289
- | Historical | Git log for pattern introduction | When pattern was introduced, if ever fixed |
290
-
291
- Write `session.json.patterns[]`: `[{id, source_diagnosis, layer, signature, description, risk, fix_template}]`
292
-
293
- **Step 2 — 4-agent scan (spawn_agents_on_csv, Wave 3):**
248
+ **Wave 3spawn_agents_on_csv (4 agents):**
294
249
 
295
250
  Append Wave 3 rows to `tasks.csv`:
296
251
  ```csv
@@ -301,55 +256,56 @@ Append Wave 3 rows to `tasks.csv`:
301
256
  ```
302
257
  `spawn_agents_on_csv({ csv_path:"tasks.csv", max_concurrency:4, max_runtime_seconds:300, output_csv_path:"wave-3-results.csv", output_schema:SHARED_OUTPUT_SCHEMA })`
303
258
 
304
- **Step 3 Cross-layer dedup**: same file:line multi-layer → boost confidence | single-layer → `needs_review` | historical fixed → `regression_risk`
305
-
306
- **Step 4 — Iterative deepening**: module ≥3 hits → targeted deep scan (max 1 round).
307
-
308
- **Step 5 — Quality Gate** (self-iteration).
309
-
310
- **Step 6:** Write `generalization_stats`: `{patterns_extracted, total_hits, cross_layer_confirmed, regression_risks, by_layer, deepening_triggered}`. Update §6. Mark G5 done.
311
-
312
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): GENERALIZE — 泛化扫描"`
313
-
314
- ### A_DISCOVER
315
- 按 base A_DISCOVER 执行。Mark G6 done.
259
+ Update section 6. Mark G5.
316
260
 
317
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): DISCOVER发现分类"`
261
+ Commit: `"odyssey-improve({slug}): GENERALIZEpattern scan"`
318
262
 
319
- ### A_RECORD
320
- 1. **understanding.md §8**: Improvement metrics — before/after comparison table from baseline_metrics vs current
321
- 2. **understanding.md §9**: Engineering learnings Knowledge Persistence 表分类记录(临时),completion summary 列出建议的 `/spec-add` 命令
322
- 3. Mark G7 done. Pending decisions: **Normal** request_user_input. **`-y`** skip, show deferred count.
323
- 4. 其余按 base A_RECORD 执行。
324
- 5. `current_state = "COMPLETED"`. Emit completion summary: Target, Dimensions, Findings (C/H/M/L), Diagnosed count, Fix count + verified, Metrics (improved/regressed), Patterns (count + layer distribution), Scan hits (cross-layer), Issues created, Decisions (resolved/pending/deferred), Learnings count, Self-iter rounds, Cross-loops used, Goals (done/total/skipped).
263
+ ### A_DISCOVER, A_RECORD
264
+ Base shared_actions. Improve overrides:
265
+ - **A_RECORD** section 8: before/after comparison table from baseline_metrics vs current measurements
266
+ - **A_RECORD** section 9: learnings per Knowledge Persistence table
325
267
 
326
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): RECORD — 指标总结与知识沉淀"`
268
+ **Completion summary:**
269
+ ```
270
+ --- IMPROVE ODYSSEY COMPLETE ---
271
+ Target: {target}
272
+ Dimensions: {dimensions}
273
+ Findings: {critical}/{high}/{medium}/{low}
274
+ Diagnosed: {count}
275
+ Fixed: {count} verified
276
+ Metrics: {improved}/{regressed}
277
+ Patterns: {count} ({by_layer})
278
+ Scan hits: {total} ({cross_layer} confirmed)
279
+ Issues: {N} created
280
+ Decisions: {N} resolved, {M} pending, {K} deferred
281
+ Learnings: {N} persisted
282
+ Self-iter: {N} rounds across {M} stages
283
+ Cross-loops:{N} used
284
+ Goals: {done}/{total} ({skipped} skipped)
285
+ ---
286
+ ```
327
287
 
328
288
  </actions>
329
289
 
330
290
  <appendix>
331
291
 
332
- ### Goal Prompt Template
333
- **⚠️ 仅在 A_INTAKE 完成后显示一次,A_RECORD 完成时不重复。**
334
-
335
- 列出所有非 skipped 的 phase_goals,附加收敛规则:
336
- - 穷尽迭代至所有 findings 已处理(fix/issue/decision)且 `phase_goals_all_done=true`
337
- - 修复按 severity 逐轮迭代,每轮 re-verify
338
- - Baseline 修复前采集,修复后对比确认改进
339
- - pending decision 必须 request_user_input,不允许"只报告不处理"
292
+ ### `-y` improve-specific points
340
293
 
341
- ### `-y` Auto-Confirm Behavior
342
294
  | Decision Point | Normal | `-y` |
343
295
  |---------------|--------|------|
344
- | A_FIX improvement confirmation | request_user_input | auto-proceed, `deferred` |
345
- | A_DIAGNOSE ambiguity | request_user_input | best-effort, `deferred` |
346
- | A_ESCALATE 3-strike | request_user_input 3-way | auto INCONCLUSIVE |
347
- | A_DISCOVER hit routing | request_user_input | auto create issue, `deferred` |
348
- | A_DISCOVER ambiguous items | request_user_input | all `deferred` |
349
- | A_RECORD pending decisions | request_user_input | skip, show deferred count |
350
- | A_RECORD goal audit | request_user_input | auto accept |
296
+ | A_FIX improvement confirmation | request_user_input | auto-proceed, deferred |
297
+ | A_DIAGNOSE ambiguity | request_user_input | best-effort, deferred |
298
+ | A_ESCALATE 3-strike | request_user_input | INCONCLUSIVE |
351
299
 
352
- `deferred` items shown as "待决策" in completion summary; recoverable via `-c`.
300
+ ### Goal Prompt convergence rules
301
+
302
+ ```
303
+ Exhaust all findings (fix/issue/decision) until remaining_actionable == 0
304
+ and phase_goals_all_done=true.
305
+ Fix by severity tier with re-verify per tier.
306
+ Baseline captured before fix, compared after to confirm improvement.
307
+ Pending decisions must request_user_input — no report-only.
308
+ ```
353
309
 
354
310
  </appendix>
355
311
 
@@ -366,24 +322,24 @@ Append Wave 3 rows to `tasks.csv`:
366
322
 
367
323
  <success_criteria>
368
324
  - [ ] Target resolved, baseline metrics captured
369
- - [ ] Survey + 6-dimension audit with structured findings and severity matrix
325
+ - [ ] Survey + 6-dimension audit with severity matrix
370
326
  - [ ] Root causes diagnosed for critical/high findings
371
327
  - [ ] Improvements implemented and verified with before/after metrics (unless --skip-fix)
372
328
  - [ ] Multi-layer generalization + cross-phase loops (unless --skip-generalize)
373
- - [ ] Every unfixed finding has individual classification and reason
374
- - [ ] understanding.md §8 (metrics) and §9 (learnings) completed
329
+ - [ ] Every unfixed finding individually classified with reason
330
+ - [ ] understanding.md sections 8-9 completed
375
331
  - [ ] phase_goals G1-G7 tracked and audited
376
332
  - [ ] Session resumable via -c
377
333
  </success_criteria>
378
334
 
379
335
  <next_step_routing>
380
- | Condition | Next step |
381
- |-----------|-----------|
336
+ | Condition | Next |
337
+ |-----------|------|
382
338
  | Security findings need deep investigation | `$odyssey-debug "<finding>"` |
383
339
  | UI-related findings | `$odyssey-ui "<component>"` |
384
340
  | Issues created from discoveries | `/manage-issue list --source improve-odyssey` |
385
341
  | Architecture pattern to document | `/spec-add arch "..."` |
386
342
  | Performance pattern to persist | `/spec-add coding "..."` |
387
- | Want formal review of changes | `$odyssey-review-test-fix <changed-files>` |
388
- | Decisions still pending | Filter evidence.ndjson phase=decision status=pending |
343
+ | Formal review of changes | `$odyssey-review-test-fix <changed-files>` |
344
+ | Pending decisions | Filter evidence phase=decision status=pending |
389
345
  </next_step_routing>