maestro-flow 0.5.39 → 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 (139) 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/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 +176 -150
  52. package/.codex/skills/odyssey-improve/SKILL.md +210 -177
  53. package/.codex/skills/odyssey-planex/SKILL.md +162 -242
  54. package/.codex/skills/odyssey-review-test-fix/SKILL.md +96 -90
  55. package/.codex/skills/odyssey-ui/SKILL.md +211 -179
  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/src/commands/install-backend.js +19 -0
  71. package/dashboard/dist-server/src/commands/install-backend.js.map +1 -1
  72. package/dashboard/dist-server/src/core/manifest.d.ts +5 -0
  73. package/dashboard/dist-server/src/core/manifest.js.map +1 -1
  74. package/dashboard/dist-server/src/core/plugin-bridge.d.ts +59 -0
  75. package/dashboard/dist-server/src/core/plugin-bridge.js +355 -0
  76. package/dashboard/dist-server/src/core/plugin-bridge.js.map +1 -0
  77. package/dashboard/dist-server/src/tools/spec-loader.js +27 -19
  78. package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
  79. package/dashboard/dist-server/src/tools/spec-seeds.d.ts +8 -0
  80. package/dashboard/dist-server/src/tools/spec-seeds.js +114 -0
  81. package/dashboard/dist-server/src/tools/spec-seeds.js.map +1 -1
  82. package/dist/src/cli.js +19 -1
  83. package/dist/src/cli.js.map +1 -1
  84. package/dist/src/commands/install-backend.d.ts.map +1 -1
  85. package/dist/src/commands/install-backend.js +19 -0
  86. package/dist/src/commands/install-backend.js.map +1 -1
  87. package/dist/src/commands/install.d.ts.map +1 -1
  88. package/dist/src/commands/install.js +17 -1
  89. package/dist/src/commands/install.js.map +1 -1
  90. package/dist/src/commands/plugin.d.ts +3 -0
  91. package/dist/src/commands/plugin.d.ts.map +1 -0
  92. package/dist/src/commands/plugin.js +137 -0
  93. package/dist/src/commands/plugin.js.map +1 -0
  94. package/dist/src/commands/spec.d.ts.map +1 -1
  95. package/dist/src/commands/spec.js +13 -3
  96. package/dist/src/commands/spec.js.map +1 -1
  97. package/dist/src/commands/update.d.ts.map +1 -1
  98. package/dist/src/commands/update.js +23 -0
  99. package/dist/src/commands/update.js.map +1 -1
  100. package/dist/src/core/install-executor.d.ts +1 -1
  101. package/dist/src/core/install-executor.d.ts.map +1 -1
  102. package/dist/src/core/install-executor.js +27 -0
  103. package/dist/src/core/install-executor.js.map +1 -1
  104. package/dist/src/core/install-profile.d.ts +5 -0
  105. package/dist/src/core/install-profile.d.ts.map +1 -1
  106. package/dist/src/core/install-profile.js +8 -0
  107. package/dist/src/core/install-profile.js.map +1 -1
  108. package/dist/src/core/manifest.d.ts +5 -0
  109. package/dist/src/core/manifest.d.ts.map +1 -1
  110. package/dist/src/core/manifest.js.map +1 -1
  111. package/dist/src/core/plugin-bridge.d.ts +60 -0
  112. package/dist/src/core/plugin-bridge.d.ts.map +1 -0
  113. package/dist/src/core/plugin-bridge.js +355 -0
  114. package/dist/src/core/plugin-bridge.js.map +1 -0
  115. package/dist/src/tools/spec-init.d.ts +4 -3
  116. package/dist/src/tools/spec-init.d.ts.map +1 -1
  117. package/dist/src/tools/spec-init.js +9 -5
  118. package/dist/src/tools/spec-init.js.map +1 -1
  119. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  120. package/dist/src/tools/spec-loader.js +27 -19
  121. package/dist/src/tools/spec-loader.js.map +1 -1
  122. package/dist/src/tools/spec-seeds.d.ts +8 -0
  123. package/dist/src/tools/spec-seeds.d.ts.map +1 -1
  124. package/dist/src/tools/spec-seeds.js +114 -0
  125. package/dist/src/tools/spec-seeds.js.map +1 -1
  126. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  127. package/dist/src/tui/install-ui/InstallFlow.js +43 -14
  128. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  129. package/dist/src/tui/install-ui/types.d.ts +2 -0
  130. package/dist/src/tui/install-ui/types.d.ts.map +1 -1
  131. package/dist/src/tui/install-ui/types.js.map +1 -1
  132. package/dist/src/tui/install-ui/useInstallFlowState.d.ts.map +1 -1
  133. package/dist/src/tui/install-ui/useInstallFlowState.js +13 -1
  134. package/dist/src/tui/install-ui/useInstallFlowState.js.map +1 -1
  135. package/dist/src/utils/update-notices.js +11 -0
  136. package/dist/src/utils/update-notices.js.map +1 -1
  137. package/package.json +1 -1
  138. package/workflows/odyssey-base-codex.md +306 -0
  139. package/workflows/shell-exec-protocol.md +30 -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,198 +63,249 @@ $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
