maestro-flow 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.codex/skills/maestro-collab/SKILL.md +218 -117
  2. package/.codex/skills/maestro-execute/SKILL.md +13 -11
  3. package/.codex/skills/maestro-milestone-audit/SKILL.md +12 -10
  4. package/.codex/skills/maestro-ui-codify/SKILL.md +18 -16
  5. package/.codex/skills/manage-codebase-rebuild/SKILL.md +20 -13
  6. package/.codex/skills/manage-issue-discover/SKILL.md +19 -17
  7. package/.codex/skills/quality-debug/SKILL.md +35 -31
  8. package/.codex/skills/quality-refactor/SKILL.md +20 -12
  9. package/.codex/skills/quality-review/SKILL.md +21 -17
  10. package/.codex/skills/team-coordinate/SKILL.md +462 -235
  11. package/.codex/skills/team-coordinate/specs/role-catalog.md +132 -0
  12. package/.codex/skills/team-lifecycle-v4/SKILL.md +445 -191
  13. package/.codex/skills/team-quality-assurance/SKILL.md +205 -161
  14. package/.codex/skills/team-review/SKILL.md +198 -159
  15. package/.codex/skills/team-tech-debt/SKILL.md +214 -144
  16. package/.codex/skills/team-testing/SKILL.md +210 -158
  17. package/package.json +1 -1
  18. package/.codex/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +0 -247
  19. package/.codex/skills/team-coordinate/roles/coordinator/commands/dispatch.md +0 -126
  20. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +0 -265
  21. package/.codex/skills/team-coordinate/roles/coordinator/role.md +0 -403
  22. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +0 -113
  23. package/.codex/skills/team-coordinate/specs/pipelines.md +0 -97
  24. package/.codex/skills/team-coordinate/specs/quality-gates.md +0 -112
  25. package/.codex/skills/team-coordinate/specs/role-spec-template.md +0 -192
  26. package/.codex/skills/team-executor/SKILL.md +0 -116
  27. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +0 -213
  28. package/.codex/skills/team-executor/roles/executor/role.md +0 -173
  29. package/.codex/skills/team-executor/specs/session-schema.md +0 -230
  30. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +0 -56
  31. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +0 -61
  32. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +0 -113
  33. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +0 -189
  34. package/.codex/skills/team-lifecycle-v4/schemas/tasks-schema.md +0 -100
  35. package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +0 -204
  36. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +0 -72
  37. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +0 -108
  38. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +0 -163
  39. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +0 -177
  40. package/.codex/skills/team-review/roles/coordinator/commands/analyze.md +0 -71
  41. package/.codex/skills/team-review/roles/coordinator/commands/dispatch.md +0 -90
  42. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +0 -135
  43. package/.codex/skills/team-review/roles/coordinator/role.md +0 -176
  44. package/.codex/skills/team-tech-debt/roles/coordinator/commands/analyze.md +0 -47
  45. package/.codex/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +0 -163
  46. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +0 -133
  47. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +0 -173
  48. package/.codex/skills/team-testing/roles/coordinator/commands/analyze.md +0 -70
  49. package/.codex/skills/team-testing/roles/coordinator/commands/dispatch.md +0 -106
  50. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +0 -156
  51. package/.codex/skills/team-testing/roles/coordinator/role.md +0 -185
