maestro-flow 0.2.1 → 0.3.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.
Files changed (143) hide show
  1. package/.claude/agents/team-supervisor.md +18 -8
  2. package/.claude/agents/team-worker.md +84 -2
  3. package/.claude/commands/manage-harvest.md +131 -0
  4. package/.claude/skills/team-coordinate/SKILL.md +266 -0
  5. package/.claude/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +247 -0
  6. package/.claude/skills/team-coordinate/roles/coordinator/commands/dispatch.md +131 -0
  7. package/.claude/skills/team-coordinate/roles/coordinator/commands/monitor.md +358 -0
  8. package/.claude/skills/team-coordinate/roles/coordinator/role.md +363 -0
  9. package/.claude/skills/team-coordinate/specs/knowledge-transfer.md +111 -0
  10. package/.claude/skills/team-coordinate/specs/pipelines.md +97 -0
  11. package/.claude/skills/team-coordinate/specs/quality-gates.md +112 -0
  12. package/.claude/skills/team-coordinate/specs/role-spec-template.md +198 -0
  13. package/.claude/skills/team-executor/SKILL.md +189 -0
  14. package/.claude/skills/team-executor/roles/executor/commands/monitor.md +239 -0
  15. package/.claude/skills/team-executor/roles/executor/role.md +171 -0
  16. package/.claude/skills/team-executor/specs/session-schema.md +264 -0
  17. package/.claude/skills/team-lifecycle-v4/SKILL.md +209 -0
  18. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +94 -0
  19. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +56 -0
  20. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +56 -0
  21. package/.claude/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +206 -0
  22. package/.claude/skills/team-lifecycle-v4/roles/coordinator/role.md +130 -0
  23. package/.claude/skills/team-lifecycle-v4/roles/executor/commands/fix.md +35 -0
  24. package/.claude/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -0
  25. package/.claude/skills/team-lifecycle-v4/roles/executor/role.md +67 -0
  26. package/.claude/skills/team-lifecycle-v4/roles/planner/role.md +85 -0
  27. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-code.md +34 -0
  28. package/.claude/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +44 -0
  29. package/.claude/skills/team-lifecycle-v4/roles/reviewer/role.md +69 -0
  30. package/.claude/skills/team-lifecycle-v4/roles/supervisor/role.md +192 -0
  31. package/.claude/skills/team-lifecycle-v4/roles/tester/role.md +87 -0
  32. package/.claude/skills/team-lifecycle-v4/roles/writer/role.md +95 -0
  33. package/.claude/skills/team-lifecycle-v4/specs/knowledge-transfer.md +114 -0
  34. package/.claude/skills/team-lifecycle-v4/specs/pipelines.md +140 -0
  35. package/.claude/skills/team-lifecycle-v4/specs/quality-gates.md +130 -0
  36. package/.claude/skills/team-lifecycle-v4/templates/architecture.md +254 -0
  37. package/.claude/skills/team-lifecycle-v4/templates/epics.md +196 -0
  38. package/.claude/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
  39. package/.claude/skills/team-lifecycle-v4/templates/requirements.md +224 -0
  40. package/.claude/skills/team-quality-assurance/SKILL.md +147 -0
  41. package/.claude/skills/team-quality-assurance/roles/analyst/role.md +88 -0
  42. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -0
  43. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +111 -0
  44. package/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +250 -0
  45. package/.claude/skills/team-quality-assurance/roles/coordinator/role.md +143 -0
  46. package/.claude/skills/team-quality-assurance/roles/executor/role.md +66 -0
  47. package/.claude/skills/team-quality-assurance/roles/generator/role.md +68 -0
  48. package/.claude/skills/team-quality-assurance/roles/scout/role.md +75 -0
  49. package/.claude/skills/team-quality-assurance/roles/strategist/role.md +71 -0
  50. package/.claude/skills/team-quality-assurance/specs/pipelines.md +115 -0
  51. package/.claude/skills/team-quality-assurance/specs/team-config.json +131 -0
  52. package/.claude/skills/team-review/SKILL.md +147 -0
  53. package/.claude/skills/team-review/roles/coordinator/commands/analyze.md +71 -0
  54. package/.claude/skills/team-review/roles/coordinator/commands/dispatch.md +91 -0
  55. package/.claude/skills/team-review/roles/coordinator/commands/monitor.md +224 -0
  56. package/.claude/skills/team-review/roles/coordinator/role.md +132 -0
  57. package/.claude/skills/team-review/roles/fixer/role.md +76 -0
  58. package/.claude/skills/team-review/roles/reviewer/role.md +68 -0
  59. package/.claude/skills/team-review/roles/scanner/role.md +79 -0
  60. package/.claude/skills/team-review/specs/dimensions.md +82 -0
  61. package/.claude/skills/team-review/specs/finding-schema.json +82 -0
  62. package/.claude/skills/team-review/specs/pipelines.md +102 -0
  63. package/.claude/skills/team-review/specs/team-config.json +27 -0
  64. package/.claude/skills/team-tech-debt/SKILL.md +128 -0
  65. package/.claude/skills/team-tech-debt/roles/assessor/role.md +77 -0
  66. package/.claude/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -0
  67. package/.claude/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +156 -0
  68. package/.claude/skills/team-tech-debt/roles/coordinator/commands/monitor.md +209 -0
  69. package/.claude/skills/team-tech-debt/roles/coordinator/role.md +123 -0
  70. package/.claude/skills/team-tech-debt/roles/executor/role.md +76 -0
  71. package/.claude/skills/team-tech-debt/roles/planner/role.md +69 -0
  72. package/.claude/skills/team-tech-debt/roles/scanner/role.md +90 -0
  73. package/.claude/skills/team-tech-debt/roles/validator/role.md +78 -0
  74. package/.claude/skills/team-tech-debt/specs/pipelines.md +47 -0
  75. package/.claude/skills/team-tech-debt/specs/team-config.json +129 -0
  76. package/.claude/skills/team-testing/SKILL.md +143 -0
  77. package/.claude/skills/team-testing/roles/analyst/role.md +103 -0
  78. package/.claude/skills/team-testing/roles/coordinator/commands/analyze.md +70 -0
  79. package/.claude/skills/team-testing/roles/coordinator/commands/dispatch.md +108 -0
  80. package/.claude/skills/team-testing/roles/coordinator/commands/monitor.md +257 -0
  81. package/.claude/skills/team-testing/roles/coordinator/role.md +134 -0
  82. package/.claude/skills/team-testing/roles/executor/role.md +99 -0
  83. package/.claude/skills/team-testing/roles/generator/role.md +98 -0
  84. package/.claude/skills/team-testing/roles/strategist/role.md +83 -0
  85. package/.claude/skills/team-testing/specs/pipelines.md +101 -0
  86. package/.claude/skills/team-testing/specs/team-config.json +93 -0
  87. package/.codex/skills/maestro-coordinate/SKILL.md +6 -6
  88. package/.codex/skills/maestro-overlay/SKILL.md +1 -3
  89. package/.codex/skills/manage-issue-analyze/SKILL.md +2 -2
  90. package/.codex/skills/quality-retrospective/SKILL.md +30 -31
  91. package/.codex/skills/team-coordinate/SKILL.md +16 -18
  92. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +50 -7
  93. package/.codex/skills/team-coordinate/roles/coordinator/role.md +4 -4
  94. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +2 -0
  95. package/.codex/skills/team-executor/SKILL.md +11 -13
  96. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +47 -11
  97. package/.codex/skills/team-lifecycle-v4/SKILL.md +27 -33
  98. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +94 -0
  99. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +1 -1
  100. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +94 -27
  101. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +12 -14
  102. package/.codex/skills/team-lifecycle-v4/roles/supervisor/role.md +1 -1
  103. package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +69 -1
  104. package/.codex/skills/team-quality-assurance/SKILL.md +14 -16
  105. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +60 -11
  106. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +4 -4
  107. package/.codex/skills/team-review/SKILL.md +14 -16
  108. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +47 -10
  109. package/.codex/skills/team-review/roles/coordinator/role.md +4 -4
  110. package/.codex/skills/team-tech-debt/SKILL.md +13 -15
  111. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +51 -12
  112. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +4 -4
  113. package/.codex/skills/team-testing/SKILL.md +15 -17
  114. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +51 -13
  115. package/.codex/skills/team-testing/roles/coordinator/role.md +4 -4
  116. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +4 -0
  117. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  118. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js +8 -1
  119. package/dashboard/dist-server/dashboard/src/server/routes/cli-history.js.map +1 -1
  120. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js +20 -0
  121. package/dashboard/dist-server/dashboard/src/server/routes/mcp.js.map +1 -1
  122. package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +1 -0
  123. package/dashboard/dist-server/dashboard/src/shared/constants.js +1 -0
  124. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  125. package/dashboard/dist-server/src/agents/cli-history-store.js +21 -3
  126. package/dashboard/dist-server/src/agents/cli-history-store.js.map +1 -1
  127. package/dist/src/agents/cli-history-store.d.ts.map +1 -1
  128. package/dist/src/agents/cli-history-store.js +21 -3
  129. package/dist/src/agents/cli-history-store.js.map +1 -1
  130. package/dist/src/commands/cli.d.ts.map +1 -1
  131. package/dist/src/commands/cli.js +20 -8
  132. package/dist/src/commands/cli.js.map +1 -1
  133. package/dist/src/commands/uninstall-ui/UninstallFlow.d.ts.map +1 -1
  134. package/dist/src/commands/uninstall-ui/UninstallFlow.js +5 -4
  135. package/dist/src/commands/uninstall-ui/UninstallFlow.js.map +1 -1
  136. package/dist/src/commands/uninstall.js +1 -1
  137. package/dist/src/commands/uninstall.js.map +1 -1
  138. package/dist/src/core/manifest.d.ts.map +1 -1
  139. package/dist/src/core/manifest.js +9 -1
  140. package/dist/src/core/manifest.js.map +1 -1
  141. package/package.json +1 -1
  142. package/workflows/cli-tools-usage.md +6 -2
  143. package/workflows/harvest.md +420 -0