94
-
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-*")` → 先前会话
75
+ 8. Improvement Metrics ← S_RECORD | 9. Engineering Learnings ← S_RECORD
99
76
 
100
- ### Knowledge Persistence(S_RECORD 中写入产出文件)
77
+ **Knowledge Persistence categories (written to understanding.md section 9):**
101
78
 
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
- Self-iteration 适用阶段: S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE
87
+ <csv_schema>
88
+
89
+ ### Shared Output Schema (all waves)
90
+ ```json
91
+ {
92
+ "type": "object",
93
+ "properties": {
94
+ "id": { "type": "string" },
95
+ "result_status": { "type": "string", "enum": ["completed", "failed"] },
96
+ "findings": { "type": "string", "maxLength": 500 },
97
+ "evidence": { "type": "string" },
98
+ "error": { "type": "string" }
99
+ },
100
+ "required": ["id", "result_status", "findings"]
101
+ }
102
+ ```
103
+
104
+ **Termination contract:** Call `report_agent_job_result` EXACTLY ONCE. Read-only. Do NOT modify source files, tasks.csv, wave-*.csv, results.csv, or call spawn_agents_on_csv.
105
+
106
+ ### tasks.csv
107
+ ```csv
108
+ id,title,description,task_type,dimension,deps,wave,status,findings,evidence,error
109
+ ```
110
+
111
+ **Waves:**
112
+ | Wave | Tasks | Parallelism |
113
+ |------|-------|-------------|
114
+ | 1 | Survey (dependency-audit, complexity-scan) | 2 agents |
115
+ | 2 | Audit (performance, security, architecture, reliability, observability, maintainability) | 6 agents |
116
+ | 3 | Generalization (syntax-grep, semantic-scan, structural-match, historical-grep) | 4 agents |
117
+ </csv_schema>
118
+
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>
113
126
 
114
127
  <state_machine>
115
128
 
116
129
  <states>
117
- S_INTAKE Parse target, load context, establish baseline metrics PERSIST: session.json + understanding.md §1
118
- S_SURVEY — Current state: dependency audit, complexity scan, coverage PERSIST: evidence.ndjson (survey) + understanding.md §2
119
- S_AUDIT — 6-dimension parallel deep audit PERSIST: evidence.ndjson (audit) + understanding.md §3
120
- S_DIAGNOSE — Root cause analysis for critical/high findings PERSIST: evidence.ndjson (diagnosis|decision) + understanding.md §4
121
- S_FIX — Implement improvements (skip if --skip-fix) PERSIST: code changes + evidence.ndjson (fix)
122
- S_VERIFY — Tests + measurement comparison (skip if --skip-fix) PERSIST: session.json.confirmation + understanding.md §5
123
- S_GENERALIZE — Pattern extraction + 4-agent scan (skip if --skip-gen) PERSIST: session.json.patterns + understanding.md §6
124
- S_DISCOVER — Classify hits, create issues (skip if --skip-gen) PERSIST: evidence.ndjson (discovery|decision) + understanding.md §7
125
- 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
126
131
  </states>
127
132
 
128
133
  <transitions>
