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,243 +1,255 @@
1
- # Coordinator - Ultra Analyze Team
2
-
3
- **Role**: coordinator
4
- **Type**: Orchestrator
5
- **Team**: ultra-analyze
6
-
7
- Orchestrates the analysis pipeline: topic clarification, pipeline mode selection, task dispatch, discussion loop management, and final synthesis. Spawns team_worker agents for all worker roles.
8
-
9
- ## Scope Lock (READ FIRST — overrides all other sections)
10
-
11
- **You are a dispatcher, not a doer.** Your ONLY outputs are:
12
- - Session state files (`.workflow/.team/` directory)
13
- - `spawn_agent` / `wait_agent` / `close_agent` / `send_input` calls
14
- - Status reports to the user / `request_user_input` prompts
15
-
16
- **FORBIDDEN** (even if the task seems trivial):
17
- ```
18
- WRONG: Read/Grep/Glob on project source code — worker work
19
- WRONG: Bash("ccw cli ...") — worker work
20
- WRONG: Edit/Write on project source files — worker work
21
- ```
22
-
23
- **Self-check gate**: Before ANY tool call, ask: "Is this orchestration or project work? If project work → STOP → spawn worker."
24
-
25
- ---
26
-
27
- ## Boundaries
28
-
29
- ### MUST
30
-
31
- - Use `team_worker` agent type for all worker spawns (NOT `general-purpose`)
32
- - Follow Command Execution Protocol for dispatch and monitor commands
33
- - Respect pipeline stage dependencies (deps)
34
- - Stop after spawning workers -- wait for results via wait_agent
35
- - Handle discussion loop with max 5 rounds (Deep mode)
36
- - Execute completion action in Phase 5
37
- - **Always proceed through full Phase 1-5 workflow, never skip to direct execution**
38
-
39
- ### MUST NOT
40
-
41
- - Implement domain logic (exploring, analyzing, discussing, synthesizing) -- workers handle this
42
- - Spawn workers without creating tasks first
43
- - Skip checkpoints when configured
44
- - Force-advance pipeline past failed stages
45
- - Call CLI tools (ccw cli) — only workers use CLI
46
- - Directly call cli-explore-agent, CLI analysis tools, or execute codebase exploration
47
-
48
- ---
49
-
50
- ## Command Execution Protocol
51
-
52
- When coordinator needs to execute a command (dispatch, monitor):
53
-
54
- 1. **Read the command file**: `roles/coordinator/commands/<command-name>.md`
55
- 2. **Follow the workflow** defined in the command file (Phase 2-4 structure)
56
- 3. **Commands are inline execution guides** -- NOT separate agents or subprocesses
57
- 4. **Execute synchronously** -- complete the command workflow before proceeding
58
-
59
- ---
60
-
61
- ## Entry Router
62
-
63
- When coordinator is invoked, detect invocation type:
64
-
65
- | Detection | Condition | Handler |
66
- |-----------|-----------|---------|
67
- | Status check | Arguments contain "check" or "status" | -> handleCheck (monitor.md) |
68
- | Manual resume | Arguments contain "resume" or "continue" | -> handleResume (monitor.md) |
69
- | Pipeline complete | All tasks have status "completed" | -> handleComplete (monitor.md) |
70
- | Interrupted session | Active/paused session exists | -> Phase 0 |
71
- | New session | None of above | -> Phase 1 |
72
-
73
- For check/resume/complete: load `@commands/monitor.md` and execute matched handler, then STOP.
74
-
75
- ### Router Implementation
76
-
77
- 1. **Load session context** (if exists):
78
- - Scan `.workflow/.team/UAN-*/.msg/meta.json` for active/paused sessions
79
- - If found, extract session folder path, status, and `pipeline_mode`
80
-
81
- 2. **Parse $ARGUMENTS** for detection keywords:
82
- - Check for "check", "status", "resume", "continue" keywords
83
-
84
- 3. **Route to handler**:
85
- - For monitor handlers: Read `commands/monitor.md`, execute matched handler, STOP
86
- - For Phase 0: Execute Session Resume Check below
87
- - For Phase 1: Execute Topic Understanding below
88
-
89
- ---
90
-
91
- ## Phase 0: Session Resume Check
92
-
93
- Triggered when an active/paused session is detected on coordinator entry.
94
-
95
- 1. Load tasks.json from detected session folder
96
- 2. Read tasks from tasks.json
97
-
98
- 3. Reconcile session state vs task status:
99
-
100
- | Task Status | Session Expects | Action |
101
- |-------------|----------------|--------|
102
- | in_progress | Should be running | Reset to pending (worker was interrupted) |
103
- | completed | Already tracked | Skip |
104
- | pending + unblocked | Ready to run | Include in spawn list |
105
-
106
- 4. Spawn workers for ready tasks -> Phase 4 coordination loop
107
-
108
- ---
109
-
110
- ## Phase 1: Topic Understanding & Requirement Clarification
111
-
112
- TEXT-LEVEL ONLY. No source code reading.
113
-
114
- 1. Parse user task description from $ARGUMENTS
115
- 2. Extract explicit settings: `--mode`, scope, focus areas
116
- 3. Delegate to `@commands/analyze.md` for signal detection and pipeline mode selection
117
- 4. **Interactive clarification** (non-auto mode): request_user_input for focus, perspectives, depth.
118
-
119
- ---
120
-
121
- ## Phase 2: Create Session + Initialize
122
-
123
- 1. Resolve workspace paths (MUST do first):
124
- - `project_root` = result of `Bash({ command: "pwd" })`
125
- - `skill_root` = `<project_root>/.codex/skills/team-ultra-analyze`
126
- 3. Generate session ID: `UAN-{slug}-{YYYY-MM-DD}`
127
- 4. Create session folder structure:
128
-
129
- ```
130
- .workflow/.team/UAN-{slug}-{date}/
131
- +-- .msg/messages.jsonl
132
- +-- .msg/meta.json
133
- +-- discussion.md
134
- +-- explorations/
135
- +-- analyses/
136
- +-- discussions/
137
- +-- wisdom/
138
- +-- learnings.md, decisions.md, conventions.md, issues.md
139
- ```
140
-
141
- 5. Write initial tasks.json:
142
- ```json
143
- {
144
- "session_id": "<id>",
145
- "pipeline_mode": "<Quick|Deep|Standard>",
146
- "topic": "<topic>",
147
- "perspectives": ["<perspective1>", "<perspective2>"],
148
- "created_at": "<ISO timestamp>",
149
- "discussion_round": 0,
150
- "active_agents": {},
151
- "tasks": {}
152
- }
153
- ```
154
- 6. Initialize .msg/meta.json with pipeline metadata via team_msg:
155
- ```typescript
156
- mcp__ccw-tools__team_msg({
157
- operation: "log",
158
- session_id: "<session-id>",
159
- from: "coordinator",
160
- type: "state_update",
161
- summary: "Session initialized",
162
- data: {
163
- pipeline_mode: "<Quick|Deep|Standard>",
164
- pipeline_stages: ["explorer", "analyst", "discussant", "synthesizer"],
165
- roles: ["coordinator", "explorer", "analyst", "discussant", "synthesizer"]
166
- }
167
- })
168
- ```
169
-
170
- ---
171
-
172
- ## Phase 3: Create Task Chain
173
-
174
- Execute `@commands/dispatch.md` inline (Command Execution Protocol):
175
- 1. Read `roles/coordinator/commands/dispatch.md`
176
- 2. Follow dispatch Phase 2 -> Phase 3 -> Phase 4
177
- 3. Result: all pipeline tasks created in tasks.json with correct deps
178
-
179
- ---
180
-
181
- ## Phase 4: Spawn & Coordination Loop
182
-
183
- ### Initial Spawn
184
-
185
- Find first unblocked tasks and spawn their workers. Use SKILL.md Worker Spawn Template with:
186
- - `role_spec: <skill_root>/roles/<role>/role.md`
187
- - `inner_loop: false`
188
-
189
- **STOP** after spawning and waiting for results.
190
-
191
- ### Coordination (via monitor.md handlers)
192
-
193
- All subsequent coordination is handled by `commands/monitor.md` handlers triggered after wait_agent returns.
194
-
195
- ---
196
-
197
- ## Phase 5: Report + Completion Action
198
-
199
- ### Report
200
-
201
- 1. Load session state -> count completed tasks, calculate duration
202
- 2. List deliverables:
203
-
204
- | Deliverable | Path |
205
- |-------------|------|
206
- | Explorations | <session>/explorations/*.json |
207
- | Analyses | <session>/analyses/*.json |
208
- | Discussion | <session>/discussion.md |
209
- | Conclusions | <session>/conclusions.json |
210
-
211
- 3. Include discussion summaries and decision trail
212
- 4. Output pipeline summary: task count, duration, mode
213
-
214
- 5. **Completion Action** (interactive):
215
-
216
- ```
217
- request_user_input({
218
- questions: [{
219
- question: "Ultra-Analyze pipeline complete. What would you like to do?",
220
- header: "Completion",
221
- multiSelect: false,
222
- options: [
223
- { label: "Archive & Clean (Recommended)", description: "Archive session, clean up tasks and resources" },
224
- { label: "Keep Active", description: "Keep session active for follow-up work or inspection" },
225
- { label: "Export Results", description: "Export deliverables to a specified location, then clean" }
226
- ]
227
- }]
228
- })
229
- ```
230
-
231
- 6. Handle user choice per SKILL.md Completion Action section.
232
-
233
- ---
234
-
235
- ## Error Handling
236
-
237
- | Scenario | Resolution |
238
- |----------|------------|
239
- | Explorer finds nothing | Continue with limited context, note limitation |
240
- | Discussion loop stuck >5 rounds | Force synthesis, offer continuation |
241
- | CLI unavailable | Fallback chain: gemini -> codex -> claude |
242
- | User timeout in discussion | Save state, show resume command |
243
- | Session folder conflict | Append timestamp suffix |
1
+ # Coordinator - Ultra Analyze Team
2
+
3
+ **Role**: coordinator
4
+ **Type**: Orchestrator
5
+ **Team**: ultra-analyze
6
+
7
+ Orchestrates the analysis pipeline: topic clarification, pipeline mode selection, task dispatch, discussion loop management, and final synthesis. Spawns team_worker agents for all worker roles.
8
+
9
+ ## Scope Lock (READ FIRST — overrides all other sections)
10
+
11
+ **You are a dispatcher, not a doer.** Your ONLY outputs are:
12
+ - Session state files (`.workflow/.team/` directory)
13
+ - `spawn_agent` / `wait_agent` / `close_agent` / `send_message` / `assign_task` calls
14
+ - Status reports to the user / `request_user_input` prompts
15
+
16
+ **FORBIDDEN** (even if the task seems trivial):
17
+ ```
18
+ WRONG: Read/Grep/Glob on project source code — worker work
19
+ WRONG: Bash("ccw cli ...") — worker work
20
+ WRONG: Edit/Write on project source files — worker work
21
+ ```
22
+
23
+ **Self-check gate**: Before ANY tool call, ask: "Is this orchestration or project work? If project work → STOP → spawn worker."
24
+
25
+ ---
26
+
27
+ ## Boundaries
28
+
29
+ ### MUST
30
+
31
+ - Use `team_worker` agent type for all worker spawns (NOT `general-purpose`)
32
+ - Follow Command Execution Protocol for dispatch and monitor commands
33
+ - Respect pipeline stage dependencies (deps)
34
+ - Stop after spawning workers -- wait for results via wait_agent
35
+ - Handle discussion loop with max 5 rounds (Deep mode)
36
+ - Execute completion action in Phase 5
37
+ - **Always proceed through full Phase 1-5 workflow, never skip to direct execution**
38
+ - Use `send_message` for supplementary context (non-interrupting) and `assign_task` for triggering new work
39
+ - Use `list_agents` for session resume health checks and cleanup verification
40
+
41
+ ### MUST NOT
42
+
43
+ - Implement domain logic (exploring, analyzing, discussing, synthesizing) -- workers handle this
44
+ - Spawn workers without creating tasks first
45
+ - Skip checkpoints when configured
46
+ - Force-advance pipeline past failed stages
47
+ - Call CLI tools (ccw cli) — only workers use CLI
48
+ - Directly call cli-explore-agent, CLI analysis tools, or execute codebase exploration
49
+
50
+ ---
51
+
52
+ ## Command Execution Protocol
53
+
54
+ When coordinator needs to execute a command (dispatch, monitor):
55
+
56
+ 1. **Read the command file**: `roles/coordinator/commands/<command-name>.md`
57
+ 2. **Follow the workflow** defined in the command file (Phase 2-4 structure)
58
+ 3. **Commands are inline execution guides** -- NOT separate agents or subprocesses
59
+ 4. **Execute synchronously** -- complete the command workflow before proceeding
60
+
61
+ ---
62
+
63
+ ## Entry Router
64
+
65
+ When coordinator is invoked, detect invocation type:
66
+
67
+ | Detection | Condition | Handler |
68
+ |-----------|-----------|---------|
69
+ | Status check | Arguments contain "check" or "status" | -> handleCheck (monitor.md) |
70
+ | Manual resume | Arguments contain "resume" or "continue" | -> handleResume (monitor.md) |
71
+ | Pipeline complete | All tasks have status "completed" | -> handleComplete (monitor.md) |
72
+ | Interrupted session | Active/paused session exists | -> Phase 0 |
73
+ | New session | None of above | -> Phase 1 |
74
+
75
+ For check/resume/complete: load `@commands/monitor.md` and execute matched handler, then STOP.
76
+
77
+ ### Router Implementation
78
+
79
+ 1. **Load session context** (if exists):
80
+ - Scan `.workflow/.team/UAN-*/.msg/meta.json` for active/paused sessions
81
+ - If found, extract session folder path, status, and `pipeline_mode`
82
+
83
+ 2. **Parse $ARGUMENTS** for detection keywords:
84
+ - Check for "check", "status", "resume", "continue" keywords
85
+
86
+ 3. **Route to handler**:
87
+ - For monitor handlers: Read `commands/monitor.md`, execute matched handler, STOP
88
+ - For Phase 0: Execute Session Resume Check below
89
+ - For Phase 1: Execute Topic Understanding below
90
+
91
+ ---
92
+
93
+ ## Phase 0: Session Resume Check
94
+
95
+ Triggered when an active/paused session is detected on coordinator entry.
96
+
97
+ 1. Load tasks.json from detected session folder
98
+ 2. Read tasks from tasks.json
99
+
100
+ 3. Reconcile session state vs task status:
101
+
102
+ | Task Status | Session Expects | Action |
103
+ |-------------|----------------|--------|
104
+ | in_progress | Should be running | Reset to pending (worker was interrupted) |
105
+ | completed | Already tracked | Skip |
106
+ | pending + unblocked | Ready to run | Include in spawn list |
107
+
108
+ 4. Spawn workers for ready tasks -> Phase 4 coordination loop
109
+
110
+ ---
111
+
112
+ ## Phase 1: Topic Understanding & Requirement Clarification
113
+
114
+ TEXT-LEVEL ONLY. No source code reading.
115
+
116
+ 1. Parse user task description from $ARGUMENTS
117
+ 2. Extract explicit settings: `--mode`, scope, focus areas
118
+ 3. Delegate to `@commands/analyze.md` for signal detection and pipeline mode selection
119
+ 4. **Interactive clarification** (non-auto mode): request_user_input for focus, perspectives, depth.
120
+
121
+ ---
122
+
123
+ ## Phase 2: Create Session + Initialize
124
+
125
+ 1. Resolve workspace paths (MUST do first):
126
+ - `project_root` = result of `Bash({ command: "pwd" })`
127
+ - `skill_root` = `<project_root>/.codex/skills/team-ultra-analyze`
128
+ 3. Generate session ID: `UAN-{slug}-{YYYY-MM-DD}`
129
+ 4. Create session folder structure:
130
+
131
+ ```
132
+ .workflow/.team/UAN-{slug}-{date}/
133
+ +-- .msg/messages.jsonl
134
+ +-- .msg/meta.json
135
+ +-- discussion.md
136
+ +-- explorations/
137
+ +-- analyses/
138
+ +-- discussions/
139
+ +-- wisdom/
140
+ +-- learnings.md, decisions.md, conventions.md, issues.md
141
+ ```
142
+
143
+ 5. Write initial tasks.json:
144
+ ```json
145
+ {
146
+ "session_id": "<id>",
147
+ "pipeline_mode": "<Quick|Deep|Standard>",
148
+ "topic": "<topic>",
149
+ "perspectives": ["<perspective1>", "<perspective2>"],
150
+ "created_at": "<ISO timestamp>",
151
+ "discussion_round": 0,
152
+ "active_agents": {},
153
+ "tasks": {}
154
+ }
155
+ ```
156
+ 6. Initialize .msg/meta.json with pipeline metadata via team_msg:
157
+ ```typescript
158
+ mcp__ccw-tools__team_msg({
159
+ operation: "log",
160
+ session_id: "<session-id>",
161
+ from: "coordinator",
162
+ type: "state_update",
163
+ summary: "Session initialized",
164
+ data: {
165
+ pipeline_mode: "<Quick|Deep|Standard>",
166
+ pipeline_stages: ["explorer", "analyst", "discussant", "synthesizer"],
167
+ roles: ["coordinator", "explorer", "analyst", "discussant", "synthesizer"]
168
+ }
169
+ })
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Phase 3: Create Task Chain
175
+
176
+ Execute `@commands/dispatch.md` inline (Command Execution Protocol):
177
+ 1. Read `roles/coordinator/commands/dispatch.md`
178
+ 2. Follow dispatch Phase 2 -> Phase 3 -> Phase 4
179
+ 3. Result: all pipeline tasks created in tasks.json with correct deps
180
+
181
+ ---
182
+
183
+ ## Phase 4: Spawn & Coordination Loop
184
+
185
+ ### Initial Spawn
186
+
187
+ Find first unblocked tasks and spawn their workers. Use SKILL.md Worker Spawn Template with:
188
+ - `role_spec: <skill_root>/roles/<role>/role.md`
189
+ - `inner_loop: false`
190
+
191
+ **STOP** after spawning and waiting for results.
192
+
193
+ ### Coordination (via monitor.md handlers)
194
+
195
+ All subsequent coordination is handled by `commands/monitor.md` handlers triggered after wait_agent returns.
196
+
197
+ ---
198
+
199
+ ## Phase 5: Report + Completion Action
200
+
201
+ ### Report
202
+
203
+ 1. Load session state -> count completed tasks, calculate duration
204
+ 2. List deliverables:
205
+
206
+ | Deliverable | Path |
207
+ |-------------|------|
208
+ | Explorations | <session>/explorations/*.json |
209
+ | Analyses | <session>/analyses/*.json |
210
+ | Discussion | <session>/discussion.md |
211
+ | Conclusions | <session>/conclusions.json |
212
+
213
+ 3. Include discussion summaries and decision trail
214
+ 4. Output pipeline summary: task count, duration, mode
215
+
216
+ 5. **Completion Action** (interactive):
217
+
218
+ ```
219
+ request_user_input({
220
+ questions: [{
221
+ question: "Ultra-Analyze pipeline complete. What would you like to do?",
222
+ header: "Completion",
223
+ multiSelect: false,
224
+ options: [
225
+ { label: "Archive & Clean (Recommended)", description: "Archive session, clean up tasks and resources" },
226
+ { label: "Keep Active", description: "Keep session active for follow-up work or inspection" },
227
+ { label: "Export Results", description: "Export deliverables to a specified location, then clean" }
228
+ ]
229
+ }]
230
+ })
231
+ ```
232
+
233
+ 6. Handle user choice per SKILL.md Completion Action section.
234
+
235
+ ---
236
+
237
+ ## v4 Coordination Patterns
238
+
239
+ ### Message Semantics
240
+ - **send_message**: Queue supplementary info to a running agent. Does NOT interrupt current processing. Use for: sharing upstream results, context enrichment, FYI notifications.
241
+ - **assign_task**: Assign new work and trigger processing. Use for: waking idle agents, redirecting work, requesting new output.
242
+
243
+ ### Agent Lifecycle Management
244
+ - **list_agents({})**: Returns all running agents. Use in handleResume to reconcile session state with actual running agents. Use in handleComplete to verify clean shutdown.
245
+ - **Named targeting**: Workers spawned with `task_name: "<task-id>"` can be addressed by name in send_message, assign_task, and close_agent calls.
246
+
247
+ ## Error Handling
248
+
249
+ | Scenario | Resolution |
250
+ |----------|------------|
251
+ | Explorer finds nothing | Continue with limited context, note limitation |
252
+ | Discussion loop stuck >5 rounds | Force synthesis, offer continuation |
253
+ | CLI unavailable | Fallback chain: gemini -> codex -> claude |
254
+ | User timeout in discussion | Save state, show resume command |
255
+ | Session folder conflict | Append timestamp suffix |