pi-maestro-flow 0.2.0
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/README.md +124 -0
- package/agents/aggregator.md +27 -0
- package/agents/cli-explore-agent.md +188 -0
- package/agents/cross-role-reviewer.md +171 -0
- package/agents/delegate.md +19 -0
- package/agents/explorer.md +23 -0
- package/agents/impeccable-agent.md +99 -0
- package/agents/ralph-executor.md +81 -0
- package/agents/reference.md +24 -0
- package/agents/role-design-author.md +220 -0
- package/agents/team-supervisor.md +143 -0
- package/agents/team-worker.md +237 -0
- package/agents/ui-design-agent.md +270 -0
- package/agents/workflow-analyzer.md +116 -0
- package/agents/workflow-codebase-mapper.md +77 -0
- package/agents/workflow-collab-planner.md +147 -0
- package/agents/workflow-debugger.md +104 -0
- package/agents/workflow-executor.md +133 -0
- package/agents/workflow-external-researcher.md +86 -0
- package/agents/workflow-integration-checker.md +83 -0
- package/agents/workflow-nyquist-auditor.md +85 -0
- package/agents/workflow-phase-researcher.md +85 -0
- package/agents/workflow-plan-checker.md +100 -0
- package/agents/workflow-planner.md +200 -0
- package/agents/workflow-project-researcher.md +74 -0
- package/agents/workflow-research-synthesizer.md +70 -0
- package/agents/workflow-reviewer.md +82 -0
- package/agents/workflow-roadmapper.md +81 -0
- package/agents/workflow-verifier.md +120 -0
- package/package.json +58 -0
- package/skills/codify-to-knowhow/SKILL.md +167 -0
- package/skills/delegation-check/SKILL.md +297 -0
- package/skills/domain-add/SKILL.md +75 -0
- package/skills/insight-challenge/SKILL.md +226 -0
- package/skills/learn-decompose/SKILL.md +124 -0
- package/skills/learn-follow/SKILL.md +163 -0
- package/skills/learn-investigate/SKILL.md +160 -0
- package/skills/learn-second-opinion/SKILL.md +128 -0
- package/skills/maestro/SKILL.md +239 -0
- package/skills/maestro-amend/SKILL.md +169 -0
- package/skills/maestro-analyze/SKILL.md +173 -0
- package/skills/maestro-blueprint/SKILL.md +159 -0
- package/skills/maestro-brainstorm/SKILL.md +193 -0
- package/skills/maestro-collab/SKILL.md +181 -0
- package/skills/maestro-companion/SKILL.md +536 -0
- package/skills/maestro-composer/SKILL.md +192 -0
- package/skills/maestro-execute/SKILL.md +193 -0
- package/skills/maestro-fork/SKILL.md +104 -0
- package/skills/maestro-grill/SKILL.md +151 -0
- package/skills/maestro-guard/SKILL.md +124 -0
- package/skills/maestro-help/SKILL.md +328 -0
- package/skills/maestro-impeccable/SKILL.md +302 -0
- package/skills/maestro-init/SKILL.md +151 -0
- package/skills/maestro-merge/SKILL.md +90 -0
- package/skills/maestro-milestone-audit/SKILL.md +117 -0
- package/skills/maestro-milestone-complete/SKILL.md +133 -0
- package/skills/maestro-milestone-release/SKILL.md +131 -0
- package/skills/maestro-next/SKILL.md +269 -0
- package/skills/maestro-overlay/SKILL.md +203 -0
- package/skills/maestro-plan/SKILL.md +194 -0
- package/skills/maestro-player/SKILL.md +184 -0
- package/skills/maestro-quick/SKILL.md +117 -0
- package/skills/maestro-ralph/SKILL.md +905 -0
- package/skills/maestro-ralph-cli/SKILL.md +976 -0
- package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
- package/skills/maestro-ralph-execute/SKILL.md +409 -0
- package/skills/maestro-ralph-v2/SKILL.md +1198 -0
- package/skills/maestro-roadmap/SKILL.md +157 -0
- package/skills/maestro-swarm-workflow/SKILL.md +272 -0
- package/skills/maestro-tools-execute/SKILL.md +143 -0
- package/skills/maestro-tools-register/SKILL.md +192 -0
- package/skills/maestro-ui-codify/SKILL.md +127 -0
- package/skills/maestro-universal-workflow/SKILL.md +622 -0
- package/skills/maestro-update/SKILL.md +156 -0
- package/skills/manage-codebase-rebuild/SKILL.md +111 -0
- package/skills/manage-drift-realign/SKILL.md +159 -0
- package/skills/manage-harvest/SKILL.md +121 -0
- package/skills/manage-issue/SKILL.md +88 -0
- package/skills/manage-issue-discover/SKILL.md +104 -0
- package/skills/manage-kg-extractors/SKILL.md +147 -0
- package/skills/manage-knowhow/SKILL.md +102 -0
- package/skills/manage-knowhow-capture/SKILL.md +109 -0
- package/skills/manage-knowledge-audit/SKILL.md +147 -0
- package/skills/manage-status/SKILL.md +80 -0
- package/skills/manage-wiki/SKILL.md +104 -0
- package/skills/odyssey-debug/SKILL.md +344 -0
- package/skills/odyssey-improve/SKILL.md +423 -0
- package/skills/odyssey-planex/SKILL.md +542 -0
- package/skills/odyssey-review-test-fix/SKILL.md +392 -0
- package/skills/odyssey-ui/SKILL.md +388 -0
- package/skills/prompt-generator/SKILL.md +470 -0
- package/skills/quality-auto-test/SKILL.md +168 -0
- package/skills/quality-debug/SKILL.md +176 -0
- package/skills/quality-refactor/SKILL.md +108 -0
- package/skills/quality-retrospective/SKILL.md +134 -0
- package/skills/quality-review/SKILL.md +169 -0
- package/skills/quality-sync/SKILL.md +90 -0
- package/skills/quality-test/SKILL.md +183 -0
- package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
- package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
- package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
- package/skills/scholar-citation-verify/SKILL.md +166 -0
- package/skills/scholar-citation-verify/references/api-usage.md +372 -0
- package/skills/scholar-citation-verify/references/common-errors.md +384 -0
- package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
- package/skills/scholar-experiment/SKILL.md +321 -0
- package/skills/scholar-ideation/SKILL.md +288 -0
- package/skills/scholar-latex-organizer/SKILL.md +186 -0
- package/skills/scholar-publish/SKILL.md +220 -0
- package/skills/scholar-rebuttal-pro/README.md +313 -0
- package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
- package/skills/scholar-review/SKILL.md +227 -0
- package/skills/scholar-thesis-docx/README.md +111 -0
- package/skills/scholar-thesis-docx/README_EN.md +108 -0
- package/skills/scholar-thesis-docx/SKILL.md +212 -0
- package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
- package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
- package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
- package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
- package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
- package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
- package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
- package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
- package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
- package/skills/scholar-writing/SKILL.md +296 -0
- package/skills/security-audit/SKILL.md +244 -0
- package/skills/skill-generator/SKILL.md +472 -0
- package/skills/skill-iter-tune/SKILL.md +382 -0
- package/skills/skill-simplify/SKILL.md +63 -0
- package/skills/skill-tuning/SKILL.md +174 -0
- package/skills/spec-add/SKILL.md +105 -0
- package/skills/spec-load/SKILL.md +98 -0
- package/skills/spec-remove/SKILL.md +74 -0
- package/skills/spec-setup/SKILL.md +75 -0
- package/skills/team-adversarial-swarm/SKILL.md +233 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
- package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
- package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
- package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
- package/skills/team-arch-opt/SKILL.md +158 -0
- package/skills/team-brainstorm/SKILL.md +171 -0
- package/skills/team-coordinate/SKILL.md +266 -0
- package/skills/team-designer/SKILL.md +160 -0
- package/skills/team-executor/SKILL.md +189 -0
- package/skills/team-frontend/SKILL.md +136 -0
- package/skills/team-frontend-debug/SKILL.md +198 -0
- package/skills/team-interactive-craft/SKILL.md +141 -0
- package/skills/team-issue/SKILL.md +171 -0
- package/skills/team-lifecycle-v4/SKILL.md +209 -0
- package/skills/team-motion-design/SKILL.md +142 -0
- package/skills/team-perf-opt/SKILL.md +175 -0
- package/skills/team-planex/SKILL.md +137 -0
- package/skills/team-quality-assurance/SKILL.md +147 -0
- package/skills/team-review/SKILL.md +147 -0
- package/skills/team-roadmap-dev/SKILL.md +169 -0
- package/skills/team-swarm/SKILL.md +178 -0
- package/skills/team-swarm/scripts/aco.py +473 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +92 -0
- package/skills/team-swarm/scripts/test_aco.py +475 -0
- package/skills/team-tech-debt/SKILL.md +128 -0
- package/skills/team-testing/SKILL.md +143 -0
- package/skills/team-ui-polish/SKILL.md +141 -0
- package/skills/team-uidesign/SKILL.md +144 -0
- package/skills/team-ultra-analyze/SKILL.md +173 -0
- package/skills/team-ux-improve/SKILL.md +151 -0
- package/skills/team-visual-a11y/SKILL.md +156 -0
- package/skills/workflow-skill-designer/SKILL.md +496 -0
- package/src/extension/index.ts +222 -0
- package/src/extension/schemas.ts +131 -0
- package/src/providers/cli-tools-loader.ts +74 -0
- package/src/providers/provider-registry.ts +130 -0
- package/src/tools/delegate.ts +85 -0
- package/src/tools/explore.ts +134 -0
- package/src/tools/moa.ts +213 -0
- package/src/tools/status.ts +99 -0
- package/src/tools/wait.ts +166 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: odyssey-improve
|
|
3
|
+
description: "Long-running codebase improvement cycle — multi-dimensional audit, deep diagnosis, targeted fix, verify, generalize, and engineering knowledge persistence Arguments: <target> [--dimensions <list>] [--fix-threshold <severity>] [--skip-fix] [--skip-generalize] [--auto] [-y] [-c] [--heartbeat]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<base>@~/.maestro/workflows/odyssey-base.md</base>
|
|
8
|
+
|
|
9
|
+
<purpose>
|
|
10
|
+
survey → 6-dimension audit → diagnose → fix → verify → generalize → discover → persist.
|
|
11
|
+
Exhaustive iteration until zero remaining actionable findings.
|
|
12
|
+
</purpose>
|
|
13
|
+
|
|
14
|
+
<boundary>
|
|
15
|
+
**In scope:** Runtime quality improvement — performance/security/architecture/reliability/observability/maintainability audit → diagnose → fix → generalize.
|
|
16
|
+
**Out of scope:** UI visual → `/odyssey-ui` | New features → `/odyssey-planex` | Single bug → `/odyssey-debug` | Style review → `/odyssey-review-test-fix`
|
|
17
|
+
**Exploration freedom:** Free exploration within boundary — profiling, security scanning, architecture analysis, dependency audit.
|
|
18
|
+
**Zero-residual:** Every finding MUST have a concrete action (fix / issue / decision). "Report and shelve" is not allowed. "Pre-existing issue" is not a valid skip reason.
|
|
19
|
+
</boundary>
|
|
20
|
+
|
|
21
|
+
<context>
|
|
22
|
+
$ARGUMENTS
|
|
23
|
+
|
|
24
|
+
**Target resolution:**
|
|
25
|
+
| Input | Resolution |
|
|
26
|
+
|-------|-----------|
|
|
27
|
+
| Module/dir path | Audit that module |
|
|
28
|
+
| `HEAD` / `staged` | Review changes in diff |
|
|
29
|
+
| Feature area keyword | Resolve to related files |
|
|
30
|
+
| `--all` | Full project scan (use with caution) |
|
|
31
|
+
|
|
32
|
+
**Flags:** `--dimensions <list>` dimension subset | `--fix-threshold <severity>` fix cutoff (default: all) | `--skip-fix` audit+diagnose only | `--skip-generalize` skip S_GENERALIZE+S_DISCOVER | `--auto` no delegate confirmation | `-y` auto-confirm | `-c` resume | `--heartbeat` /loop heartbeat
|
|
33
|
+
|
|
34
|
+
**Dimensions (6):**
|
|
35
|
+
1. **performance** — hot paths, N+1 queries, memory allocation, cache efficiency, bundle size, lazy loading
|
|
36
|
+
2. **security** — OWASP Top 10, injection, auth bypass, data exposure, dependency vulnerabilities, secrets
|
|
37
|
+
3. **architecture** — layer violations, circular dependencies, coupling metrics, interface contracts, SRP violations
|
|
38
|
+
4. **reliability** — error handling gaps, retry logic, timeout handling, graceful degradation, resource cleanup
|
|
39
|
+
5. **observability** — logging coverage, metric gaps, trace propagation, error reporting, health checks
|
|
40
|
+
6. **maintainability** — code complexity (cyclomatic), dead code, test coverage gaps, documentation debt
|
|
41
|
+
|
|
42
|
+
**Session**: `.workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`
|
|
43
|
+
**Output**: `session.json` | `evidence.ndjson` | `understanding.md`
|
|
44
|
+
|
|
45
|
+
**Output boundary**: ALL file writes MUST target the session directory (`.workflow/scratch/{YYYYMMDD}-improve-odyssey-{slug}/`) or `.workflow/state.json` only. Source code modifications during S_FIX are in-scope but MUST be committed per action. NEVER write artifacts outside these paths.
|
|
46
|
+
|
|
47
|
+
**session.json — improve-specific fields:**
|
|
48
|
+
```json
|
|
49
|
+
{ "target": "", "dimensions": [], "baseline_metrics": {},
|
|
50
|
+
"audit_result": {}, "diagnoses": [], "confirmation": null,
|
|
51
|
+
"generalization_stats": null }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**evidence.ndjson phases:** `survey|audit|diagnosis|fix|discovery|decision|self-iteration`
|
|
55
|
+
- `survey`: `category` (dependency|complexity|coverage|error_pattern), `detail`
|
|
56
|
+
- `audit`: `dimension`, `severity`, `measurement`
|
|
57
|
+
- `diagnosis`: `finding_ref`, `hypothesis`, `result` (confirmed|disproved|inconclusive), `root_cause`
|
|
58
|
+
- `fix`: `finding_ref`, `change_summary`, `risk`
|
|
59
|
+
- `discovery`: `file`, `line`, `classification` (safe|risk|issue), `action` (fix|issue|decision|skip)
|
|
60
|
+
- `decision`: `question`, `options`, `context`, `status` (pending|resolved|deferred), `resolution`
|
|
61
|
+
- `self-iteration`: `stage`, `round`, `assessment`, `expansion`
|
|
62
|
+
|
|
63
|
+
**phase_goals[]:**
|
|
64
|
+
|
|
65
|
+
| ID | Goal | Phase | skip_when |
|
|
66
|
+
|----|------|-------|-----------|
|
|
67
|
+
| G1 | Survey completed | S_SURVEY | — |
|
|
68
|
+
| G2 | Audit completed | S_AUDIT | — |
|
|
69
|
+
| G3 | Diagnosis completed | S_DIAGNOSE | — |
|
|
70
|
+
| G4 | Zero remaining: all findings fixed and verified | S_VERIFY | skip_fix |
|
|
71
|
+
| G5 | Pattern generalized | S_GENERALIZE | skip_generalize |
|
|
72
|
+
| G6 | Discoveries triaged | S_DISCOVER | skip_generalize |
|
|
73
|
+
| G7 | Learnings persisted | S_RECORD | — |
|
|
74
|
+
|
|
75
|
+
**understanding.md — 9 sections:**
|
|
76
|
+
1. Target & Baseline ← S_INTAKE | 2. Current State Survey ← S_SURVEY | 3. Audit Findings ← S_AUDIT
|
|
77
|
+
4. Root Cause Diagnosis ← S_DIAGNOSE | 5. Fix & Verification ← S_FIX+S_VERIFY
|
|
78
|
+
6. Generalization ← S_GENERALIZE | 7. Discoveries ← S_DISCOVER
|
|
79
|
+
8. Improvement Metrics ← S_RECORD (before/after) | 9. Engineering Learnings ← S_RECORD
|
|
80
|
+
|
|
81
|
+
**Knowledge Persistence categories (§9):**
|
|
82
|
+
|
|
83
|
+
| Category | Content | Follow-up |
|
|
84
|
+
|----------|---------|-----------|
|
|
85
|
+
| Performance pattern | Bottleneck type + fix approach + measurement method | `/spec-add coding` |
|
|
86
|
+
| Security rule | Vulnerability class + fix + prevention method | `/spec-add debug` |
|
|
87
|
+
| Architecture constraint | Violation description + correct boundary + check method | `/spec-add arch` |
|
|
88
|
+
| Reliability pattern | Failure mode + handling strategy + verification method | `/spec-add coding` |
|
|
89
|
+
</context>
|
|
90
|
+
|
|
91
|
+
<invariants>
|
|
92
|
+
All invariants (evidence append-only, session-as-state, phase goal tracking, auto-commit, zero-residual) defined in base.
|
|
93
|
+
6. **Generalize is mandatory** — S_GENERALIZE and S_DISCOVER execute unless `skip_generalize == true`. "All verified" or context pressure are NOT valid reasons to skip. The phase itself determines whether patterns exist.
|
|
94
|
+
</invariants>
|
|
95
|
+
|
|
96
|
+
<self_iteration>
|
|
97
|
+
Applies to: **S_SURVEY, S_AUDIT, S_DIAGNOSE, S_GENERALIZE**. Logic in base.
|
|
98
|
+
</self_iteration>
|
|
99
|
+
|
|
100
|
+
<execution>
|
|
101
|
+
Follow base execution discipline completely. Actions defined in state_machine below.
|
|
102
|
+
|
|
103
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
104
|
+
|
|
105
|
+
**GATE 1: INTAKE → SURVEY**
|
|
106
|
+
- REQUIRED: Target resolved, SESSION_DIR created, session.json initialized with baseline_metrics.
|
|
107
|
+
- REQUIRED: phase_goals[] derived from flags.
|
|
108
|
+
- BLOCKED if: no target specified (E001) or target path not found (E002).
|
|
109
|
+
|
|
110
|
+
**GATE 2: SURVEY → AUDIT**
|
|
111
|
+
- REQUIRED: Current state survey completed — dependency audit, complexity scan, test coverage map, error handling scan.
|
|
112
|
+
- REQUIRED: Evidence phase=survey logged, understanding.md §2 updated, G1 marked done.
|
|
113
|
+
- BLOCKED if: survey incomplete — all 4 scan types must be attempted.
|
|
114
|
+
|
|
115
|
+
**GATE 3: AUDIT → DIAGNOSE**
|
|
116
|
+
- REQUIRED: All dimension agents completed (or --dimensions subset), findings merged with severity classification.
|
|
117
|
+
- REQUIRED: audit_result written to session.json, understanding.md §3 with severity matrix, G2 marked done.
|
|
118
|
+
- BLOCKED if: zero dimensions reviewed (W002 partial is allowed, zero is not).
|
|
119
|
+
|
|
120
|
+
**GATE 4: DIAGNOSE → FIX**
|
|
121
|
+
- REQUIRED: Root causes identified for all critical/high findings with evidence.
|
|
122
|
+
- REQUIRED: diagnoses[] written, understanding.md §4 updated, G3 marked done.
|
|
123
|
+
- BLOCKED if: hypotheses failed 3 times without escalation decision (A_ESCALATE_DIAGNOSIS).
|
|
124
|
+
|
|
125
|
+
**GATE 5: FIX → VERIFY**
|
|
126
|
+
- REQUIRED: ALL findings within fix_threshold fixed by severity tier (critical → high → medium → low).
|
|
127
|
+
- REQUIRED: Per-fix evidence phase=fix logged.
|
|
128
|
+
- BLOCKED if: tier incomplete — each tier must be fully addressed before advancing.
|
|
129
|
+
|
|
130
|
+
**GATE 6: VERIFY → GENERALIZE**
|
|
131
|
+
- REQUIRED: Tests pass, metrics re-captured, before/after comparison logged.
|
|
132
|
+
- REQUIRED: confirmation written, understanding.md §5 updated, G4 marked done.
|
|
133
|
+
- BLOCKED if: needs_rework → route back to S_FIX.
|
|
134
|
+
|
|
135
|
+
**GATE 7: GENERALIZE → DISCOVER**
|
|
136
|
+
- REQUIRED: ALL 3 layers (syntax/semantic/structural) attempted with evidence logged.
|
|
137
|
+
- REQUIRED: generalization_stats written with by_layer entries for all 3 layers, G5 marked done.
|
|
138
|
+
- BLOCKED if: any layer not attempted (thoroughness floor violation).
|
|
139
|
+
|
|
140
|
+
**GATE 8: DISCOVER → RECORD**
|
|
141
|
+
- REQUIRED: All hits triaged with per-item classification and reason.
|
|
142
|
+
- REQUIRED: remaining_actionable == 0 OR loops >= max_loops with per-item reasons logged.
|
|
143
|
+
- REQUIRED: G6 marked done.
|
|
144
|
+
- BLOCKED if: unclassified hits remain.
|
|
145
|
+
|
|
146
|
+
</execution>
|
|
147
|
+
|
|
148
|
+
<state_machine>
|
|
149
|
+
|
|
150
|
+
<states>
|
|
151
|
+
S_INTAKE → S_SURVEY → S_AUDIT → S_DIAGNOSE → S_FIX → S_VERIFY → S_GENERALIZE → S_DISCOVER → S_RECORD → END
|
|
152
|
+
</states>
|
|
153
|
+
|
|
154
|
+
<transitions>
|
|
155
|
+
S_INTAKE → S_INTAKE : -c + session found → A_RESUME
|
|
156
|
+
S_INTAKE → S_SURVEY : target resolved → A_INTAKE
|
|
157
|
+
S_INTAKE → S_INTAKE : no target → AskUserQuestion
|
|
158
|
+
|
|
159
|
+
S_SURVEY → S_AUDIT : complete
|
|
160
|
+
|
|
161
|
+
S_AUDIT → S_DIAGNOSE : critical/high findings exist
|
|
162
|
+
S_AUDIT → S_GENERALIZE : no critical/high, !skip_generalize
|
|
163
|
+
S_AUDIT → S_RECORD : no findings OR skip_generalize
|
|
164
|
+
|
|
165
|
+
S_DIAGNOSE → S_FIX : root causes identified, !skip_fix
|
|
166
|
+
S_DIAGNOSE → S_GENERALIZE : root causes identified, skip_fix, !skip_generalize
|
|
167
|
+
S_DIAGNOSE → S_RECORD : root causes identified, skip_fix, skip_generalize
|
|
168
|
+
S_DIAGNOSE → S_DIAGNOSE : hypotheses failed, retries < 3 → A_ESCALATE_DIAGNOSIS
|
|
169
|
+
S_DIAGNOSE → S_RECORD : retries >= 3 → INCONCLUSIVE
|
|
170
|
+
|
|
171
|
+
S_FIX → S_VERIFY : fix implemented
|
|
172
|
+
|
|
173
|
+
S_VERIFY → S_GENERALIZE : verified, !skip_generalize
|
|
174
|
+
S_VERIFY → S_RECORD : verified, skip_generalize
|
|
175
|
+
S_VERIFY → S_FIX : needs_rework
|
|
176
|
+
|
|
177
|
+
S_GENERALIZE → S_DISCOVER : hits found
|
|
178
|
+
S_GENERALIZE → S_RECORD : all 3 layers scanned with evidence, total_hits == 0
|
|
179
|
+
|
|
180
|
+
S_DISCOVER → S_DIAGNOSE : new critical issue → cross_phase_loops++
|
|
181
|
+
S_DISCOVER → S_FIX : same-pattern fix, !skip_fix → cross_phase_loops++
|
|
182
|
+
S_DISCOVER → S_RECORD : remaining_actionable == 0
|
|
183
|
+
S_DISCOVER → S_RECORD : loops >= max_loops → MUST log per-item reasons
|
|
184
|
+
|
|
185
|
+
S_RECORD → END : complete
|
|
186
|
+
</transitions>
|
|
187
|
+
|
|
188
|
+
<actions>
|
|
189
|
+
|
|
190
|
+
### A_INTAKE
|
|
191
|
+
1. Parse arguments: target description, flags, `--dimensions` subset
|
|
192
|
+
2. Generate slug, create `SESSION_DIR`
|
|
193
|
+
3. Search: `maestro search "<keywords>"` + Glob prior sessions + ARCHITECTURE.md + spec load coding/debug
|
|
194
|
+
4. **Baseline capture**: Record current metrics (test pass rate, bundle size, dependency count, complexity hotspots) to `session.json.baseline_metrics`
|
|
195
|
+
5. Derive `phase_goals[]` from flags
|
|
196
|
+
6. Write `session.json` + `understanding.md` §1, emit Goal Prompt
|
|
197
|
+
|
|
198
|
+
Commit: `"odyssey-improve({slug}): INTAKE — parse target and capture baseline"`
|
|
199
|
+
|
|
200
|
+
### A_RESUME
|
|
201
|
+
Glob latest session → read `session.json` → display summary → jump to `current_state`.
|
|
202
|
+
|
|
203
|
+
### A_SURVEY
|
|
204
|
+
Current state survey — understand what exists before proposing changes.
|
|
205
|
+
|
|
206
|
+
1. Dependency audit (package.json/lock), complexity scan (size/nesting), test coverage map, error handling scan (empty catch, unhandled promise)
|
|
207
|
+
2. **CLI-assisted** (optional): `maestro delegate --role analyze --mode analysis` for dependency health, complexity hotspots, coverage gaps, error patterns. Execute `run_in_background: true`.
|
|
208
|
+
3. Evidence phase=survey. Update §2. Mark G1.
|
|
209
|
+
|
|
210
|
+
Commit: `"odyssey-improve({slug}): SURVEY — current state analysis"`
|
|
211
|
+
|
|
212
|
+
### A_AUDIT
|
|
213
|
+
Spawn 6 parallel Agents (one per dimension, or `--dimensions` subset).
|
|
214
|
+
Each returns: `[{title, severity, dimension, file, line, description, suggestion, measurement}]`
|
|
215
|
+
|
|
216
|
+
Merge → evidence phase=audit. Write `session.json.audit_result`.
|
|
217
|
+
Update §3 (findings by dimension + severity matrix). Mark G2.
|
|
218
|
+
|
|
219
|
+
Commit: `"odyssey-improve({slug}): AUDIT — multi-dimension review"`
|
|
220
|
+
|
|
221
|
+
### A_DIAGNOSE
|
|
222
|
+
Root cause analysis for critical/high findings — don't fix symptoms.
|
|
223
|
+
|
|
224
|
+
1. Group by dimension, prioritize by severity. For each: hypothesis → trace code path + git history → evidence phase=diagnosis
|
|
225
|
+
2. Ambiguity → evidence phase=decision; Normal: AskUserQuestion | `-y`: defer
|
|
226
|
+
3. CLI-assisted for complex findings: `maestro delegate --role analyze --mode analysis` (`run_in_background: true`)
|
|
227
|
+
4. Write `session.json.diagnoses[]`. Update §4. Mark G3.
|
|
228
|
+
|
|
229
|
+
Commit: `"odyssey-improve({slug}): DIAGNOSE — root cause analysis"`
|
|
230
|
+
|
|
231
|
+
### A_ESCALATE_DIAGNOSIS
|
|
232
|
+
`retries++`. < 3: `maestro delegate --role analyze`, new hypotheses, → S_DIAGNOSE. >= 3: Normal → AskUserQuestion | `-y` → INCONCLUSIVE → S_RECORD.
|
|
233
|
+
|
|
234
|
+
### A_FIX
|
|
235
|
+
1. Exhaustive fix: ALL diagnosed issues by severity tier (critical → high → medium → low within fix_threshold), one dimension at a time. After each tier, re-verify **current tier's dimension only** (not all dimensions) — new findings at same or higher severity append to current tier. Cross-dimension regression checks run once at S_VERIFY after all tiers complete.
|
|
236
|
+
2. For each fix: implement → evidence phase=fix
|
|
237
|
+
3. Normal: AskUserQuestion per-fix confirmation | `-y`: auto-proceed, record `deferred`
|
|
238
|
+
|
|
239
|
+
Commit: `"odyssey-improve({slug}): FIX — improvements applied"`
|
|
240
|
+
|
|
241
|
+
### A_VERIFY
|
|
242
|
+
1. Run tests covering modified areas
|
|
243
|
+
2. Re-capture metrics, compare with `session.json.baseline_metrics`
|
|
244
|
+
3. CLI-assisted: `maestro delegate --role review --mode analysis` (`run_in_background: true`)
|
|
245
|
+
4. `needs_rework` → S_FIX. `verified` → mark G4, advance.
|
|
246
|
+
5. Write `session.json.confirmation`. Update §5 (before/after metrics table).
|
|
247
|
+
|
|
248
|
+
Commit: `"odyssey-improve({slug}): VERIFY — improvements verified"`
|
|
249
|
+
|
|
250
|
+
### A_GENERALIZE
|
|
251
|
+
|
|
252
|
+
**MANDATORY — executes unless `skip_generalize == true`. Prior-phase convergence, "all verified," or context pressure are NOT valid skip reasons.**
|
|
253
|
+
|
|
254
|
+
Pattern source: diagnosed root causes + applied fixes across all dimensions.
|
|
255
|
+
|
|
256
|
+
**Step 1 — 3-layer pattern extraction** from diagnoses and fixes:
|
|
257
|
+
|
|
258
|
+
| Layer | Method | Targets |
|
|
259
|
+
|-------|--------|---------|
|
|
260
|
+
| Syntax | Build regex from fix diffs → Grep | N+1 query patterns, missing error type check, unescaped interpolation, inline eval |
|
|
261
|
+
| Semantic | Understand anti-pattern per dimension → Agent scan | Cache bypass in hot path, auth check gap, circular import chain, missing timeout |
|
|
262
|
+
| Structural | Find modules with same shape / dependency graph | Controllers sharing validation shape, middleware with same hook pattern, parallel services |
|
|
263
|
+
|
|
264
|
+
Write `session.json.patterns[]`: `[{id, source, layer, signature, description, risk, fix_template, confidence}]`
|
|
265
|
+
|
|
266
|
+
**Thoroughness floor:** ALL 3 layers must be attempted and logged. Each layer records search method, scope, hit count in evidence phase=generalization. "No hits" requires all 3 layers to return 0 with logged evidence.
|
|
267
|
+
|
|
268
|
+
**Step 2 — 4-agent concurrent scan** (single message, 4 Agents):
|
|
269
|
+
|
|
270
|
+
| Agent | Strategy | Scope |
|
|
271
|
+
|-------|----------|-------|
|
|
272
|
+
| Syntax grep | Grep regex from pattern signatures | Full project |
|
|
273
|
+
| Semantic scan | Per-dimension anti-pattern check | Related modules |
|
|
274
|
+
| Structural match | Find structurally similar files | Full project |
|
|
275
|
+
| Historical grep | `git log -S` for pattern signatures | Git history |
|
|
276
|
+
|
|
277
|
+
**Step 3 — Cross-layer dedup:** multi-layer hit → boost | single-layer → `needs_review` | historically fixed → `regression_risk`
|
|
278
|
+
|
|
279
|
+
**Step 4 — Iterative deepening:** Module with ≥3 hits → targeted deep scan (max 1 round).
|
|
280
|
+
|
|
281
|
+
**Step 5 — Persist:** Update understanding.md §6 + write `session.json.generalization_stats`:
|
|
282
|
+
```json
|
|
283
|
+
{"patterns_extracted": 0, "total_hits": 0, "cross_layer_confirmed": 0, "regression_risks": 0, "by_layer": {"syntax": 0, "semantic": 0, "structural": 0}, "deepening_triggered": false}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Transition guard:** `S_GENERALIZE → S_RECORD` requires `by_layer` has entries for all 3 layers with search evidence logged. Mark G5 done.
|
|
287
|
+
|
|
288
|
+
Commit: `"odyssey-improve({slug}): GENERALIZE — generalization scan complete"`
|
|
289
|
+
|
|
290
|
+
### A_DISCOVER
|
|
291
|
+
|
|
292
|
+
**Executes whenever `total_hits > 0`. Cannot be skipped without `skip_generalize == true`.**
|
|
293
|
+
|
|
294
|
+
1. **Triage** each hit with ±10 lines context → classify:
|
|
295
|
+
- `bug` — confirmed improvement defect (same dimension)
|
|
296
|
+
- `risk` — potential degradation or violation
|
|
297
|
+
- `safe` — false positive (must log individual reason — blanket "pre-existing" forbidden)
|
|
298
|
+
|
|
299
|
+
2. **Route:**
|
|
300
|
+
|
|
301
|
+
| Classification | Action |
|
|
302
|
+
|---------------|--------|
|
|
303
|
+
| bug + fix_template applicable | Immediate fix → back to S_FIX |
|
|
304
|
+
| bug + cross-module decision or no template | Create issue (fix suggestion + impact + dimension) |
|
|
305
|
+
| risk + guard addable directly | Fix directly |
|
|
306
|
+
| risk + complex | Create issue |
|
|
307
|
+
| safe | Skip with logged per-item reason |
|
|
308
|
+
|
|
309
|
+
Normal: AskUserQuestion per hit | `-y`: auto-fix bugs with fix_template, create issue for rest
|
|
310
|
+
|
|
311
|
+
3. **Cross-phase loops:** `cross_phase_loops++` on fix/diagnose return. `loops >= max_loops` → must log per-item reasons.
|
|
312
|
+
|
|
313
|
+
4. Append evidence phase=discovery. Update understanding.md §7. Mark G6 done.
|
|
314
|
+
|
|
315
|
+
Commit: `"odyssey-improve({slug}): DISCOVER — discovery triage complete"`
|
|
316
|
+
|
|
317
|
+
### A_RECORD
|
|
318
|
+
|
|
319
|
+
1. understanding.md §8: improvement metrics — before/after comparison from `baseline_metrics` vs current. Re-capture metrics, build comparison table.
|
|
320
|
+
2. understanding.md §9: learnings by Knowledge Persistence categories:
|
|
321
|
+
- Performance pattern → `/spec-add coding`
|
|
322
|
+
- Security rule → `/spec-add debug`
|
|
323
|
+
- Architecture constraint → `/spec-add arch`
|
|
324
|
+
- Reliability pattern → `/spec-add coding`
|
|
325
|
+
Completion summary lists suggested `/spec-add` commands.
|
|
326
|
+
|
|
327
|
+
3. Mark G7 done. Pending decisions: Normal → AskUserQuestion | `-y` → skip (show deferred count).
|
|
328
|
+
|
|
329
|
+
4. **Goal audit (hardened):**
|
|
330
|
+
- `done` → confirmed
|
|
331
|
+
- `skipped` → confirmed ONLY if corresponding `skip_when` flag is true
|
|
332
|
+
- **Hard rule:** G5 and G6 CANNOT be `skipped` unless `skip_generalize == true`. Pending without flag → `failed` (Normal: AskUserQuestion | `-y`: record `failed`)
|
|
333
|
+
- `phase_goals_all_done = true` only when all goals pass this audit
|
|
334
|
+
|
|
335
|
+
5. `current_state = "COMPLETED"`, emit completion summary.
|
|
336
|
+
|
|
337
|
+
**Completion summary:**
|
|
338
|
+
```
|
|
339
|
+
--- IMPROVE ODYSSEY COMPLETE ---
|
|
340
|
+
Target: {target}
|
|
341
|
+
Dimensions: {dimensions}
|
|
342
|
+
Findings: {critical}C / {high}H / {medium}M / {low}L
|
|
343
|
+
Diagnosed: {count}
|
|
344
|
+
Fixed: {count} ({verified} verified)
|
|
345
|
+
Metrics: {improved} improved / {regressed} regressed
|
|
346
|
+
Patterns: {count} ({by_layer})
|
|
347
|
+
Scan hits: {total} ({cross_layer_confirmed} confirmed)
|
|
348
|
+
Issues: {N} created
|
|
349
|
+
Decisions: {N} resolved, {M} pending, {K} deferred
|
|
350
|
+
Learnings: {N} persisted
|
|
351
|
+
Self-iter: {N} rounds across {M} stages
|
|
352
|
+
Cross-loops: {N}
|
|
353
|
+
Goals: {done}/{total} ({skipped} skipped)
|
|
354
|
+
---
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Commit: `"odyssey-improve({slug}): RECORD — summary and knowledge persistence"`
|
|
358
|
+
|
|
359
|
+
</actions>
|
|
360
|
+
|
|
361
|
+
<appendix>
|
|
362
|
+
|
|
363
|
+
### `-y` improve-specific points
|
|
364
|
+
|
|
365
|
+
| Decision Point | Normal | `-y` |
|
|
366
|
+
|---------------|--------|------|
|
|
367
|
+
| A_FIX improvement confirmation | AskUserQuestion | auto-proceed, `deferred` |
|
|
368
|
+
| A_DIAGNOSE ambiguity | AskUserQuestion | best-effort, `deferred` |
|
|
369
|
+
| A_ESCALATE 3-strike | AskUserQuestion 3-way | auto INCONCLUSIVE |
|
|
370
|
+
| A_DISCOVER hit routing | AskUserQuestion | auto create issue |
|
|
371
|
+
| A_DISCOVER ambiguous items | AskUserQuestion | all `deferred` |
|
|
372
|
+
|
|
373
|
+
`deferred` items shown in completion summary; recoverable via `-c`.
|
|
374
|
+
|
|
375
|
+
### Goal Prompt convergence rules
|
|
376
|
+
|
|
377
|
+
```
|
|
378
|
+
Exhaust iteration until all findings actioned (fix/issue/decision)
|
|
379
|
+
and phase_goals_all_done=true.
|
|
380
|
+
Fix by severity tiers, re-verify after each tier.
|
|
381
|
+
Baseline captured before fix, compared after to confirm improvement.
|
|
382
|
+
Pending decisions must AskUserQuestion — no silent resolve.
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
</appendix>
|
|
386
|
+
|
|
387
|
+
</state_machine>
|
|
388
|
+
|
|
389
|
+
<error_codes>
|
|
390
|
+
| Code | Severity | Condition | Recovery |
|
|
391
|
+
|------|----------|-----------|----------|
|
|
392
|
+
| E001 | error | No target specified | Provide target or use -c |
|
|
393
|
+
| E002 | error | Target path not found | Check path |
|
|
394
|
+
| W001 | warning | No dependency manifest found | Proceed without dep audit |
|
|
395
|
+
| W002 | warning | Some dimension agents failed | Partial audit coverage |
|
|
396
|
+
| W003 | warning | Generalization 0 hits after full 3-layer scan | Advance to S_RECORD (requires all 3 layers attempted with evidence) |
|
|
397
|
+
</error_codes>
|
|
398
|
+
|
|
399
|
+
<success_criteria>
|
|
400
|
+
- [ ] Target resolved, baseline metrics captured
|
|
401
|
+
- [ ] Survey + 6-dimension audit with structured findings and severity matrix
|
|
402
|
+
- [ ] Root causes diagnosed for critical/high findings
|
|
403
|
+
- [ ] Improvements implemented and verified with before/after metrics (unless --skip-fix)
|
|
404
|
+
- [ ] Multi-layer generalization + cross-phase loops (unless --skip-generalize)
|
|
405
|
+
- [ ] Every unfixed finding has individual classification and reason
|
|
406
|
+
- [ ] understanding.md §8 (metrics) and §9 (learnings) completed
|
|
407
|
+
- [ ] phase_goals G1-G7 tracked and audited
|
|
408
|
+
- [ ] Session resumable via -c
|
|
409
|
+
- [ ] Completion summary
|
|
410
|
+
</success_criteria>
|
|
411
|
+
|
|
412
|
+
<next_step_routing>
|
|
413
|
+
| Condition | Next |
|
|
414
|
+
|-----------|------|
|
|
415
|
+
| Security findings need deep investigation | `/odyssey-debug "<finding>"` |
|
|
416
|
+
| UI-related findings | `/odyssey-ui "<component>"` |
|
|
417
|
+
| Issues created from discoveries | `/manage-issue list --source improve-odyssey` |
|
|
418
|
+
| Architecture pattern to document | `/spec-add arch "..."` |
|
|
419
|
+
| Performance pattern to persist | `/spec-add coding "..."` |
|
|
420
|
+
| Formal review of changes | `/odyssey-review-test-fix <changed-files>` |
|
|
421
|
+
| Pending decisions | Filter evidence phase=decision status=pending |
|
|
422
|
+
</next_step_routing>
|
|
423
|
+
</output>
|