129
- S_INTAKE:
130
- S_INTAKE WHEN -c + session found DO A_RESUME
131
- S_SURVEY WHEN target resolved DO A_INTAKE
132
- → S_INTAKE WHEN no target DO request_user_input
133
-
134
- S_SURVEY → S_AUDIT DO A_SURVEY
135
-
136
- S_AUDIT:
137
- S_DIAGNOSE WHEN critical/high findings exist DO A_AUDIT
138
- → S_GENERALIZE WHEN no critical/high AND !skip_gen DO A_AUDIT
139
- S_RECORD WHEN no findings OR skip_gen DO A_AUDIT
140
-
141
- S_DIAGNOSE:
142
- S_FIX WHEN root causes identified AND !skip_fix DO A_DIAGNOSE
143
- S_GENERALIZE WHEN root causes identified AND skip_fix AND !skip_gen DO A_DIAGNOSE
144
- → S_RECORD WHEN root causes identified AND skip_fix AND skip_gen DO A_DIAGNOSE
145
- S_DIAGNOSE WHEN hypotheses failed AND retries < 3 DO A_ESCALATE_DIAGNOSIS
146
- → S_RECORD WHEN hypotheses failed AND retries >= 3 DO mark INCONCLUSIVE
147
-
148
- S_FIX S_VERIFY DO A_FIX
149
-
150
- S_VERIFY:
151
- S_GENERALIZE WHEN verified AND !skip_gen DO A_VERIFY
152
- → S_RECORD WHEN verified AND skip_gen DO A_VERIFY
153
- → S_FIX WHEN needs_rework DO A_VERIFY
154
-
155
- S_GENERALIZE:
156
- S_DISCOVER WHEN hits found DO A_GENERALIZE
157
- → S_RECORD WHEN no hits DO A_GENERALIZE
158
-
159
- S_DISCOVER S_DIAGNOSE : new critical issue found → cross_phase_loops++
160
- S_DISCOVER → S_FIX : same-pattern fix, !skip_fix → cross_phase_loops++
161
- S_DISCOVER → S_RECORD : triage complete AND remaining_actionable == 0
162
- S_DISCOVER → S_RECORD : loops >= max_loops → MUST log each unfixed item with specific reason (blanket "pre-existing" is forbidden)
163
-
164
- 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
165
165
  </transitions>
166
166
 
167
167
  <actions>
168
168
 
169
169
  ### A_INTAKE
170
- 1. Parse arguments: target description, flags, `--dimensions` subset
171
- 2. Generate slug, create `SESSION_DIR`
172
- 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
173
173
  4. **Baseline capture**: Record current metrics (test pass rate, bundle size, dependency count, complexity hotspots) to `session.json.baseline_metrics`
174
- 5. Derive `phase_goals[]` from flags (apply `skip_when`)
175
- 6. Write `session.json` + `understanding.md` §1 (Target & Baseline)
176
- 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
177
176
 
178
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): INTAKE — 目标解析与基线采集"`
177
+ Commit: `"odyssey-improve({slug}): INTAKE — target parsed and baseline captured"`
179
178
 
180
179
  ### A_RESUME
181
- 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`.
182
181
 
183
182
  ### A_SURVEY
184
- Current state survey — understand what exists before proposing changes.
183
+ **spawn_agents_on_csv (Wave 1):**
184
+
185
+ Write `tasks.csv` with Wave 1 rows:
186
+ ```csv
187
+ "survey-deps","Dependency Audit","Analyze dependencies for {target_files}: package versions, known CVEs, unused deps, circular imports, dep depth. Return [{dep,version,issue_type,severity,detail}].","survey","","","1","pending","","",""
188
+ "survey-complexity","Complexity Scan","Measure complexity for {target_files}: cyclomatic complexity, function length, nesting depth, file size, export count. Return [{file,metric,value,threshold,status}].","survey","","","1","pending","","",""
189
+ ```
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 })`
185
191
 
186
- 1. Dependency audit (package.json/lock), complexity scan (size/nesting), test coverage map, error handling scan (empty catch, unhandled promise)
187
- 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`.
188
- 3. Append evidence.ndjson (phase: "survey"). Update `understanding.md` §2. Mark G1 done.
192
+ Merge evidence.ndjson (phase: "survey"). Extract `baseline_metrics`. Update section 2. Mark G1.
189
193
 
190
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): SURVEY — 现状调查"`
194
+ Commit: `"odyssey-improve({slug}): SURVEY — current state survey"`
191
195
 
192
196
  ### A_AUDIT
