maestro-flow 0.3.38 → 0.3.40
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/.claude/agents/workflow-analyzer.md +2 -0
- package/.claude/agents/workflow-debugger.md +2 -0
- package/.claude/agents/workflow-executor.md +2 -0
- package/.claude/agents/workflow-integration-checker.md +1 -0
- package/.claude/agents/workflow-nyquist-auditor.md +1 -0
- package/.claude/agents/workflow-planner.md +2 -0
- package/.claude/agents/workflow-reviewer.md +2 -0
- package/.claude/agents/workflow-verifier.md +2 -0
- package/.claude/commands/learn-decompose.md +176 -176
- package/.claude/commands/learn-follow.md +167 -167
- package/.claude/commands/learn-investigate.md +221 -221
- package/.claude/commands/learn-retro.md +303 -303
- package/.claude/commands/learn-second-opinion.md +167 -167
- package/.claude/commands/maestro-amend.md +300 -300
- package/.claude/commands/maestro-analyze.md +130 -126
- package/.claude/commands/maestro-brainstorm.md +104 -100
- package/.claude/commands/maestro-composer.md +354 -354
- package/.claude/commands/maestro-execute.md +120 -114
- package/.claude/commands/maestro-fork.md +86 -86
- package/.claude/commands/maestro-init.md +78 -78
- package/.claude/commands/maestro-learn.md +140 -140
- package/.claude/commands/maestro-link-coordinate.md +1 -1
- package/.claude/commands/maestro-merge.md +61 -61
- package/.claude/commands/maestro-milestone-release.md +96 -96
- package/.claude/commands/maestro-overlay.md +178 -178
- package/.claude/commands/maestro-plan.md +154 -138
- package/.claude/commands/maestro-player.md +404 -404
- package/.claude/commands/maestro-quick.md +56 -56
- package/.claude/commands/maestro-ralph-execute.md +7 -18
- package/.claude/commands/maestro-ralph.md +48 -12
- package/.claude/commands/maestro-roadmap.md +1 -1
- package/.claude/commands/maestro-ui-design.md +93 -93
- package/.claude/commands/maestro-update.md +176 -176
- package/.claude/commands/maestro-verify.md +96 -90
- package/.claude/commands/maestro.md +121 -121
- package/.claude/commands/manage-codebase-rebuild.md +75 -75
- package/.claude/commands/manage-codebase-refresh.md +57 -57
- package/.claude/commands/manage-harvest.md +94 -94
- package/.claude/commands/manage-issue-discover.md +77 -77
- package/.claude/commands/manage-issue.md +73 -73
- package/.claude/commands/manage-knowhow-capture.md +193 -193
- package/.claude/commands/manage-knowhow.md +77 -77
- package/.claude/commands/manage-learn.md +67 -67
- package/.claude/commands/manage-status.md +51 -51
- package/.claude/commands/manage-wiki.md +62 -62
- package/.claude/commands/quality-auto-test.md +5 -1
- package/.claude/commands/quality-debug.md +125 -115
- package/.claude/commands/quality-refactor.md +55 -55
- package/.claude/commands/quality-retrospective.md +78 -78
- package/.claude/commands/quality-review.md +114 -108
- package/.claude/commands/quality-sync.md +51 -51
- package/.claude/commands/quality-test.md +107 -103
- package/.claude/commands/spec-add.md +49 -49
- package/.claude/commands/spec-load.md +51 -51
- package/.claude/commands/spec-remove.md +51 -51
- package/.claude/commands/spec-setup.md +51 -51
- package/.claude/commands/wiki-connect.md +62 -62
- package/.claude/commands/wiki-digest.md +69 -69
- package/.codex/skills/learn-decompose/SKILL.md +113 -113
- package/.codex/skills/learn-follow/SKILL.md +1 -1
- package/.codex/skills/learn-investigate/SKILL.md +83 -83
- package/.codex/skills/learn-retro/SKILL.md +83 -83
- package/.codex/skills/learn-second-opinion/SKILL.md +86 -86
- package/.codex/skills/maestro/SKILL.md +304 -304
- package/.codex/skills/maestro-analyze/SKILL.md +11 -3
- package/.codex/skills/maestro-brainstorm/SKILL.md +451 -397
- package/.codex/skills/maestro-composer/SKILL.md +213 -213
- package/.codex/skills/maestro-execute/SKILL.md +346 -318
- package/.codex/skills/maestro-fork/SKILL.md +56 -2
- package/.codex/skills/maestro-init/SKILL.md +40 -16
- package/.codex/skills/maestro-learn/SKILL.md +80 -80
- package/.codex/skills/maestro-link-coordinate/SKILL.md +257 -257
- package/.codex/skills/maestro-merge/SKILL.md +1 -1
- package/.codex/skills/maestro-milestone-audit/SKILL.md +1 -1
- package/.codex/skills/maestro-milestone-complete/SKILL.md +40 -9
- package/.codex/skills/maestro-milestone-release/SKILL.md +70 -70
- package/.codex/skills/maestro-overlay/SKILL.md +1 -1
- package/.codex/skills/maestro-plan/SKILL.md +29 -4
- package/.codex/skills/maestro-player/SKILL.md +323 -323
- package/.codex/skills/maestro-quick/SKILL.md +1 -1
- package/.codex/skills/maestro-ralph/SKILL.md +693 -578
- package/.codex/skills/maestro-roadmap/SKILL.md +518 -468
- package/.codex/skills/maestro-ui-design/SKILL.md +109 -12
- package/.codex/skills/maestro-verify/SKILL.md +27 -9
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +3 -2
- package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
- package/.codex/skills/manage-harvest/SKILL.md +91 -91
- package/.codex/skills/manage-issue/SKILL.md +19 -6
- package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
- package/.codex/skills/manage-knowhow/SKILL.md +95 -95
- package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -110
- package/.codex/skills/manage-learn/SKILL.md +1 -1
- package/.codex/skills/manage-status/SKILL.md +1 -1
- package/.codex/skills/manage-wiki/SKILL.md +55 -55
- package/.codex/skills/quality-auto-test/SKILL.md +553 -547
- package/.codex/skills/quality-debug/SKILL.md +345 -334
- package/.codex/skills/quality-refactor/SKILL.md +1 -1
- package/.codex/skills/quality-retrospective/SKILL.md +292 -292
- package/.codex/skills/quality-review/SKILL.md +365 -364
- package/.codex/skills/quality-sync/SKILL.md +1 -1
- package/.codex/skills/quality-test/SKILL.md +507 -498
- package/.codex/skills/spec-add/SKILL.md +101 -101
- package/.codex/skills/spec-load/SKILL.md +77 -77
- package/.codex/skills/spec-map/SKILL.md +1 -1
- package/.codex/skills/spec-remove/SKILL.md +69 -69
- package/.codex/skills/spec-setup/SKILL.md +1 -1
- package/.codex/skills/team-coordinate/SKILL.md +2 -1
- package/.codex/skills/team-executor/SKILL.md +116 -115
- package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -1
- package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +14 -6
- package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +16 -4
- package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +7 -1
- package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +16 -4
- package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +8 -2
- package/.codex/skills/team-quality-assurance/SKILL.md +2 -1
- package/.codex/skills/team-quality-assurance/roles/scout/role.md +9 -2
- package/.codex/skills/team-review/SKILL.md +2 -1
- package/.codex/skills/team-review/roles/reviewer/role.md +10 -1
- package/.codex/skills/team-review/roles/scanner/role.md +10 -1
- package/.codex/skills/team-tech-debt/SKILL.md +144 -143
- package/.codex/skills/team-tech-debt/roles/executor/role.md +9 -5
- package/.codex/skills/team-tech-debt/roles/scanner/role.md +10 -0
- package/.codex/skills/team-tech-debt/roles/validator/role.md +8 -2
- package/.codex/skills/team-testing/SKILL.md +2 -1
- package/.codex/skills/team-testing/roles/executor/role.md +8 -2
- package/.codex/skills/team-testing/roles/generator/role.md +8 -2
- package/.codex/skills/wiki-connect/SKILL.md +73 -73
- package/.codex/skills/wiki-digest/SKILL.md +87 -87
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +6 -0
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
- package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
- package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
- package/dashboard/dist-server/src/commands/delegate.js +18 -0
- package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
- package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
- package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
- package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
- package/dist/shared/agent-types.d.ts +2 -0
- package/dist/shared/agent-types.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.d.ts +2 -0
- package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.js +4 -0
- package/dist/src/agents/cli-agent-runner.js.map +1 -1
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +29 -1
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/delegate.d.ts +2 -0
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +18 -0
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/commands/launcher.d.ts.map +1 -1
- package/dist/src/commands/launcher.js +27 -4
- package/dist/src/commands/launcher.js.map +1 -1
- package/dist/src/config/cli-tools-config.d.ts +6 -0
- package/dist/src/config/cli-tools-config.d.ts.map +1 -1
- package/dist/src/config/cli-tools-config.js +2 -0
- package/dist/src/config/cli-tools-config.js.map +1 -1
- package/dist/src/core/overlay/applier.d.ts.map +1 -1
- package/dist/src/core/overlay/applier.js +65 -5
- package/dist/src/core/overlay/applier.js.map +1 -1
- package/dist/src/core/overlay/loader.d.ts.map +1 -1
- package/dist/src/core/overlay/loader.js +9 -4
- package/dist/src/core/overlay/loader.js.map +1 -1
- package/dist/src/core/overlay/types.d.ts +2 -0
- package/dist/src/core/overlay/types.d.ts.map +1 -1
- package/dist/src/core/overlay/types.js +2 -0
- package/dist/src/core/overlay/types.js.map +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
- package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
- package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
- package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
- package/package.json +1 -1
- package/shared/agent-types.ts +2 -0
- package/workflows/analyze.md +24 -2
- package/workflows/auto-test.md +12 -0
- package/workflows/brainstorm.md +11 -1
- package/workflows/debug.md +13 -4
- package/workflows/delegate-protocol.codex.md +65 -0
- package/workflows/plan.md +14 -4
- package/workflows/test.md +10 -0
|
@@ -38,6 +38,8 @@ You perform structured multi-dimensional analysis of technical topics, proposals
|
|
|
38
38
|
- Subject of analysis (proposal, technology choice, architecture decision, etc.)
|
|
39
39
|
- Context: constraints, goals, existing system state
|
|
40
40
|
- Comparison alternatives (if applicable)
|
|
41
|
+
- **Codebase docs** (if `.workflow/codebase/` exists) — `ARCHITECTURE.md` and `CONCERNS.md` as evidence sources for feasibility/risk/dependency dimensions
|
|
42
|
+
- **Wiki prior knowledge** (if `maestro wiki` available) — `maestro wiki search "<subject keywords>"` for prior decisions and analyses on related topics
|
|
41
43
|
|
|
42
44
|
## Output
|
|
43
45
|
`analysis.md`:
|
|
@@ -48,6 +48,8 @@ Each line in evidence.ndjson:
|
|
|
48
48
|
- Codebase access for investigation and fixing
|
|
49
49
|
- Prior debug sessions from `.debug/` (if any)
|
|
50
50
|
- **Project specs** — `maestro spec load --category debug`: known issues, root causes, workarounds. Check before forming hypotheses to avoid re-investigating known problems.
|
|
51
|
+
- **Codebase docs** (if `.workflow/codebase/` exists) — Read `ARCHITECTURE.md` for module boundaries to scope impact analysis and form better hypotheses
|
|
52
|
+
- **Wiki prior knowledge** (if `maestro wiki` available) — `maestro wiki search "<symptom keywords>"` for prior investigations on similar issues; skip already-documented root causes
|
|
51
53
|
|
|
52
54
|
## Output
|
|
53
55
|
- Debug session directory with:
|
|
@@ -62,6 +62,8 @@ You implement a single task from the execution plan. Each task is executed atomi
|
|
|
62
62
|
- `context.md` -- Phase context with Locked/Free/Deferred decisions (read to understand constraints before implementing)
|
|
63
63
|
- `analysis.md` -- Phase analysis with 6-dimension scores (reference for quality expectations)
|
|
64
64
|
- Codebase access for implementation
|
|
65
|
+
- **Codebase docs** (if `.workflow/codebase/` exists) — Read `ARCHITECTURE.md` for module boundaries and component relationships before implementing cross-module changes
|
|
66
|
+
- **Wiki prior knowledge** (if `maestro wiki` available) — `maestro wiki search "<task keywords>"` for related decisions/constraints that may affect implementation approach
|
|
65
67
|
|
|
66
68
|
## Output
|
|
67
69
|
- Code changes (the actual implementation)
|
|
@@ -40,6 +40,7 @@ N/A -- reads code artifacts, not task JSON.
|
|
|
40
40
|
- Completed phase artifacts (code, configs, tests)
|
|
41
41
|
- Phase/scratch definitions (resolved via state.json artifact registry)
|
|
42
42
|
- Task summaries from `.summaries/`
|
|
43
|
+
- **Codebase docs** (if `.workflow/codebase/` exists) — `ARCHITECTURE.md` for expected interface contracts and module boundaries across phases
|
|
43
44
|
|
|
44
45
|
## Output Location
|
|
45
46
|
`.workflow/scratch/{milestone}/integration-audit.md`
|
|
@@ -37,6 +37,7 @@ You audit test coverage by mapping requirements to test files, calculating cover
|
|
|
37
37
|
- Existing test files and test configuration
|
|
38
38
|
- Source code to analyze coverage against
|
|
39
39
|
- **Project specs** — `maestro spec load --category test`: test conventions (framework, naming, patterns). Generated stubs must follow loaded conventions.
|
|
40
|
+
- **Codebase docs** (if `.workflow/codebase/` exists) — `FEATURES.md` for requirement→component mapping to improve coverage traceability
|
|
40
41
|
|
|
41
42
|
## Output Location
|
|
42
43
|
- Validation artifacts: `.workflow/scratch/{slug}/validation.json`
|
|
@@ -39,6 +39,8 @@ When invoked with `quick` flag:
|
|
|
39
39
|
- `.workflow/scratch/{slug}/context.md` -- Context and decisions (resolved via state.json artifact registry)
|
|
40
40
|
- `.workflow/scratch/{slug}/research.md` -- Research (if available, resolved via artifact registry)
|
|
41
41
|
- Spec references and doc-index
|
|
42
|
+
- **Codebase docs** (if `.workflow/codebase/` exists) — `doc-index.json` for component mapping; `ARCHITECTURE.md` for module boundaries when decomposing tasks
|
|
43
|
+
- **Wiki prior knowledge** (if `maestro wiki` available) — `maestro wiki search "<phase keywords>"` for related decisions/constraints that inform task design
|
|
42
44
|
- **Project specs** (MANDATORY) -- Loaded via `maestro spec load --category arch`:
|
|
43
45
|
- Architecture constraints (module structure, layer boundaries, dependency rules)
|
|
44
46
|
- Coding conventions (naming, imports, patterns)
|
|
@@ -46,6 +46,8 @@ You perform focused code review for a single dimension (e.g., security, performa
|
|
|
46
46
|
- `phase_context`: Phase goal, success criteria, task descriptions
|
|
47
47
|
- `specs_context`: Project coding conventions, architecture constraints, quality rules (optional)
|
|
48
48
|
- `tech_stack`: Language, framework, test framework (optional)
|
|
49
|
+
- `codebase_context` (optional): `.workflow/codebase/ARCHITECTURE.md` content — component boundaries, layer rules, dependency direction. Use for architecture dimension and cross-referencing layer violations.
|
|
50
|
+
- `wiki_context` (optional): Related wiki entries from `maestro wiki search` — architecture decisions and constraints to evaluate code against.
|
|
49
51
|
|
|
50
52
|
## Output
|
|
51
53
|
Return a JSON array of findings:
|
|
@@ -48,6 +48,8 @@ You perform goal-backward verification of completed work using a three-layer che
|
|
|
48
48
|
- Completed code/artifacts to verify
|
|
49
49
|
- Task summaries from `.summaries/`
|
|
50
50
|
- **Project specs** — `maestro spec load --category quality`: verification criteria, acceptance standards. Must verify code complies with loaded constraints.
|
|
51
|
+
- **Codebase docs** (if `.workflow/codebase/` exists) — Read `ARCHITECTURE.md` for expected module wiring and `FEATURES.md` for component mapping; use in Layer 3 (Connection) checks
|
|
52
|
+
- **Wiki constraints** (if `maestro wiki` available) — `maestro wiki search "architecture constraint"` for documented invariants to include as additional truth checks
|
|
51
53
|
|
|
52
54
|
## Output
|
|
53
55
|
`verification.json`:
|
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: learn-decompose
|
|
3
|
-
description:
|
|
4
|
-
argument-hint: "<path|module> [--patterns <list>] [--save-spec] [--save-wiki]"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Write
|
|
8
|
-
- Bash
|
|
9
|
-
- Glob
|
|
10
|
-
- Grep
|
|
11
|
-
- Agent
|
|
12
|
-
- AskUserQuestion
|
|
13
|
-
---
|
|
14
|
-
<purpose>
|
|
15
|
-
Systematic pattern extraction from code. Analyzes a module or directory across 4 dimensions (structural, behavioral, data, error) using parallel agents, then catalogs findings with code anchors. Discovered patterns can be persisted to specs (via `spec-add`) and wiki (via `maestro wiki create`).
|
|
16
|
-
|
|
17
|
-
Unlike `learn-follow` which reads code with forcing questions, this command is purpose-built for pattern identification and cataloging. It produces a reusable pattern catalog that feeds into the spec system.
|
|
18
|
-
</purpose>
|
|
19
|
-
|
|
20
|
-
<context>
|
|
21
|
-
Arguments: $ARGUMENTS
|
|
22
|
-
|
|
23
|
-
**Target resolution:**
|
|
24
|
-
- File path → analyze that file
|
|
25
|
-
- Directory path → analyze all source files in it
|
|
26
|
-
- Module name → Glob for matching directory under `src/`
|
|
27
|
-
|
|
28
|
-
**Flags:**
|
|
29
|
-
- `--patterns <list>` — Comma-separated pattern names to look for (e.g., "observer,factory,middleware"). If omitted, detect all.
|
|
30
|
-
- `--save-spec` — Invoke `Skill({ skill: "spec-add" })` for each newly discovered pattern
|
|
31
|
-
- `--save-wiki` — Create wiki note entries per pattern group via `maestro wiki create --type note`
|
|
32
|
-
|
|
33
|
-
**Storage written:**
|
|
34
|
-
- `.workflow/learning/decompose-{slug}-{YYYY-MM-DD}.md` — Pattern decomposition report
|
|
35
|
-
- `.workflow/learning/lessons.jsonl` — One insight per discovered pattern (source: "decompose")
|
|
36
|
-
- `.workflow/learning/learning-index.json` — Updated index
|
|
37
|
-
- If `--save-spec`: entries appended to `.workflow/specs/coding-conventions.md`
|
|
38
|
-
- If `--save-wiki`: new wiki note entries
|
|
39
|
-
|
|
40
|
-
**Storage read:**
|
|
41
|
-
- Source files at target path
|
|
42
|
-
- `.workflow/specs/coding-conventions.md` — Existing documented patterns (for dedup)
|
|
43
|
-
- `.workflow/learning/lessons.jsonl` — Previously identified patterns (for dedup)
|
|
44
|
-
</context>
|
|
45
|
-
|
|
46
|
-
<execution>
|
|
47
|
-
|
|
48
|
-
### Stage 1: Resolve Target
|
|
49
|
-
- If argument is a file: verify exists, use as single-file target
|
|
50
|
-
- If argument is a directory: list all `.ts`, `.tsx`, `.js`, `.jsx` files (exclude `node_modules`, `dist`, `.test.`)
|
|
51
|
-
- If argument is a module name: Glob `src/**/{module}*` to find matching directory
|
|
52
|
-
- If target unresolvable, AskUserQuestion with suggestions
|
|
53
|
-
|
|
54
|
-
### Stage 2: Load Existing Patterns
|
|
55
|
-
- Read `.workflow/specs/coding-conventions.md` — extract documented patterns
|
|
56
|
-
- Search `lessons.jsonl` for entries with `category: "pattern"` — previously discovered
|
|
57
|
-
- Build dedup set: pattern names already known
|
|
58
|
-
|
|
59
|
-
### Stage 3: Parallel Agent Analysis (4 dimensions)
|
|
60
|
-
Spawn 4 Agents in a single message, each analyzing the target from one dimension:
|
|
61
|
-
|
|
62
|
-
**Agent 1 — Structural Patterns:**
|
|
63
|
-
- Class hierarchy and composition relationships
|
|
64
|
-
- Module boundaries and encapsulation
|
|
65
|
-
- Dependency injection / inversion of control
|
|
66
|
-
- Builder, Factory, Singleton patterns
|
|
67
|
-
- Export structure (barrel files, re-exports)
|
|
68
|
-
|
|
69
|
-
**Agent 2 — Behavioral Patterns:**
|
|
70
|
-
- Event flow (EventEmitter, pub/sub, callbacks)
|
|
71
|
-
- Middleware chains and interceptors
|
|
72
|
-
- Observer/subscriber patterns
|
|
73
|
-
- Command/strategy patterns
|
|
74
|
-
- State machines
|
|
75
|
-
|
|
76
|
-
**Agent 3 — Data Patterns:**
|
|
77
|
-
- Repository / data access patterns
|
|
78
|
-
- DTO / transformation pipelines
|
|
79
|
-
- Caching strategies (memoization, LRU, TTL)
|
|
80
|
-
- Serialization / deserialization
|
|
81
|
-
- Schema validation approaches
|
|
82
|
-
|
|
83
|
-
**Agent 4 — Error Patterns:**
|
|
84
|
-
- Error boundary and propagation
|
|
85
|
-
- Retry / backoff / circuit breaker
|
|
86
|
-
- Fallback chains
|
|
87
|
-
- Validation and guard clauses
|
|
88
|
-
- Logging and observability patterns
|
|
89
|
-
|
|
90
|
-
Each agent returns findings as structured list:
|
|
91
|
-
```json
|
|
92
|
-
[{
|
|
93
|
-
"name": "pattern name",
|
|
94
|
-
"dimension": "structural|behavioral|data|error",
|
|
95
|
-
"confidence": "high|medium|low",
|
|
96
|
-
"anchors": ["file:line", "file:line"],
|
|
97
|
-
"description": "what it does",
|
|
98
|
-
"rationale": "why this approach",
|
|
99
|
-
"tradeoffs": "what was given up"
|
|
100
|
-
}]
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
If `--patterns` specified, instruct agents to focus only on named patterns.
|
|
104
|
-
|
|
105
|
-
### Stage 4: Cross-Reference & Dedup
|
|
106
|
-
- Match agent findings against existing pattern set from Stage 2
|
|
107
|
-
- Mark each finding: `documented` (already in specs), `known` (in lessons), or `new`
|
|
108
|
-
- Flag contradictions: finding conflicts with documented convention
|
|
109
|
-
- Merge duplicate findings across agents (same pattern found by multiple dimensions)
|
|
110
|
-
|
|
111
|
-
### Stage 5: Produce Pattern Catalog
|
|
112
|
-
Build the decomposition report grouped by dimension:
|
|
113
|
-
|
|
114
|
-
```markdown
|
|
115
|
-
# Pattern Decomposition: {target}
|
|
116
|
-
|
|
117
|
-
## Summary
|
|
118
|
-
- Patterns found: N (M new, K documented, J known)
|
|
119
|
-
- Dimensions analyzed: structural, behavioral, data, error
|
|
120
|
-
- Contradictions: N
|
|
121
|
-
|
|
122
|
-
## Structural Patterns
|
|
123
|
-
| Pattern | Confidence | Location | Status |
|
|
124
|
-
|---------|-----------|----------|--------|
|
|
125
|
-
| {name} | high | {file:line} | new / documented / known |
|
|
126
|
-
|
|
127
|
-
### {Pattern Name}
|
|
128
|
-
**Description:** ...
|
|
129
|
-
**Code example:** (inline snippet from anchor)
|
|
130
|
-
**Trade-offs:** ...
|
|
131
|
-
|
|
132
|
-
## Behavioral Patterns
|
|
133
|
-
...
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Stage 6: Persist
|
|
137
|
-
1. Write `.workflow/learning/decompose-{slug}-{date}.md`
|
|
138
|
-
2. Append each **new** pattern to `lessons.jsonl`:
|
|
139
|
-
- `source: "decompose"`, `category: "pattern"`, `confidence: <level>`
|
|
140
|
-
- Tags: `["decompose", "{dimension}", "{target-slug}"]`
|
|
141
|
-
- Stable INS-id from `hash("decompose" + target + pattern_name)`
|
|
142
|
-
3. Update `learning-index.json`
|
|
143
|
-
4. If `--save-spec`: for each new pattern, invoke `Skill({ skill: "spec-add", args: "pattern {description}" })`
|
|
144
|
-
5. If `--save-wiki`: create wiki note per dimension group via `maestro wiki create --type note --slug decompose-{dimension}-{slug}`
|
|
145
|
-
6. Display summary with counts and next steps
|
|
146
|
-
|
|
147
|
-
**Next-step routing:**
|
|
148
|
-
- Follow-along on a specific pattern → `/learn-follow <anchor-file>`
|
|
149
|
-
- Get second opinion on findings → `/learn-second-opinion <target>`
|
|
150
|
-
- Add all new patterns to specs → `/spec-add coding ...` per pattern
|
|
151
|
-
</execution>
|
|
152
|
-
|
|
153
|
-
<error_codes>
|
|
154
|
-
| Code | Severity | Condition | Recovery |
|
|
155
|
-
|------|----------|-----------|----------|
|
|
156
|
-
| E001 | error | Target path not found | Check path exists, or use a module name |
|
|
157
|
-
| E002 | error | No source files found in target directory | Check target has .ts/.js files, exclude filters may be too aggressive |
|
|
158
|
-
| W001 | warning | One or more dimension agents failed — partial results | Proceed with available dimensions, retry failed ones |
|
|
159
|
-
| W002 | warning | coding-conventions.md not found — skipping dedup against specs | All patterns marked as "new" |
|
|
160
|
-
| W003 | warning | Large target (>50 files) — analysis may be slow | Consider narrowing scope with --patterns filter |
|
|
161
|
-
</error_codes>
|
|
162
|
-
|
|
163
|
-
<success_criteria>
|
|
164
|
-
- [ ] Target resolved to concrete file list
|
|
165
|
-
- [ ] Existing patterns loaded for dedup
|
|
166
|
-
- [ ] All 4 dimension agents spawned in parallel
|
|
167
|
-
- [ ] Each finding has: name, dimension, confidence, anchors, description, tradeoffs
|
|
168
|
-
- [ ] Cross-reference performed (documented / known / new status assigned)
|
|
169
|
-
- [ ] Pattern catalog written to `decompose-{slug}-{date}.md`
|
|
170
|
-
- [ ] New patterns appended to `lessons.jsonl` with stable INS-ids
|
|
171
|
-
- [ ] `learning-index.json` updated
|
|
172
|
-
- [ ] If --save-spec: spec entries created for new patterns
|
|
173
|
-
- [ ] If --save-wiki: wiki notes created per dimension group
|
|
174
|
-
- [ ] No files modified outside `.workflow/learning/` (and optionally specs/wiki)
|
|
175
|
-
- [ ] Summary displayed with pattern counts and next-step routing
|
|
176
|
-
</success_criteria>
|
|
1
|
+
---
|
|
2
|
+
name: learn-decompose
|
|
3
|
+
description: Extract design patterns from code into specs and wiki
|
|
4
|
+
argument-hint: "<path|module> [--patterns <list>] [--save-spec] [--save-wiki]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Agent
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
<purpose>
|
|
15
|
+
Systematic pattern extraction from code. Analyzes a module or directory across 4 dimensions (structural, behavioral, data, error) using parallel agents, then catalogs findings with code anchors. Discovered patterns can be persisted to specs (via `spec-add`) and wiki (via `maestro wiki create`).
|
|
16
|
+
|
|
17
|
+
Unlike `learn-follow` which reads code with forcing questions, this command is purpose-built for pattern identification and cataloging. It produces a reusable pattern catalog that feeds into the spec system.
|
|
18
|
+
</purpose>
|
|
19
|
+
|
|
20
|
+
<context>
|
|
21
|
+
Arguments: $ARGUMENTS
|
|
22
|
+
|
|
23
|
+
**Target resolution:**
|
|
24
|
+
- File path → analyze that file
|
|
25
|
+
- Directory path → analyze all source files in it
|
|
26
|
+
- Module name → Glob for matching directory under `src/`
|
|
27
|
+
|
|
28
|
+
**Flags:**
|
|
29
|
+
- `--patterns <list>` — Comma-separated pattern names to look for (e.g., "observer,factory,middleware"). If omitted, detect all.
|
|
30
|
+
- `--save-spec` — Invoke `Skill({ skill: "spec-add" })` for each newly discovered pattern
|
|
31
|
+
- `--save-wiki` — Create wiki note entries per pattern group via `maestro wiki create --type note`
|
|
32
|
+
|
|
33
|
+
**Storage written:**
|
|
34
|
+
- `.workflow/learning/decompose-{slug}-{YYYY-MM-DD}.md` — Pattern decomposition report
|
|
35
|
+
- `.workflow/learning/lessons.jsonl` — One insight per discovered pattern (source: "decompose")
|
|
36
|
+
- `.workflow/learning/learning-index.json` — Updated index
|
|
37
|
+
- If `--save-spec`: entries appended to `.workflow/specs/coding-conventions.md`
|
|
38
|
+
- If `--save-wiki`: new wiki note entries
|
|
39
|
+
|
|
40
|
+
**Storage read:**
|
|
41
|
+
- Source files at target path
|
|
42
|
+
- `.workflow/specs/coding-conventions.md` — Existing documented patterns (for dedup)
|
|
43
|
+
- `.workflow/learning/lessons.jsonl` — Previously identified patterns (for dedup)
|
|
44
|
+
</context>
|
|
45
|
+
|
|
46
|
+
<execution>
|
|
47
|
+
|
|
48
|
+
### Stage 1: Resolve Target
|
|
49
|
+
- If argument is a file: verify exists, use as single-file target
|
|
50
|
+
- If argument is a directory: list all `.ts`, `.tsx`, `.js`, `.jsx` files (exclude `node_modules`, `dist`, `.test.`)
|
|
51
|
+
- If argument is a module name: Glob `src/**/{module}*` to find matching directory
|
|
52
|
+
- If target unresolvable, AskUserQuestion with suggestions
|
|
53
|
+
|
|
54
|
+
### Stage 2: Load Existing Patterns
|
|
55
|
+
- Read `.workflow/specs/coding-conventions.md` — extract documented patterns
|
|
56
|
+
- Search `lessons.jsonl` for entries with `category: "pattern"` — previously discovered
|
|
57
|
+
- Build dedup set: pattern names already known
|
|
58
|
+
|
|
59
|
+
### Stage 3: Parallel Agent Analysis (4 dimensions)
|
|
60
|
+
Spawn 4 Agents in a single message, each analyzing the target from one dimension:
|
|
61
|
+
|
|
62
|
+
**Agent 1 — Structural Patterns:**
|
|
63
|
+
- Class hierarchy and composition relationships
|
|
64
|
+
- Module boundaries and encapsulation
|
|
65
|
+
- Dependency injection / inversion of control
|
|
66
|
+
- Builder, Factory, Singleton patterns
|
|
67
|
+
- Export structure (barrel files, re-exports)
|
|
68
|
+
|
|
69
|
+
**Agent 2 — Behavioral Patterns:**
|
|
70
|
+
- Event flow (EventEmitter, pub/sub, callbacks)
|
|
71
|
+
- Middleware chains and interceptors
|
|
72
|
+
- Observer/subscriber patterns
|
|
73
|
+
- Command/strategy patterns
|
|
74
|
+
- State machines
|
|
75
|
+
|
|
76
|
+
**Agent 3 — Data Patterns:**
|
|
77
|
+
- Repository / data access patterns
|
|
78
|
+
- DTO / transformation pipelines
|
|
79
|
+
- Caching strategies (memoization, LRU, TTL)
|
|
80
|
+
- Serialization / deserialization
|
|
81
|
+
- Schema validation approaches
|
|
82
|
+
|
|
83
|
+
**Agent 4 — Error Patterns:**
|
|
84
|
+
- Error boundary and propagation
|
|
85
|
+
- Retry / backoff / circuit breaker
|
|
86
|
+
- Fallback chains
|
|
87
|
+
- Validation and guard clauses
|
|
88
|
+
- Logging and observability patterns
|
|
89
|
+
|
|
90
|
+
Each agent returns findings as structured list:
|
|
91
|
+
```json
|
|
92
|
+
[{
|
|
93
|
+
"name": "pattern name",
|
|
94
|
+
"dimension": "structural|behavioral|data|error",
|
|
95
|
+
"confidence": "high|medium|low",
|
|
96
|
+
"anchors": ["file:line", "file:line"],
|
|
97
|
+
"description": "what it does",
|
|
98
|
+
"rationale": "why this approach",
|
|
99
|
+
"tradeoffs": "what was given up"
|
|
100
|
+
}]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If `--patterns` specified, instruct agents to focus only on named patterns.
|
|
104
|
+
|
|
105
|
+
### Stage 4: Cross-Reference & Dedup
|
|
106
|
+
- Match agent findings against existing pattern set from Stage 2
|
|
107
|
+
- Mark each finding: `documented` (already in specs), `known` (in lessons), or `new`
|
|
108
|
+
- Flag contradictions: finding conflicts with documented convention
|
|
109
|
+
- Merge duplicate findings across agents (same pattern found by multiple dimensions)
|
|
110
|
+
|
|
111
|
+
### Stage 5: Produce Pattern Catalog
|
|
112
|
+
Build the decomposition report grouped by dimension:
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
# Pattern Decomposition: {target}
|
|
116
|
+
|
|
117
|
+
## Summary
|
|
118
|
+
- Patterns found: N (M new, K documented, J known)
|
|
119
|
+
- Dimensions analyzed: structural, behavioral, data, error
|
|
120
|
+
- Contradictions: N
|
|
121
|
+
|
|
122
|
+
## Structural Patterns
|
|
123
|
+
| Pattern | Confidence | Location | Status |
|
|
124
|
+
|---------|-----------|----------|--------|
|
|
125
|
+
| {name} | high | {file:line} | new / documented / known |
|
|
126
|
+
|
|
127
|
+
### {Pattern Name}
|
|
128
|
+
**Description:** ...
|
|
129
|
+
**Code example:** (inline snippet from anchor)
|
|
130
|
+
**Trade-offs:** ...
|
|
131
|
+
|
|
132
|
+
## Behavioral Patterns
|
|
133
|
+
...
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Stage 6: Persist
|
|
137
|
+
1. Write `.workflow/learning/decompose-{slug}-{date}.md`
|
|
138
|
+
2. Append each **new** pattern to `lessons.jsonl`:
|
|
139
|
+
- `source: "decompose"`, `category: "pattern"`, `confidence: <level>`
|
|
140
|
+
- Tags: `["decompose", "{dimension}", "{target-slug}"]`
|
|
141
|
+
- Stable INS-id from `hash("decompose" + target + pattern_name)`
|
|
142
|
+
3. Update `learning-index.json`
|
|
143
|
+
4. If `--save-spec`: for each new pattern, invoke `Skill({ skill: "spec-add", args: "pattern {description}" })`
|
|
144
|
+
5. If `--save-wiki`: create wiki note per dimension group via `maestro wiki create --type note --slug decompose-{dimension}-{slug}`
|
|
145
|
+
6. Display summary with counts and next steps
|
|
146
|
+
|
|
147
|
+
**Next-step routing:**
|
|
148
|
+
- Follow-along on a specific pattern → `/learn-follow <anchor-file>`
|
|
149
|
+
- Get second opinion on findings → `/learn-second-opinion <target>`
|
|
150
|
+
- Add all new patterns to specs → `/spec-add coding ...` per pattern
|
|
151
|
+
</execution>
|
|
152
|
+
|
|
153
|
+
<error_codes>
|
|
154
|
+
| Code | Severity | Condition | Recovery |
|
|
155
|
+
|------|----------|-----------|----------|
|
|
156
|
+
| E001 | error | Target path not found | Check path exists, or use a module name |
|
|
157
|
+
| E002 | error | No source files found in target directory | Check target has .ts/.js files, exclude filters may be too aggressive |
|
|
158
|
+
| W001 | warning | One or more dimension agents failed — partial results | Proceed with available dimensions, retry failed ones |
|
|
159
|
+
| W002 | warning | coding-conventions.md not found — skipping dedup against specs | All patterns marked as "new" |
|
|
160
|
+
| W003 | warning | Large target (>50 files) — analysis may be slow | Consider narrowing scope with --patterns filter |
|
|
161
|
+
</error_codes>
|
|
162
|
+
|
|
163
|
+
<success_criteria>
|
|
164
|
+
- [ ] Target resolved to concrete file list
|
|
165
|
+
- [ ] Existing patterns loaded for dedup
|
|
166
|
+
- [ ] All 4 dimension agents spawned in parallel
|
|
167
|
+
- [ ] Each finding has: name, dimension, confidence, anchors, description, tradeoffs
|
|
168
|
+
- [ ] Cross-reference performed (documented / known / new status assigned)
|
|
169
|
+
- [ ] Pattern catalog written to `decompose-{slug}-{date}.md`
|
|
170
|
+
- [ ] New patterns appended to `lessons.jsonl` with stable INS-ids
|
|
171
|
+
- [ ] `learning-index.json` updated
|
|
172
|
+
- [ ] If --save-spec: spec entries created for new patterns
|
|
173
|
+
- [ ] If --save-wiki: wiki notes created per dimension group
|
|
174
|
+
- [ ] No files modified outside `.workflow/learning/` (and optionally specs/wiki)
|
|
175
|
+
- [ ] Summary displayed with pattern counts and next-step routing
|
|
176
|
+
</success_criteria>
|