claude-code-workflow 7.2.23 → 7.2.24

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 (181) hide show
  1. package/.codex/skills/team-arch-opt/SKILL.md +242 -175
  2. package/.codex/skills/team-arch-opt/roles/analyzer/role.md +78 -78
  3. package/.codex/skills/team-arch-opt/roles/coordinator/commands/analyze.md +57 -57
  4. package/.codex/skills/team-arch-opt/roles/coordinator/commands/monitor.md +246 -204
  5. package/.codex/skills/team-arch-opt/roles/coordinator/role.md +196 -184
  6. package/.codex/skills/team-arch-opt/roles/designer/role.md +115 -115
  7. package/.codex/skills/team-arch-opt/roles/refactorer/role.md +102 -102
  8. package/.codex/skills/team-arch-opt/roles/reviewer/role.md +111 -111
  9. package/.codex/skills/team-arch-opt/roles/validator/role.md +115 -115
  10. package/.codex/skills/team-arch-opt/specs/pipelines.md +102 -102
  11. package/.codex/skills/team-brainstorm/SKILL.md +72 -4
  12. package/.codex/skills/team-brainstorm/roles/challenger/role.md +61 -61
  13. package/.codex/skills/team-brainstorm/roles/coordinator/commands/analyze.md +58 -58
  14. package/.codex/skills/team-brainstorm/roles/coordinator/commands/monitor.md +212 -171
  15. package/.codex/skills/team-brainstorm/roles/coordinator/role.md +172 -160
  16. package/.codex/skills/team-brainstorm/roles/evaluator/role.md +56 -56
  17. package/.codex/skills/team-brainstorm/roles/ideator/role.md +69 -69
  18. package/.codex/skills/team-brainstorm/roles/synthesizer/role.md +57 -57
  19. package/.codex/skills/team-brainstorm/specs/pipelines.md +72 -72
  20. package/.codex/skills/team-coordinate/SKILL.md +71 -3
  21. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +45 -5
  22. package/.codex/skills/team-coordinate/roles/coordinator/role.md +402 -389
  23. package/.codex/skills/team-coordinate/specs/knowledge-transfer.md +111 -111
  24. package/.codex/skills/team-coordinate/specs/pipelines.md +97 -97
  25. package/.codex/skills/team-coordinate/specs/quality-gates.md +112 -112
  26. package/.codex/skills/team-designer/SKILL.md +153 -153
  27. package/.codex/skills/team-designer/phases/01-requirements-analysis.md +250 -250
  28. package/.codex/skills/team-designer/phases/02-scaffold-generation.md +228 -228
  29. package/.codex/skills/team-designer/phases/03-content-generation.md +330 -330
  30. package/.codex/skills/team-designer/phases/04-validation.md +320 -320
  31. package/.codex/skills/team-executor/SKILL.md +29 -2
  32. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +23 -15
  33. package/.codex/skills/team-frontend/SKILL.md +77 -3
  34. package/.codex/skills/team-frontend/roles/analyst/role.md +92 -92
  35. package/.codex/skills/team-frontend/roles/architect/role.md +86 -86
  36. package/.codex/skills/team-frontend/roles/coordinator/commands/analyze.md +52 -52
  37. package/.codex/skills/team-frontend/roles/coordinator/commands/monitor.md +222 -188
  38. package/.codex/skills/team-frontend/roles/coordinator/role.md +189 -177
  39. package/.codex/skills/team-frontend/roles/developer/role.md +93 -93
  40. package/.codex/skills/team-frontend/roles/qa/role.md +79 -79
  41. package/.codex/skills/team-frontend/specs/pipelines.md +76 -76
  42. package/.codex/skills/team-frontend-debug/SKILL.md +66 -3
  43. package/.codex/skills/team-frontend-debug/roles/analyzer/role.md +208 -208
  44. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +174 -174
  45. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/dispatch.md +198 -198
  46. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/monitor.md +177 -143
  47. package/.codex/skills/team-frontend-debug/roles/coordinator/role.md +164 -152
  48. package/.codex/skills/team-frontend-debug/roles/fixer/role.md +147 -147
  49. package/.codex/skills/team-frontend-debug/roles/reproducer/role.md +147 -147
  50. package/.codex/skills/team-frontend-debug/roles/tester/role.md +231 -231
  51. package/.codex/skills/team-frontend-debug/roles/verifier/role.md +172 -172
  52. package/.codex/skills/team-frontend-debug/specs/debug-tools.md +215 -215
  53. package/.codex/skills/team-frontend-debug/specs/pipelines.md +94 -94
  54. package/.codex/skills/team-issue/SKILL.md +83 -4
  55. package/.codex/skills/team-issue/roles/coordinator/commands/analyze.md +64 -64
  56. package/.codex/skills/team-issue/roles/coordinator/commands/dispatch.md +273 -273
  57. package/.codex/skills/team-issue/roles/coordinator/commands/monitor.md +235 -194
  58. package/.codex/skills/team-issue/roles/coordinator/role.md +206 -194
  59. package/.codex/skills/team-issue/roles/explorer/role.md +94 -94
  60. package/.codex/skills/team-issue/roles/implementer/role.md +87 -87
  61. package/.codex/skills/team-issue/roles/integrator/role.md +84 -84
  62. package/.codex/skills/team-issue/roles/planner/role.md +81 -81
  63. package/.codex/skills/team-issue/roles/reviewer/role.md +86 -86
  64. package/.codex/skills/team-issue/specs/pipelines.md +124 -124
  65. package/.codex/skills/team-iterdev/SKILL.md +64 -3
  66. package/.codex/skills/team-iterdev/roles/architect/role.md +65 -65
  67. package/.codex/skills/team-iterdev/roles/coordinator/commands/analyze.md +62 -62
  68. package/.codex/skills/team-iterdev/roles/coordinator/commands/monitor.md +227 -186
  69. package/.codex/skills/team-iterdev/roles/coordinator/role.md +193 -181
  70. package/.codex/skills/team-iterdev/roles/developer/role.md +74 -74
  71. package/.codex/skills/team-iterdev/roles/reviewer/role.md +66 -66
  72. package/.codex/skills/team-iterdev/roles/tester/role.md +88 -88
  73. package/.codex/skills/team-iterdev/specs/pipelines.md +94 -94
  74. package/.codex/skills/team-lifecycle-v4/MIGRATION-PLAN.md +6 -6
  75. package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -242
  76. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +1 -1
  77. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +66 -24
  78. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +13 -1
  79. package/.codex/skills/team-lifecycle-v4/roles/supervisor/role.md +1 -1
  80. package/.codex/skills/team-lifecycle-v4/templates/architecture.md +254 -254
  81. package/.codex/skills/team-lifecycle-v4/templates/epics.md +196 -196
  82. package/.codex/skills/team-lifecycle-v4/templates/product-brief.md +133 -133
  83. package/.codex/skills/team-lifecycle-v4/templates/requirements.md +224 -224
  84. package/.codex/skills/team-perf-opt/SKILL.md +68 -3
  85. package/.codex/skills/team-perf-opt/roles/benchmarker/role.md +89 -89
  86. package/.codex/skills/team-perf-opt/roles/coordinator/commands/analyze.md +61 -61
  87. package/.codex/skills/team-perf-opt/roles/coordinator/commands/monitor.md +35 -1
  88. package/.codex/skills/team-perf-opt/roles/coordinator/role.md +179 -167
  89. package/.codex/skills/team-perf-opt/roles/optimizer/role.md +97 -97
  90. package/.codex/skills/team-perf-opt/roles/profiler/role.md +73 -73
  91. package/.codex/skills/team-perf-opt/roles/reviewer/role.md +75 -75
  92. package/.codex/skills/team-perf-opt/roles/strategist/role.md +94 -94
  93. package/.codex/skills/team-perf-opt/specs/pipelines.md +65 -65
  94. package/.codex/skills/team-planex/SKILL.md +65 -3
  95. package/.codex/skills/team-planex/roles/coordinator/commands/analyze.md +52 -52
  96. package/.codex/skills/team-planex/roles/coordinator/commands/monitor.md +210 -164
  97. package/.codex/skills/team-planex/roles/coordinator/role.md +171 -159
  98. package/.codex/skills/team-planex/roles/executor/role.md +91 -91
  99. package/.codex/skills/team-planex/roles/planner/role.md +112 -112
  100. package/.codex/skills/team-planex/specs/pipelines.md +93 -93
  101. package/.codex/skills/team-quality-assurance/SKILL.md +60 -3
  102. package/.codex/skills/team-quality-assurance/roles/analyst/role.md +80 -80
  103. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -72
  104. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +108 -108
  105. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +243 -209
  106. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +176 -164
  107. package/.codex/skills/team-quality-assurance/roles/executor/role.md +66 -66
  108. package/.codex/skills/team-quality-assurance/roles/generator/role.md +68 -68
  109. package/.codex/skills/team-quality-assurance/roles/scout/role.md +67 -67
  110. package/.codex/skills/team-quality-assurance/roles/strategist/role.md +71 -71
  111. package/.codex/skills/team-quality-assurance/specs/pipelines.md +115 -115
  112. package/.codex/skills/team-review/SKILL.md +58 -3
  113. package/.codex/skills/team-review/roles/coordinator/commands/analyze.md +71 -71
  114. package/.codex/skills/team-review/roles/coordinator/commands/dispatch.md +90 -90
  115. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +225 -185
  116. package/.codex/skills/team-review/roles/coordinator/role.md +175 -163
  117. package/.codex/skills/team-review/roles/fixer/role.md +76 -76
  118. package/.codex/skills/team-review/roles/reviewer/role.md +68 -68
  119. package/.codex/skills/team-review/roles/scanner/role.md +71 -71
  120. package/.codex/skills/team-review/specs/pipelines.md +102 -102
  121. package/.codex/skills/team-roadmap-dev/SKILL.md +55 -3
  122. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/analyze.md +61 -61
  123. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/monitor.md +502 -468
  124. package/.codex/skills/team-roadmap-dev/roles/coordinator/role.md +335 -322
  125. package/.codex/skills/team-roadmap-dev/roles/executor/role.md +71 -71
  126. package/.codex/skills/team-roadmap-dev/roles/planner/role.md +76 -76
  127. package/.codex/skills/team-roadmap-dev/roles/verifier/role.md +74 -74
  128. package/.codex/skills/team-roadmap-dev/specs/pipelines.md +93 -93
  129. package/.codex/skills/team-tech-debt/SKILL.md +56 -3
  130. package/.codex/skills/team-tech-debt/roles/assessor/role.md +69 -69
  131. package/.codex/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -47
  132. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +272 -231
  133. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +172 -160
  134. package/.codex/skills/team-tech-debt/roles/executor/role.md +76 -76
  135. package/.codex/skills/team-tech-debt/roles/planner/role.md +69 -69
  136. package/.codex/skills/team-tech-debt/roles/scanner/role.md +82 -82
  137. package/.codex/skills/team-tech-debt/roles/validator/role.md +75 -75
  138. package/.codex/skills/team-tech-debt/specs/pipelines.md +47 -47
  139. package/.codex/skills/team-testing/SKILL.md +72 -3
  140. package/.codex/skills/team-testing/roles/analyst/role.md +95 -95
  141. package/.codex/skills/team-testing/roles/coordinator/commands/analyze.md +70 -70
  142. package/.codex/skills/team-testing/roles/coordinator/commands/dispatch.md +106 -106
  143. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +283 -242
  144. package/.codex/skills/team-testing/roles/coordinator/role.md +184 -172
  145. package/.codex/skills/team-testing/roles/executor/role.md +96 -96
  146. package/.codex/skills/team-testing/roles/generator/role.md +95 -95
  147. package/.codex/skills/team-testing/roles/strategist/role.md +83 -83
  148. package/.codex/skills/team-testing/specs/pipelines.md +101 -101
  149. package/.codex/skills/team-uidesign/SKILL.md +65 -3
  150. package/.codex/skills/team-uidesign/roles/coordinator/commands/analyze.md +59 -59
  151. package/.codex/skills/team-uidesign/roles/coordinator/commands/dispatch.md +156 -156
  152. package/.codex/skills/team-uidesign/roles/coordinator/commands/monitor.md +234 -194
  153. package/.codex/skills/team-uidesign/roles/coordinator/role.md +211 -199
  154. package/.codex/skills/team-uidesign/roles/designer/role.md +69 -69
  155. package/.codex/skills/team-uidesign/roles/implementer/role.md +72 -72
  156. package/.codex/skills/team-uidesign/roles/researcher/role.md +82 -82
  157. package/.codex/skills/team-uidesign/roles/reviewer/role.md +67 -67
  158. package/.codex/skills/team-uidesign/specs/pipelines.md +76 -76
  159. package/.codex/skills/team-ultra-analyze/SKILL.md +73 -3
  160. package/.codex/skills/team-ultra-analyze/roles/analyst/role.md +90 -90
  161. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/analyze.md +73 -73
  162. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +50 -9
  163. package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +255 -243
  164. package/.codex/skills/team-ultra-analyze/roles/discussant/role.md +104 -104
  165. package/.codex/skills/team-ultra-analyze/roles/explorer/role.md +74 -74
  166. package/.codex/skills/team-ultra-analyze/roles/synthesizer/role.md +78 -78
  167. package/.codex/skills/team-ultra-analyze/specs/pipelines.md +64 -64
  168. package/.codex/skills/team-ux-improve/SKILL.md +64 -3
  169. package/.codex/skills/team-ux-improve/roles/coordinator/commands/analyze.md +62 -62
  170. package/.codex/skills/team-ux-improve/roles/coordinator/commands/dispatch.md +233 -233
  171. package/.codex/skills/team-ux-improve/roles/coordinator/commands/monitor.md +195 -160
  172. package/.codex/skills/team-ux-improve/roles/coordinator/role.md +170 -158
  173. package/.codex/skills/team-ux-improve/roles/designer/role.md +122 -122
  174. package/.codex/skills/team-ux-improve/roles/diagnoser/role.md +93 -93
  175. package/.codex/skills/team-ux-improve/roles/explorer/role.md +77 -77
  176. package/.codex/skills/team-ux-improve/roles/implementer/role.md +102 -102
  177. package/.codex/skills/team-ux-improve/roles/scanner/role.md +93 -93
  178. package/.codex/skills/team-ux-improve/roles/tester/role.md +84 -84
  179. package/.codex/skills/team-ux-improve/specs/pipelines.md +54 -54
  180. package/README.md +1 -0
  181. package/package.json +1 -1