193
- Spawn 6 parallel agents via `spawn_agents_on_csv` (one per dimension from Dimensions list above, or `--dimensions` subset).
194
- Each returns: `[{title, severity, dimension, file, line, description, suggestion, measurement}]`
197
+ **spawn_agents_on_csv (Wave 2)** 6 agents (one per dimension, or `--dimensions` subset):
198
+
199
+ Append Wave 2 rows to `tasks.csv`:
200
+ ```csv
201
+ "audit-perf","Performance","Hot paths, N+1 queries, memory allocation, cache strategy, bundle analysis, lazy loading for {target_files}","audit","performance","","2","pending","","",""
202
+ "audit-security","Security","OWASP Top 10: injection, broken auth, data exposure, XXE, access control, misconfig, XSS, deserialization, deps, logging for {target_files}","audit","security","","2","pending","","",""
203
+ "audit-arch","Architecture","Layer boundaries, circular deps, coupling metrics, interface contracts, SRP compliance, dependency direction for {target_files}","audit","architecture","","2","pending","","",""
204
+ "audit-reliability","Reliability","Error handling completeness, retry logic, timeout config, circuit breakers, graceful degradation, resource cleanup for {target_files}","audit","reliability","","2","pending","","",""
205
+ "audit-observability","Observability","Logging coverage, structured logs, metrics emission, trace propagation, error reporting, health endpoints for {target_files}","audit","observability","","2","pending","","",""
206
+ "audit-maintain","Maintainability","Dead code, complex conditionals, test coverage gaps, magic numbers, naming clarity, doc debt for {target_files}","audit","maintainability","","2","pending","","",""
207
+ ```
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 })`
195
209
 
196
- Merge → evidence.ndjson (phase: "audit"). Write `session.json.audit_result`.
197
- 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.
198
212
 
199
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): AUDIT — 多维审查"`
213
+ Commit: `"odyssey-improve({slug}): AUDIT — multi-dimensional audit"`
200
214
 
201
215
  ### A_DIAGNOSE
202
- Root cause analysis for critical/high findings — don't fix symptoms.
216
+ Root cause analysis for critical/high findings.
203
217
 
204
- 1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence.ndjson (phase: "diagnosis")
205
- 2. **Decision journal**: ambiguity → evidence (phase: "decision"); Normal: request_user_input | `-y`: defer
206
- 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`.
207
- 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.
208
222
 
209
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): DIAGNOSE — 根因诊断"`
223
+ Commit: `"odyssey-improve({slug}): DIAGNOSE — root cause analysis"`
210
224
 
211
225
  ### A_ESCALATE_DIAGNOSIS
212
- 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.
213
227
 
214
228
  ### A_FIX
215
- 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.
216
230
 
217
- 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.
218
- 2. For each fix: implement → record evidence.ndjson (phase: "fix")
219
- 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.
220
232
 
221
- 📌 **Auto-commit**: `git add -A && git commit -m "odyssey-improve({slug}): FIX — 改进实现"`
233
+ Commit: `"odyssey-improve({slug}): FIX — improvements implemented"`
222
234
 
223
235
  ### A_VERIFY
224
236
  1. Run tests covering modified areas
225
237
  2. Re-capture metrics, compare with `session.json.baseline_metrics`
226
- 3. **CLI-assisted**: `maestro delegate --role review --mode analysis` to check fix correctness, test regressions, measure impact vs baseline. Execute `run_in_background: true`.
227
- 4. `needs_rework` → S_FIX. `verified` → mark G4 done, advance.
228
- 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.
229
241
 
230
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): VERIFY — 改进验证"`
242
+ Commit: `"odyssey-improve({slug}): VERIFY — improvements verified"`
231
243
 
232
244
  ### A_GENERALIZE
233
- base A_GENERALIZE 执行。Pattern 来源: diagnoses + fixes。Mark G5 done.
234
-
235
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): GENERALIZE — 泛化扫描"`
236
-
237
- ### A_DISCOVER
238
- base A_DISCOVER 执行。Mark G6 done.
239
-
240
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): DISCOVER — 发现分类"`
241
-
242
- ### A_RECORD
243
- 1. **understanding.md §8**: Improvement metrics before/after comparison table from baseline_metrics vs current
244
- 2. **understanding.md §9**: Engineering learnings — 按 Knowledge Persistence 表分类记录(临时),completion summary 列出建议的 `/spec-add` 命令
245
- 3. Mark G7 done. Pending decisions: **Normal** → request_user_input. **`-y`** → skip, show deferred count.
246
- 4. 其余按 base A_RECORD 执行。
247
- 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).
248
-
249
- 📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): RECORD指标总结与知识沉淀"`
245
+ Base shared_actions. Improve overrides:
246
+ - Pattern source: diagnoses + fixes
247
+
248
+ **Wave 3 — spawn_agents_on_csv (4 agents):**
249
+
250
+ Append Wave 3 rows to `tasks.csv`:
251
+ ```csv
252
+ "gen-syntax","Syntax Grep","Grep syntax-layer signatures '${signatures}' across project. Return [{file,line,context,risk_level,layer:'syntax',confidence}].","generalization","syntax","","3","pending","","",""
253
+ "gen-semantic","Semantic Scan","Check related modules for anti-pattern: ${description}. Return [{file,line,context,risk_level,layer:'semantic',confidence}].","generalization","semantic","","3","pending","","",""
254
+ "gen-structural","Structural Match","Find structurally similar files to ${diagnosed_files}, check for same anti-pattern. Return [{file,line,description,risk,layer:'structural',confidence}].","generalization","structural","","3","pending","","",""
255
+ "gen-historical","Historical Grep","Run git log -S '${signature}' --oneline. Return [{sha,file,date,type:'introduced|fixed',context}].","generalization","historical","","3","pending","","",""
256
+ ```
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 })`
258
+
259
+ Update section 6. Mark G5.
260
+
261
+ Commit: `"odyssey-improve({slug}): GENERALIZEpattern scan"`
262
+
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
267
+
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
+ ```
250
287
 