@@ -1,158 +1,210 @@
1
- ---
2
- name: team-testing
3
- description: Team testing with progressive coverage and generator-critic loops
4
- allowed-tools: spawn_agent(*), wait_agent(*), send_message(*), followup_task(*), close_agent(*), list_agents(*), report_agent_job_result(*), request_user_input(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*), mcp__maestro-tools__team_msg(*)
5
- ---
6
-
7
- <purpose>
8
- Orchestrate multi-agent test pipeline: strategist -> generator -> executor -> analyst. Progressive layer coverage (L1/L2/L3) with Generator-Critic loops for coverage convergence.
9
-
10
- ```
11
- Skill(skill="team-testing", args="task description")
12
- |
13
- SKILL.md (this file) = Router
14
- |
15
- +--------------+--------------+
16
- | |
17
- no --role flag --role <name>
18
- | |
19
- Coordinator Worker
20
- roles/coordinator/role.md roles/<name>/role.md
21
- |
22
- +-- analyze -> dispatch -> spawn workers -> STOP
23
- |
24
- +-------+-------+-------+-------+
25
- v v v v
26
- [strat] [gen] [exec] [analyst]
27
- team-worker agents, each loads roles/<role>/role.md
28
- ```
29
-
30
- </purpose>
31
-
32
- <context>
33
- ### Role Registry
34
-
35
- | Role | Path | Prefix | Inner Loop |
36
- |------|------|--------|------------|
37
- | coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | -- | -- |
38
- | strategist | [roles/strategist/role.md](roles/strategist/role.md) | STRATEGY-* | false |
39
- | generator | [roles/generator/role.md](roles/generator/role.md) | TESTGEN-* | true |
40
- | executor | [roles/executor/role.md](roles/executor/role.md) | TESTRUN-* | true |
41
- | analyst | [roles/analyst/role.md](roles/analyst/role.md) | TESTANA-* | false |
42
-
43
- ### Role Router
44
-
45
- Parse `$ARGUMENTS`:
46
- - Has `--role <name>` -> Read `roles/<name>/role.md`, execute Phase 2-4
47
- - No `--role` -> `roles/coordinator/role.md`, execute entry router
48
-
49
- ### Delegation Lock
50
-
51
- **Coordinator is a PURE ORCHESTRATOR. It coordinates, it does NOT do.**
52
-
53
- Before calling ANY tool, apply this check:
54
-
55
- | Tool Call | Verdict | Reason |
56
- |-----------|---------|--------|
57
- | `spawn_agent`, `wait_agent`, `close_agent`, `send_message`, `followup_task` | ALLOWED | Orchestration |
58
- | `list_agents` | ALLOWED | Agent health check |
59
- | `request_user_input` | ALLOWED | User interaction |
60
- | `mcp__maestro-tools__team_msg` | ALLOWED | Message bus |
61
- | `Read/Write` on `.workflow/.team/` files | ALLOWED | Session state |
62
- | `Read` on `roles/`, `commands/`, `specs/` | ALLOWED | Loading own instructions |
63
- | `Read/Grep/Glob` on project source code | BLOCKED | Delegate to worker |
64
- | `Edit` on any file outside `.workflow/` | BLOCKED | Delegate to worker |
65
- | `Bash("maestro delegate ...")` | BLOCKED | Only workers call CLI |
66
- | `Bash` running build/test/lint commands | BLOCKED | Delegate to worker |
67
-
68
- **If a tool call is BLOCKED**: STOP. Create a task, spawn a worker.
69
-
70
- **No exceptions for "simple" tasks.** Even a single-file read-and-report MUST go through spawn_agent.
71
-
72
- ### Shared Constants
73
-
74
- - **Session prefix**: `TST`
75
- - **Session path**: `.workflow/.team/TST-<slug>-<date>/`
76
- - **Team name**: `testing`
77
- - **CLI tools**: `maestro delegate --mode analysis` (read-only), `maestro delegate --mode write` (modifications)
78
- - **Message bus**: `mcp__maestro-tools__team_msg(session_id=<session-id>, ...)`
79
-
80
- ### Worker Spawn Template
81
-
82
- Spawn via `team-worker` agent. Message includes: role, role_spec path, session folder/id, requirement, inner_loop flag, task context, upstream context. After spawning: `wait_agent` (30 min). Timeout: STATUS_CHECK (3 min) -> FINALIZE (3 min) -> close.
83
-
84
- ### Model Selection Guide
85
-
86
- | Role | reasoning_effort |
87
- |------|-------------------|
88
- | Strategist (STRATEGY-*) | high |
89
- | Generator (TESTGEN-*) | high |
90
- | Executor (TESTRUN-*) | medium |
91
- | Analyst (TESTANA-*) | high |
92
-
93
- Override via `model`/`reasoning_effort` params in spawn_agent for cost optimization.
94
-
95
- ### User Commands
96
-
97
- | Command | Action |
98
- |---------|--------|
99
- | `check` / `status` | View pipeline status graph |
100
- | `resume` / `continue` | Advance to next step |
101
- | `revise <TASK-ID>` | Revise specific task |
102
- | `feedback <text>` | Inject feedback for revision |
103
-
104
- ### v4 Agent Coordination
105
-
106
- **Message Semantics**: `send_message` to queue strategy to generators. `list_agents` for health checks. `followup_task` not used (all one-shot).
107
-
108
- **Parallel Test Generation**: Spawn multiple generators per layer (L1/L2/L3) in parallel, then executors.
109
-
110
- **GC Loop Coordination**: Create dynamic TESTGEN-fix and TESTRUN-fix tasks when coverage below target. Track `gc_rounds[layer]`.
111
-
112
- **Agent Health Check**: Reconcile `tasks.json` with `list_agents({})`. Reset orphaned tasks to pending.
113
-
114
- **Named Targeting**: `send_message({ target: "TESTGEN-001" })`, `close_agent({ target: "TESTRUN-001" })`.
115
-
116
- ### Completion Action
117
-
118
- Present choice: **Archive & Clean** (recommended), **Keep Active**, **Deepen Coverage** (add layers or raise targets).
119
-
120
- ### Session Directory
121
-
122
- ```
123
- .workflow/.team/TST-<slug>-<date>/
124
- +-- .msg/messages.jsonl # Team message bus
125
- +-- .msg/meta.json # Session metadata
126
- +-- wisdom/ # Cross-task knowledge
127
- +-- strategy/ # Strategist output
128
- +-- tests/ # Generator output (L1-unit/, L2-integration/, L3-e2e/)
129
- +-- results/ # Executor output
130
- +-- analysis/ # Analyst output
131
- ```
132
-
133
- ### Specs Reference
134
-
135
- - [specs/pipelines.md](specs/pipelines.md) -- Pipeline definitions and task registry
136
- - [specs/team-config.json](specs/team-config.json) -- Team configuration
137
- </context>
138
-
139
- <error_codes>
140
-
141
- | Scenario | Resolution |
142
- |----------|------------|
143
- | Unknown --role value | Error with available role list |
144
- | Role not found | Error with expected path (roles/<name>/role.md) |
145
- | CLI tool fails | Worker fallback to direct implementation |
146
- | GC loop exceeded | Accept current coverage with warning |
147
- | Fast-advance conflict | Coordinator reconciles on next callback |
148
- | Completion action fails | Default to Keep Active |
149
- </error_codes>
150
-
151
- <success_criteria>
152
- - [ ] Role router correctly dispatches to coordinator or worker based on --role flag
153
- - [ ] Pipeline executes strategist -> generator -> executor -> analyst in order
154
- - [ ] Parallel generators spawned per test layer (L1/L2/L3)
155
- - [ ] GC loops create fix tasks dynamically when coverage is below target
156
- - [ ] Session state persisted after each wave
157
- - [ ] Completion action presented and handled correctly
158
- </success_criteria>
1
+ ---
2
+ name: team-testing
3
+ description: Team testing with progressive coverage and generator-critic loops
4
+ argument-hint: "[scope] [-y|--yes] [-c|--concurrency N] [--continue] [--pipeline targeted|standard|comprehensive]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based test pipeline via `spawn_agents_on_csv`. Progressive layer coverage (L1/L2/L3) with Generator-Critic loops for convergence.
10
+
11
+ ```
12
+ +-------------------------------------------------------------------+
13
+ | TESTING CSV WAVE WORKFLOW |
14
+ +-------------------------------------------------------------------+
15
+ | Phase 1: Pipeline Selection + CSV Generation |
16
+ | +-- Detect pipeline (targeted/standard/comprehensive) |
17
+ | +-- Build tasks.csv with wave assignments |
18
+ | |
19
+ | Phase 2: Wave Execution Engine |
20
+ | +-- Sequential waves, parallel tasks within wave |
21
+ | +-- GC Loop: after TESTRUN, check pass_rate + coverage |
22
+ | | +-- pass_rate < 0.95 OR coverage < target → iterate |
23
+ | +-- discoveries.ndjson shared across waves |
24
+ | |
25
+ | Phase 3: Results Aggregation |
26
+ +-------------------------------------------------------------------+
27
+ ```
28
+ </purpose>
29
+
30
+ <context>
31
+ ```bash
32
+ $team-testing "src/auth module"
33
+ $team-testing -y --pipeline comprehensive "src/"
34
+ $team-testing --continue "20260518-tst-auth"
35
+ ```
36
+
37
+ **Flags**: `-y` (auto), `-c N` (concurrency, default 3), `--continue` (resume), `--pipeline targeted|standard|comprehensive`
38
+
39
+ ### Role Registry (Fixed)
40
+
41
+ | Role | Path | Prefix |
42
+ |------|------|--------|
43
+ | strategist | [roles/strategist/role.md](roles/strategist/role.md) | STRATEGY-* |
44
+ | generator | [roles/generator/role.md](roles/generator/role.md) | TESTGEN-* |
45
+ | executor | [roles/executor/role.md](roles/executor/role.md) | TESTRUN-* |
46
+ | analyst | [roles/analyst/role.md](roles/analyst/role.md) | TESTANA-* |
47
+
48
+ **Session**: `.workflow/.csv-wave/{YYYYMMDD}-tst-{slug}/`
49
+ **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md
50
+
51
+ ### Pipeline Selection
52
+
53
+ | Scope | Pipeline |
54
+ |-------|----------|
55
+ | ≤3 files, ≤1 module | targeted |
56
+ | ≤10 files, ≤3 modules | standard |
57
+ | >10 files or >3 modules | comprehensive |
58
+ </context>
59
+
60
+ <csv_schema>
61
+
62
+ ### tasks.csv (Input columns)
63
+
64
+ ```csv
65
+ id,title,description,role,test_layer,deps,context_from,wave
66
+ ```
67
+
68
+ | Column | Description |
69
+ |--------|-------------|
70
+ | `id` | Task ID: `{PREFIX}-{NNN}` |
71
+ | `title` | Short task title |
72
+ | `description` | PURPOSE/TASK/EXPECTED/CONSTRAINTS |
73
+ | `role` | Fixed role name |
74
+ | `test_layer` | L1/L2/L3 or empty |
75
+ | `deps` | Semicolon-separated dependency IDs |
76
+ | `context_from` | Semicolon-separated context source IDs |
77
+ | `wave` | Wave number |
78
+
79
+ **Output columns** (via `output_schema` only):
80
+
81
+ | Column | Description |
82
+ |--------|-------------|
83
+ | `result_status` | completed / failed / blocked |
84
+ | `findings` | Key findings (max 500 chars) |
85
+ | `files_modified` | Semicolon-separated paths |
86
+ | `pass_rate` | Test pass rate (0.0-1.0, for TESTRUN tasks) |
87
+ | `coverage_score` | Coverage % (0-100, for TESTRUN tasks) |
88
+ | `error` | Error message |
89
+
90
+ **Column separation rule**: Input and Output MUST NOT share names.
91
+
92
+ ### Pipeline Wave Assignments
93
+
94
+ #### targeted (3 waves)
95
+
96
+ | Wave | Task | Role |
97
+ |------|------|------|
98
+ | 1 | STRATEGY-001 | strategist |
99
+ | 2 | TESTGEN-001 | generator |
100
+ | 3 | TESTRUN-001 | executor |
101
+
102
+ #### standard (6+ waves, GC loops)
103
+
104
+ | Wave | Task | Role |
105
+ |------|------|------|
106
+ | 1 | STRATEGY-001 | strategist |
107
+ | 2 | TESTGEN-001 | generator (L1) |
108
+ | 3 | TESTRUN-001 | executor (L1) |
109
+ | 4 | TESTGEN-002 | generator (L2) |
110
+ | 5 | TESTRUN-002 | executor (L2) |
111
+ | 6 | TESTANA-001 | analyst |
112
+
113
+ GC: After TESTRUN, if pass_rate < 0.95 or coverage < target → iterate (max 3).
114
+
115
+ #### comprehensive (8+ waves, parallel + GC)
116
+
117
+ | Wave | Task | Role |
118
+ |------|------|------|
119
+ | 1 | STRATEGY-001 | strategist |
120
+ | 2 | TESTGEN-001; TESTGEN-002 | generator (L1+L2 parallel) |
121
+ | 3 | TESTRUN-001; TESTRUN-002 | executor (L1+L2 parallel) |
122
+ | 4 | TESTGEN-003 | generator (L3) |
123
+ | 5 | TESTRUN-003 | executor (L3) |
124
+ | 6 | TESTANA-001 | analyst |
125
+
126
+ **Coverage Targets**: L1≥80%, L2≥60%, L3≥40%. **Max GC Rounds**: 3 per layer.
127
+ </csv_schema>
128
+
129
+ <invariants>
130
+ 1. **Wave Order Sacred**
131
+ 2. **CSV Source of Truth**
132
+ 3. **Column Separation Rule**
133
+ 4. **GC Loop Max 3**: Per-layer, triggered by pass_rate < 0.95 OR coverage < target
134
+ 5. **Coverage Targets**: L1≥80%, L2≥60%, L3≥40%
135
+ 6. **Discovery Board Append-Only**
136
+ 7. **Cleanup Temp Files**
137
+ 8. **DO NOT STOP**
138
+ 9. **Role Files Authoritative**
139
+ </invariants>
140
+
141
+ <state_machine>
142
+
143
+ <states>
144
+ S_PARSE — Parse arguments, detect pipeline
145
+ S_CSV_GEN — Generate tasks.csv
146
+ S_WAVE_{N} — Execute wave N
147
+ S_GC_CHECK — Check pass_rate + coverage after TESTRUN
148
+ S_AGGREGATE — Generate report
149
+ </states>
150
+
151
+ <transitions>
152
+ S_PARSE S_CSV_GEN
153
+ S_CSV_GEN S_WAVE_1
154
+ S_WAVE_{N} S_GC_CHECK WHEN: wave was TESTRUN
155
+ S_WAVE_{N} S_WAVE_{N+1} WHEN: not GC-eligible
156
+ S_GC_CHECK S_WAVE_{N+1} WHEN: pass_rate >= 0.95 AND coverage >= target (converged)
157
+ S_GC_CHECK S_WAVE_{N+1} WHEN: not converged, gc_rounds < 3 (add TESTGEN+TESTRUN rows)
158
+ S_GC_CHECK → S_WAVE_{N+1} WHEN: gc_rounds >= 3 (proceed with warning)
159
+ S_WAVE_{N} → S_AGGREGATE WHEN: last wave
160
+ </transitions>
161
+
162
+ <actions>
163
+
164
+ ### GC Loop
165
+
166
+ After each TESTRUN wave:
167
+ 1. Read `pass_rate` and `coverage_score`
168
+ 2. pass_rate >= 0.95 AND coverage >= target → converged, continue
169
+ 3. Not converged AND gc_rounds < 3 → add TESTGEN+TESTRUN rows, iterate
170
+ 4. gc_rounds >= 3 → proceed with warning
171
+
172
+ ### Instruction Builder
173
+
174
+ ```
175
+ You are a team-testing agent.
176
+ Role: read 'role' column. Task: read 'description' column.
177
+
178
+ ## Role Definition
179
+ Read: {skillRoot}/roles/{role}/role.md
180
+
181
+ ## Context
182
+ Session: {sessionFolder}
183
+ Discovery board: {sessionFolder}/discoveries.ndjson
184
+ Previous context: 'prev_context' column
185
+
186
+ ## Output
187
+ result_status, findings, files_modified, pass_rate (TESTRUN), coverage_score (TESTRUN), error
188
+ ```
189
+
190
+ </actions>
191
+ </state_machine>
192
+
193
+ <error_codes>
194
+
195
+ | Condition | Recovery |
196
+ |-----------|----------|
197
+ | Strategy produces empty plan | Default to L1 unit tests only |
198
+ | Generator produces 0 tests | Mark blocked, skip executor |
199
+ | Coverage never converges | After 3 GC rounds, proceed with warning |
200
+ | All tests pass on first run | Normal — skip GC iterations |
201
+ </error_codes>
202
+
203
+ <success_criteria>
204
+ - [ ] Pipeline selected and CSV generated
205
+ - [ ] Waves executed via spawn_agents_on_csv
206
+ - [ ] GC loops iterate until converged or max 3
207
+ - [ ] pass_rate and coverage_score tracked per TESTRUN
208
+ - [ ] Column separation maintained
209
+ - [ ] results.csv and context.md generated
210
+ </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Workflow orchestration CLI with MCP endpoint support and extensible architecture",
5
5
  "type": "module",
