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
@@ -15,19 +15,19 @@ allowed-tools:
15
15
  <base>@~/.maestro/workflows/odyssey-base.md</base>
16
16
 
17
17
  <purpose>
18
- Deep codebase improvement: survey → 6-dimension audit → diagnose → fix → verify → generalize → discover → persist.
19
- Baseline-first approach with exhaustive iteration until zero remaining actionable findings.
18
+ survey → 6-dimension audit → diagnose → fix → verify → generalize → discover → persist.
19
+ Exhaustive iteration until zero remaining actionable findings.
20
20
  </purpose>
21
21
 
22
22
  <boundary>
23
- **范围内:** 目标代码的运行质量提升性能/安全/架构/可靠性/可观测性/可维护性多维度审查诊断修复泛化
24
- **范围外:** UI 视觉优化 → `/odyssey-ui` | 新功能实现 → `/odyssey-planex` | 单一 bug 调查 → `/odyssey-debug` | 代码风格审查 → `/odyssey-review-test-fix`
25
- **探索自由度:** 边界内自由探索 profiling、安全扫描、架构分析、依赖审计。在约束下尽可能发现深层问题。
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.
23
+ **In scope:** Runtime quality improvement performance/security/architecture/reliability/observability/maintainability audit diagnosefixgeneralize.
24
+ **Out of scope:** UI visual → `/odyssey-ui` | New features → `/odyssey-planex` | Single bug → `/odyssey-debug` | Style review → `/odyssey-review-test-fix`
25
+ **Exploration freedom:** Free exploration within boundary profiling, security scanning, architecture analysis, dependency audit.
26
+ **Zero-residual:** 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.
27
27
  </boundary>
28
28
 
29
29
  <context>
30
- $ARGUMENTS — target and optional flags.
30
+ $ARGUMENTS
31
31
 
32
32
  **Target resolution:**
33
33
  | Input | Resolution |
@@ -37,17 +37,7 @@ $ARGUMENTS — target and optional flags.
37
37
  | Feature area keyword | Resolve to related files |
38
38
  | `--all` | Full project scan (use with caution) |
39
39
 
40
- **Flags:**
41
- | Flag | Effect | Default |
42
- |------|--------|---------|
43
- | `--dimensions <list>` | Comma-separated subset of 6 dimensions | all 6 |
44
- | `--fix-threshold <severity>` | 修复到哪个 severity 为止(all = 全部修复)| all |
45
- | `--skip-fix` | Audit + diagnose only, no code changes | false |
46
- | `--skip-generalize` | Skip S_GENERALIZE and S_DISCOVER | false |
47
- | `--auto` | CLI delegates without confirmation | false |
48
- | `-y` | Auto-confirm all decisions (see appendix) | false |
49
- | `-c` | Resume most recent session | — |
50
- | `--heartbeat` | Enable /loop heartbeat protocol (see base) | false |
40
+ **Flags:** `--dimensions <list>` dimension subset | `--fix-threshold <severity>` fix cutoff (default: all) | `--skip-fix` audit+diagnose only | `--skip-generalize` skip S_GENERALIZE+S_DISCOVER | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
51
41
 
52
42
  **Dimensions (6):**
53
43
  1. **performance** — hot paths, N+1 queries, memory allocation, cache efficiency, bundle size, lazy loading
@@ -57,13 +47,17 @@ $ARGUMENTS — target and optional flags.
57
47
  5. **observability** — logging coverage, metric gaps, trace propagation, error reporting, health checks
58
48
  6. **maintainability** — code complexity (cyclomatic), dead code, test coverage gaps, documentation debt
59
49
 
