maestro-flow-one 0.2.33 → 0.2.34
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.
- package/maestro-flow/commands/lifecycle/odyssey-debug.md +473 -0
- package/maestro-flow/commands/lifecycle/odyssey-improve.md +505 -0
- package/maestro-flow/commands/lifecycle/odyssey-planex.md +601 -0
- package/maestro-flow/commands/lifecycle/odyssey-review-test-fix.md +427 -0
- package/maestro-flow/commands/lifecycle/odyssey-ui.md +462 -0
- package/maestro-flow/commands/lifecycle/security-audit.md +179 -0
- package/package.json +1 -1
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: odyssey-debug
|
|
3
|
+
description: Long-running debug cycle — archaeology, diagnosis, fix, confirmation, generalization, discovery, and knowledge persistence
|
|
4
|
+
argument-hint: "<issue> [--skip-fix] [--skip-generalize] [--auto] [-y] [-c]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Bash
|
|
10
|
+
- Glob
|
|
11
|
+
- Grep
|
|
12
|
+
- Agent
|
|
13
|
+
- AskUserQuestion
|
|
14
|
+
---
|
|
15
|
+
<purpose>
|
|
16
|
+
Closed-loop deep debugging: archaeology (what changed) → explore (call chains, error gaps) → diagnose (hypothesis-driven) → fix & confirm → generalize (举一反三) → discover siblings → persist learnings.
|
|
17
|
+
|
|
18
|
+
Unlike `quality-debug` (fast fix), this treats every bug as a learning signal — digs into git history before hypotheses, confirms fixes with CLI review, scans for siblings of the root cause.
|
|
19
|
+
|
|
20
|
+
Core philosophy:
|
|
21
|
+
- **Archaeology before hypothesis** — look at what changed before guessing why
|
|
22
|
+
- **Fix one, find many** — a single bug reveals a class of bugs
|
|
23
|
+
- **Decision journal** — human-judgment items recorded, not lost
|
|
24
|
+
- **CLI-assisted review** — delegate for second-opinion analysis
|
|
25
|
+
|
|
26
|
+
**三句哲学约束(穷尽迭代):**
|
|
27
|
+
1. **零遗留** — 根因必须确认到底,修复必须验证通过,泛化必须扫描穷尽
|
|
28
|
+
2. **穷尽迭代** — 假设失败不放弃:扩范围 → 换视角 → 升级工具,直到根因确认或明确 INCONCLUSIVE
|
|
29
|
+
3. **改进即标准** — 修复后重新确认同区域无新问题,泛化发现的同类 bug 全部处理
|
|
30
|
+
|
|
31
|
+
Entry: `/odyssey-debug "issue"` (full cycle) | `-c` (resume) | `--skip-fix` (analysis-only)
|
|
32
|
+
</purpose>
|
|
33
|
+
|
|
34
|
+
<boundary>
|
|
35
|
+
**范围内:** 单一 bug/issue 的完整闭环 — 考古 → 探索 → 诊断 → 修复 → 确认 → 泛化同类 → 沉淀
|
|
36
|
+
**范围外:** 新功能开发 → `/odyssey-planex` | 代码质量审查 → `/odyssey-review-test-fix` | UI 视觉优化 → `/odyssey-ui` | 架构重设计 → `/maestro-plan`
|
|
37
|
+
**探索自由度:** 边界内自由探索 — 可追踪任意调用链、分析任意历史、测试任意假设。泛化阶段可扫描全项目寻找同类问题。
|
|
38
|
+
**模板支持:** `--template <name>` 从预定义调查策略启动,跳过假设生成直接进入针对性诊断:
|
|
39
|
+
|
|
40
|
+
| Template | 调查策略 | 适用场景 |
|
|
41
|
+
|----------|---------|---------|
|
|
42
|
+
| `performance` | profiling → hot path → allocation → cache | 性能劣化 |
|
|
43
|
+
| `memory-leak` | heap snapshot → retention chain → lifecycle | 内存泄漏 |
|
|
44
|
+
| `race-condition` | timeline → concurrent access → lock analysis | 竞态条件 |
|
|
45
|
+
| `regression` | git bisect → diff analysis → boundary check | 回归问题 |
|
|
46
|
+
| `crash` | stack trace → null chain → error propagation | 崩溃/异常 |
|
|
47
|
+
</boundary>
|
|
48
|
+
|
|
49
|
+
<execution_discipline>
|
|
50
|
+
**三条铁律(所有阶段适用):**
|
|
51
|
+
|
|
52
|
+
1. **Phase auto-commit** — 每个阶段完成后**自动** `git commit`,无需用户确认
|
|
53
|
+
- 代码变更 + understanding.md → `git add` → `git commit -m "odyssey-debug({slug}): {phase} — {摘要}"`
|
|
54
|
+
- session.json / evidence.ndjson 为运行时状态,不纳入 commit
|
|
55
|
+
- 确保每个阶段的进展可回溯、可恢复
|
|
56
|
+
|
|
57
|
+
2. **有把握才改** — 仅修改自己有把握的内容;不确定的记录决策等人判断
|
|
58
|
+
- 有把握 → 直接修改代码,commit
|
|
59
|
+
- 需要决策 → 记录 `evidence.ndjson {"phase":"decision","status":"pending"}` 不改代码
|
|
60
|
+
- 禁止猜测性修改,宁可多记录一条 decision 也不冒险改错
|
|
61
|
+
|
|
62
|
+
3. **多 CLI 辅助** — 利用 `maestro delegate` 调用多个 CLI 工具交叉验证
|
|
63
|
+
- 关键判断用不同 `--role`(analyze / review / explore)获取多视角
|
|
64
|
+
- 修复前后各做一次 CLI review 确认
|
|
65
|
+
- 不同阶段可调用不同工具,综合多方意见再行动
|
|
66
|
+
</execution_discipline>
|
|
67
|
+
|
|
68
|
+
<context>
|
|
69
|
+
$ARGUMENTS — issue description and optional flags.
|
|
70
|
+
|
|
71
|
+
**Flags:** `--skip-fix` analysis-only | `--skip-generalize` quick fix | `--template <name>` 预定义策略 | `--auto` no delegate confirmation | `-y` auto-confirm all decisions | `-c` resume last session
|
|
72
|
+
|
|
73
|
+
**Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-debug-odyssey-{slug}/`
|
|
74
|
+
|
|
75
|
+
**Output — 4 files:**
|
|
76
|
+
```
|
|
77
|
+
SESSION_DIR/
|
|
78
|
+
├── session.json # state + confirmation + patterns + phase_goals
|
|
79
|
+
├── evidence.ndjson # append-only evidence trail (phase field distinguishes origin)
|
|
80
|
+
├── explore.json # structured CLI exploration snapshot
|
|
81
|
+
└── understanding.md # evolving narrative — 9 sections
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**session.json schema:**
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"session_id": "debug-odyssey-{YYYYMMDD-HHmmss}", "issue": "",
|
|
88
|
+
"flags": { "skip_fix": false, "skip_generalize": false, "auto": false, "auto_confirm": false },
|
|
89
|
+
"current_state": "S_INTAKE", "diagnosis_retries": 0,
|
|
90
|
+
"root_cause": null, "patterns": [], "confirmation": null,
|
|
91
|
+
"phase_goals": [], "phase_goals_all_done": false, "self_iteration_log": [],
|
|
92
|
+
"generalization_stats": null,
|
|
93
|
+
"cross_phase_loops": 0, "max_loops": 3,
|
|
94
|
+
"created_at": "", "updated_at": ""
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**evidence.ndjson — unified trail:**
|
|
99
|
+
```json
|
|
100
|
+
{"ts":"","phase":"archaeology|explore|diagnosis|discovery|decision|self-iteration","type":"","source":"","content":"","note":""}
|
|
101
|
+
```
|
|
102
|
+
Phase-specific fields:
|
|
103
|
+
- `archaeology`: `sha`, `author`, `date`, `message`, `relevance` (high|medium|low)
|
|
104
|
+
- `explore`: `category` (call_chain|recent_change|error_gap|similar_pattern), `detail`
|
|
105
|
+
- `diagnosis`: `hypothesis`, `result` (confirmed|disproved|inconclusive)
|
|
106
|
+
- `discovery`: `file`, `line`, `classification` (safe|risk|bug), `action` (fix|issue|decision|skip)
|
|
107
|
+
- `decision`: `question`, `options`, `context`, `status` (pending|resolved|deferred), `resolution`
|
|
108
|
+
- `self-iteration`: `stage`, `round`, `assessment`, `expansion`
|
|
109
|
+
|
|
110
|
+
**explore.json schema:**
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"call_chains": [{"entry":"","chain":["file:line"]}],
|
|
114
|
+
"recent_changes": [{"file":"","commits":[{"sha":"","message":"","date":""}]}],
|
|
115
|
+
"error_gaps": [{"file":"","line":0,"description":""}],
|
|
116
|
+
"similar_patterns": [{"file":"","line":0,"description":""}],
|
|
117
|
+
"cli_tool": "", "timestamp": ""
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**phase_goals[] — auto-derived from flags:**
|
|
122
|
+
|
|
123
|
+
| ID | Goal | done_when | phase | skip_when |
|
|
124
|
+
|----|------|-----------|-------|-----------|
|
|
125
|
+
| G1 | Root cause identified | evidence.ndjson has phase=diagnosis result=confirmed | S_DIAGNOSE | — |
|
|
126
|
+
| G2 | Explore context gathered | explore.json ≥1 category populated | S_EXPLORE | — |
|
|
127
|
+
| G3 | Fix applied and confirmed | confirmation.overall == confirmed | S_CONFIRM | skip_fix |
|
|
128
|
+
| G4 | Pattern generalized | patterns[] ≥1 entry | S_GENERALIZE | skip_generalize |
|
|
129
|
+
| G5 | Discoveries triaged | all scan hits classified | S_DISCOVER | skip_generalize |
|
|
130
|
+
| G6 | Learnings persisted | spec entries created OR no actionable learnings | S_RECORD | — |
|
|
131
|
+
|
|
132
|
+
When `flags[skip_when] == true` → auto set `status: "skipped"`, `completion_confirmed: true`.
|
|
133
|
+
|
|
134
|
+
**understanding.md — 9 sections (written by owning phase):**
|
|
135
|
+
1. Issue & Scope ← S_INTAKE | 2. Archaeology Summary ← S_ARCHAEOLOGY | 3. Exploration ← S_EXPLORE
|
|
136
|
+
4. Hypotheses & Testing ← S_DIAGNOSE | 5. Root Cause ← S_DIAGNOSE | 6. Fix & Confirmation ← S_FIX+S_CONFIRM
|
|
137
|
+
7. Generalization ← S_GENERALIZE | 8. Discoveries & Decisions ← S_DISCOVER | 9. Learnings ← S_RECORD
|
|
138
|
+
|
|
139
|
+
### Pre-load(可选,缺失不阻塞)
|
|
140
|
+
|
|
141
|
+
| 层级 | 命令 | 作用 |
|
|
142
|
+
|------|------|------|
|
|
143
|
+
| Codebase docs | Read `.workflow/codebase/ARCHITECTURE.md` | 模块边界,作为所有分析的上下文 |
|
|
144
|
+
| Wiki search | `maestro search "<issue keywords>" --json` | 先前调查、相关决策(取 top 5) |
|
|
145
|
+
| Specs + tools | `maestro spec load --category debug --keyword "<symptom>"` | 已知 issue/workaround + 可发现的 knowhow 工具 |
|
|
146
|
+
| Role knowledge | `maestro search --category debug` → 选相关 → `maestro wiki load <id>` | 累积领域知识 |
|
|
147
|
+
| Prior sessions | `Glob(".workflow/scratch/*-debug-odyssey-*")` | 相关 odyssey 会话 |
|
|
148
|
+
|
|
149
|
+
### Knowledge Persistence(S_RECORD 中写入产出文件)
|
|
150
|
+
|
|
151
|
+
S_RECORD 阶段将可沉淀知识 **写入 understanding.md §9 Learnings**,按以下分类结构化:
|
|
152
|
+
|
|
153
|
+
| 分类 | 写入内容 | 后续建议命令 |
|
|
154
|
+
|------|---------|-------------|
|
|
155
|
+
| 反复根因模式 | 模式描述 + 触发条件 + 修复模板 | `/spec-add debug "..."` |
|
|
156
|
+
| 非显而易见 workaround | 问题场景 + 解决方案 + 适用范围 | `/spec-add learning "..."` |
|
|
157
|
+
| 架构边界违反 | 违反描述 + 正确边界 + 检查方法 | `/spec-add arch "..."` |
|
|
158
|
+
| 可复用泛化 pattern | pattern 签名 + 风险说明 + fix 模板 | `/spec-add coding "..."` |
|
|
159
|
+
|
|
160
|
+
**两步模式:** 执行中写入产出文件(临时记录)→ 任务完成后用户通过 next_step_routing 沉淀为永久知识。执行过程中不调用外部 Skill。
|
|
161
|
+
</context>
|
|
162
|
+
|
|
163
|
+
<self_iteration>
|
|
164
|
+
**Quality Gate (适用: S_ARCHAEOLOGY, S_EXPLORE, S_DIAGNOSE, S_GENERALIZE)**
|
|
165
|
+
|
|
166
|
+
| 维度 | sufficient | insufficient |
|
|
167
|
+
|------|-----------|-------------|
|
|
168
|
+
| Coverage | 已知相关文件/模块均已分析 | 遗漏 grep/git log 可发现的目标 |
|
|
169
|
+
| Depth | ≥80% 发现有 file:line 级证据 | 多数仅泛泛描述 |
|
|
170
|
+
| Actionability | 每条结论有具体后续动作 | 仅"建议关注"类无操作性结论 |
|
|
171
|
+
|
|
172
|
+
**规则:** 阶段完成 → 评估 3 维度 → 任一 insufficient → 重入(每阶段最多 2 轮)。
|
|
173
|
+
- Round 1: 扩范围 — 增加目录、git log depth ×2、增加 delegate 角度
|
|
174
|
+
- Round 2: 换视角 — 不同 CLI tool、反向追踪、手动 code reading
|
|
175
|
+
|
|
176
|
+
**退出:** 全 sufficient → 推进 | 2 轮上限 → 记录 gap 继续。记录至 `evidence.ndjson` + `session.json.self_iteration_log[]`.
|
|
177
|
+
</self_iteration>
|
|
178
|
+
|
|
179
|
+
<state_machine>
|
|
180
|
+
|
|
181
|
+
<states>
|
|
182
|
+
S_INTAKE — 解析问题、加载上下文、检查/恢复 session PERSIST: session.json + understanding.md §1
|
|
183
|
+
S_ARCHAEOLOGY — 考古:git history + CLI 分析 PERSIST: evidence.ndjson (archaeology) + understanding.md §2
|
|
184
|
+
S_EXPLORE — CLI 探索:调用链、错误间隙、相似模式 PERSIST: explore.json + evidence.ndjson (explore) + understanding.md §3
|
|
185
|
+
S_DIAGNOSE — 假设驱动根因分析 PERSIST: evidence.ndjson (diagnosis|decision) + understanding.md §4-5
|
|
186
|
+
S_FIX — 实现修复 (skip_fix 时跳过) PERSIST: code changes + evidence.ndjson (decision)
|
|
187
|
+
S_CONFIRM — 测试 + CLI review 双重确认 (skip_fix 时跳过) PERSIST: session.json.confirmation + understanding.md §6
|
|
188
|
+
S_GENERALIZE — 举一反三:提取 pattern,扫描相似代码 PERSIST: session.json.patterns + understanding.md §7
|
|
189
|
+
S_DISCOVER — 评估发现,创建 issue / 记录决策 PERSIST: evidence.ndjson (discovery|decision) + understanding.md §8
|
|
190
|
+
S_RECORD — 知识沉淀 + 目标审计 PERSIST: understanding.md §9 + spec entries
|
|
191
|
+
</states>
|
|
192
|
+
|
|
193
|
+
<transitions>
|
|
194
|
+
S_INTAKE → S_INTAKE : -c + session found → A_RESUME_SESSION
|
|
195
|
+
S_INTAKE → S_ARCHAEOLOGY : issue parsed → A_INTAKE
|
|
196
|
+
S_INTAKE → S_INTAKE : no issue, no session → AskUserQuestion
|
|
197
|
+
|
|
198
|
+
S_ARCHAEOLOGY → S_EXPLORE : A_ARCHAEOLOGY complete
|
|
199
|
+
S_EXPLORE → S_DIAGNOSE : A_EXPLORE complete
|
|
200
|
+
|
|
201
|
+
S_DIAGNOSE → S_FIX : root cause confirmed, !skip_fix
|
|
202
|
+
S_DIAGNOSE → S_GENERALIZE : root cause confirmed, skip_fix, !skip_generalize
|
|
203
|
+
S_DIAGNOSE → S_RECORD : root cause confirmed, skip_fix, skip_generalize
|
|
204
|
+
S_DIAGNOSE → S_DIAGNOSE : all hypotheses failed, retries < 3 → A_ESCALATE_DIAGNOSIS
|
|
205
|
+
S_DIAGNOSE → S_RECORD : all hypotheses failed, retries >= 3 → mark INCONCLUSIVE
|
|
206
|
+
|
|
207
|
+
S_FIX → S_CONFIRM : fix implemented
|
|
208
|
+
S_CONFIRM → S_GENERALIZE : confirmed, !skip_generalize
|
|
209
|
+
S_CONFIRM → S_RECORD : confirmed, skip_generalize
|
|
210
|
+
S_CONFIRM → S_FIX : needs_rework
|
|
211
|
+
|
|
212
|
+
S_GENERALIZE → S_DISCOVER : similar code found
|
|
213
|
+
S_GENERALIZE → S_RECORD : no similar code
|
|
214
|
+
|
|
215
|
+
S_DISCOVER → S_DIAGNOSE : discovery finds new bug worth investigating, loops < max_loops → cross_phase_loops++
|
|
216
|
+
S_DISCOVER → S_FIX : discovery finds same-pattern bug, fix template applies, loops < max_loops → cross_phase_loops++
|
|
217
|
+
S_DISCOVER → S_RECORD : triage complete OR loops >= max_loops (剩余项 → issue/decision)
|
|
218
|
+
|
|
219
|
+
S_RECORD → END : A_RECORD complete
|
|
220
|
+
</transitions>
|
|
221
|
+
|
|
222
|
+
<actions>
|
|
223
|
+
|
|
224
|
+
### A_INTAKE
|
|
225
|
+
1. Parse arguments: issue description, flags
|
|
226
|
+
2. Generate slug, create `SESSION_DIR`
|
|
227
|
+
3. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + Grep keywords
|
|
228
|
+
4. Derive `phase_goals[]` from flags (apply `skip_when`)
|
|
229
|
+
5. Write `session.json` + `understanding.md` §1
|
|
230
|
+
6. Emit Goal Prompt (see Appendix)
|
|
231
|
+
|
|
232
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): INTAKE — 目标解析与上下文加载"`
|
|
233
|
+
|
|
234
|
+
### A_RESUME_SESSION
|
|
235
|
+
Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
|
|
236
|
+
|
|
237
|
+
### A_ARCHAEOLOGY
|
|
238
|
+
**Git archaeology (2 parallel Agents):**
|
|
239
|
+
|
|
240
|
+
| Agent | Task |
|
|
241
|
+
|-------|------|
|
|
242
|
+
| Timeline | `git log --oneline -20 -- {files}` → change timeline |
|
|
243
|
+
| Blame | Top 3 suspicious files: `git blame -L {region}` → critical paths |
|
|
244
|
+
|
|
245
|
+
Append findings to `evidence.ndjson` (phase: "archaeology").
|
|
246
|
+
|
|
247
|
+
**CLI-assisted change review:**
|
|
248
|
+
```bash
|
|
249
|
+
maestro delegate "PURPOSE: Review recent modifications related to: {issue}
|
|
250
|
+
TASK: Analyze intent behind changes | Identify risky modifications | Flag potential bug sources
|
|
251
|
+
MODE: analysis
|
|
252
|
+
CONTEXT: @{relevant_files} | Git log: {top_10_commits}
|
|
253
|
+
EXPECTED: JSON [{commit_sha, risk_level, analysis, could_cause_issue, explanation}]
|
|
254
|
+
CONSTRAINTS: Focus on behavioral changes, not formatting
|
|
255
|
+
" --role analyze --mode analysis
|
|
256
|
+
```
|
|
257
|
+
Run_in_background, STOP, wait for callback. Append results to evidence.
|
|
258
|
+
|
|
259
|
+
Update `understanding.md` §2.
|
|
260
|
+
|
|
261
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): ARCHAEOLOGY — git 考古分析"`
|
|
262
|
+
|
|
263
|
+
### A_EXPLORE
|
|
264
|
+
Skip if no enabled CLI tools (W006).
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
maestro delegate "PURPOSE: Gather codebase evidence for: {issue}
|
|
268
|
+
TASK: Trace call chains | Find recent changes | Identify error gaps | Check similar patterns
|
|
269
|
+
MODE: analysis
|
|
270
|
+
CONTEXT: @**/*
|
|
271
|
+
EXPECTED: JSON {call_chains, recent_changes, error_gaps, similar_patterns}
|
|
272
|
+
CONSTRAINTS: Max 20 entries/category | Symptom-related code paths
|
|
273
|
+
Symptoms: {issue} Archaeology hints: {suspicious_commits}
|
|
274
|
+
" --role explore --mode analysis
|
|
275
|
+
```
|
|
276
|
+
Run_in_background, STOP, wait for callback.
|
|
277
|
+
|
|
278
|
+
Parse → write `explore.json` + append `evidence.ndjson` (phase: "explore"). Update §3. Mark G2 done.
|
|
279
|
+
|
|
280
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): EXPLORE — 代码探索完成"`
|
|
281
|
+
|
|
282
|
+
### A_DIAGNOSE
|
|
283
|
+
1. **Form hypotheses** from evidence (archaeology + explore), ranked [HIGH]/[MEDIUM]/[LOW] → §4
|
|
284
|
+
2. **Test each** (rank order): design test → execute → append evidence (phase: "diagnosis")
|
|
285
|
+
3. **Decision journal**: ambiguity → evidence (phase: "decision"); Normal: AskUserQuestion | `-y`: defer
|
|
286
|
+
4. **Root cause**: confirmed → `session.json.root_cause` + §5. Mark G1 done.
|
|
287
|
+
|
|
288
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): DIAGNOSE — 根因确认"`
|
|
289
|
+
|
|
290
|
+
### A_ESCALATE_DIAGNOSIS
|
|
291
|
+
Increment `diagnosis_retries`. If < 3: broaden scope via `maestro delegate --role analyze` (same delegate format), form new hypotheses, return to S_DIAGNOSE. If >= 3: Normal → AskUserQuestion (broaden/new/INCONCLUSIVE) | `-y` → auto INCONCLUSIVE, proceed to S_RECORD. See Appendix: `-y` behavior.
|
|
292
|
+
|
|
293
|
+
### A_FIX
|
|
294
|
+
1. Present root cause + proposed fix. Normal: AskUserQuestion | `-y`: auto proceed (see Appendix)
|
|
295
|
+
2. Implement fix
|
|
296
|
+
3. Record in evidence (phase: "decision")
|
|
297
|
+
|
|
298
|
+
📌 **Auto-commit**: `git add -A && git commit -m "odyssey-debug({slug}): FIX — {修复摘要}"`
|
|
299
|
+
|
|
300
|
+
### A_CONFIRM
|
|
301
|
+
1. **Tests**: auto-detect framework, run covering tests
|
|
302
|
+
2. **CLI fix review**:
|
|
303
|
+
```bash
|
|
304
|
+
maestro delegate "PURPOSE: Review fix for: {issue}
|
|
305
|
+
TASK: Verify correctness | Check regressions | Assess completeness | Review edge cases
|
|
306
|
+
MODE: analysis
|
|
307
|
+
CONTEXT: @{modified_files} | Root cause: {summary} | Diff: {git_diff}
|
|
308
|
+
EXPECTED: JSON {verdict, findings [{severity, description, suggestion}], regression_risk}
|
|
309
|
+
CONSTRAINTS: Focus on correctness, not style
|
|
310
|
+
" --role review --mode analysis
|
|
311
|
+
```
|
|
312
|
+
Run_in_background, STOP, wait for callback.
|
|
313
|
+
|
|
314
|
+
3. Write `session.json.confirmation`: `{test_result, cli_review, overall: "confirmed|needs_rework", timestamp}`
|
|
315
|
+
4. Update §6. `needs_rework` → S_FIX. `confirmed` → mark G3 done, advance.
|
|
316
|
+
|
|
317
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): CONFIRM — 修复验证"`
|
|
318
|
+
|
|
319
|
+
### A_GENERALIZE
|
|
320
|
+
举一反三: multi-layer pattern extraction → 4-agent scan → cross-layer dedup → iterative deepening.
|
|
321
|
+
|
|
322
|
+
**Pattern extraction** from root cause + fix:
|
|
323
|
+
|
|
324
|
+
| Layer | Method | Example |
|
|
325
|
+
|-------|--------|---------|
|
|
326
|
+
| Syntax | Regex patterns (direct Grep) | `eval(`, missing `await`, unclosed resource |
|
|
327
|
+
| Semantic | Anti-pattern description (Agent-driven) | Unhandled async errors, unvalidated input |
|
|
328
|
+
| Structural | Architecture-level (file/module similarity) | Same import structure, missing override |
|
|
329
|
+
|
|
330
|
+
Write `session.json.patterns[]`: `[{id, source, layer, signature, description, risk, fix_template}]`
|
|
331
|
+
|
|
332
|
+
**4-agent parallel codebase scan:**
|
|
333
|
+
|
|
334
|
+
| Agent | Strategy | Input | Scope |
|
|
335
|
+
|-------|----------|-------|-------|
|
|
336
|
+
| Syntax grep | Grep syntax-layer regex | P*.signature | Full project |
|
|
337
|
+
| Semantic scan | Understand + check anti-pattern | P*.description | Related modules |
|
|
338
|
+
| Structural match | Find structurally similar files | Buggy file structure | Full project |
|
|
339
|
+
| Historical grep | `git log -S "{pattern}"` | P*.signature | Full git history |
|
|
340
|
+
|
|
341
|
+
Returns: `[{pattern_id, file, line, context, risk_level, layer, confidence}]`
|
|
342
|
+
|
|
343
|
+
**Cross-layer dedup**: same file:line multi-layer hit → boost confidence | single-layer → `needs_review` | historical hit on fixed record → `regression_risk`
|
|
344
|
+
|
|
345
|
+
**Iterative deepening**: module with ≥3 hits → targeted deep scan (max 1 round).
|
|
346
|
+
|
|
347
|
+
**Quality Gate** (self-iteration) → if insufficient, expand and re-scan.
|
|
348
|
+
|
|
349
|
+
Write §7 + `session.json.generalization_stats`: `{patterns_extracted, total_hits, cross_layer_confirmed, regression_risks, by_layer, deepening_triggered}`. Mark G4 done.
|
|
350
|
+
|
|
351
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): GENERALIZE — 泛化扫描完成"`
|
|
352
|
+
|
|
353
|
+
### A_DISCOVER
|
|
354
|
+
1. **Triage** each hit: read ±10 lines context → classify `safe`/`risk`/`bug`
|
|
355
|
+
2. **Route**: see Appendix `-y` behavior table. Append evidence (phase: "discovery" + "decision")
|
|
356
|
+
3. Update §8. Mark G5 done.
|
|
357
|
+
|
|
358
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): DISCOVER — 发现分类完成"`
|
|
359
|
+
|
|
360
|
+
### A_RECORD
|
|
361
|
+
1. Finalize `understanding.md` §9
|
|
362
|
+
2. **Write learnings** to understanding.md §9: 按 Knowledge Persistence 表分类记录(临时),completion summary 列出建议的 `/spec-add` 命令
|
|
363
|
+
3. Mark G6 done. Process pending decisions: Normal → AskUserQuestion | `-y` → skip (show deferred count)
|
|
364
|
+
4. **Goal audit**: all `completion_confirmed` true → `phase_goals_all_done = true`. Any false: Normal → AskUserQuestion (回退/跳过/接受) | `-y` → auto accept
|
|
365
|
+
5. **Completion**: `current_state = "COMPLETED"`, emit summary:
|
|
366
|
+
```
|
|
367
|
+
--- DEBUG ODYSSEY COMPLETE ---
|
|
368
|
+
Issue: {issue}
|
|
369
|
+
Root cause: {root_cause.hypothesis}
|
|
370
|
+
Fix: {applied|skipped|inconclusive}
|
|
371
|
+
Patterns: {patterns_extracted} ({by_layer} distribution)
|
|
372
|
+
Scan hits: {total_hits} ({cross_layer_confirmed} cross-layer confirmed)
|
|
373
|
+
Issues: {N} created
|
|
374
|
+
Decisions: {N} resolved, {M} pending, {K} deferred
|
|
375
|
+
Learnings: {N} spec entries persisted
|
|
376
|
+
Self-iter: {N} quality gate rounds across {M} stages
|
|
377
|
+
Goals: {done}/{total} confirmed ({skipped} skipped)
|
|
378
|
+
---
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-debug({slug}): RECORD — 会话总结与知识沉淀"`
|
|
382
|
+
|
|
383
|
+
</actions>
|
|
384
|
+
|
|
385
|
+
<appendix>
|
|
386
|
+
|
|
387
|
+
### Goal Prompt Template
|
|
388
|
+
|
|
389
|
+
**时机守卫:仅在 A_INTAKE 完成后显示一次。A_RECORD 完成时禁止重新显示。**
|
|
390
|
+
|
|
391
|
+
```
|
|
392
|
+
📋 Debug Odyssey 会话已创建。可随时复制以下 /goal 设定终止条件:
|
|
393
|
+
|
|
394
|
+
/goal 穷尽迭代:直到根因确认(或明确 INCONCLUSIVE)且修复验证通过
|
|
395
|
+
且泛化扫描穷尽(所有 hits 已分类处理)且 phase_goals_all_done=true 才停。
|
|
396
|
+
假设失败时扩范围→换视角→升级工具,不轻易放弃。
|
|
397
|
+
泛化发现的同类 bug 全部修复或创建 issue,不允许遗留。
|
|
398
|
+
遇到 phase=decision 的 pending 必须 AskUserQuestion,不得自行 resolve。
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
Odyssey 输出提示词后继续执行不阻塞。`/goal` 由用户任意时刻输入。
|
|
402
|
+
|
|
403
|
+
### `-y` Auto-Confirm Behavior
|
|
404
|
+
|
|
405
|
+
| Decision Point | Normal | `-y` mode |
|
|
406
|
+
|---------------|--------|-----------|
|
|
407
|
+
| A_DIAGNOSE ambiguity | AskUserQuestion blocks | record `deferred`, best-effort continue |
|
|
408
|
+
| A_ESCALATE 3-strike | AskUserQuestion 3-way | auto INCONCLUSIVE |
|
|
409
|
+
| A_FIX direction | AskUserQuestion confirm | auto proceed with suggested fix |
|
|
410
|
+
| A_DISCOVER bug triage | AskUserQuestion route | auto create issue |
|
|
411
|
+
| A_DISCOVER ambiguous | AskUserQuestion batch | all `deferred` |
|
|
412
|
+
| A_RECORD decisions | AskUserQuestion per-item | skip, show deferred count |
|
|
413
|
+
| A_RECORD goal audit | AskUserQuestion 3-way | auto accept current state |
|
|
414
|
+
|
|
415
|
+
`deferred` items shown as "待决策" in completion summary; recoverable via `-c`.
|
|
416
|
+
|
|
417
|
+
### Phase Goal Lifecycle
|
|
418
|
+
|
|
419
|
+
`pending → done (confirmed=true)` normal | `pending → skipped (confirmed=true)` flags/manual | `pending → failed (confirmed=false)` INCONCLUSIVE
|
|
420
|
+
|
|
421
|
+
`phase_goals_all_done = true` only when ALL goals have `completion_confirmed == true`.
|
|
422
|
+
|
|
423
|
+
</appendix>
|
|
424
|
+
|
|
425
|
+
</state_machine>
|
|
426
|
+
|
|
427
|
+
<error_codes>
|
|
428
|
+
| Code | Severity | Condition | Recovery |
|
|
429
|
+
|------|----------|-----------|----------|
|
|
430
|
+
| E001 | error | No issue and no session to resume | Provide issue or use -c |
|
|
431
|
+
| E003 | error | Resume but no session found | Start new session |
|
|
432
|
+
| E004 | error | Delegate execution failed | Retry or proceed without CLI |
|
|
433
|
+
| W001 | warning | No relevant git history | Proceed with limited context |
|
|
434
|
+
| W002 | warning | All hypotheses inconclusive after 3 retries | INCONCLUSIVE |
|
|
435
|
+
| W003 | warning | Generalization scan 0 hits | Skip discovery |
|
|
436
|
+
| W004 | warning | Delegate parse failed | Use raw output |
|
|
437
|
+
| W005 | warning | Pending decisions unresolved | Filter evidence.ndjson phase=decision |
|
|
438
|
+
| W006 | warning | CLI exploration skipped (no tools) | Proceed without explore.json |
|
|
439
|
+
</error_codes>
|
|
440
|
+
|
|
441
|
+
<success_criteria>
|
|
442
|
+
- [ ] Session directory created with 4 output files
|
|
443
|
+
- [ ] Prior knowledge searched (maestro search + sessions + architecture)
|
|
444
|
+
- [ ] Git archaeology (log + blame) + CLI change review, evidence.ndjson phase=archaeology
|
|
445
|
+
- [ ] CLI exploration, explore.json written, evidence phase=explore
|
|
446
|
+
- [ ] Hypotheses formed from archaeology + explore, tested and logged phase=diagnosis
|
|
447
|
+
- [ ] Root cause declared with evidence refs
|
|
448
|
+
- [ ] understanding.md tracks all 9 sections progressively
|
|
449
|
+
- [ ] Fix implemented + confirmed with test + CLI review (unless --skip-fix)
|
|
450
|
+
- [ ] Multi-layer patterns (syntax/semantic/structural) extracted (unless --skip-generalize)
|
|
451
|
+
- [ ] 4-agent scan + cross-layer dedup + iterative deepening for ≥3 hits/module
|
|
452
|
+
- [ ] Discoveries classified and routed (fix/issue/decision/skip)
|
|
453
|
+
- [ ] Decision journal: all human-judgment items in evidence.ndjson phase=decision
|
|
454
|
+
- [ ] phase_goals derived from flags, skip_when applied, each phase marks its goal
|
|
455
|
+
- [ ] Goal audit in A_RECORD — unmet goals surfaced, phase_goals_all_done set correctly
|
|
456
|
+
- [ ] Goal Prompt displayed once after session creation
|
|
457
|
+
- [ ] `-y`: all decisions auto-resolve/defer, deferred count in summary
|
|
458
|
+
- [ ] State saved at each transition (resumable via -c)
|
|
459
|
+
- [ ] Quality Gate self-iteration when insufficient, logged in self_iteration_log
|
|
460
|
+
- [ ] Spec entries persisted for reusable learnings
|
|
461
|
+
- [ ] Completion summary with all stats
|
|
462
|
+
</success_criteria>
|
|
463
|
+
|
|
464
|
+
<next_step_routing>
|
|
465
|
+
| Condition | Next step |
|
|
466
|
+
|-----------|-----------|
|
|
467
|
+
| Issues from discoveries | `/manage-issue list --source debug-odyssey` |
|
|
468
|
+
| Pattern worth documenting | `/learn-decompose <module>` |
|
|
469
|
+
| Fix needs formal review | `/quality-review <phase>` |
|
|
470
|
+
| Second opinion on root cause | `/learn-second-opinion <understanding.md>` |
|
|
471
|
+
| Related question | `/learn-investigate "<question>"` |
|
|
472
|
+
| Decisions still pending | Filter evidence.ndjson phase=decision status=pending |
|
|
473
|
+
</next_step_routing>
|