@@ -1,242 +1,283 @@
1
- # Monitor Pipeline
2
-
3
- Synchronous pipeline coordination using spawn_agent + wait_agent.
4
-
5
- ## Constants
6
-
7
- - WORKER_AGENT: team_worker
8
- - ONE_STEP_PER_INVOCATION: false (synchronous wait loop)
9
- - FAST_ADVANCE_AWARE: true
10
- - MAX_GC_ROUNDS: 3
11
-
12
- ## Handler Router
13
-
14
- | Source | Handler |
15
- |--------|---------|
16
- | "capability_gap" | handleAdapt |
17
- | "check" or "status" | handleCheck |
18
- | "resume" or "continue" | handleResume |
19
- | All tasks completed | handleComplete |
20
- | Default | handleSpawnNext |
21
-
22
- ## Role-Worker Map
23
-
24
- | Prefix | Role | Role Spec | inner_loop |
25
- |--------|------|-----------|------------|
26
- | STRATEGY-* | strategist | `<project>/.codex/skills/team-testing/roles/strategist/role.md` | false |
27
- | TESTGEN-* | generator | `<project>/.codex/skills/team-testing/roles/generator/role.md` | true |
28
- | TESTRUN-* | executor | `<project>/.codex/skills/team-testing/roles/executor/role.md` | true |
29
- | TESTANA-* | analyst | `<project>/.codex/skills/team-testing/roles/analyst/role.md` | false |
30
-
31
- ## handleCheck
32
-
33
- Read-only status report from tasks.json, then STOP.
34
-
35
- 1. Read tasks.json
36
- 2. Count tasks by status (pending, in_progress, completed, failed)
37
-
38
- Output:
39
- ```
40
- [coordinator] Testing Pipeline Status
41
- [coordinator] Mode: <pipeline_mode>
42
- [coordinator] Progress: <done>/<total> (<pct>%)
43
- [coordinator] GC Rounds: L1: <n>/3, L2: <n>/3
44
-
45
- [coordinator] Pipeline Graph:
46
- STRATEGY-001: <done|run|wait> test-strategy.md
47
- TESTGEN-001: <done|run|wait> generating L1...
48
- TESTRUN-001: <done|run|wait> blocked by TESTGEN-001
49
- TESTGEN-002: <done|run|wait> blocked by TESTRUN-001
50
- TESTRUN-002: <done|run|wait> blocked by TESTGEN-002
51
- TESTANA-001: <done|run|wait> blocked by TESTRUN-*
52
-
53
- [coordinator] Active agents: <list with elapsed time>
54
- [coordinator] Ready: <pending tasks with resolved deps>
55
- [coordinator] Commands: 'resume' to advance | 'check' to refresh
56
- ```
57
-
58
- Then STOP.
59
-
60
- ## handleResume
61
-
62
- 1. Read tasks.json, check active_agents
63
- 2. No active agents -> handleSpawnNext
64
- 3. Has active agents -> check each status
65
- - completed -> mark done
66
- - in_progress -> still running
67
- 4. Some completed -> handleSpawnNext
68
- 5. All running -> report status, STOP
69
-
70
- ## handleSpawnNext
71
-
72
- Find ready tasks, spawn workers, wait for completion, process results.
73
-
74
- 1. Read tasks.json
75
- 2. Collect:
76
- - completedTasks: status = completed
77
- - inProgressTasks: status = in_progress
78
- - readyTasks: status = pending AND all deps in completedTasks
79
-
80
- 3. No ready + work in progress -> report waiting, STOP
81
- 4. No ready + nothing in progress -> handleComplete
82
- 5. Has ready -> for each ready task:
83
- a. Determine role from prefix (use Role-Worker Map)
84
- b. Check if inner loop role (generator/executor) with active worker -> skip (worker picks up next task)
85
- c. Update task status in tasks.json -> in_progress
86
- d. team_msg log -> task_unblocked
87
-
88
- ### Spawn Workers
89
-
90
- For each ready task:
91
-
92
- ```javascript
93
- // 1) Update status in tasks.json
94
- state.tasks[taskId].status = 'in_progress'
95
-
96
- // 2) Spawn worker
97
- const agentId = spawn_agent({
98
- agent_type: "team_worker",
99
- items: [
100
- { type: "text", text: `## Role Assignment
101
- role: ${task.role}
102
- role_spec: ${skillRoot}/roles/${task.role}/role.md
103
- session: ${sessionFolder}
104
- session_id: ${sessionId}
105
- team_name: testing
106
- requirement: ${task.description}
107
- inner_loop: ${task.role === 'generator' || task.role === 'executor'}
108
-
109
- ## Current Task
110
- - Task ID: ${taskId}
111
- - Task: ${task.title}` },
112
-
113
- { type: "text", text: `Read role_spec file (${skillRoot}/roles/${task.role}/role.md) to load Phase 2-4 domain instructions.
114
- Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).` },
115
-
116
- { type: "text", text: `## Task Context
117
- task_id: ${taskId}
118
- title: ${task.title}
119
- description: ${task.description}` },
120
-
121
- { type: "text", text: `## Upstream Context\n${prevContext}` }
122
- ]
123
- })
124
-
125
- // 3) Track agent
126
- state.active_agents[taskId] = { agentId, role: task.role, started_at: now }
127
- ```
128
-
129
- 6. **Parallel spawn** (comprehensive pipeline):
130
- - TESTGEN-001 + TESTGEN-002 both unblocked -> spawn both in parallel (name: "generator-1", "generator-2")
131
- - TESTRUN-001 + TESTRUN-002 both unblocked -> spawn both in parallel (name: "executor-1", "executor-2")
132
-
133
- ### Wait and Process Results
134
-
135
- After spawning all ready tasks:
136
-
137
- ```javascript
138
- // 4) Batch wait for all spawned workers
139
- const agentIds = Object.values(state.active_agents).map(a => a.agentId)
140
- wait_agent({ ids: agentIds, timeout_ms: 900000 })
141
-
142
- // 5) Collect results
143
- for (const [taskId, agent] of Object.entries(state.active_agents)) {
144
- state.tasks[taskId].status = 'completed'
145
- close_agent({ id: agent.agentId })
146
- delete state.active_agents[taskId]
147
- }
148
- ```
149
-
150
- ### GC Checkpoint (TESTRUN-* completes)
151
-
152
- After TESTRUN-* completion, read meta.json for executor.pass_rate and executor.coverage:
153
- - (pass_rate >= 0.95 AND coverage >= target) OR gc_rounds[layer] >= MAX_GC_ROUNDS -> proceed
154
- - (pass_rate < 0.95 OR coverage < target) AND gc_rounds[layer] < MAX_GC_ROUNDS -> create GC fix tasks, increment gc_rounds[layer]
155
-
156
- **GC Fix Task Creation** (when coverage below target):
157
-
158
- Add to tasks.json:
159
- ```json
160
- {
161
- "TESTGEN-<layer>-fix-<round>": {
162
- "title": "Revise <layer> tests (GC #<round>)",
163
- "description": "PURPOSE: Revise tests to fix failures and improve coverage | Success: pass_rate >= 0.95 AND coverage >= target\nTASK:\n - Read previous test results and failure details\n - Revise tests to address failures\n - Improve coverage for uncovered areas\nCONTEXT:\n - Session: <session-folder>\n - Layer: <layer>\n - Previous results: <session>/results/run-<N>.json\nEXPECTED: Revised test files in <session>/tests/<layer>/\nCONSTRAINTS: Only modify test files\n---\nInnerLoop: true\nRoleSpec: <project>/.codex/skills/team-testing/roles/generator/role.md",
164
- "role": "generator",
165
- "prefix": "TESTGEN",
166
- "deps": [],
167
- "status": "pending",
168
- "findings": null,
169
- "error": null
170
- },
171
- "TESTRUN-<layer>-fix-<round>": {
172
- "title": "Re-execute <layer> (GC #<round>)",
173
- "description": "PURPOSE: Re-execute tests after revision | Success: pass_rate >= 0.95\nCONTEXT:\n - Session: <session-folder>\n - Layer: <layer>\n - Input: tests/<layer>\nEXPECTED: <session>/results/run-<N>-gc.json\n---\nInnerLoop: true\nRoleSpec: <project>/.codex/skills/team-testing/roles/executor/role.md",
174
- "role": "executor",
175
- "prefix": "TESTRUN",
176
- "deps": ["TESTGEN-<layer>-fix-<round>"],
177
- "status": "pending",
178
- "findings": null,
179
- "error": null
180
- }
181
- }
182
- ```
183
- Update tasks.json gc_rounds[layer]++
184
-
185
- ### Persist and Loop
186
-
187
- After processing all results:
188
- 1. Write updated tasks.json
189
- 2. Check if more tasks are now ready (deps newly resolved)
190
- 3. If yes -> loop back to step 1 of handleSpawnNext
191
- 4. If no more ready and all done -> handleComplete
192
- 5. If no more ready but some still blocked -> report status, STOP
193
-
194
- ## handleComplete
195
-
196
- Pipeline done. Generate report and completion action.
197
-
198
- 1. Verify all tasks (including any GC fix tasks) have status "completed" or "failed"
199
- 2. If any tasks incomplete -> return to handleSpawnNext
200
- 3. If all complete:
201
- - Read final state from meta.json (analyst.quality_score, executor.coverage, gc_rounds)
202
- - Generate summary (deliverables, task count, GC rounds, coverage metrics)
203
- 4. Execute completion action per tasks.json completion_action:
204
- - interactive -> request_user_input (Archive/Keep/Deepen Coverage)
205
- - auto_archive -> Archive & Clean (rm -rf session folder)
206
- - auto_keep -> Keep Active (status=paused)
207
-
208
- ## handleAdapt
209
-
210
- Capability gap reported mid-pipeline.
211
-
212
- 1. Parse gap description
213
- 2. Check if existing role covers it -> redirect
214
- 3. Role count < 5 -> generate dynamic role-spec in <session>/role-specs/
215
- 4. Add new task to tasks.json, spawn worker via spawn_agent + wait_agent
216
- 5. Role count >= 5 -> merge or pause
217
-
218
- ## Fast-Advance Reconciliation
219
-
220
- On every coordinator wake:
221
- 1. Read team_msg entries with type="fast_advance"
222
- 2. Sync active_agents with spawned successors
223
- 3. No duplicate spawns
224
-
225
- ## Phase 4: State Persistence
226
-
227
- After every handler execution:
228
- 1. Reconcile active_agents with actual tasks.json states
229
- 2. Remove entries for completed/failed tasks
230
- 3. Write updated tasks.json
231
- 4. STOP (wait for next invocation)
232
-
233
- ## Error Handling
234
-
235
- | Scenario | Resolution |
236
- |----------|------------|
237
- | Session file not found | Error, suggest re-initialization |
238
- | Unknown role in callback | Log info, scan for other completions |
239
- | GC loop exceeded (3 rounds) | Accept current coverage with warning, proceed |
240
- | Pipeline stall | Check deps chains, report to user |
241
- | Coverage tool unavailable | Degrade to pass rate judgment |
242
- | Worker crash | Reset task to pending in tasks.json, respawn via spawn_agent |
1
+ # Monitor Pipeline
2
+
3
+ Synchronous pipeline coordination using spawn_agent + wait_agent.
4
+
5
+ ## Constants
6
+
7
+ - WORKER_AGENT: team_worker
8
+ - ONE_STEP_PER_INVOCATION: false (synchronous wait loop)
9
+ - FAST_ADVANCE_AWARE: true
10
+ - MAX_GC_ROUNDS: 3
11
+
12
+ ## Handler Router
13
+
14
+ | Source | Handler |
15
+ |--------|---------|
16
+ | "capability_gap" | handleAdapt |
17
+ | "check" or "status" | handleCheck |
18
+ | "resume" or "continue" | handleResume |
19
+ | All tasks completed | handleComplete |
20
+ | Default | handleSpawnNext |
21
+
22
+ ## Role-Worker Map
23
+
24
+ | Prefix | Role | Role Spec | inner_loop |
25
+ |--------|------|-----------|------------|
26
+ | STRATEGY-* | strategist | `<project>/.codex/skills/team-testing/roles/strategist/role.md` | false |
27
+ | TESTGEN-* | generator | `<project>/.codex/skills/team-testing/roles/generator/role.md` | true |
28
+ | TESTRUN-* | executor | `<project>/.codex/skills/team-testing/roles/executor/role.md` | true |
29
+ | TESTANA-* | analyst | `<project>/.codex/skills/team-testing/roles/analyst/role.md` | false |
30
+
31
+ ## handleCheck
32
+
33
+ Read-only status report from tasks.json, then STOP.
34
+
35
+ 1. Read tasks.json
36
+ 2. Count tasks by status (pending, in_progress, completed, failed)
37
+
38
+ Output:
39
+ ```
40
+ [coordinator] Testing Pipeline Status
41
+ [coordinator] Mode: <pipeline_mode>
42
+ [coordinator] Progress: <done>/<total> (<pct>%)
43
+ [coordinator] GC Rounds: L1: <n>/3, L2: <n>/3
44
+
45
+ [coordinator] Pipeline Graph:
46
+ STRATEGY-001: <done|run|wait> test-strategy.md
47
+ TESTGEN-001: <done|run|wait> generating L1...
48
+ TESTRUN-001: <done|run|wait> blocked by TESTGEN-001
49
+ TESTGEN-002: <done|run|wait> blocked by TESTRUN-001
50
+ TESTRUN-002: <done|run|wait> blocked by TESTGEN-002
51
+ TESTANA-001: <done|run|wait> blocked by TESTRUN-*
52
+
53
+ [coordinator] Active agents: <list with elapsed time>
54
+ [coordinator] Ready: <pending tasks with resolved deps>
55
+ [coordinator] Commands: 'resume' to advance | 'check' to refresh
56
+ ```
57
+
58
+ Then STOP.
59
+
60
+ ## handleResume
61
+
62
+ **Agent Health Check** (v4):
63
+ ```
64
+ // Verify actual running agents match session state
65
+ const runningAgents = list_agents({})
66
+ // For each active_agent in tasks.json:
67
+ // - If agent NOT in runningAgents -> agent crashed
68
+ // - Reset that task to pending, remove from active_agents
69
+ // This prevents stale agent references from blocking the pipeline
70
+ ```
71
+
72
+ 1. Read tasks.json, check active_agents
73
+ 2. No active agents -> handleSpawnNext
74
+ 3. Has active agents -> check each status
75
+ - completed -> mark done
76
+ - in_progress -> still running
77
+ 4. Some completed -> handleSpawnNext
78
+ 5. All running -> report status, STOP
79
+
80
+ ## handleSpawnNext
81
+
82
+ Find ready tasks, spawn workers, wait for completion, process results.
83
+
84
+ 1. Read tasks.json
85
+ 2. Collect:
86
+ - completedTasks: status = completed
87
+ - inProgressTasks: status = in_progress
88
+ - readyTasks: status = pending AND all deps in completedTasks
89
+
90
+ 3. No ready + work in progress -> report waiting, STOP
91
+ 4. No ready + nothing in progress -> handleComplete
92
+ 5. Has ready -> for each ready task:
93
+ a. Determine role from prefix (use Role-Worker Map)
94
+ b. Check if inner loop role (generator/executor) with active worker -> skip (worker picks up next task)
95
+ c. Update task status in tasks.json -> in_progress
96
+ d. team_msg log -> task_unblocked
97
+
98
+ ### Spawn Workers
99
+
100
+ For each ready task:
101
+
102
+ ```javascript
103
+ // 1) Update status in tasks.json
104
+ state.tasks[taskId].status = 'in_progress'
105
+
106
+ // 2) Spawn worker
107
+ const agentId = spawn_agent({
108
+ agent_type: "team_worker",
109
+ task_name: taskId, // e.g., "STRATEGY-001" — enables named targeting
110
+ items: [
111
+ { type: "text", text: `## Role Assignment
112
+ role: ${task.role}
113
+ role_spec: ${skillRoot}/roles/${task.role}/role.md
114
+ session: ${sessionFolder}
115
+ session_id: ${sessionId}
116
+ team_name: testing
117
+ requirement: ${task.description}
118
+ inner_loop: ${task.role === 'generator' || task.role === 'executor'}
119
+
120
+ ## Current Task
121
+ - Task ID: ${taskId}
122
+ - Task: ${task.title}` },
123
+
124
+ { type: "text", text: `Read role_spec file (${skillRoot}/roles/${task.role}/role.md) to load Phase 2-4 domain instructions.
125
+ Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).` },
126
+
127
+ { type: "text", text: `## Task Context
128
+ task_id: ${taskId}
129
+ title: ${task.title}
130
+ description: ${task.description}` },
131
+
132
+ { type: "text", text: `## Upstream Context\n${prevContext}` }
133
+ ]
134
+ })
135
+
136
+ // 3) Track agent
137
+ state.active_agents[taskId] = { agentId, role: task.role, started_at: now }
138
+ ```
139
+
140
+ 6. **Parallel spawn** (comprehensive pipeline):
141
+ - TESTGEN-001 + TESTGEN-002 both unblocked -> spawn both in parallel (name: "generator-1", "generator-2")
142
+ - TESTRUN-001 + TESTRUN-002 both unblocked -> spawn both in parallel (name: "executor-1", "executor-2")
143
+
144
+ ### Wait and Process Results
145
+
146
+ After spawning all ready tasks:
147
+
148
+ ```javascript
149
+ // 4) Batch wait — use task_name for stable targeting (v4)
150
+ const taskNames = Object.keys(state.active_agents)
151
+ const waitResult = wait_agent({ targets: taskNames, timeout_ms: 900000 })
152
+ if (waitResult.timed_out) {
153
+ for (const taskId of taskNames) {
154
+ state.tasks[taskId].status = 'timed_out'
155
+ close_agent({ target: taskId })
156
+ delete state.active_agents[taskId]
157
+ }
158
+ } else {
159
+ // 5) Collect results
160
+ for (const [taskId, agent] of Object.entries(state.active_agents)) {
161
+ state.tasks[taskId].status = 'completed'
162
+ close_agent({ target: taskId }) // Use task_name, not agentId
163
+ delete state.active_agents[taskId]
164
+ }
165
+ }
166
+ ```
167
+
168
+ ### GC Checkpoint (TESTRUN-* completes)
169
+
170
+ After TESTRUN-* completion, read meta.json for executor.pass_rate and executor.coverage:
171
+ - (pass_rate >= 0.95 AND coverage >= target) OR gc_rounds[layer] >= MAX_GC_ROUNDS -> proceed
172
+ - (pass_rate < 0.95 OR coverage < target) AND gc_rounds[layer] < MAX_GC_ROUNDS -> create GC fix tasks, increment gc_rounds[layer]
173
+
174
+ **GC Fix Task Creation** (when coverage below target):
175
+
176
+ Add to tasks.json:
177
+ ```json
178
+ {
179
+ "TESTGEN-<layer>-fix-<round>": {
180
+ "title": "Revise <layer> tests (GC #<round>)",
181
+ "description": "PURPOSE: Revise tests to fix failures and improve coverage | Success: pass_rate >= 0.95 AND coverage >= target\nTASK:\n - Read previous test results and failure details\n - Revise tests to address failures\n - Improve coverage for uncovered areas\nCONTEXT:\n - Session: <session-folder>\n - Layer: <layer>\n - Previous results: <session>/results/run-<N>.json\nEXPECTED: Revised test files in <session>/tests/<layer>/\nCONSTRAINTS: Only modify test files\n---\nInnerLoop: true\nRoleSpec: <project>/.codex/skills/team-testing/roles/generator/role.md",
182
+ "role": "generator",
183
+ "prefix": "TESTGEN",
184
+ "deps": [],
185
+ "status": "pending",
186
+ "findings": null,
187
+ "error": null
188
+ },
189
+ "TESTRUN-<layer>-fix-<round>": {
190
+ "title": "Re-execute <layer> (GC #<round>)",
191
+ "description": "PURPOSE: Re-execute tests after revision | Success: pass_rate >= 0.95\nCONTEXT:\n - Session: <session-folder>\n - Layer: <layer>\n - Input: tests/<layer>\nEXPECTED: <session>/results/run-<N>-gc.json\n---\nInnerLoop: true\nRoleSpec: <project>/.codex/skills/team-testing/roles/executor/role.md",
192
+ "role": "executor",
193
+ "prefix": "TESTRUN",
194
+ "deps": ["TESTGEN-<layer>-fix-<round>"],
195
+ "status": "pending",
196
+ "findings": null,
197
+ "error": null
198
+ }
199
+ }
200
+ ```
201
+ Update tasks.json gc_rounds[layer]++
202
+
203
+ **Cross-Agent Supplementary Context** (v4):
204
+
205
+ When spawning workers in a later pipeline phase, send upstream results as supplementary context to already-running workers:
206
+
207
+ ```
208
+ // Example: Send strategy results to running generators
209
+ send_message({
210
+ target: "<running-agent-task-name>",
211
+ items: [{ type: "text", text: `## Supplementary Context\n${upstreamFindings}` }]
212
+ })
213
+ // Note: send_message queues info without interrupting the agent's current work
214
+ ```
215
+
216
+ Use `send_message` (not `assign_task`) for supplementary info that enriches but doesn't redirect the agent's current task.
217
+
218
+ ### Persist and Loop
219
+
220
+ After processing all results:
221
+ 1. Write updated tasks.json
222
+ 2. Check if more tasks are now ready (deps newly resolved)
223
+ 3. If yes -> loop back to step 1 of handleSpawnNext
224
+ 4. If no more ready and all done -> handleComplete
225
+ 5. If no more ready but some still blocked -> report status, STOP
226
+
227
+ ## handleComplete
228
+
229
+ **Cleanup Verification** (v4):
230
+ ```
231
+ // Verify all agents are properly closed
232
+ const remaining = list_agents({})
233
+ // If any team agents still running -> close_agent each
234
+ // Ensures clean session shutdown
235
+ ```
236
+
237
+ Pipeline done. Generate report and completion action.
238
+
239
+ 1. Verify all tasks (including any GC fix tasks) have status "completed" or "failed"
240
+ 2. If any tasks incomplete -> return to handleSpawnNext
241
+ 3. If all complete:
242
+ - Read final state from meta.json (analyst.quality_score, executor.coverage, gc_rounds)
243
+ - Generate summary (deliverables, task count, GC rounds, coverage metrics)
244
+ 4. Execute completion action per tasks.json completion_action:
245
+ - interactive -> request_user_input (Archive/Keep/Deepen Coverage)
246
+ - auto_archive -> Archive & Clean (rm -rf session folder)
247
+ - auto_keep -> Keep Active (status=paused)
248
+
249
+ ## handleAdapt
250
+
251
+ Capability gap reported mid-pipeline.
252
+
253
+ 1. Parse gap description
254
+ 2. Check if existing role covers it -> redirect
255
+ 3. Role count < 5 -> generate dynamic role-spec in <session>/role-specs/
256
+ 4. Add new task to tasks.json, spawn worker via spawn_agent + wait_agent
257
+ 5. Role count >= 5 -> merge or pause
258
+
259
+ ## Fast-Advance Reconciliation
260
+
261
+ On every coordinator wake:
262
+ 1. Read team_msg entries with type="fast_advance"
263
+ 2. Sync active_agents with spawned successors
264
+ 3. No duplicate spawns
265
+
266
+ ## Phase 4: State Persistence
267
+
268
+ After every handler execution:
269
+ 1. Reconcile active_agents with actual tasks.json states
270
+ 2. Remove entries for completed/failed tasks
271
+ 3. Write updated tasks.json
272
+ 4. STOP (wait for next invocation)
273
+
274
+ ## Error Handling
275
+
276
+ | Scenario | Resolution |
277
+ |----------|------------|
278
+ | Session file not found | Error, suggest re-initialization |
279
+ | Unknown role in callback | Log info, scan for other completions |
280
+ | GC loop exceeded (3 rounds) | Accept current coverage with warning, proceed |
281
+ | Pipeline stall | Check deps chains, report to user |
282
+ | Coverage tool unavailable | Degrade to pass rate judgment |
283
+ | Worker crash | Reset task to pending in tasks.json, respawn via spawn_agent |