60
- **Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
50
+ **Session**: `.workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
51
+ **Output**: `session.json` | `evidence.ndjson` | `understanding.md`
61
52
 
62
- **Output:** `session.json` (state + audit + diagnoses + patterns + goals) | `evidence.ndjson` (append-only) | `understanding.md` (9-section narrative)
53
+ **session.json improve-specific fields:**
54
+ ```json
55
+ { "target": "", "dimensions": [], "baseline_metrics": {},
56
+ "audit_result": {}, "diagnoses": [], "confirmation": null,
57
+ "generalization_stats": null }
58
+ ```
63
59
 
64
- **session.json unique fields:** `target`, `dimensions`, `baseline_metrics`, `audit_result`, `diagnoses`, `confirmation`, `generalization_stats` (`progress_metrics`, `directions_tried` from base)
65
-
66
- **evidence.ndjson phase-specific fields:**
60
+ **evidence.ndjson phases:** `survey|audit|diagnosis|fix|discovery|decision|self-iteration`
67
61
  - `survey`: `category` (dependency|complexity|coverage|error_pattern), `detail`
68
62
  - `audit`: `dimension`, `severity`, `measurement`
69
63
  - `diagnosis`: `finding_ref`, `hypothesis`, `result` (confirmed|disproved|inconclusive), `root_cause`
@@ -73,92 +67,79 @@ $ARGUMENTS — target and optional flags.
73
67
  - `self-iteration`: `stage`, `round`, `assessment`, `expansion`
74
68
 
75
69
  **phase_goals[]:**
70
+
76
71
  | ID | Goal | Phase | skip_when |
77
72
  |----|------|-------|-----------|
78
73
  | G1 | Survey completed | S_SURVEY | — |
79
74
  | G2 | Audit completed | S_AUDIT | — |
80
75
  | G3 | Diagnosis completed | S_DIAGNOSE | — |
81
- | G4 | Zero remaining: all findings fixed and verified | `remaining_actionable == 0` within fix_threshold | S_VERIFY | skip_fix |
76
+ | G4 | Zero remaining: all findings fixed and verified | S_VERIFY | skip_fix |
82
77
  | G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
83
78
  | G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
84
79
  | G7 | Learnings persisted | S_RECORD | — |
85
80
 
86
- **understanding.md — 9 sections (written by owning phase):**
81
+ **understanding.md — 9 sections:**
87
82
  1. Target & Baseline ← S_INTAKE | 2. Current State Survey ← S_SURVEY | 3. Audit Findings ← S_AUDIT
88
83
  4. Root Cause Diagnosis ← S_DIAGNOSE | 5. Fix & Verification ← S_FIX+S_VERIFY
89
84
  6. Generalization ← S_GENERALIZE | 7. Discoveries ← S_DISCOVER
90
85
  8. Improvement Metrics ← S_RECORD (before/after) | 9. Engineering Learnings ← S_RECORD
91
86
 
92
- ### Pre-load(可选,缺失不阻塞)
93
- - ARCHITECTURE.md → 模块边界 | `maestro search "<target>" --json` → 先前优化(top 5)
94
- - `maestro load --type spec --category coding` + `--category debug` → 编码规范 + 已知模式
95
- - `maestro search --category coding` → knowhow | `Glob(".workflow/scratch/*-improve-odyssey-*")` → 先前会话
96
-
97
- ### Knowledge Persistence(S_RECORD 中写入产出文件)
87
+ **Knowledge Persistence categories (§9):**
98
88
 
99
- S_RECORD 阶段将可沉淀知识 **写入 understanding.md §9 Learnings**,按以下分类结构化:
100
-
101
- | 分类 | 写入内容 | 后续建议命令 |
102
- |------|---------|-------------|
103
- | 性能 pattern | 瓶颈类型 + 修复方案 + 度量方法 | `/spec-add coding "..."` |
104
- | 安全规则 | 漏洞类别 + 修复 + 预防方法 | `/spec-add debug "..."` |
105
- | 架构约束 | 违反描述 + 正确边界 + 检查方法 | `/spec-add arch "..."` |
106
- | 可靠性 pattern | 故障模式 + 处理策略 + 验证手段 | `/spec-add coding "..."` |
89
+ | Category | Content | Follow-up |
90
+ |----------|---------|-----------|
91
+ | Performance pattern | Bottleneck type + fix approach + measurement method | `/spec-add coding` |
92
+ | Security rule | Vulnerability class + fix + prevention method | `/spec-add debug` |
93
+ | Architecture constraint | Violation description + correct boundary + check method | `/spec-add arch` |
94
+ | Reliability pattern | Failure mode + handling strategy + verification method | `/spec-add coding` |
107
95
  </context>
108
96
 
109
- Self-iteration 适用阶段: S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE
97
+ <invariants>
98
+ All invariants (evidence append-only, session-as-state, phase goal tracking, auto-commit, zero-residual) defined in base.
99
+ </invariants>
100
+
101
+ <self_iteration>
102
+ Applies to: **S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE**. Logic in base.
103
+ </self_iteration>
110
104
 
111
105
  <state_machine>
112
106
 
113
107
  <states>
114
- S_INTAKE Parse target, load context, establish baseline metrics PERSIST: session.json + understanding.md §1
115
- S_SURVEY — Current state: dependency audit, complexity scan, coverage PERSIST: evidence.ndjson (survey) + understanding.md §2
116
- S_AUDIT — 6-dimension parallel deep audit PERSIST: evidence.ndjson (audit) + understanding.md §3
117
- S_DIAGNOSE — Root cause analysis for critical/high findings PERSIST: evidence.ndjson (diagnosis|decision) + understanding.md §4
118
- S_FIX — Implement improvements (skip if --skip-fix) PERSIST: code changes + evidence.ndjson (fix)
119
- S_VERIFY — Tests + measurement comparison (skip if --skip-fix) PERSIST: session.json.confirmation + understanding.md §5
120
- S_GENERALIZE — Pattern extraction + 4-agent scan (skip if --skip-gen) PERSIST: session.json.patterns + understanding.md §6
121
- S_DISCOVER — Classify hits, create issues (skip if --skip-gen) PERSIST: evidence.ndjson (discovery|decision) + understanding.md §7
122
- S_RECORD — Persist metrics + learnings + final report PERSIST: understanding.md §8-9 + spec entries
108
+ S_INTAKE S_SURVEY S_AUDIT S_DIAGNOSE S_FIX S_VERIFY → S_GENERALIZE → S_DISCOVER → S_RECORD → END
123
109
  </states>
124
110
 
125
111
  <transitions>
126
- S_INTAKE:
127
- S_INTAKE WHEN -c + session found DO A_RESUME
128
- S_SURVEY WHEN target resolved DO A_INTAKE
129
- → S_INTAKE WHEN no target DO AskUserQuestion
112
+ S_INTAKE → S_INTAKE : -c + session found → A_RESUME
113
+ S_INTAKE S_SURVEY : target resolved A_INTAKE
114
+ S_INTAKE S_INTAKE : no target AskUserQuestion
130
115
 
131
- S_SURVEY → S_AUDIT DO A_SURVEY
116
+ S_SURVEY → S_AUDIT : complete
132
117
 
133
- S_AUDIT:
134
- S_DIAGNOSE WHEN critical/high findings exist DO A_AUDIT
135
- S_GENERALIZE WHEN no critical/high AND !skip_gen DO A_AUDIT
136
- → S_RECORD WHEN no findings OR skip_gen DO A_AUDIT
118
+ S_AUDIT → S_DIAGNOSE : critical/high findings exist
119
+ S_AUDIT S_GENERALIZE : no critical/high, !skip_generalize
120
+ S_AUDIT S_RECORD : no findings OR skip_generalize
137
121
 
138
- S_DIAGNOSE:
139
- S_FIX WHEN root causes identified AND !skip_fix DO A_DIAGNOSE
140
- S_GENERALIZE WHEN root causes identified AND skip_fix AND !skip_gen DO A_DIAGNOSE
141
- S_RECORD WHEN root causes identified AND skip_fix AND skip_gen DO A_DIAGNOSE
142
- S_DIAGNOSE WHEN hypotheses failed AND retries < 3 DO A_ESCALATE_DIAGNOSIS
143
- → S_RECORD WHEN hypotheses failed AND retries >= 3 DO mark INCONCLUSIVE
122
+ S_DIAGNOSE → S_FIX : root causes identified, !skip_fix
123
+ S_DIAGNOSE S_GENERALIZE : root causes identified, skip_fix, !skip_generalize
124
+ S_DIAGNOSE S_RECORD : root causes identified, skip_fix, skip_generalize
125
+ S_DIAGNOSE S_DIAGNOSE : hypotheses failed, retries < 3 A_ESCALATE_DIAGNOSIS
126
+ S_DIAGNOSE S_RECORD : retries >= 3 → INCONCLUSIVE
144
127
 
145
- S_FIX → S_VERIFY DO A_FIX
128
+ S_FIX → S_VERIFY : fix implemented
146
129
 
147
- S_VERIFY:
148
- S_GENERALIZE WHEN verified AND !skip_gen DO A_VERIFY
149
- S_RECORD WHEN verified AND skip_gen DO A_VERIFY
150
- → S_FIX WHEN needs_rework DO A_VERIFY
130
+ S_VERIFY → S_GENERALIZE : verified, !skip_generalize
131
+ S_VERIFY S_RECORD : verified, skip_generalize
132
+ S_VERIFY S_FIX : needs_rework
151
133
 
152
- S_GENERALIZE:
153
- S_DISCOVER WHEN hits found DO A_GENERALIZE
154
- → S_RECORD WHEN no hits DO A_GENERALIZE
134
+ S_GENERALIZE → S_DISCOVER : hits found
135
+ S_GENERALIZE S_RECORD : no hits
155
136
 
156
- S_DISCOVER → S_DIAGNOSE : new critical issue found → cross_phase_loops++
137
+ S_DISCOVER → S_DIAGNOSE : new critical issue → cross_phase_loops++
157
138
  S_DISCOVER → S_FIX : same-pattern fix, !skip_fix → cross_phase_loops++
158
- S_DISCOVER → S_RECORD : triage complete AND remaining_actionable == 0
159
- S_DISCOVER → S_RECORD : loops >= max_loops → MUST log each unfixed item with specific reason (blanket "pre-existing" is forbidden)
139
+ S_DISCOVER → S_RECORD : remaining_actionable == 0
140
+ S_DISCOVER → S_RECORD : loops >= max_loops → MUST log per-item reasons
160
141
 
161
- S_RECORD → END DO A_RECORD
142
+ S_RECORD → END : complete
162
143
  </transitions>
163
144
 
164
145
  <actions>
@@ -168,108 +149,111 @@ S_RECORD → END DO A_RECORD
168
149
  2. Generate slug, create `SESSION_DIR`
169
150
  3. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load coding/debug
170
151
  4. **Baseline capture**: Record current metrics (test pass rate, bundle size, dependency count, complexity hotspots) to `session.json.baseline_metrics`
171
- 5. Derive `phase_goals[]` from flags (apply `skip_when`)
172
- 6. Write `session.json` + `understanding.md` §1 (Target & Baseline)
173
- 7. Emit Goal Prompt (see Appendix)
152
+ 5. Derive `phase_goals[]` from flags
153
+ 6. Write `session.json` + `understanding.md` §1, emit Goal Prompt
174
154
 
175
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): INTAKE — 目标解析与基线采集"`
155
+ Commit: `"odyssey-improve({slug}): INTAKE — parse target and capture baseline"`
176
156
 