6
6
  "imports": {
@@ -1,247 +0,0 @@
1
- # Command: analyze-task
2
-
3
- ## Purpose
4
-
5
- Parse user task description -> detect required capabilities -> build dependency graph -> design dynamic roles with role-spec metadata. Outputs structured task-analysis.json with frontmatter fields for role-spec generation.
6
-
7
- ## CRITICAL CONSTRAINT
8
-
9
- **TEXT-LEVEL analysis only. MUST NOT read source code or explore codebase.**
10
-
11
- **Allowed:**
12
- - Parse user task description text
13
- - request_user_input for clarification
14
- - Keyword-to-capability mapping
15
- - Write `task-analysis.json`
16
-
17
- If task context requires codebase knowledge, set `needs_research: true`. Phase 2 will spawn researcher worker.
18
-
19
- ## When to Use
20
-
21
- | Trigger | Condition |
22
- |---------|-----------|
23
- | New task | Coordinator Phase 1 receives task description |
24
- | Re-analysis | User provides revised requirements |
25
- | Adapt | handleAdapt extends analysis for new capability |
26
-
27
- ## Strategy
28
-
29
- - **Delegation**: Inline execution (coordinator processes directly)
30
- - **Mode**: Text-level analysis only (no codebase reading)
31
- - **Output**: `<session>/task-analysis.json`
32
-
33
- ## Phase 2: Context Loading
34
-
35
- | Input | Source | Required |
36
- |-------|--------|----------|
37
- | Task description | User input from Phase 1 | Yes |
38
- | Clarification answers | request_user_input results (if any) | No |
39
- | Session folder | From coordinator Phase 2 | Yes |
40
-
41
- ## Phase 3: Task Analysis
42
-
43
- ### Step 1: Signal Detection
44
-
45
- Scan task description for capability keywords:
46
-
47
- | Signal | Keywords | Capability | Prefix | Responsibility Type |
48
- |--------|----------|------------|--------|---------------------|
49
- | Research | investigate, explore, compare, survey, find, research, discover, benchmark, study | researcher | RESEARCH | orchestration |
50
- | Writing | write, draft, document, article, report, blog, describe, explain, summarize, content | writer | DRAFT | code-gen (docs) |
51
- | Coding | implement, build, code, fix, refactor, develop, create app, program, migrate, port | developer | IMPL | code-gen (code) |
52
- | Design | design, architect, plan, structure, blueprint, model, schema, wireframe, layout | designer | DESIGN | orchestration |
53
- | Analysis | analyze, review, audit, assess, evaluate, inspect, examine, diagnose, profile | analyst | ANALYSIS | read-only |
54
- | Testing | test, verify, validate, QA, quality, check, assert, coverage, regression | tester | TEST | validation |
55
- | Planning | plan, breakdown, organize, schedule, decompose, roadmap, strategy, prioritize | planner | PLAN | orchestration |
56
-
57
- **Multi-match**: A task may trigger multiple capabilities.
58
-
59
- **No match**: Default to a single `general` capability with `TASK` prefix.
60
-
61
- ### Step 2: Artifact Inference
62
-
63
- Each capability produces default output artifacts:
64
-
65
- | Capability | Default Artifact | Format |
66
- |------------|-----------------|--------|
67
- | researcher | Research findings | `<session>/artifacts/research-findings.md` |
68
- | writer | Written document(s) | `<session>/artifacts/<doc-name>.md` |
69
- | developer | Code implementation | Source files + `<session>/artifacts/implementation-summary.md` |
70
- | designer | Design document | `<session>/artifacts/design-spec.md` |
71
- | analyst | Analysis report | `<session>/artifacts/analysis-report.md` |
72
- | tester | Test results | `<session>/artifacts/test-report.md` |
73
- | planner | Execution plan | `<session>/artifacts/execution-plan.md` |
74
-
75
- ### Step 2.5: Key File Inference
76
-
77
- For each task, infer relevant files based on capability type and task keywords:
78
-
79
- | Capability | File Inference Strategy |
80
- |------------|------------------------|
81
- | researcher | Extract domain keywords -> map to likely directories (e.g., "auth" -> `src/auth/**`, `middleware/auth.ts`) |
82
- | developer | Extract feature/module keywords -> map to source files (e.g., "payment" -> `src/payments/**`, `types/payment.ts`) |
83
- | designer | Look for architecture/config keywords -> map to config/schema files |
84
- | analyst | Extract target keywords -> map to files under analysis |
85
- | tester | Extract test target keywords -> map to source + test files |
86
- | writer | Extract documentation target -> map to relevant source files for context |
87
- | planner | No specific files (planning is abstract) |
88
-
89
- **Inference rules:**
90
- - Extract nouns and verbs from task description
91
- - Match against common directory patterns (src/, lib/, components/, services/, utils/)
92
- - Include related type definition files (types/, *.d.ts)
93
- - For "fix bug" tasks, include error-prone areas (error handlers, validation)
94
- - For "implement feature" tasks, include similar existing features as reference
95
-
96
- ### Step 3: Dependency Graph Construction
97
-
98
- Build a DAG of work streams using natural ordering tiers:
99
-
100
- | Tier | Capabilities | Description |
101
- |------|-------------|-------------|
102
- | 0 | researcher, planner | Knowledge gathering / planning |
103
- | 1 | designer | Design (requires context from tier 0 if present) |
104
- | 2 | writer, developer | Creation (requires design/plan if present) |
105
- | 3 | analyst, tester | Validation (requires artifacts to validate) |
106
-
107
- ### Step 4: Complexity Scoring
108
-
109
- | Factor | Weight | Condition |
110
- |--------|--------|-----------|
111
- | Capability count | +1 each | Number of distinct capabilities |
112
- | Cross-domain factor | +2 | Capabilities span 3+ tiers |
113
- | Parallel tracks | +1 each | Independent parallel work streams |
114
- | Serial depth | +1 per level | Longest dependency chain length |
115
-
116
- | Total Score | Complexity | Role Limit |
117
- |-------------|------------|------------|
118
- | 1-3 | Low | 1-2 roles |
119
- | 4-6 | Medium | 2-3 roles |
120
- | 7+ | High | 3-5 roles |
121
-
122
- ### Step 5: Role Minimization
123
-
124
- Apply merging rules to reduce role count (cap at 5).
125
-
126
- ### Step 6: Role-Spec Metadata Assignment
127
-
128
- For each role, determine frontmatter and generation hints:
129
-
130
- | Field | Derivation |
131
- |-------|------------|
132
- | `prefix` | From capability prefix (e.g., RESEARCH, DRAFT, IMPL) |
133
- | `inner_loop` | `true` if role has 2+ serial same-prefix tasks |
134
- | `CLI tools` | Suggested, not mandatory -- coordinator may adjust based on task needs |
135
- | `pattern_hint` | Reference pattern name from role-spec-template (research/document/code/analysis/validation) -- guides coordinator's Phase 2-4 composition, NOT a rigid template selector |
136
- | `output_type` | `artifact` (new files in session/artifacts/) / `codebase` (modify existing project files) / `mixed` (both) -- determines verification strategy in Behavioral Traits |
137
- | `message_types.success` | `<prefix>_complete` |
138
- | `message_types.error` | `error` |
139
-
140
- **output_type derivation**:
141
-
142
- | Task Signal | output_type | Example |
143
- |-------------|-------------|---------|
144
- | "write report", "analyze", "research" | `artifact` | New analysis-report.md in session |
145
- | "update docs", "modify code", "fix bug" | `codebase` | Modify existing project files |
146
- | "implement feature + write summary" | `mixed` | Code changes + implementation summary |
147
-
148
- ## Phase 4: Output
149
-
150
- Write `<session-folder>/task-analysis.json`:
151
-
152
- ```json
153
- {
154
- "task_description": "<original user input>",
155
- "capabilities": [
156
- {
157
- "name": "researcher",
158
- "prefix": "RESEARCH",
159
- "responsibility_type": "orchestration",
160
- "tasks": [
161
- {
162
- "id": "RESEARCH-001",
163
- "goal": "What this task achieves and why",
164
- "steps": [
165
- "step 1: specific action with clear verb",
166
- "step 2: specific action with clear verb",
167
- "step 3: specific action with clear verb"
168
- ],
169
- "key_files": [
170
- "src/path/to/relevant.ts",
171
- "src/path/to/other.ts"
172
- ],
173
- "upstream_artifacts": [],
174
- "success_criteria": "Measurable completion condition",
175
- "constraints": "Scope limits, focus areas"
176
- }
177
- ],
178
- "artifacts": ["research-findings.md"]
179
- }
180
- ],
181
- "dependency_graph": {
182
- "RESEARCH-001": [],
183
- "DRAFT-001": ["RESEARCH-001"],
184
- "ANALYSIS-001": ["DRAFT-001"]
185
- },
186
- "roles": [
187
- {
188
- "name": "researcher",
189
- "prefix": "RESEARCH",
190
- "responsibility_type": "orchestration",
191
- "task_count": 1,
192
- "inner_loop": false,
193
- "role_spec_metadata": {
194
- "CLI tools": ["explore"],
195
- "pattern_hint": "research",
196
- "output_type": "artifact",
197
- "message_types": {
198
- "success": "research_complete",
199
- "error": "error"
200
- }
201
- }
202
- }
203
- ],
204
- "complexity": {
205
- "capability_count": 2,
206
- "cross_domain_factor": false,
207
- "parallel_tracks": 0,
208
- "serial_depth": 2,
209
- "total_score": 3,
210
- "level": "low"
211
- },
212
- "needs_research": false,
213
- "artifacts": [
214
- { "name": "research-findings.md", "producer": "researcher", "path": "artifacts/research-findings.md" }
215
- ]
216
- }
217
- ```
218
-
219
- ## Complexity Interpretation
220
-
221
- **CRITICAL**: Complexity score is for **role design optimization**, NOT for skipping team workflow.
222
-
223
- | Complexity | Team Structure | Coordinator Action |
224
- |------------|----------------|-------------------|
225
- | Low (1-2 roles) | Minimal team | Generate 1-2 role-specs, create team, spawn workers |
226
- | Medium (2-3 roles) | Standard team | Generate role-specs, create team, spawn workers |
227
- | High (3-5 roles) | Full team | Generate role-specs, create team, spawn workers |
228
-
229
- **All complexity levels use team_worker architecture**:
230
- - Single-role tasks still spawn team_worker agent
231
- - Coordinator NEVER executes task work directly
232
- - Team infrastructure provides session management, message bus, fast-advance
233
-
234
- **Purpose of complexity score**:
235
- - Determine optimal role count (merge vs separate)
236
- - Guide dependency graph design
237
- - Inform user about task scope
238
- - NOT for deciding whether to use team workflow
239
-
240
- ## Error Handling
241
-
242
- | Scenario | Resolution |
243
- |----------|------------|
244
- | No capabilities detected | Default to single `general` role with TASK prefix |
245
- | Circular dependency in graph | Break cycle at lowest-tier edge, warn |
246
- | Task description too vague | Return minimal analysis, coordinator will request_user_input |
247
- | All capabilities merge into one | Valid -- single-role execution via team_worker |