maestro-flow 0.5.37 → 0.5.39
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/.agents/skills/maestro/SKILL.md +11 -5
- package/.agents/skills/maestro-ralph/SKILL.md +80 -12
- package/.agents/skills/maestro-ralph-execute/SKILL.md +17 -6
- package/.agents/skills/manage-drift-realign/SKILL.md +153 -0
- package/.agents/skills/odyssey-debug/SKILL.md +90 -269
- package/.agents/skills/odyssey-improve/SKILL.md +39 -240
- package/.agents/skills/odyssey-planex/SKILL.md +21 -105
- package/.agents/skills/odyssey-review-test-fix/SKILL.md +98 -318
- package/.agents/skills/odyssey-ui/SKILL.md +82 -265
- package/.agy/skills/maestro/SKILL.md +11 -5
- package/.agy/skills/maestro-ralph/SKILL.md +80 -12
- package/.agy/skills/maestro-ralph-execute/SKILL.md +17 -6
- package/.agy/skills/manage-drift-realign/SKILL.md +153 -0
- package/.agy/skills/odyssey-debug/SKILL.md +90 -269
- package/.agy/skills/odyssey-improve/SKILL.md +39 -240
- package/.agy/skills/odyssey-planex/SKILL.md +21 -105
- package/.agy/skills/odyssey-review-test-fix/SKILL.md +98 -318
- package/.agy/skills/odyssey-ui/SKILL.md +82 -265
- package/.claude/commands/maestro-ralph-execute.md +17 -6
- package/.claude/commands/maestro-ralph.md +80 -12
- package/.claude/commands/maestro.md +11 -5
- package/.claude/commands/manage-drift-realign.md +151 -0
- package/.claude/commands/odyssey-debug.md +90 -269
- package/.claude/commands/odyssey-improve.md +39 -240
- package/.claude/commands/odyssey-planex.md +21 -105
- package/.claude/commands/odyssey-review-test-fix.md +98 -318
- package/.claude/commands/odyssey-ui.md +82 -265
- package/.codex/skills/maestro/SKILL.md +16 -8
- package/.codex/skills/maestro-ralph/SKILL.md +138 -11
- package/.codex/skills/maestro-ralph-execute/SKILL.md +17 -6
- package/.codex/skills/manage-drift-realign/SKILL.md +471 -0
- package/.codex/skills/odyssey-debug/SKILL.md +167 -338
- package/.codex/skills/odyssey-improve/SKILL.md +226 -395
- package/.codex/skills/odyssey-planex/SKILL.md +317 -159
- package/.codex/skills/odyssey-review-test-fix/SKILL.md +137 -255
- package/.codex/skills/odyssey-ui/SKILL.md +197 -338
- package/README.md +25 -8
- package/README.zh-CN.md +6 -6
- package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +23 -2
- package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +242 -26
- package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +2 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +92 -29
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
- package/dashboard/dist-server/src/commands/hooks.d.ts +2 -1
- package/dashboard/dist-server/src/commands/hooks.js +16 -9
- package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
- package/dashboard/dist-server/src/commands/install-backend.d.ts +10 -0
- package/dashboard/dist-server/src/commands/install-backend.js +69 -0
- package/dashboard/dist-server/src/commands/install-backend.js.map +1 -1
- package/dashboard/dist-server/src/core/component-defs.d.ts +11 -0
- package/dashboard/dist-server/src/core/component-defs.js +34 -2
- package/dashboard/dist-server/src/core/component-defs.js.map +1 -1
- package/dashboard/dist-server/src/hooks/kg-sync-hook.js +5 -0
- package/dashboard/dist-server/src/hooks/kg-sync-hook.js.map +1 -1
- package/dashboard/dist-server/src/hooks/session-context.js +276 -3
- package/dashboard/dist-server/src/hooks/session-context.js.map +1 -1
- package/dashboard/dist-server/src/search/daemon-client.d.ts +8 -3
- package/dashboard/dist-server/src/search/daemon-client.js +20 -0
- package/dashboard/dist-server/src/search/daemon-client.js.map +1 -1
- package/dist/src/cli.js +3 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/domain.d.ts.map +1 -1
- package/dist/src/commands/domain.js +12 -3
- package/dist/src/commands/domain.js.map +1 -1
- package/dist/src/commands/hooks.d.ts +2 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +16 -9
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/install-backend.d.ts +10 -0
- package/dist/src/commands/install-backend.d.ts.map +1 -1
- package/dist/src/commands/install-backend.js +69 -0
- package/dist/src/commands/install-backend.js.map +1 -1
- package/dist/src/commands/install.js +34 -2
- package/dist/src/commands/install.js.map +1 -1
- package/dist/src/commands/ralph.d.ts.map +1 -1
- package/dist/src/commands/ralph.js +8 -0
- package/dist/src/commands/ralph.js.map +1 -1
- package/dist/src/commands/search.d.ts.map +1 -1
- package/dist/src/commands/search.js +59 -6
- package/dist/src/commands/search.js.map +1 -1
- package/dist/src/commands/spec.d.ts.map +1 -1
- package/dist/src/commands/spec.js +15 -0
- package/dist/src/commands/spec.js.map +1 -1
- package/dist/src/commands/timeline.d.ts +14 -0
- package/dist/src/commands/timeline.d.ts.map +1 -0
- package/dist/src/commands/timeline.js +377 -0
- package/dist/src/commands/timeline.js.map +1 -0
- package/dist/src/core/component-defs.d.ts +11 -0
- package/dist/src/core/component-defs.d.ts.map +1 -1
- package/dist/src/core/component-defs.js +34 -2
- package/dist/src/core/component-defs.js.map +1 -1
- package/dist/src/core/install-executor.d.ts.map +1 -1
- package/dist/src/core/install-executor.js +11 -1
- package/dist/src/core/install-executor.js.map +1 -1
- package/dist/src/core/install-profile.d.ts.map +1 -1
- package/dist/src/core/install-profile.js +52 -17
- package/dist/src/core/install-profile.js.map +1 -1
- package/dist/src/hooks/kg-sync-hook.d.ts.map +1 -1
- package/dist/src/hooks/kg-sync-hook.js +5 -0
- package/dist/src/hooks/kg-sync-hook.js.map +1 -1
- package/dist/src/hooks/session-context.d.ts.map +1 -1
- package/dist/src/hooks/session-context.js +276 -3
- package/dist/src/hooks/session-context.js.map +1 -1
- package/dist/src/i18n/locales/en.d.ts.map +1 -1
- package/dist/src/i18n/locales/en.js +4 -1
- package/dist/src/i18n/locales/en.js.map +1 -1
- package/dist/src/i18n/locales/zh.d.ts.map +1 -1
- package/dist/src/i18n/locales/zh.js +4 -1
- package/dist/src/i18n/locales/zh.js.map +1 -1
- package/dist/src/i18n/types.d.ts +3 -0
- package/dist/src/i18n/types.d.ts.map +1 -1
- package/dist/src/ralph/cmd-complete.d.ts +4 -0
- package/dist/src/ralph/cmd-complete.d.ts.map +1 -1
- package/dist/src/ralph/cmd-complete.js +8 -0
- package/dist/src/ralph/cmd-complete.js.map +1 -1
- package/dist/src/ralph/cmd-next.js +58 -8
- package/dist/src/ralph/cmd-next.js.map +1 -1
- package/dist/src/ralph/status-schema.d.ts +29 -2
- package/dist/src/ralph/status-schema.d.ts.map +1 -1
- package/dist/src/ralph/status-schema.js +1 -1
- package/dist/src/search/daemon-client.d.ts +8 -3
- package/dist/src/search/daemon-client.d.ts.map +1 -1
- package/dist/src/search/daemon-client.js +20 -0
- package/dist/src/search/daemon-client.js.map +1 -1
- package/dist/src/search/daemon.d.ts +3 -3
- package/dist/src/search/daemon.d.ts.map +1 -1
- package/dist/src/search/daemon.js +9 -3
- package/dist/src/search/daemon.js.map +1 -1
- package/dist/src/tui/install-ui/ComponentGrid.d.ts.map +1 -1
- package/dist/src/tui/install-ui/ComponentGrid.js +71 -38
- package/dist/src/tui/install-ui/ComponentGrid.js.map +1 -1
- package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts +12 -3
- package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts.map +1 -1
- package/dist/src/tui/install-ui/ComponentGrid.logic.js +21 -4
- package/dist/src/tui/install-ui/ComponentGrid.logic.js.map +1 -1
- package/dist/src/tui/install-ui/CyberItem.d.ts +3 -1
- package/dist/src/tui/install-ui/CyberItem.d.ts.map +1 -1
- package/dist/src/tui/install-ui/CyberItem.js +6 -5
- package/dist/src/tui/install-ui/CyberItem.js.map +1 -1
- package/dist/src/tui/install-ui/GroupedHub.d.ts +9 -0
- package/dist/src/tui/install-ui/GroupedHub.d.ts.map +1 -1
- package/dist/src/tui/install-ui/GroupedHub.js +54 -47
- package/dist/src/tui/install-ui/GroupedHub.js.map +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.js +54 -5
- package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/tui/install-ui/types.d.ts +1 -0
- package/dist/src/tui/install-ui/types.d.ts.map +1 -1
- package/dist/src/tui/install-ui/types.js.map +1 -1
- package/dist/src/tui/install-ui/useInstallFlowState.d.ts +8 -2
- package/dist/src/tui/install-ui/useInstallFlowState.d.ts.map +1 -1
- package/dist/src/tui/install-ui/useInstallFlowState.js +145 -15
- package/dist/src/tui/install-ui/useInstallFlowState.js.map +1 -1
- package/dist/src/utils/update-notices.js +12 -0
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +1 -1
- package/workflows/agy-instructions.md +127 -88
- package/workflows/analyze.md +2 -2
- package/workflows/auto-test.md +7 -1
- package/workflows/blueprint.md +22 -19
- package/workflows/brainstorm.md +11 -3
- package/workflows/business-test.md +4 -0
- package/workflows/codebase-rebuild.md +8 -1
- package/workflows/codebase-refresh.md +7 -1
- package/workflows/codex-instructions.md +1 -1
- package/workflows/debug.md +5 -2
- package/workflows/domain-add.md +6 -0
- package/workflows/drift-realign.md +396 -0
- package/workflows/execute.md +5 -4
- package/workflows/explore-usage.md +2 -2
- package/workflows/finish-work.md +6 -6
- package/workflows/fork.md +2 -2
- package/workflows/grill.md +6 -5
- package/workflows/harvest.md +2 -2
- package/workflows/impeccable.md +3 -2
- package/workflows/init.md +7 -7
- package/workflows/integration-test.md +1 -0
- package/workflows/issue-gaps-analyze.codex.md +2 -0
- package/workflows/issue-gaps-analyze.md +4 -4
- package/workflows/issue-plan.md +1 -1
- package/workflows/knowhow.md +7 -1
- package/workflows/knowledge-audit.md +1 -1
- package/workflows/maestro-super.md +2 -2
- package/workflows/maestro.md +3 -3
- package/workflows/map.md +2 -2
- package/workflows/milestone-audit.md +1 -1
- package/workflows/milestone-complete.md +1 -1
- package/workflows/odyssey-base.md +258 -0
- package/workflows/plan.md +7 -6
- package/workflows/quick.md +8 -6
- package/workflows/ralph-amend-goal.md +177 -0
- package/workflows/refactor.md +2 -0
- package/workflows/retrospective.md +7 -3
- package/workflows/review.md +6 -4
- package/workflows/roadmap-common.md +3 -3
- package/workflows/roadmap.md +8 -5
- package/workflows/spec-generate.md +23 -18
- package/workflows/specs-load.md +1 -1
- package/workflows/specs-setup.md +2 -0
- package/workflows/sync.md +4 -2
- package/workflows/test-gen.md +1 -1
- package/workflows/test.md +1 -1
- package/workflows/ui-codify-extract.md +1 -0
- package/workflows/ui-codify-knowhow.md +1 -1
- package/workflows/ui-codify-package.md +1 -1
- package/workflows/ui-codify.md +9 -7
- package/workflows/ui-design.md +9 -7
- package/workflows/ui-style.md +6 -4
- package/workflows/verify.md +4 -4
- package/workflows/wiki-connect.md +2 -0
- package/workflows/wiki-digest.md +5 -3
- package/workflows/wiki-manage.md +4 -0
- package/workflows/maestro.codex.md +0 -365
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: odyssey-improve
|
|
3
3
|
description: "Long-running codebase improvement cycle — multi-dimensional audit, deep diagnosis, targeted fix, verify, generalize, and engineering knowledge persistence"
|
|
4
|
-
argument-hint: '"<target>" [--dimensions <list>] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c]'
|
|
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
8
|
|
|
8
9
|
<purpose>
|
|
9
|
-
Deep codebase improvement: survey
|
|
10
|
-
|
|
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.
|
|
11
12
|
|
|
12
13
|
Core philosophy:
|
|
13
14
|
- **Measure before improving** — baseline first, then optimize
|
|
@@ -22,460 +23,290 @@ Core philosophy:
|
|
|
22
23
|
</purpose>
|
|
23
24
|
|
|
24
25
|
<boundary>
|
|
25
|
-
**范围内:**
|
|
26
|
-
**范围外:** UI → `$odyssey-ui` |
|
|
27
|
-
**探索自由度:** profiling
|
|
28
|
-
|
|
26
|
+
**范围内:** 目标代码的运行质量提升 — 性能/安全/架构/可靠性/可观测性/可维护性多维度审查 → 诊断 → 修复 → 泛化
|
|
27
|
+
**范围外:** UI 视觉优化 → `$odyssey-ui` | 新功能实现 → `$odyssey-planex` | 单一 bug 调查 → `$odyssey-debug` | 代码风格审查 → `$odyssey-review-test-fix`
|
|
28
|
+
**探索自由度:** 边界内自由探索 — 可 profiling、安全扫描、架构分析、依赖审计。在约束下尽可能发现深层问题。
|
|
29
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.
|
|
30
30
|
</boundary>
|
|
31
31
|
|
|
32
|
-
<execution_discipline>
|
|
33
|
-
**三条铁律(所有阶段适用):**
|
|
34
|
-
1. **Phase auto-commit** — 阶段完成后**自动** `git commit`,无需用户确认(session.json/evidence.ndjson 不纳入)
|
|
35
|
-
2. **Confident edits only, but must attempt** — only modify what you're confident about; record decisions only when genuinely requiring human judgment
|
|
36
|
-
- Confident → edit code directly, commit
|
|
37
|
-
- Needs decision → record `evidence.ndjson {"phase":"decision","status":"pending"}`, don't touch code
|
|
38
|
-
- No speculative changes
|
|
39
|
-
- ⚠️ **Decision gate** — ONLY these qualify as decisions (not fixes):
|
|
40
|
-
- Cross-module architectural tradeoffs requiring human direction
|
|
41
|
-
- Ambiguous business semantics where the fix could alter intended behavior
|
|
42
|
-
- Requires new dependency or breaking API change
|
|
43
|
-
- ❌ "Unsure how to fix", "Large scope", "Pre-existing issue" are NOT valid decision reasons — either fix it, or explain specifically why it's unfixable
|
|
44
|
-
3. **多 CLI 辅助** — `maestro delegate` 多 `--role`(analyze/review/explore)交叉验证关键判断
|
|
45
|
-
</execution_discipline>
|
|
46
|
-
|
|
47
32
|
<context>
|
|
48
33
|
$ARGUMENTS — target and optional flags.
|
|
49
34
|
|
|
50
35
|
**Target resolution:**
|
|
51
36
|
| Input | Resolution |
|
|
52
37
|
|-------|-----------|
|
|
53
|
-
| Module/
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
38
|
+
| Module/dir path | Audit that module |
|
|
39
|
+
| `HEAD` / `staged` | Review changes in diff |
|
|
40
|
+
| Feature area keyword | Resolve to related files |
|
|
41
|
+
| `--all` | Full project scan (use with caution) |
|
|
57
42
|
|
|
58
43
|
**Flags:**
|
|
59
|
-
| Flag | Effect |
|
|
60
|
-
|
|
61
|
-
| `--dimensions <list>` | Comma-separated subset
|
|
62
|
-
| `--
|
|
63
|
-
| `--skip-
|
|
64
|
-
| `--
|
|
65
|
-
|
|
|
66
|
-
| `-
|
|
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 |
|
|
67
54
|
|
|
68
55
|
**Dimensions (6):**
|
|
69
|
-
1. **performance** — hot paths, N+1 queries, memory
|
|
70
|
-
2. **security** — OWASP Top 10, injection, auth bypass, data exposure, dependency
|
|
71
|
-
3. **architecture** — layer violations, circular
|
|
72
|
-
4. **reliability** — error handling, retry logic, timeout
|
|
73
|
-
5. **observability** — logging coverage,
|
|
74
|
-
6. **maintainability** —
|
|
56
|
+
1. **performance** — hot paths, N+1 queries, memory allocation, cache efficiency, bundle size, lazy loading
|
|
57
|
+
2. **security** — OWASP Top 10, injection, auth bypass, data exposure, dependency vulnerabilities, secrets
|
|
58
|
+
3. **architecture** — layer violations, circular dependencies, coupling metrics, interface contracts, SRP violations
|
|
59
|
+
4. **reliability** — error handling gaps, retry logic, timeout handling, graceful degradation, resource cleanup
|
|
60
|
+
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
|
|
75
62
|
|
|
76
63
|
**Session**: `SESSION_DIR = .workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
|
|
77
64
|
|
|
78
|
-
**Output
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
├── session.json # state + baseline + audit_result + diagnoses + patterns + phase_goals
|
|
82
|
-
├── evidence.ndjson # ALL evidence (phase: survey|audit|diagnose|fix|discovery|decision|self-iteration)
|
|
83
|
-
└── understanding.md # 9-section evolving narrative (§1-§9, one per major phase)
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**session.json schema:**
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"session_id": "improve-odyssey-{YYYYMMDD-HHmmss}",
|
|
90
|
-
"target": "", "dimensions": [],
|
|
91
|
-
"flags": { "skip_fix": false, "skip_generalize": false, "auto": false, "auto_confirm": false },
|
|
92
|
-
"current_state": "S_INTAKE",
|
|
93
|
-
"baseline_metrics": {},
|
|
94
|
-
"audit_result": { "dimensions_audited": [], "finding_count": 0, "severity_distribution": {} },
|
|
95
|
-
"diagnoses": [],
|
|
96
|
-
"patterns": [],
|
|
97
|
-
"generalization_stats": null,
|
|
98
|
-
"phase_goals": [], "phase_goals_all_done": false,
|
|
99
|
-
"self_iteration_log": [],
|
|
100
|
-
"cross_phase_loops": 0, "max_loops": 5,
|
|
101
|
-
"created_at": "", "updated_at": ""
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**evidence.ndjson:** `{"ts":"","phase":"survey|audit|diagnose|fix|discovery|decision|self-iteration","type":"","dimension":"","title":"","severity":"","file":"","line":0,"description":"","suggestion":"","metrics":{}}`
|
|
106
|
-
|
|
107
|
-
**phase_goals[] — auto-derived from flags:**
|
|
65
|
+
**Output:** `session.json` (state + audit + diagnoses + patterns + goals) | `evidence.ndjson` (append-only) | `understanding.md` (9-section narrative)
|
|
66
|
+
|
|
67
|
+
**session.json unique fields:** `target`, `dimensions`, `baseline_metrics`, `audit_result`, `diagnoses`, `confirmation`, `generalization_stats` (`progress_metrics`, `directions_tried` from base)
|
|
108
68
|
|
|
69
|
+
**evidence.ndjson phase-specific fields:**
|
|
70
|
+
- `survey`: `category` (dependency|complexity|coverage|error_pattern), `detail`
|
|
71
|
+
- `audit`: `dimension`, `severity`, `measurement`
|
|
72
|
+
- `diagnosis`: `finding_ref`, `hypothesis`, `result` (confirmed|disproved|inconclusive), `root_cause`
|
|
73
|
+
- `fix`: `finding_ref`, `change_summary`, `risk`
|
|
74
|
+
- `discovery`: `file`, `line`, `classification` (safe|risk|issue), `action` (fix|issue|decision|skip)
|
|
75
|
+
- `decision`: `question`, `options`, `context`, `status` (pending|resolved|deferred), `resolution`
|
|
76
|
+
- `self-iteration`: `stage`, `round`, `assessment`, `expansion`
|
|
77
|
+
|
|
78
|
+
**phase_goals[]:**
|
|
109
79
|
| ID | Goal | Phase | skip_when |
|
|
110
80
|
|----|------|-------|-----------|
|
|
111
81
|
| G1 | Survey completed | S_SURVEY | — |
|
|
112
82
|
| G2 | Audit completed | S_AUDIT | — |
|
|
113
83
|
| G3 | Diagnosis completed | S_DIAGNOSE | — |
|
|
114
|
-
| G4 |
|
|
84
|
+
| G4 | Zero remaining: all findings fixed and verified | `remaining_actionable == 0` within fix_threshold | S_VERIFY | skip_fix |
|
|
115
85
|
| G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
|
|
116
86
|
| G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
|
|
117
87
|
| G7 | Learnings persisted | S_RECORD | — |
|
|
118
88
|
|
|
119
|
-
|
|
89
|
+
**understanding.md — 9 sections (written by owning phase):**
|
|
90
|
+
1. Target & Baseline ← S_INTAKE | 2. Current State Survey ← S_SURVEY | 3. Audit Findings ← S_AUDIT
|
|
91
|
+
4. Root Cause Diagnosis ← S_DIAGNOSE | 5. Fix & Verification ← S_FIX+S_VERIFY
|
|
92
|
+
6. Generalization ← S_GENERALIZE | 7. Discoveries ← S_DISCOVER
|
|
93
|
+
8. Improvement Metrics ← S_RECORD (before/after) | 9. Engineering Learnings ← S_RECORD
|
|
120
94
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
§8 Improvement Metrics (S_RECORD) | §9 Engineering Learnings (S_RECORD)
|
|
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-*")` → 先前会话
|
|
126
99
|
|
|
127
|
-
###
|
|
100
|
+
### Knowledge Persistence(S_RECORD 中写入产出文件)
|
|
128
101
|
|
|
129
|
-
|
|
130
|
-
|-------|---------|---------|
|
|
131
|
-
| Codebase docs | Read `.workflow/codebase/ARCHITECTURE.md` | Module boundaries |
|
|
132
|
-
| Wiki search | `maestro search "<target keywords>" --json` | Prior investigations (top 5) |
|
|
133
|
-
| Specs | `maestro load --type spec --category coding --keyword "<target>"` | Coding conventions |
|
|
134
|
-
| Debug specs | `maestro load --type spec --category debug` | Known issues, workarounds |
|
|
135
|
-
| Role knowledge | `maestro search --category arch` -> select -> `maestro load --type knowhow --id <id>` | Domain knowledge |
|
|
136
|
-
| Prior sessions | `Glob(".workflow/scratch/*-improve-odyssey-*")` | Related sessions |
|
|
102
|
+
S_RECORD 阶段将可沉淀知识 **写入 understanding.md §9 Learnings**,按以下分类结构化:
|
|
137
103
|
|
|
138
|
-
|
|
104
|
+
| 分类 | 写入内容 | 后续建议命令 |
|
|
105
|
+
|------|---------|-------------|
|
|
106
|
+
| 性能 pattern | 瓶颈类型 + 修复方案 + 度量方法 | `/spec-add coding "..."` |
|
|
107
|
+
| 安全规则 | 漏洞类别 + 修复 + 预防方法 | `/spec-add debug "..."` |
|
|
108
|
+
| 架构约束 | 违反描述 + 正确边界 + 检查方法 | `/spec-add arch "..."` |
|
|
109
|
+
| 可靠性 pattern | 故障模式 + 处理策略 + 验证手段 | `/spec-add coding "..."` |
|
|
110
|
+
</context>
|
|
139
111
|
|
|
140
|
-
|
|
112
|
+
Self-iteration 适用阶段: S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE
|
|
113
|
+
|
|
114
|
+
<state_machine>
|
|
115
|
+
|
|
116
|
+
<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
|
|
126
|
+
</states>
|
|
127
|
+
|
|
128
|
+
<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
|
|
165
|
+
</transitions>
|
|
166
|
+
|
|
167
|
+
<actions>
|
|
168
|
+
|
|
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
|
|
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)
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
|----------|---------|-----------|
|
|
144
|
-
| Recurring root cause | Pattern + trigger + fix template | `$spec-add debug "..."` |
|
|
145
|
-
| Non-obvious workaround | Problem + solution + scope | `$spec-add learning "..."` |
|
|
146
|
-
| Architecture violation | Violation + correct boundary + check method | `$spec-add arch "..."` |
|
|
147
|
-
| Reusable pattern | Pattern signature + risk + fix template | `$spec-add coding "..."` |
|
|
178
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): INTAKE — 目标解析与基线采集"`
|
|
148
179
|
|
|
149
|
-
|
|
150
|
-
|
|
180
|
+
### A_RESUME
|
|
181
|
+
Find latest session via Glob → read `session.json` → display summary → jump to `current_state`.
|
|
151
182
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
| Dimension | Sufficient | Insufficient |
|
|
156
|
-
|-----------|-----------|-------------|
|
|
157
|
-
| Coverage | All known related files/modules analyzed | Missed targets discoverable via grep/glob |
|
|
158
|
-
| Depth | >=80% findings have file:line evidence | Most findings lack specifics |
|
|
159
|
-
| Actionability | Each conclusion has concrete next action | "Consider reviewing" without action |
|
|
160
|
-
|
|
161
|
-
**Expansion:** Round 1 = widen scope (more directories, deeper dependency analysis, additional delegate angles). Round 2 = shift perspective (different CLI tool, reverse trace, manual code reading). Round 3 = combine both + targeted deep-dive on remaining gaps.
|
|
162
|
-
|
|
163
|
-
**Applicable stages:** S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE
|
|
164
|
-
|
|
165
|
-
**Exit:** All sufficient -> advance | 3-round cap -> record gap, continue. Logged to `evidence.ndjson` + `session.json.self_iteration_log[]`.
|
|
166
|
-
</self_iteration>
|
|
167
|
-
|
|
168
|
-
<csv_schema>
|
|
169
|
-
|
|
170
|
-
### Shared Output Schema (all waves)
|
|
171
|
-
```json
|
|
172
|
-
{
|
|
173
|
-
"type": "object",
|
|
174
|
-
"properties": {
|
|
175
|
-
"id": { "type": "string" },
|
|
176
|
-
"result_status": { "type": "string", "enum": ["completed", "failed"] },
|
|
177
|
-
"findings": { "type": "string", "maxLength": 500 },
|
|
178
|
-
"evidence": { "type": "string" },
|
|
179
|
-
"error": { "type": "string" }
|
|
180
|
-
},
|
|
181
|
-
"required": ["id", "result_status", "findings"]
|
|
182
|
-
}
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
**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.
|
|
186
|
-
|
|
187
|
-
### tasks.csv
|
|
188
|
-
```csv
|
|
189
|
-
id,title,description,task_type,dimension,deps,wave,status,findings,evidence,error
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Waves:**
|
|
193
|
-
| Wave | Tasks | Parallelism |
|
|
194
|
-
|------|-------|-------------|
|
|
195
|
-
| 1 | Survey (dependency-audit, complexity-scan) | 2 agents |
|
|
196
|
-
| 2 | Audit (performance, security, architecture, reliability, observability, maintainability) | 6 agents |
|
|
197
|
-
| 3 | Generalization (syntax-grep, semantic-scan, structural-match, historical-grep) | 4 agents |
|
|
198
|
-
</csv_schema>
|
|
199
|
-
|
|
200
|
-
<invariants>
|
|
201
|
-
1. **Measure before improve** — baseline metrics MUST precede any fix
|
|
202
|
-
2. **Root cause over symptom** — NO FIX without diagnosis evidence
|
|
203
|
-
3. **Evidence append-only** — evidence.ndjson is never overwritten
|
|
204
|
-
4. **Session is source of truth** — session.json holds all state
|
|
205
|
-
5. **Phase goal tracking** — each stage MUST mark its goal on completion
|
|
206
|
-
6. **`-y` defers, never drops** — auto-confirm records `deferred`, never silently skips
|
|
207
|
-
7. **CLI delegate is background** — all `maestro delegate` calls use run_in_background
|
|
208
|
-
8. **Goal is outcome-oriented** — odyssey outputs prompt then continues
|
|
209
|
-
9. **Verify improvement** — post-fix metrics MUST be compared with baseline
|
|
210
|
-
10. **Decision journal integrity** — all human-judgment items recorded phase=decision
|
|
211
|
-
11. **Resumable state** — current_state saved at every transition
|
|
212
|
-
12. **Invariant violation = BLOCK** — violating any invariant blocks the operation
|
|
213
|
-
</invariants>
|
|
214
|
-
|
|
215
|
-
<execution>
|
|
216
|
-
|
|
217
|
-
**States:** S_INTAKE -> S_SURVEY -> S_AUDIT -> S_DIAGNOSE -> S_FIX -> S_VERIFY -> S_GENERALIZE -> S_DISCOVER -> S_RECORD
|
|
218
|
-
- S_FIX/S_VERIFY skip when `--skip-fix`
|
|
219
|
-
- S_GENERALIZE/S_DISCOVER skip when `--skip-generalize`
|
|
220
|
-
|
|
221
|
-
**Cross-phase loops:**
|
|
222
|
-
- S_DIAGNOSE -> S_DIAGNOSE (hypothesis retry, max 3)
|
|
223
|
-
- S_VERIFY -> S_FIX (rework on failed verification)
|
|
224
|
-
- S_DISCOVER -> S_DIAGNOSE (new critical issue found, cross_phase_loops++)
|
|
225
|
-
- S_DISCOVER -> S_FIX (same-pattern fix with template)
|
|
226
|
-
- S_DISCOVER -> S_RECORD : triage complete AND remaining_actionable == 0
|
|
227
|
-
- S_DISCOVER -> S_RECORD : loops >= max_loops → MUST log each unfixed item with specific reason (blanket "pre-existing" is forbidden)
|
|
228
|
-
|
|
229
|
-
### S_INTAKE
|
|
230
|
-
1. Parse target + flags -> resolve file list
|
|
231
|
-
2. Generate slug, create `SESSION_DIR`
|
|
232
|
-
3. Search prior knowledge: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load (coding, debug)
|
|
233
|
-
4. Derive `phase_goals[]` from flags (apply `skip_when`)
|
|
234
|
-
5. Write `session.json` + `understanding.md` §1
|
|
235
|
-
6. Display Goal Prompt (appendix), continue without blocking
|
|
183
|
+
### A_SURVEY
|
|
184
|
+
Current state survey — understand what exists before proposing changes.
|
|
236
185
|
|
|
237
|
-
|
|
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.
|
|
238
189
|
|
|
239
|
-
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}):
|
|
240
|
-
|
|
241
|
-
### S_SURVEY
|
|
242
|
-
**spawn_agents_on_csv (Wave 1):**
|
|
243
|
-
|
|
244
|
-
Write `tasks.csv` with Wave 1 rows:
|
|
245
|
-
```csv
|
|
246
|
-
"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","","",""
|
|
247
|
-
"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","","",""
|
|
248
|
-
```
|
|
249
|
-
`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 })`
|
|
190
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): SURVEY — 现状调查"`
|
|
250
191
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
### S_AUDIT
|
|
256
|
-
**spawn_agents_on_csv (Wave 2)** — 6 agents (one per dimension):
|
|
192
|
+
### 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}]`
|
|
257
195
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
"audit-perf","Performance","Hot paths, N+1 queries, memory allocation, cache strategy, bundle analysis, lazy loading for {target_files}","audit","performance","","2","pending","","",""
|
|
261
|
-
"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","","",""
|
|
262
|
-
"audit-arch","Architecture","Layer boundaries, circular deps, coupling metrics, interface contracts, SRP compliance, dependency direction for {target_files}","audit","architecture","","2","pending","","",""
|
|
263
|
-
"audit-reliability","Reliability","Error handling completeness, retry logic, timeout config, circuit breakers, graceful degradation, resource cleanup for {target_files}","audit","reliability","","2","pending","","",""
|
|
264
|
-
"audit-observability","Observability","Logging coverage, structured logs, metrics emission, trace propagation, error reporting, health endpoints for {target_files}","audit","observability","","2","pending","","",""
|
|
265
|
-
"audit-maintain","Maintainability","Dead code, complex conditionals, test coverage gaps, magic numbers, naming clarity, doc debt for {target_files}","audit","maintainability","","2","pending","","",""
|
|
266
|
-
```
|
|
267
|
-
`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 })`
|
|
196
|
+
Merge → evidence.ndjson (phase: "audit"). Write `session.json.audit_result`.
|
|
197
|
+
Update `understanding.md` §3 (findings by dimension + severity matrix). Mark G2 done.
|
|
268
198
|
|
|
269
|
-
|
|
199
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): AUDIT — 多维审查"`
|
|
270
200
|
|
|
271
|
-
|
|
201
|
+
### A_DIAGNOSE
|
|
202
|
+
Root cause analysis for critical/high findings — don't fix symptoms.
|
|
272
203
|
|
|
273
|
-
|
|
274
|
-
|
|
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.
|
|
275
208
|
|
|
276
|
-
|
|
277
|
-
2. **CLI deep analysis** for top finding clusters:
|
|
278
|
-
```bash
|
|
279
|
-
maestro delegate "PURPOSE: Root cause analysis for codebase quality issues in {target}
|
|
280
|
-
TASK: Trace origin of each finding | Identify shared root causes | Map dependency chains | Assess blast radius
|
|
281
|
-
MODE: analysis
|
|
282
|
-
CONTEXT: @{target_files} | Audit findings: {top_findings_json}
|
|
283
|
-
EXPECTED: JSON [{finding_ids, root_cause, origin_file, origin_line, blast_radius, fix_approach, confidence}]
|
|
284
|
-
CONSTRAINTS: Trace to origin, not just symptoms | Group related findings
|
|
285
|
-
" --role analyze --mode analysis
|
|
286
|
-
```
|
|
287
|
-
Execute with `run_in_background: true`, then wait for callback (do NOT halt the Odyssey flow).
|
|
288
|
-
|
|
289
|
-
3. **Hypothesis testing**: for each root cause — design verification -> execute -> evidence (phase: "diagnose")
|
|
290
|
-
4. **Decision journal**: ambiguity -> evidence (phase: "decision"); Normal: request_user_input | `-y`: defer
|
|
291
|
-
5. **Confirmed diagnoses** -> `session.json.diagnoses[]`: `[{id, finding_ids, root_cause, evidence_refs, confidence, fix_approach}]`
|
|
292
|
-
|
|
293
|
-
**Escalation (3-strike):** Hypothesis fails -> retry with broader scope via `maestro delegate --role explore`. After 3 retries: Normal -> request_user_input | `-y` -> mark INCONCLUSIVE, proceed.
|
|
294
|
-
|
|
295
|
-
Update §4. Mark G3 done.
|
|
296
|
-
|
|
297
|
-
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): S_DIAGNOSE — 诊断"`
|
|
298
|
-
|
|
299
|
-
### S_FIX
|
|
300
|
-
Skip if `--skip-fix`.
|
|
301
|
-
|
|
302
|
-
1. Present diagnoses + proposed fixes, prioritized by blast radius. Normal: `request_user_input` to confirm. `-y`: auto proceed.
|
|
303
|
-
2. Implement fixes in priority order (highest blast radius first)
|
|
304
|
-
3. Record each fix in evidence (phase: "fix" + "decision")
|
|
305
|
-
4. Update §5
|
|
306
|
-
|
|
307
|
-
📌 **Auto-commit**: `git add -A && git commit -m "odyssey-improve({slug}): S_FIX — 修复"`
|
|
308
|
-
|
|
309
|
-
### S_VERIFY
|
|
310
|
-
Skip if `--skip-fix`.
|
|
311
|
-
|
|
312
|
-
1. **Tests**: auto-detect framework, run covering tests on modified files
|
|
313
|
-
2. **CLI fix review**:
|
|
314
|
-
```bash
|
|
315
|
-
maestro delegate "PURPOSE: Verify improvement fixes for: {target}
|
|
316
|
-
TASK: Check correctness | Assess regression risk | Verify no new issues introduced | Compare metrics
|
|
317
|
-
MODE: analysis
|
|
318
|
-
CONTEXT: @{modified_files} | Diagnoses: {summary} | Diff: {git_diff} | Baseline: {baseline_metrics}
|
|
319
|
-
EXPECTED: JSON {verdict, findings [{severity, description, suggestion}], regression_risk, metrics_comparison}
|
|
320
|
-
CONSTRAINTS: Focus on correctness and measurable improvement
|
|
321
|
-
" --role review --mode analysis
|
|
322
|
-
```
|
|
323
|
-
Execute with `run_in_background: true`, then wait for callback (do NOT halt the Odyssey flow).
|
|
324
|
-
|
|
325
|
-
3. **Metrics comparison**: measure post-fix metrics, compare with `baseline_metrics`
|
|
326
|
-
4. `needs_rework` -> S_FIX (loop). `confirmed` -> mark G4 done, advance
|
|
327
|
-
5. Update §5 with before/after metrics
|
|
328
|
-
|
|
329
|
-
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): S_VERIFY — 验证"`
|
|
330
|
-
|
|
331
|
-
### S_GENERALIZE
|
|
332
|
-
Skip if `--skip-generalize`. Extract patterns from confirmed diagnoses, scan for siblings.
|
|
333
|
-
|
|
334
|
-
**Step 1 — Multi-layer pattern extraction:**
|
|
335
|
-
|
|
336
|
-
| Layer | Method | Example |
|
|
337
|
-
|-------|--------|---------|
|
|
338
|
-
| Syntax | Regex patterns (direct Grep) | Missing `await`, unclosed resources, `catch {}` empty |
|
|
339
|
-
| Semantic | Agent anti-pattern scan | Unvalidated input, missing error boundary, no timeout |
|
|
340
|
-
| Structural | Architecture-level similarity | Same import structure, identical anti-pattern |
|
|
341
|
-
| Historical | Git log for pattern introduction | When pattern was introduced, if ever fixed |
|
|
342
|
-
|
|
343
|
-
Write `session.json.patterns[]`: `[{id, source_diagnosis, layer, signature, description, risk, fix_template}]`
|
|
344
|
-
|
|
345
|
-
**Step 2 — 4-agent scan (spawn_agents_on_csv, Wave 3):**
|
|
346
|
-
|
|
347
|
-
Append Wave 3 rows to `tasks.csv`:
|
|
348
|
-
```csv
|
|
349
|
-
"gen-syntax","Syntax Grep","Grep syntax-layer signatures '${signatures}' across project. Return [{file,line,context,risk_level,layer:'syntax',confidence}].","generalization","syntax","","3","pending","","",""
|
|
350
|
-
"gen-semantic","Semantic Scan","Check related modules for anti-pattern: ${description}. Return [{file,line,context,risk_level,layer:'semantic',confidence}].","generalization","semantic","","3","pending","","",""
|
|
351
|
-
"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","","",""
|
|
352
|
-
"gen-historical","Historical Grep","Run git log -S '${signature}' --oneline. Return [{sha,file,date,type:'introduced|fixed',context}].","generalization","historical","","3","pending","","",""
|
|
353
|
-
```
|
|
354
|
-
`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 })`
|
|
355
|
-
|
|
356
|
-
**Step 3 — Cross-layer dedup**: same file:line multi-layer -> boost confidence | single-layer -> `needs_review` | historical fixed -> `regression_risk`
|
|
357
|
-
|
|
358
|
-
**Step 4 — Iterative deepening**: module >= 3 hits -> targeted deep scan (max 1 round).
|
|
359
|
-
|
|
360
|
-
**Step 5 — Quality Gate** (self-iteration).
|
|
361
|
-
|
|
362
|
-
**Step 6:** Write `generalization_stats`: `{patterns_extracted, total_hits, cross_layer_confirmed, regression_risks, by_layer, deepening_triggered}`. Update §6. Mark G5 done.
|
|
363
|
-
|
|
364
|
-
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): S_GENERALIZE — 泛化"`
|
|
365
|
-
|
|
366
|
-
### S_DISCOVER
|
|
367
|
-
Skip if no generalization hits.
|
|
368
|
-
|
|
369
|
-
1. **Triage** each hit: read +-10 lines -> classify `safe` / `risk` / `bug` / `issue`
|
|
370
|
-
2. **Route**:
|
|
371
|
-
- `bug`/`issue` + directly fixable → **fix immediately** → back to S_FIX
|
|
372
|
-
- `bug`/`issue` + requires cross-module/architectural decision → create issue (with fix suggestion + impact analysis)
|
|
373
|
-
- `risk` → evaluate if guard/validation can mitigate directly; if yes, fix it
|
|
374
|
-
- `safe` → mark skip
|
|
375
|
-
See appendix for `-y` behavior. Append evidence (phase: "discovery" + "decision")
|
|
376
|
-
3. **Cross-phase loop**:
|
|
377
|
-
- Discovery finds new critical issue → S_DIAGNOSE (cross_phase_loops++)
|
|
378
|
-
- Same-pattern with fix template → S_FIX (!skip_fix)
|
|
379
|
-
- S_DISCOVER → S_RECORD: triage complete AND remaining_actionable == 0
|
|
380
|
-
- S_DISCOVER → S_RECORD: loops >= max_loops → MUST log each unfixed item with specific reason (blanket "pre-existing" is forbidden)
|
|
381
|
-
4. Update §7. Mark G6 done.
|
|
382
|
-
|
|
383
|
-
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): S_DISCOVER — 发现"`
|
|
384
|
-
|
|
385
|
-
### S_RECORD
|
|
386
|
-
1. Finalize §8: before/after metrics comparison table
|
|
387
|
-
2. Write §9: structured by Knowledge Persistence table (temporary)
|
|
388
|
-
3. Mark G7 done. Pending decisions: **Normal** -> `request_user_input`. **`-y`** -> skip, show deferred count
|
|
389
|
-
4. **Goal audit**: all confirmed -> `phase_goals_all_done = true`. Any false: **Normal** -> `request_user_input` (回退/跳过/接受). **`-y`** -> auto accept
|
|
390
|
-
5. **Completion**: `current_state = "COMPLETED"`, emit summary:
|
|
391
|
-
```
|
|
392
|
-
--- IMPROVE ODYSSEY COMPLETE ---
|
|
393
|
-
Target: {target}
|
|
394
|
-
Dimensions: {audited_list}
|
|
395
|
-
Baseline: {baseline_summary}
|
|
396
|
-
Audit: {C}C {H}H {M}M {L}L across {dim_count} dimensions
|
|
397
|
-
Diagnoses: {N} root causes ({confirmed} confirmed, {inconclusive} inconclusive)
|
|
398
|
-
Fix: {F} applied, {S} skipped | Before: {baseline} -> After: {post_fix}
|
|
399
|
-
Patterns: {N} extracted ({by_layer} distribution)
|
|
400
|
-
Scan: {total} hits ({cross_layer} cross-layer confirmed)
|
|
401
|
-
Issues: {N} created
|
|
402
|
-
Decisions: {resolved}/{pending}/{deferred}
|
|
403
|
-
Self-iter: {R} quality gate rounds across {P} stages
|
|
404
|
-
Goals: {done}/{total} ({skipped} skipped)
|
|
405
|
-
---
|
|
406
|
-
```
|
|
407
|
-
**Next steps:** `$manage-issue list --source improve-odyssey`, `$learn-decompose <module>`,
|
|
408
|
-
`$quality-review`, `$learn-second-opinion <understanding.md>`, `$learn-investigate "<question>"`
|
|
209
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): DIAGNOSE — 根因诊断"`
|
|
409
210
|
|
|
410
|
-
|
|
411
|
-
|
|
211
|
+
### 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.
|
|
412
213
|
|
|
413
|
-
|
|
214
|
+
### A_FIX
|
|
215
|
+
Skip if `--skip-fix`. Implement improvements for diagnosed root causes.
|
|
414
216
|
|
|
415
|
-
|
|
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`.
|
|
416
220
|
|
|
417
|
-
**
|
|
221
|
+
📌 **Auto-commit**: `git add -A && git commit -m "odyssey-improve({slug}): FIX — 改进实现"`
|
|
418
222
|
|
|
419
|
-
|
|
420
|
-
|
|
223
|
+
### A_VERIFY
|
|
224
|
+
1. Run tests covering modified areas
|
|
225
|
+
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).
|
|
421
229
|
|
|
422
|
-
|
|
423
|
-
且 phase_goals_all_done=true 才停。修复按 severity 逐轮迭代,每轮修复后 re-verify。
|
|
424
|
-
Baseline metrics 必须在修复前采集,修复后必须与 baseline 对比。
|
|
425
|
-
不允许"只报告不处理"。遇到 phase=decision 的 pending 必须 request_user_input。
|
|
426
|
-
```
|
|
230
|
+
📌 **Auto-commit**: `git add understanding.md && git commit -m "odyssey-improve({slug}): VERIFY — 改进验证"`
|
|
427
231
|
|
|
428
|
-
|
|
232
|
+
### A_GENERALIZE
|
|
233
|
+
按 base A_GENERALIZE 执行。Pattern 来源: diagnoses + fixes。Mark G5 done.
|
|
429
234
|
|
|
430
|
-
|
|
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 — 指标总结与知识沉淀"`
|
|
431
250
|
|
|
432
|
-
|
|
433
|
-
|----------------|--------|-----------|
|
|
434
|
-
| S_DIAGNOSE ambiguity | request_user_input blocks | record `deferred`, best-effort continue |
|
|
435
|
-
| S_DIAGNOSE 3-strike | request_user_input 3-way | auto INCONCLUSIVE |
|
|
436
|
-
| S_FIX fix direction | request_user_input confirm | auto proceed by priority |
|
|
437
|
-
| S_DISCOVER bug triage | request_user_input per hit | auto create issue |
|
|
438
|
-
| S_DISCOVER ambiguous | request_user_input batch | all `deferred` |
|
|
439
|
-
| S_RECORD pending decisions | request_user_input per-item | skip, show deferred count |
|
|
251
|
+
</actions>
|
|
440
252
|
|
|
441
|
-
|
|
253
|
+
<appendix>
|
|
442
254
|
|
|
443
|
-
###
|
|
255
|
+
### Goal Prompt Template
|
|
256
|
+
**⚠️ 仅在 A_INTAKE 完成后显示一次,A_RECORD 完成时不重复。**
|
|
444
257
|
|
|
445
|
-
|
|
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,不允许"只报告不处理"
|
|
446
263
|
|
|
447
|
-
|
|
264
|
+
### `-y` Auto-Confirm Behavior
|
|
265
|
+
| Decision Point | Normal | `-y` |
|
|
266
|
+
|---------------|--------|------|
|
|
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 |
|
|
274
|
+
|
|
275
|
+
`deferred` items shown as "待决策" in completion summary; recoverable via `-c`.
|
|
448
276
|
|
|
449
277
|
</appendix>
|
|
450
278
|
|
|
279
|
+
</state_machine>
|
|
280
|
+
|
|
451
281
|
<error_codes>
|
|
452
282
|
| Code | Severity | Condition | Recovery |
|
|
453
283
|
|------|----------|-----------|----------|
|
|
454
|
-
| E001 | error | No target
|
|
455
|
-
| E002 | error | Target not found
|
|
456
|
-
|
|
|
457
|
-
|
|
|
458
|
-
| W002 | warning | Audit dimension agent failed | Partial coverage, note gap |
|
|
459
|
-
| W003 | warning | Generalization scan 0 hits | Skip discovery |
|
|
460
|
-
| W004 | warning | Delegate parse failed | Use raw output |
|
|
284
|
+
| E001 | error | No target specified | Provide target or use -c |
|
|
285
|
+
| E002 | error | Target path not found | Check path |
|
|
286
|
+
| W001 | warning | No dependency manifest found | Proceed without dep audit |
|
|
287
|
+
| W002 | warning | Some dimension agents failed | Partial audit coverage |
|
|
461
288
|
</error_codes>
|
|
462
289
|
|
|
463
290
|
<success_criteria>
|
|
464
|
-
- [ ] Target resolved
|
|
465
|
-
- [ ]
|
|
466
|
-
- [ ]
|
|
467
|
-
- [ ]
|
|
468
|
-
- [ ]
|
|
469
|
-
- [ ]
|
|
470
|
-
- [ ]
|
|
471
|
-
- [ ]
|
|
472
|
-
- [ ]
|
|
473
|
-
- [ ] understanding.md tracks all 9 sections progressively
|
|
474
|
-
- [ ] phase_goals G1-G7 derived from flags, each phase marks its goal
|
|
475
|
-
- [ ] Goal Prompt displayed once; `-y` auto-resolves/defers
|
|
476
|
-
- [ ] State saved at each transition (resumable via -c)
|
|
477
|
-
- [ ] Quality Gate self-iteration logged in self_iteration_log
|
|
478
|
-
- [ ] Before/after metrics comparison in completion summary
|
|
479
|
-
- [ ] Completion summary with all stats
|
|
480
|
-
- [ ] **Every unfixed finding has individual classification and reason** — blanket "pre-existing" labels are forbidden
|
|
291
|
+
- [ ] Target resolved, baseline metrics captured
|
|
292
|
+
- [ ] Survey + 6-dimension audit with structured findings and severity matrix
|
|
293
|
+
- [ ] Root causes diagnosed for critical/high findings
|
|
294
|
+
- [ ] Improvements implemented and verified with before/after metrics (unless --skip-fix)
|
|
295
|
+
- [ ] 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
|
|
298
|
+
- [ ] phase_goals G1-G7 tracked and audited
|
|
299
|
+
- [ ] Session resumable via -c
|
|
481
300
|
</success_criteria>
|
|
301
|
+
|
|
302
|
+
<next_step_routing>
|
|
303
|
+
| Condition | Next step |
|
|
304
|
+
|-----------|-----------|
|
|
305
|
+
| Security findings need deep investigation | `$odyssey-debug "<finding>"` |
|
|
306
|
+
| UI-related findings | `$odyssey-ui "<component>"` |
|
|
307
|
+
| Issues created from discoveries | `/manage-issue list --source improve-odyssey` |
|
|
308
|
+
| Architecture pattern to document | `/spec-add arch "..."` |
|
|
309
|
+
| 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 |
|
|
312
|
+
</next_step_routing>
|