177
157
  ### A_RESUME
178
- Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
158
+ Glob latest session → read `session.json` → display summary → jump to `current_state`.
179
159
 
180
160
  ### A_SURVEY
181
161
  Current state survey — understand what exists before proposing changes.
182
162
 
183
163
  1. Dependency audit (package.json/lock), complexity scan (size/nesting), test coverage map, error handling scan (empty catch, unhandled promise)
184
- 2. **CLI-assisted** (optional): `maestro delegate` with `--role analyze --mode analysis` for dependency health, complexity hotspots, coverage gaps, error patterns. Execute `run_in_background: true`.
185
- 3. Append evidence.ndjson (phase: "survey"). Update `understanding.md` §2. Mark G1 done.
164
+ 2. **CLI-assisted** (optional): `maestro delegate --role analyze --mode analysis` for dependency health, complexity hotspots, coverage gaps, error patterns. Execute `run_in_background: true`.
165
+ 3. Evidence phase=survey. Update §2. Mark G1.
186
166
 
187
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): SURVEY — 现状调查"`
167
+ Commit: `"odyssey-improve({slug}): SURVEY — current state analysis"`
188
168
 
189
169
  ### A_AUDIT
190
- Spawn 6 parallel Agents (one per dimension from Dimensions list above, or `--dimensions` subset).
170
+ Spawn 6 parallel Agents (one per dimension, or `--dimensions` subset).
191
171
  Each returns: `[{title, severity, dimension, file, line, description, suggestion, measurement}]`