@@ -0,0 +1,108 @@
1
+ # Dispatch Tasks
2
+
3
+ Create testing task chains with correct dependencies. Supports targeted, standard, and comprehensive pipelines.
4
+
5
+ ## Workflow
6
+
7
+ 1. Read task-analysis.json -> extract pipeline_mode and dependency_graph
8
+ 2. Read specs/pipelines.md -> get task registry for selected pipeline
9
+ 3. Topological sort tasks (respect blockedBy)
10
+ 4. Validate all owners exist in role registry (SKILL.md)
11
+ 5. For each task (in order):
12
+ - TaskCreate with structured description (see template below)
13
+ - TaskUpdate with blockedBy + owner assignment
14
+ 6. Update session.json with pipeline.tasks_total
15
+ 7. Validate chain (no orphans, no cycles, all refs valid)
16
+
17
+ ## Task Description Template
18
+
19
+ ```
20
+ PURPOSE: <goal> | Success: <criteria>
21
+ TASK:
22
+ - <step 1>
23
+ - <step 2>
24
+ CONTEXT:
25
+ - Session: <session-folder>
26
+ - Scope: <scope>
27
+ - Layer: <L1-unit|L2-integration|L3-e2e>
28
+ - Upstream artifacts: <artifact-1>, <artifact-2>
29
+ - Shared memory: <session>/wisdom/.msg/meta.json
30
+ EXPECTED: <deliverable path> + <quality criteria>
31
+ CONSTRAINTS: <scope limits, focus areas>
32
+ ---
33
+ InnerLoop: <true|false>
34
+ RoleSpec: ~ or <project>/.claude/skills/team-testing/roles/<role>/role.md
35
+ ```
36
+
37
+ ## Pipeline Task Registry
38
+
39
+ ### Targeted Pipeline
40
+ ```
41
+ STRATEGY-001 (strategist): Analyze change scope, define test strategy
42
+ blockedBy: []
43
+ TESTGEN-001 (generator): Generate L1 unit tests
44
+ blockedBy: [STRATEGY-001], meta: layer=L1-unit
45
+ TESTRUN-001 (executor): Execute L1 tests, collect coverage
46
+ blockedBy: [TESTGEN-001], inner_loop: true, meta: layer=L1-unit, coverage_target=80%
47
+ ```
48
+
49
+ ### Standard Pipeline
50
+ ```
51
+ STRATEGY-001 (strategist): Analyze change scope, define test strategy
52
+ blockedBy: []
53
+ TESTGEN-001 (generator): Generate L1 unit tests
54
+ blockedBy: [STRATEGY-001], meta: layer=L1-unit
55
+ TESTRUN-001 (executor): Execute L1 tests, collect coverage
56
+ blockedBy: [TESTGEN-001], inner_loop: true, meta: layer=L1-unit, coverage_target=80%
57
+ TESTGEN-002 (generator): Generate L2 integration tests
58
+ blockedBy: [TESTRUN-001], meta: layer=L2-integration
59
+ TESTRUN-002 (executor): Execute L2 tests, collect coverage
60
+ blockedBy: [TESTGEN-002], inner_loop: true, meta: layer=L2-integration, coverage_target=60%
61
+ TESTANA-001 (analyst): Defect pattern analysis, quality report
62
+ blockedBy: [TESTRUN-002]
63
+ ```
64
+
65
+ ### Comprehensive Pipeline
66
+ ```
67
+ STRATEGY-001 (strategist): Analyze change scope, define test strategy
68
+ blockedBy: []
69
+ TESTGEN-001 (generator-1): Generate L1 unit tests
70
+ blockedBy: [STRATEGY-001], meta: layer=L1-unit
71
+ TESTGEN-002 (generator-2): Generate L2 integration tests
72
+ blockedBy: [STRATEGY-001], meta: layer=L2-integration
73
+ TESTRUN-001 (executor-1): Execute L1 tests, collect coverage
74
+ blockedBy: [TESTGEN-001], inner_loop: true, meta: layer=L1-unit, coverage_target=80%
75
+ TESTRUN-002 (executor-2): Execute L2 tests, collect coverage
76
+ blockedBy: [TESTGEN-002], inner_loop: true, meta: layer=L2-integration, coverage_target=60%
77
+ TESTGEN-003 (generator): Generate L3 E2E tests
78
+ blockedBy: [TESTRUN-001, TESTRUN-002], meta: layer=L3-e2e
79
+ TESTRUN-003 (executor): Execute L3 tests, collect coverage
80
+ blockedBy: [TESTGEN-003], inner_loop: true, meta: layer=L3-e2e, coverage_target=40%
81
+ TESTANA-001 (analyst): Defect pattern analysis, quality report
82
+ blockedBy: [TESTRUN-003]
83
+ ```
84
+
85
+ ## InnerLoop Flag Rules
86
+
87
+ - true: generator, executor roles (GC loop iterations)
88
+ - false: strategist, analyst roles
89
+
90
+ ## Dependency Validation
91
+
92
+ - No orphan tasks (all tasks have valid owner)
93
+ - No circular dependencies
94
+ - All blockedBy references exist
95
+ - Session reference in every task description
96
+ - RoleSpec reference in every task description
97
+
98
+ ## Log After Creation
99
+
100
+ ```
101
+ mcp__ccw-tools__team_msg({
102
+ operation: "log",
103
+ session_id: <session-id>,
104
+ from: "coordinator",
105
+ type: "pipeline_selected",
106
+ data: { pipeline: "<mode>", task_count: <N> }
107
+ })
108
+ ```
@@ -0,0 +1,257 @@
1
+ # Monitor Pipeline
2
+
3
+ Event-driven pipeline coordination. Beat model: coordinator wake -> process -> spawn -> STOP.
4
+
5
+ ## Constants
6
+
7
+ - SPAWN_MODE: background
8
+ - ONE_STEP_PER_INVOCATION: true
9
+ - FAST_ADVANCE_AWARE: true
10
+ - WORKER_AGENT: team-worker
11
+ - MAX_GC_ROUNDS: 3
12
+
13
+ ## Handler Router
14
+
15
+ | Source | Handler |
16
+ |--------|---------|
17
+ | Message contains [strategist], [generator], [executor], [analyst] | handleCallback |
18
+ | "capability_gap" | handleAdapt |
19
+ | "check" or "status" | handleCheck |
20
+ | "resume" or "continue" | handleResume |
21
+ | All tasks completed | handleComplete |
22
+ | Default | handleSpawnNext |
23
+
24
+ ## Role-Worker Map
25
+
26
+ | Prefix | Role | Role Spec | inner_loop |
27
+ |--------|------|-----------|------------|
28
+ | STRATEGY-* | strategist | `~ or <project>/.claude/skills/team-testing/roles/strategist/role.md` | false |
29
+ | TESTGEN-* | generator | `~ or <project>/.claude/skills/team-testing/roles/generator/role.md` | true |
30
+ | TESTRUN-* | executor | `~ or <project>/.claude/skills/team-testing/roles/executor/role.md` | true |
31
+ | TESTANA-* | analyst | `~ or <project>/.claude/skills/team-testing/roles/analyst/role.md` | false |
32
+
33
+ ## handleCallback
34
+
35
+ Worker completed. Process and advance.
36
+
37
+ 1. Parse message to identify role and task ID:
38
+
39
+ | Message Pattern | Role Detection |
40
+ |----------------|---------------|
41
+ | `[strategist]` or task ID `STRATEGY-*` | strategist |
42
+ | `[generator]` or task ID `TESTGEN-*` | generator |
43
+ | `[executor]` or task ID `TESTRUN-*` | executor |
44
+ | `[analyst]` or task ID `TESTANA-*` | analyst |
45
+
46
+ 2. Check if progress update (inner loop) or final completion
47
+ 3. Progress -> update session state, STOP
48
+ 4. Completion -> mark task done via TaskUpdate(status="completed"), remove from active_workers
49
+ 5. Check for checkpoints:
50
+ - TESTRUN-* completes -> read meta.json for executor.pass_rate and executor.coverage:
51
+ - (pass_rate >= 0.95 AND coverage >= target) OR gc_rounds[layer] >= MAX_GC_ROUNDS -> proceed to handleSpawnNext
52
+ - (pass_rate < 0.95 OR coverage < target) AND gc_rounds[layer] < MAX_GC_ROUNDS -> create GC fix tasks, increment gc_rounds[layer]
53
+
54
+ **GC Fix Task Creation** (when coverage below target):
55
+ ```
56
+ TaskCreate({
57
+ subject: "TESTGEN-<layer>-fix-<round>: Revise <layer> tests (GC #<round>)",
58
+ description: "PURPOSE: Revise tests to fix failures and improve coverage | Success: pass_rate >= 0.95 AND coverage >= target
59
+ TASK:
60
+ - Read previous test results and failure details
61
+ - Revise tests to address failures
62
+ - Improve coverage for uncovered areas
63
+ CONTEXT:
64
+ - Session: <session-folder>
65
+ - Layer: <layer>
66
+ - Previous results: <session>/results/run-<N>.json
67
+ EXPECTED: Revised test files in <session>/tests/<layer>/
68
+ CONSTRAINTS: Only modify test files
69
+ ---
70
+ InnerLoop: true
71
+ RoleSpec: ~ or <project>/.claude/skills/team-testing/roles/generator/role.md"
72
+ })
73
+ TaskCreate({
74
+ subject: "TESTRUN-<layer>-fix-<round>: Re-execute <layer> (GC #<round>)",
75
+ description: "PURPOSE: Re-execute tests after revision | Success: pass_rate >= 0.95
76
+ CONTEXT:
77
+ - Session: <session-folder>
78
+ - Layer: <layer>
79
+ - Input: tests/<layer>
80
+ EXPECTED: <session>/results/run-<N>-gc.json
81
+ ---
82
+ InnerLoop: true
83
+ RoleSpec: ~ or <project>/.claude/skills/team-testing/roles/executor/role.md",
84
+ blockedBy: ["TESTGEN-<layer>-fix-<round>"]
85
+ })
86
+ ```
87
+ Update session.gc_rounds[layer]++
88
+
89
+ 6. -> handleSpawnNext
90
+
91
+ ## handleCheck
92
+
93
+ Read-only status report, then STOP.
94
+
95
+ **Worker Progress** (from message bus):
96
+
97
+ Before generating status output, read worker milestones:
98
+
99
+ ```javascript
100
+ const progressMsgs = mcp__ccw-tools__team_msg({
101
+ operation: "list", session_id: sessionId, type: "progress", last: 50
102
+ })
103
+ const blockerMsgs = mcp__ccw-tools__team_msg({
104
+ operation: "list", session_id: sessionId, type: "blocker", last: 10
105
+ })
106
+
107
+ // Aggregate latest milestone per task
108
+ const taskProgress = {}
109
+ for (const msg of (progressMsgs.result?.messages || [])) {
110
+ const tid = msg.data?.task_id
111
+ if (tid && (!taskProgress[tid] || msg.ts > taskProgress[tid].ts)) {
112
+ taskProgress[tid] = { phase: msg.data.phase, pct: msg.data.progress_pct, ts: msg.ts }
113
+ }
114
+ }
115
+ ```
116
+
117
+ Include in status output:
118
+ - Per-worker latest milestone (phase + progress_pct) next to task status
119
+ - Active blockers section (if any blockerMsgs found)
120
+
121
+ Output:
122
+ ```
123
+ [coordinator] Testing Pipeline Status
124
+ [coordinator] Mode: <pipeline_mode>
125
+ [coordinator] Progress: <done>/<total> (<pct>%)
126
+ [coordinator] GC Rounds: L1: <n>/3, L2: <n>/3
127
+
128
+ [coordinator] Pipeline Graph:
129
+ STRATEGY-001: <done|run|wait> test-strategy.md
130
+ TESTGEN-001: <done|run|wait> generating L1...
131
+ TESTRUN-001: <done|run|wait> blocked by TESTGEN-001
132
+ TESTGEN-002: <done|run|wait> blocked by TESTRUN-001
133
+ TESTRUN-002: <done|run|wait> blocked by TESTGEN-002
134
+ TESTANA-001: <done|run|wait> blocked by TESTRUN-*
135
+
136
+ [coordinator] Active Workers: <list with elapsed time>
137
+ [coordinator] Ready: <pending tasks with resolved deps>
138
+ [coordinator] Commands: 'resume' to advance | 'check' to refresh
139
+ ```
140
+
141
+ Then STOP.
142
+
143
+ ## handleResume
144
+
145
+ 1. No active workers -> handleSpawnNext
146
+ 2. Has active -> check each status
147
+ - completed -> mark done via TaskUpdate
148
+ - in_progress -> still running
149
+ 3. Some completed -> handleSpawnNext
150
+ 4. All running -> report status, STOP
151
+
152
+ ## handleSpawnNext
153
+
154
+ Find ready tasks, spawn workers, STOP.
155
+
156
+ 1. Collect from TaskList():
157
+ - completedSubjects: status = completed
158
+ - inProgressSubjects: status = in_progress
159
+ - readySubjects: status = pending AND all blockedBy in completedSubjects
160
+
161
+ 2. No ready + work in progress -> report waiting, STOP
162
+ 3. No ready + nothing in progress -> handleComplete
163
+ 4. Has ready -> for each ready task:
164
+ a. Determine role from prefix (use Role-Worker Map)
165
+ b. Check if inner loop role (generator/executor) with active worker -> skip (worker picks up next task)
166
+ c. TaskUpdate -> in_progress
167
+ d. team_msg log -> task_unblocked
168
+ e. Spawn team-worker:
169
+
170
+ ```
171
+ Agent({
172
+ subagent_type: "team-worker",
173
+ description: "Spawn <role> worker for <subject>",
174
+ team_name: "testing",
175
+ name: "<role>",
176
+ run_in_background: true,
177
+ prompt: `## Role Assignment
178
+ role: <role>
179
+ role_spec: ~ or <project>/.claude/skills/team-testing/roles/<role>/role.md
180
+ session: <session-folder>
181
+ session_id: <session-id>
182
+ team_name: testing
183
+ requirement: <task-description>
184
+ inner_loop: <true|false>
185
+
186
+ ## Current Task
187
+ - Task ID: <task-id>
188
+ - Task: <subject>
189
+
190
+ ## Progress Milestones
191
+ session_id: <session-id>
192
+ Report progress via team_msg at natural phase boundaries (context loaded -> core work done -> verification).
193
+ Report blockers immediately via team_msg type="blocker".
194
+ Report completion via team_msg type="task_complete" after final SendMessage.
195
+
196
+ Read role_spec file to load Phase 2-4 domain instructions.
197
+ Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).`
198
+ })
199
+ ```
200
+
201
+ f. Add to active_workers
202
+
203
+ 5. **Parallel spawn** (comprehensive pipeline):
204
+ - TESTGEN-001 + TESTGEN-002 both unblocked -> spawn both in parallel (name: "generator-1", "generator-2")
205
+ - TESTRUN-001 + TESTRUN-002 both unblocked -> spawn both in parallel (name: "executor-1", "executor-2")
206
+
207
+ 6. Update session.json, output summary, STOP
208
+
209
+ ## handleComplete
210
+
211
+ Pipeline done. Generate report and completion action.
212
+
213
+ 1. Verify all tasks (including any GC fix tasks) have status "completed" or "deleted"
214
+ 2. If any tasks incomplete -> return to handleSpawnNext
215
+ 3. If all complete:
216
+ - Read final state from meta.json (analyst.quality_score, executor.coverage, gc_rounds)
217
+ - Generate summary (deliverables, task count, GC rounds, coverage metrics)
218
+ 4. Read session.completion_action:
219
+ - interactive -> AskUserQuestion (Archive/Keep/Deepen Coverage)
220
+ - auto_archive -> Archive & Clean (status=completed, TeamDelete)
221
+ - auto_keep -> Keep Active (status=paused)
222
+
223
+ ## handleAdapt
224
+
225
+ Capability gap reported mid-pipeline.
226
+
227
+ 1. Parse gap description
228
+ 2. Check if existing role covers it -> redirect
229
+ 3. Role count < 5 -> generate dynamic role-spec in <session>/role-specs/
230
+ 4. Create new task, spawn worker
231
+ 5. Role count >= 5 -> merge or pause
232
+
233
+ ## Fast-Advance Reconciliation
234
+
235
+ On every coordinator wake:
236
+ 1. Read team_msg entries with type="fast_advance"
237
+ 2. Sync active_workers with spawned successors
238
+ 3. No duplicate spawns
239
+
240
+ ## Phase 4: State Persistence
241
+
242
+ After every handler execution:
243
+ 1. Reconcile active_workers with actual TaskList states
244
+ 2. Remove entries for completed/deleted tasks
245
+ 3. Write updated session.json
246
+ 4. STOP (wait for next callback)
247
+
248
+ ## Error Handling
249
+
250
+ | Scenario | Resolution |
251
+ |----------|------------|
252
+ | Session file not found | Error, suggest re-initialization |
253
+ | Worker callback from unknown role | Log info, scan for other completions |
254
+ | GC loop exceeded (3 rounds) | Accept current coverage with warning, proceed |
255
+ | Pipeline stall | Check blockedBy chains, report to user |
256
+ | Coverage tool unavailable | Degrade to pass rate judgment |
257
+ | Worker crash | Reset task to pending, respawn |
@@ -0,0 +1,134 @@
1
+ # Coordinator Role
2
+
3
+ Orchestrate team-testing: analyze -> dispatch -> spawn -> monitor -> report.
4
+
5
+ ## Identity
6
+ - Name: coordinator | Tag: [coordinator]
7
+ - Responsibility: Change scope analysis -> Create team -> Dispatch tasks -> Monitor progress -> Report results
8
+
9
+ ## Boundaries
10
+
11
+ ### MUST
12
+ - Use `team-worker` agent type for all worker spawns (NOT `general-purpose`)
13
+ - Follow Command Execution Protocol for dispatch and monitor commands
14
+ - Respect pipeline stage dependencies (blockedBy)
15
+ - Stop after spawning workers -- wait for callbacks
16
+ - Handle Generator-Critic cycles with max 3 iterations per layer
17
+ - Execute completion action in Phase 5
18
+
19
+ ### MUST NOT
20
+ - Implement domain logic (test generation, execution, analysis) -- workers handle this
21
+ - Spawn workers without creating tasks first
22
+ - Skip quality gates when coverage is below target
23
+ - Modify test files or source code directly -- delegate to workers
24
+ - Force-advance pipeline past failed GC loops
25
+
26
+ ## Command Execution Protocol
27
+ When coordinator needs to execute a specific phase:
28
+ 1. Read `commands/<command>.md`
29
+ 2. Follow the workflow defined in the command
30
+ 3. Commands are inline execution guides, NOT separate agents
31
+ 4. Execute synchronously, complete before proceeding
32
+
33
+ ## Entry Router
34
+
35
+ | Detection | Condition | Handler |
36
+ |-----------|-----------|---------|
37
+ | Worker callback | Message contains [strategist], [generator], [executor], [analyst] | -> handleCallback (monitor.md) |
38
+ | Status check | Args contain "check" or "status" | -> handleCheck (monitor.md) |
39
+ | Manual resume | Args contain "resume" or "continue" | -> handleResume (monitor.md) |
40
+ | Capability gap | Message contains "capability_gap" | -> handleAdapt (monitor.md) |
41
+ | Pipeline complete | All tasks completed | -> handleComplete (monitor.md) |
42
+ | Interrupted session | Active session in .workflow/.team/TST-* | -> Phase 0 |
43
+ | New session | None of above | -> Phase 1 |
44
+
45
+ For callback/check/resume/adapt/complete: load @commands/monitor.md, execute handler, STOP.
46
+
47
+ ## Phase 0: Session Resume Check
48
+
49
+ 1. Scan .workflow/.team/TST-*/session.json for active/paused sessions
50
+ 2. No sessions -> Phase 1
51
+ 3. Single session -> reconcile (audit TaskList, reset in_progress->pending, rebuild team, kick first ready task)
52
+ 4. Multiple -> AskUserQuestion for selection
53
+
54
+ ## Phase 1: Requirement Clarification
55
+
56
+ TEXT-LEVEL ONLY. No source code reading.
57
+
58
+ 1. Parse task description from $ARGUMENTS
59
+ 2. Analyze change scope:
60
+ ```
61
+ Bash("git diff --name-only HEAD~1 2>/dev/null || git diff --name-only --cached")
62
+ ```
63
+ 3. Select pipeline:
64
+
65
+ | Condition | Pipeline |
66
+ |-----------|----------|
67
+ | fileCount <= 3 AND moduleCount <= 1 | targeted |
68
+ | fileCount <= 10 AND moduleCount <= 3 | standard |
69
+ | Otherwise | comprehensive |
70
+
71
+ 4. Clarify if ambiguous (AskUserQuestion for scope)
72
+ 5. Delegate to @commands/analyze.md
73
+ 6. Output: task-analysis.json
74
+ 7. CRITICAL: Always proceed to Phase 2, never skip team workflow
75
+
76
+ ## Phase 2: Create Team + Initialize Session
77
+
78
+ 1. Resolve workspace paths (MUST do first):
79
+ - `project_root` = result of `Bash({ command: "pwd" })`
80
+ - `skill_root` = `<project_root>/.claude/skills/team-testing`
81
+ 2. Generate session ID: TST-<slug>-<date>
82
+ 3. Create session folder structure (strategy/, tests/L1-unit/, tests/L2-integration/, tests/L3-e2e/, results/, analysis/, wisdom/)
83
+ 4. TeamCreate with team name "testing"
84
+ 5. Read specs/pipelines.md -> select pipeline based on mode
85
+ 6. Initialize pipeline via team_msg state_update:
86
+ ```
87
+ mcp__ccw-tools__team_msg({
88
+ operation: "log", session_id: "<id>", from: "coordinator",
89
+ type: "state_update", summary: "Session initialized",
90
+ data: {
91
+ pipeline_mode: "<targeted|standard|comprehensive>",
92
+ pipeline_stages: ["strategist", "generator", "executor", "analyst"],
93
+ team_name: "testing",
94
+ coverage_targets: { "L1": 80, "L2": 60, "L3": 40 },
95
+ gc_rounds: {}
96
+ }
97
+ })
98
+ ```
99
+ 7. Write session.json
100
+
101
+ ## Phase 3: Create Task Chain
102
+
103
+ Delegate to @commands/dispatch.md:
104
+ 1. Read specs/pipelines.md for selected pipeline's task registry
105
+ 2. Topological sort tasks
106
+ 3. Create tasks via TaskCreate with blockedBy
107
+ 4. Update session.json
108
+
109
+ ## Phase 4: Spawn-and-Stop
110
+
111
+ Delegate to @commands/monitor.md#handleSpawnNext:
112
+ 1. Find ready tasks (pending + blockedBy resolved)
113
+ 2. Spawn team-worker agents (see SKILL.md Spawn Template)
114
+ 3. Output status summary
115
+ 4. STOP
116
+
117
+ ## Phase 5: Report + Completion Action
118
+
119
+ 1. Generate summary (deliverables, pipeline stats, GC rounds, coverage metrics)
120
+ 2. Execute completion action per session.completion_action:
121
+ - interactive -> AskUserQuestion (Archive/Keep/Deepen Coverage)
122
+ - auto_archive -> Archive & Clean
123
+ - auto_keep -> Keep Active
124
+
125
+ ## Error Handling
126
+
127
+ | Error | Resolution |
128
+ |-------|------------|
129
+ | Task too vague | AskUserQuestion for clarification |
130
+ | Session corruption | Attempt recovery, fallback to manual |
131
+ | Worker crash | Reset task to pending, respawn |
132
+ | Dependency cycle | Detect in analysis, halt |
133
+ | GC loop exceeded (3 rounds) | Accept current coverage, log to wisdom, proceed |
134
+ | Coverage tool unavailable | Degrade to pass rate judgment |
@@ -0,0 +1,99 @@
1
+ ---
2
+ role: executor
3
+ prefix: TESTRUN
4
+ inner_loop: true
5
+ message_types:
6
+ success: tests_passed
7
+ failure: tests_failed
8
+ coverage: coverage_report
9
+ error: error
10
+ ---
11
+
12
+ # Test Executor
13
+
14
+ Execute tests, collect coverage, attempt auto-fix for failures. Acts as the Critic in the Generator-Critic loop. Reports pass rate and coverage for coordinator GC decisions.
15
+
16
+ ## Phase 2: Context Loading
17
+
18
+ | Input | Source | Required |
19
+ |-------|--------|----------|
20
+ | Task description | From task subject/description | Yes |
21
+ | Session path | Extracted from task description | Yes |
22
+ | Test directory | Task description (Input: <path>) | Yes |
23
+ | Coverage target | Task description (default: 80%) | Yes |
24
+ | .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
25
+
26
+ 1. Extract session path and test directory from task description
27
+ 2. Load test specs: Run `ccw spec load --category test` for test framework conventions and coverage targets
28
+ 3. Extract coverage target (default: 80%)
29
+ 3. Read .msg/meta.json for framework info (from strategist namespace)
30
+ 4. Determine test framework:
31
+
32
+ | Framework | Run Command |
33
+ |-----------|-------------|
34
+ | Jest | `npx jest --coverage --json --outputFile=<session>/results/jest-output.json` |
35
+ | Pytest | `python -m pytest --cov --cov-report=json:<session>/results/coverage.json -v` |
36
+ | Vitest | `npx vitest run --coverage --reporter=json` |
37
+
38
+ 5. Find test files to execute:
39
+
40
+ ```
41
+ Glob("<session>/<test-dir>/**/*")
42
+ ```
43
+
44
+ ## Phase 3: Test Execution + Fix Cycle
45
+
46
+ **Iterative test-fix cycle** (max 3 iterations):
47
+
48
+ | Step | Action |
49
+ |------|--------|
50
+ | 1 | Run test command |
51
+ | 2 | Parse results: pass rate + coverage |
52
+ | 3 | pass_rate >= 0.95 AND coverage >= target -> success, exit |
53
+ | 4 | Extract failing test details |
54
+ | 5 | Delegate fix to CLI tool (gemini write mode) |
55
+ | 6 | Increment iteration; >= 3 -> exit with failures |
56
+
57
+ ```
58
+ Bash("<test-command> 2>&1 || true")
59
+ ```
60
+
61
+ **Auto-fix delegation** (on failure):
62
+
63
+ ```
64
+ Bash({
65
+ command: `maestro cli -p "PURPOSE: Fix test failures to achieve pass rate >= 0.95; success = all tests pass
66
+ TASK: • Analyze test failure output • Identify root causes • Fix test code only (not source) • Preserve test intent
67
+ MODE: write
68
+ CONTEXT: @<session>/<test-dir>/**/* | Memory: Test framework: <framework>, iteration <N>/3
69
+ EXPECTED: Fixed test files with: corrected assertions, proper async handling, fixed imports, maintained coverage
70
+ CONSTRAINTS: Only modify test files | Preserve test structure | No source code changes
71
+ Test failures:
72
+ <test-output>" --tool gemini --mode write --cd <session>`,
73
+ run_in_background: false
74
+ })
75
+ ```
76
+
77
+ **Save results**: `<session>/results/run-<N>.json`
78
+
79
+ ## Phase 4: Defect Pattern Extraction & State Update
80
+
81
+ **Extract defect patterns from failures**:
82
+
83
+ | Pattern Type | Detection Keywords |
84
+ |--------------|-------------------|
85
+ | Null reference | "null", "undefined", "Cannot read property" |
86
+ | Async timing | "timeout", "async", "await", "promise" |
87
+ | Import errors | "Cannot find module", "import" |
88
+ | Type mismatches | "type", "expected", "received" |
89
+
90
+ **Record effective test patterns** (if pass_rate > 0.8):
91
+
92
+ | Pattern | Detection |
93
+ |---------|-----------|
94
+ | Happy path | "should succeed", "valid input" |
95
+ | Edge cases | "edge", "boundary", "limit" |
96
+ | Error handling | "should fail", "error", "throw" |
97
+
98
+ Update `<session>/wisdom/.msg/meta.json` under `executor` namespace:
99
+ - Merge `{ "executor": { pass_rate, coverage, defect_patterns, effective_patterns, coverage_history_entry } }`
@@ -0,0 +1,98 @@
1
+ ---
2
+ role: generator
3
+ prefix: TESTGEN
4
+ inner_loop: true
5
+ message_types:
6
+ success: tests_generated
7
+ revision: tests_revised
8
+ error: error
9
+ ---
10
+
11
+ # Test Generator
12
+
13
+ Generate test code by layer (L1 unit / L2 integration / L3 E2E). Acts as the Generator in the Generator-Critic loop. Supports revision mode for GC loop iterations.
14
+
15
+ ## Phase 2: Context Loading
16
+
17
+ | Input | Source | Required |
18
+ |-------|--------|----------|
19
+ | Task description | From task subject/description | Yes |
20
+ | Session path | Extracted from task description | Yes |
21
+ | Test strategy | <session>/strategy/test-strategy.md | Yes |
22
+ | .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
23
+
24
+ 1. Extract session path and layer from task description
25
+ 2. Load test specs: Run `ccw spec load --category test` for test framework conventions and coverage targets
26
+ 3. Read test strategy:
27
+
28
+ ```
29
+ Read("<session>/strategy/test-strategy.md")
30
+ ```
31
+
32
+ 3. Read source files to test (from strategy priority_files, limit 20)
33
+ 4. Read .msg/meta.json for framework and scope context
34
+
35
+ 5. Detect revision mode:
36
+
37
+ | Condition | Mode |
38
+ |-----------|------|
39
+ | Task subject contains "fix" or "revised" | Revision -- load previous failures |
40
+ | Otherwise | Fresh generation |
41
+
42
+ For revision mode:
43
+ - Read latest result file for failure details
44
+ - Read effective test patterns from .msg/meta.json
45
+
46
+ 6. Read wisdom files if available
47
+
48
+ ## Phase 3: Test Generation
49
+
50
+ **Strategy selection by complexity**:
51
+
52
+ | File Count | Strategy |
53
+ |------------|----------|
54
+ | <= 3 files | Direct: inline Write/Edit |
55
+ | 3-5 files | Single code-developer agent |
56
+ | > 5 files | Batch: group by module, one agent per batch |
57
+
58
+ **Direct generation** (per source file):
59
+ 1. Generate test path: `<session>/tests/<layer>/<test-file>`
60
+ 2. Generate test code: happy path, edge cases, error handling
61
+ 3. Write test file
62
+
63
+ **CLI delegation** (medium/high complexity):
64
+
65
+ ```
66
+ Bash({
67
+ command: `maestro cli -p "PURPOSE: Generate <layer> tests using <framework> to achieve coverage target; success = all priority files covered with quality tests
68
+ TASK: • Analyze source files • Generate test cases (happy path, edge cases, errors) • Write test files with proper structure • Ensure import resolution
69
+ MODE: write
70
+ CONTEXT: @<source-files> @<session>/strategy/test-strategy.md | Memory: Framework: <framework>, Layer: <layer>, Round: <round>
71
+ <if-revision: Previous failures: <failure-details>
72
+ Effective patterns: <patterns-from-meta>>
73
+ EXPECTED: Test files in <session>/tests/<layer>/ with: proper test structure, comprehensive coverage, correct imports, framework conventions
74
+ CONSTRAINTS: Follow test strategy priorities | Use framework best practices | <layer>-appropriate assertions
75
+ Source files to test:
76
+ <file-list-with-content>" --tool gemini --mode write --cd <session>`,
77
+ run_in_background: false
78
+ })
79
+ ```
80
+
81
+ **Output verification**:
82
+
83
+ ```
84
+ Glob("<session>/tests/<layer>/**/*")
85
+ ```
86
+
87
+ ## Phase 4: Self-Validation & State Update
88
+
89
+ **Validation checks**:
90
+
91
+ | Check | Method | Action on Fail |
92
+ |-------|--------|----------------|
93
+ | Syntax | `tsc --noEmit` or equivalent | Auto-fix imports/types |
94
+ | File count | Count generated files | Report issue |
95
+ | Import resolution | Check broken imports | Fix import paths |
96
+
97
+ Update `<session>/wisdom/.msg/meta.json` under `generator` namespace:
98
+ - Merge `{ "generator": { test_files, layer, round, is_revision } }`