251
288
  </actions>
252
289
 
253
290
  <appendix>
254
291
 
255
- ### Goal Prompt Template
256
- **⚠️ 仅在 A_INTAKE 完成后显示一次,A_RECORD 完成时不重复。**
292
+ ### `-y` improve-specific points
257
293
 
258
- 列出所有非 skipped 的 phase_goals,附加收敛规则:
259
- - 穷尽迭代至所有 findings 已处理(fix/issue/decision)且 `phase_goals_all_done=true`
260
- - 修复按 severity 逐轮迭代,每轮 re-verify
261
- - Baseline 修复前采集,修复后对比确认改进
262
- - pending decision 必须 request_user_input,不允许"只报告不处理"
263
-
264
- ### `-y` Auto-Confirm Behavior
265
294
  | Decision Point | Normal | `-y` |
266
295
  |---------------|--------|------|
267
- | A_FIX improvement confirmation | request_user_input | auto-proceed, `deferred` |
268
- | A_DIAGNOSE ambiguity | request_user_input | best-effort, `deferred` |
269
- | A_ESCALATE 3-strike | request_user_input 3-way | auto INCONCLUSIVE |
270
- | A_DISCOVER hit routing | request_user_input | auto create issue, `deferred` |
271
- | A_DISCOVER ambiguous items | request_user_input | all `deferred` |
272
- | A_RECORD pending decisions | request_user_input | skip, show deferred count |
273
- | 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 |
299
+
300
+ ### Goal Prompt convergence rules
274
301
 
275
- `deferred` items shown as "待决策" in completion summary; recoverable via `-c`.
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
+ ```
276
309
 
277
310
  </appendix>
278
311
 
@@ -289,24 +322,24 @@ Skip if `--skip-fix`. Implement improvements for diagnosed root causes.
289
322
 
290
323
  <success_criteria>
291
324
  - [ ] Target resolved, baseline metrics captured
292
- - [ ] Survey + 6-dimension audit with structured findings and severity matrix
325
+ - [ ] Survey + 6-dimension audit with severity matrix
293
326
  - [ ] Root causes diagnosed for critical/high findings
294
327
  - [ ] Improvements implemented and verified with before/after metrics (unless --skip-fix)
295
328
  - [ ] Multi-layer generalization + cross-phase loops (unless --skip-generalize)
296
- - [ ] Every unfixed finding has individual classification and reason
297
- - [ ] understanding.md §8 (metrics) and §9 (learnings) completed
329
+ - [ ] Every unfixed finding individually classified with reason
330
+ - [ ] understanding.md sections 8-9 completed
298
331
  - [ ] phase_goals G1-G7 tracked and audited
299
332
  - [ ] Session resumable via -c
300
333
  </success_criteria>
301
334
 
302
335
  <next_step_routing>
303
- | Condition | Next step |
304
- |-----------|-----------|
336
+ | Condition | Next |
337
+ |-----------|------|
305
338
  | Security findings need deep investigation | `$odyssey-debug "<finding>"` |
306
339
  | UI-related findings | `$odyssey-ui "<component>"` |
307
340
  | Issues created from discoveries | `/manage-issue list --source improve-odyssey` |
308
341
  | Architecture pattern to document | `/spec-add arch "..."` |
309
342
  | Performance pattern to persist | `/spec-add coding "..."` |
310
- | Want formal review of changes | `$odyssey-review-test-fix <changed-files>` |
311
- | 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 |
312
345
  </next_step_routing>