192
172
 
193
- Merge → evidence.ndjson (phase: "audit"). Write `session.json.audit_result`.
194
- Update `understanding.md` §3 (findings by dimension + severity matrix). Mark G2 done.
173
+ Merge → evidence phase=audit. Write `session.json.audit_result`.
174
+ Update §3 (findings by dimension + severity matrix). Mark G2.
195
175
 
196
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): AUDIT — 多维审查"`
176
+ Commit: `"odyssey-improve({slug}): AUDIT — multi-dimension review"`
197
177
 
198
178
  ### A_DIAGNOSE
199
179
  Root cause analysis for critical/high findings — don't fix symptoms.
200
180
 
201
- 1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence.ndjson (phase: "diagnosis")
202
- 2. **Decision journal**: ambiguity → evidence (phase: "decision"); Normal: AskUserQuestion | `-y`: defer
203
- 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`.
204
- 4. Write `session.json.diagnoses[]`. Update `understanding.md` §4. Mark G3 done.
181
+ 1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence phase=diagnosis
182
+ 2. Ambiguity → evidence phase=decision; Normal: AskUserQuestion | `-y`: defer
183
+ 3. CLI-assisted for complex findings: `maestro delegate --role analyze --mode analysis` (`run_in_background: true`)
184
+ 4. Write `session.json.diagnoses[]`. Update §4. Mark G3.
205
185
 
206
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): DIAGNOSE — 根因诊断"`
186
+ Commit: `"odyssey-improve({slug}): DIAGNOSE — root cause analysis"`
207
187
 
208
188
  ### A_ESCALATE_DIAGNOSIS
209
- Increment retries. If < 3: broaden scope via `maestro delegate --role analyze`, form new hypotheses, return to S_DIAGNOSE. If >= 3: Normal → AskUserQuestion (broaden/new/INCONCLUSIVE) | `-y` → auto INCONCLUSIVE, proceed to S_RECORD.
189
+ `retries++`. < 3: `maestro delegate --role analyze`, new hypotheses, S_DIAGNOSE. >= 3: Normal → AskUserQuestion | `-y` → INCONCLUSIVE S_RECORD.
210
190
 
211
191
  ### A_FIX
212
- Skip if `--skip-fix`. Implement improvements for diagnosed root causes.
192
+ 1. Exhaustive fix: ALL diagnosed issues by severity tier (critical → high → medium → low within fix_threshold), one dimension at a time. After each tier, re-verify — new findings append to current tier.
193
+ 2. For each fix: implement → evidence phase=fix
194
+ 3. Normal: AskUserQuestion per-fix confirmation | `-y`: auto-proceed, record `deferred`
213
195
 
214
- 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.
215
- 2. For each fix: implement → record evidence.ndjson (phase: "fix")
216
- 3. **Normal**: AskUserQuestion per-fix confirmation. **`-y`**: auto-proceed, record `deferred`.
217
-
218
- 📌 **Auto-commit**: `git add -A && git commit -m "odyssey-improve({slug}): FIX — 改进实现"`
196
+ Commit: `"odyssey-improve({slug}): FIXimprovements applied"`
219
197
 
220
198
  ### A_VERIFY
221
199
  1. Run tests covering modified areas
222
200
  2. Re-capture metrics, compare with `session.json.baseline_metrics`
223
- 3. **CLI-assisted**: `maestro delegate --role review --mode analysis` to check fix correctness, test regressions, measure impact vs baseline. Execute `run_in_background: true`.
224
- 4. `needs_rework` → S_FIX. `verified` → mark G4 done, advance.
225
- 5. Write `session.json.confirmation`. Update `understanding.md` §5 (before/after metrics table).
226
-
227
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): VERIFY — 改进验证"`
228
-
229
- ### A_GENERALIZE
230
- base A_GENERALIZE 执行。Pattern 来源: diagnoses + fixes。Mark G5 done.
231
-
232
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): GENERALIZE 泛化扫描"`
233
-
234
- ### A_DISCOVER
235
- 按 base A_DISCOVER 执行。Mark G6 done.
236
-
237
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): DISCOVER — 发现分类"`
238
-
239
- ### A_RECORD
240
- 1. **understanding.md §8**: Improvement metrics — before/after comparison table from baseline_metrics vs current
241
- 2. **understanding.md §9**: Engineering learnings — 按 Knowledge Persistence 表分类记录(临时),completion summary 列出建议的 `/spec-add` 命令
242
- 3. Mark G7 done. Pending decisions: **Normal** AskUserQuestion. **`-y`** → skip, show deferred count.
243
- 4. 其余按 base A_RECORD 执行。
244
- 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).
245
-
246
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): RECORD — 指标总结与知识沉淀"`
201
+ 3. CLI-assisted: `maestro delegate --role review --mode analysis` (`run_in_background: true`)
202
+ 4. `needs_rework` → S_FIX. `verified` → mark G4, advance.
203
+ 5. Write `session.json.confirmation`. Update §5 (before/after metrics table).
204
+
205
+ Commit: `"odyssey-improve({slug}): VERIFY — improvements verified"`
206
+
207
+ ### A_GENERALIZE, A_DISCOVER, A_RECORD
208
+ Base shared_actions. Improve overrides:
209
+ - **A_GENERALIZE** pattern source: diagnoses + fixes
210
+ - **A_RECORD** §8: improvement metrics (before/after comparison from baseline_metrics vs current). §9: learnings per Knowledge Persistence table. Completion summary lists suggested `/spec-add` commands.
211
+
212
+ **Completion summary:**
213
+ ```
214
+ --- IMPROVE ODYSSEY COMPLETE ---
215
+ Target: {target}
216
+ Dimensions: {dimensions}
217
+ Findings: {critical}C / {high}H / {medium}M / {low}L
218
+ Diagnosed: {count}
219
+ Fixed: {count} ({verified} verified)
220
+ Metrics: {improved} improved / {regressed} regressed
221
+ Patterns: {count} ({by_layer})
222
+ Scan hits: {total} ({cross_layer_confirmed} confirmed)
223
+ Issues: {N} created
224
+ Decisions: {N} resolved, {M} pending, {K} deferred
225
+ Learnings: {N} persisted
226
+ Self-iter: {N} rounds across {M} stages
227
+ Cross-loops: {N}
228
+ Goals: {done}/{total} ({skipped} skipped)
229
+ ---
230
+ ```
247
231
 
248
232
  </actions>
249
233
 
250
234
  <appendix>
251
235
 
252
- ### Goal Prompt Template
253
- **⚠️ 仅在 A_INTAKE 完成后显示一次,A_RECORD 完成时不重复。**
254
-
255
- 列出所有非 skipped 的 phase_goals,附加收敛规则:
256
- - 穷尽迭代至所有 findings 已处理(fix/issue/decision)且 `phase_goals_all_done=true`
257
- - 修复按 severity 逐轮迭代,每轮 re-verify
258
- - Baseline 修复前采集,修复后对比确认改进
259
- - pending decision 必须 AskUserQuestion,不允许"只报告不处理"
236
+ ### `-y` improve-specific points
260
237
 
261
- ### `-y` Auto-Confirm Behavior
262
238
  | Decision Point | Normal | `-y` |
263
239
  |---------------|--------|------|
264
240
  | A_FIX improvement confirmation | AskUserQuestion | auto-proceed, `deferred` |
265
241
  | A_DIAGNOSE ambiguity | AskUserQuestion | best-effort, `deferred` |
266
242
  | A_ESCALATE 3-strike | AskUserQuestion 3-way | auto INCONCLUSIVE |
267
- | A_DISCOVER hit routing | AskUserQuestion | auto create issue, `deferred` |
243
+ | A_DISCOVER hit routing | AskUserQuestion | auto create issue |
268
244
  | A_DISCOVER ambiguous items | AskUserQuestion | all `deferred` |
269
- | A_RECORD pending decisions | AskUserQuestion | skip, show deferred count |
270
- | A_RECORD goal audit | AskUserQuestion | auto accept |
271
245
 
272
- `deferred` items shown as "待决策" in completion summary; recoverable via `-c`.
246
+ `deferred` items shown in completion summary; recoverable via `-c`.
247
+
248
+ ### Goal Prompt convergence rules
249
+
250
+ ```
251
+ Exhaust iteration until all findings actioned (fix/issue/decision)
252
+ and phase_goals_all_done=true.
253
+ Fix by severity tiers, re-verify after each tier.
254
+ Baseline captured before fix, compared after to confirm improvement.
255
+ Pending decisions must AskUserQuestion — no silent resolve.
256
+ ```
273
257
 
274
258
  </appendix>
275
259
 
@@ -294,16 +278,18 @@ Skip if `--skip-fix`. Implement improvements for diagnosed root causes.
294
278
  - [ ] understanding.md §8 (metrics) and §9 (learnings) completed
295
279
  - [ ] phase_goals G1-G7 tracked and audited
296
280
  - [ ] Session resumable via -c
281
+ - [ ] Completion summary
297
282
  </success_criteria>
298
283
 
299
284
  <next_step_routing>
300
- | Condition | Next step |
301
- |-----------|-----------|
285
+ | Condition | Next |
286
+ |-----------|------|
302
287
  | Security findings need deep investigation | `/odyssey-debug "<finding>"` |
303
288
  | UI-related findings | `/odyssey-ui "<component>"` |
304
289
  | Issues created from discoveries | `/manage-issue list --source improve-odyssey` |
305
290
  | Architecture pattern to document | `/spec-add arch "..."` |
306
291
  | Performance pattern to persist | `/spec-add coding "..."` |
307
- | Want formal review of changes | `/odyssey-review-test-fix <changed-files>` |
308
- | Decisions still pending | Filter evidence.ndjson phase=decision status=pending |
292
+ | Formal review of changes | `/odyssey-review-test-fix <changed-files>` |
293
+ | Pending decisions | Filter evidence phase=decision status=pending |
309
294
  </next_step_routing>
295
+ </output>