claude-code-workflow 7.2.29 → 7.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 (169) hide show
  1. package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
  2. package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
  3. package/.claude/agents/action-planning-agent.md +7 -4
  4. package/.claude/agents/cli-explore-agent.md +77 -63
  5. package/.claude/agents/cli-lite-planning-agent.md +11 -10
  6. package/.claude/agents/issue-plan-agent.md +421 -426
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/commands/workflow-skill.md +130 -0
  9. package/.claude/skills/ccw-chain/SKILL.md +92 -0
  10. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +31 -0
  11. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +58 -0
  12. package/.claude/skills/ccw-chain/chains/ccw-issue.json +44 -0
  13. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +71 -0
  14. package/.claude/skills/ccw-chain/chains/ccw-main.json +65 -0
  15. package/.claude/skills/ccw-chain/chains/ccw-standard.json +51 -0
  16. package/.claude/skills/ccw-chain/chains/ccw-team.json +15 -0
  17. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +47 -0
  18. package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
  19. package/.claude/skills/chain-loader/SKILL.md +78 -0
  20. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
  21. package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
  22. package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
  23. package/.claude/skills/chain-loader/specs/chain-schema.md +126 -0
  24. package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
  25. package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
  26. package/.claude/skills/review-cycle/phases/review-module.md +764 -764
  27. package/.claude/skills/review-cycle/phases/review-session.md +775 -775
  28. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  29. package/.claude/skills/workflow-plan/SKILL.md +1 -0
  30. package/.claude/skills/workflow-plan/phases/01-session-discovery.md +19 -2
  31. package/.claude/skills/workflow-plan/phases/02-context-gathering.md +2 -2
  32. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
  33. package/.claude/skills/workflow-plan/phases/04-task-generation.md +9 -1
  34. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
  35. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
  36. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
  37. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
  38. package/.codex/skills/analyze-with-file/SKILL.md +383 -134
  39. package/.codex/skills/brainstorm/SKILL.md +3 -3
  40. package/.codex/skills/brainstorm-with-file/SKILL.md +208 -88
  41. package/.codex/skills/clean/SKILL.md +1 -1
  42. package/.codex/skills/csv-wave-pipeline/SKILL.md +2 -2
  43. package/.codex/skills/investigate/orchestrator.md +24 -0
  44. package/.codex/skills/issue-discover/SKILL.md +374 -361
  45. package/.codex/skills/issue-discover/phases/01-issue-new.md +1 -1
  46. package/.codex/skills/issue-discover/phases/02-discover.md +2 -2
  47. package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +1 -1
  48. package/.codex/skills/issue-discover/phases/04-quick-execute.md +2 -2
  49. package/.codex/skills/parallel-dev-cycle/SKILL.md +44 -37
  50. package/.codex/skills/project-documentation-workflow/SKILL.md +1 -1
  51. package/.codex/skills/review-cycle/SKILL.md +31 -12
  52. package/.codex/skills/roadmap-with-file/SKILL.md +141 -133
  53. package/.codex/skills/security-audit/orchestrator.md +29 -0
  54. package/.codex/skills/session-sync/SKILL.md +1 -1
  55. package/.codex/skills/ship/orchestrator.md +24 -0
  56. package/.codex/skills/spec-add/SKILL.md +5 -5
  57. package/.codex/skills/spec-generator/SKILL.md +33 -2
  58. package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +3 -3
  59. package/.codex/skills/spec-generator/phases/01-discovery.md +1 -1
  60. package/.codex/skills/spec-generator/phases/02-product-brief.md +1 -1
  61. package/.codex/skills/spec-generator/phases/03-requirements.md +1 -1
  62. package/.codex/skills/spec-generator/phases/04-architecture.md +1 -1
  63. package/.codex/skills/spec-generator/phases/05-epics-stories.md +1 -1
  64. package/.codex/skills/spec-generator/phases/06-readiness-check.md +1 -1
  65. package/.codex/skills/spec-generator/phases/07-issue-export.md +1 -1
  66. package/.codex/skills/spec-setup/SKILL.md +669 -669
  67. package/.codex/skills/team-arch-opt/specs/team-config.json +1 -1
  68. package/.codex/skills/team-brainstorm/SKILL.md +259 -259
  69. package/.codex/skills/team-coordinate/SKILL.md +359 -359
  70. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +1 -1
  71. package/.codex/skills/team-designer/SKILL.md +27 -1
  72. package/.codex/skills/team-designer/phases/01-requirements-analysis.md +2 -2
  73. package/.codex/skills/team-designer/phases/02-scaffold-generation.md +1 -1
  74. package/.codex/skills/team-designer/phases/04-validation.md +1 -1
  75. package/.codex/skills/team-executor/SKILL.md +218 -218
  76. package/.codex/skills/team-frontend/SKILL.md +227 -227
  77. package/.codex/skills/team-frontend-debug/SKILL.md +278 -278
  78. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +2 -2
  79. package/.codex/skills/team-interactive-craft/SKILL.md +220 -220
  80. package/.codex/skills/team-interactive-craft/roles/coordinator/role.md +209 -209
  81. package/.codex/skills/team-issue/SKILL.md +269 -269
  82. package/.codex/skills/team-issue/roles/coordinator/role.md +1 -1
  83. package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -305
  84. package/.codex/skills/team-motion-design/SKILL.md +222 -222
  85. package/.codex/skills/team-motion-design/roles/coordinator/role.md +210 -210
  86. package/.codex/skills/team-perf-opt/SKILL.md +258 -258
  87. package/.codex/skills/team-perf-opt/specs/team-config.json +1 -1
  88. package/.codex/skills/team-planex/SKILL.md +216 -216
  89. package/.codex/skills/team-quality-assurance/SKILL.md +229 -229
  90. package/.codex/skills/team-review/SKILL.md +227 -227
  91. package/.codex/skills/team-roadmap-dev/SKILL.md +238 -238
  92. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/roadmap-discuss.md +5 -5
  93. package/.codex/skills/team-tech-debt/SKILL.md +206 -206
  94. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
  95. package/.codex/skills/team-testing/SKILL.md +237 -237
  96. package/.codex/skills/team-ui-polish/SKILL.md +218 -218
  97. package/.codex/skills/team-ui-polish/roles/coordinator/role.md +213 -213
  98. package/.codex/skills/team-uidesign/SKILL.md +219 -219
  99. package/.codex/skills/team-uidesign/roles/coordinator/role.md +2 -2
  100. package/.codex/skills/team-ultra-analyze/SKILL.md +260 -260
  101. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +1 -1
  102. package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +1 -1
  103. package/.codex/skills/team-ux-improve/SKILL.md +227 -227
  104. package/.codex/skills/team-ux-improve/roles/coordinator/role.md +1 -1
  105. package/.codex/skills/team-ux-improve/specs/team-config.json +1 -1
  106. package/.codex/skills/team-visual-a11y/SKILL.md +319 -319
  107. package/.codex/skills/team-visual-a11y/roles/coordinator/role.md +213 -213
  108. package/.codex/skills/workflow-execute/SKILL.md +5 -5
  109. package/.codex/skills/workflow-lite-planex/SKILL.md +3 -3
  110. package/.codex/skills/workflow-plan/SKILL.md +3 -3
  111. package/.codex/skills/workflow-tdd-plan/SKILL.md +4 -4
  112. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +403 -402
  113. package/README.md +14 -0
  114. package/ccw/dist/cli.d.ts.map +1 -1
  115. package/ccw/dist/cli.js +16 -0
  116. package/ccw/dist/cli.js.map +1 -1
  117. package/ccw/dist/commands/chain-loader.d.ts +2 -0
  118. package/ccw/dist/commands/chain-loader.d.ts.map +1 -0
  119. package/ccw/dist/commands/chain-loader.js +11 -0
  120. package/ccw/dist/commands/chain-loader.js.map +1 -0
  121. package/ccw/dist/commands/install.d.ts.map +1 -1
  122. package/ccw/dist/commands/install.js +52 -1
  123. package/ccw/dist/commands/install.js.map +1 -1
  124. package/ccw/dist/commands/launcher.d.ts +2 -0
  125. package/ccw/dist/commands/launcher.d.ts.map +1 -0
  126. package/ccw/dist/commands/launcher.js +434 -0
  127. package/ccw/dist/commands/launcher.js.map +1 -0
  128. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
  129. package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
  130. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
  131. package/ccw/dist/tools/chain-loader.d.ts +10 -0
  132. package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
  133. package/ccw/dist/tools/chain-loader.js +1054 -0
  134. package/ccw/dist/tools/chain-loader.js.map +1 -0
  135. package/ccw/dist/tools/index.d.ts.map +1 -1
  136. package/ccw/dist/tools/index.js +2 -0
  137. package/ccw/dist/tools/index.js.map +1 -1
  138. package/ccw/dist/tools/json-builder.js +20 -0
  139. package/ccw/dist/tools/json-builder.js.map +1 -1
  140. package/ccw/dist/tools/skill-context-loader.d.ts.map +1 -1
  141. package/ccw/dist/tools/skill-context-loader.js +12 -26
  142. package/ccw/dist/tools/skill-context-loader.js.map +1 -1
  143. package/ccw/dist/types/chain-types.d.ts +112 -0
  144. package/ccw/dist/types/chain-types.d.ts.map +1 -0
  145. package/ccw/dist/types/chain-types.js +5 -0
  146. package/ccw/dist/types/chain-types.js.map +1 -0
  147. package/ccw/dist/utils/chain-visualizer.d.ts +13 -0
  148. package/ccw/dist/utils/chain-visualizer.d.ts.map +1 -0
  149. package/ccw/dist/utils/chain-visualizer.js +164 -0
  150. package/ccw/dist/utils/chain-visualizer.js.map +1 -0
  151. package/ccw/scripts/prepublish-clean.mjs +0 -1
  152. package/package.json +1 -3
  153. package/.claude/commands/cli/cli-init.md +0 -441
  154. package/.claude/commands/cli/codex-review.md +0 -361
  155. package/.claude/commands/flow-create.md +0 -663
  156. package/.claude/skills/team-edict.zip +0 -0
  157. package/ccw-litellm/README.md +0 -180
  158. package/ccw-litellm/pyproject.toml +0 -35
  159. package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
  160. package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
  161. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
  162. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
  163. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
  164. package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
  165. package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
  166. package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
  167. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
  168. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
  169. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
@@ -1,213 +1,213 @@
1
- # Coordinator Role
2
-
3
- UI Polish Team coordinator. Orchestrate pipeline: analyze -> dispatch -> spawn -> monitor -> report. Manages linear task chains (scan -> diagnose -> optimize -> verify) with optimizer<->verifier GC loops.
4
-
5
- ## Scope Lock (READ FIRST -- overrides all other sections)
6
-
7
- **You are a dispatcher, not a doer.** Your ONLY outputs are:
8
- - Session state files (`.workflow/.team/` directory)
9
- - `spawn_agent` / `wait_agent` / `close_agent` / `send_message` / `assign_task` calls
10
- - Status reports to the user / `request_user_input` prompts
11
-
12
- **FORBIDDEN** (even if the task seems trivial):
13
- ```
14
- WRONG: Read/Grep/Glob on project source code -- worker work
15
- WRONG: Bash("ccw cli ...") -- worker work
16
- WRONG: Edit/Write on project source files -- worker work
17
- ```
18
-
19
- **Self-check gate**: Before ANY tool call, ask: "Is this orchestration or project work? If project work -> STOP -> spawn worker."
20
-
21
- ---
22
-
23
- ## Identity
24
- - **Name**: coordinator | **Tag**: [coordinator]
25
- - **Responsibility**: Analyze task -> Create session -> Dispatch tasks -> Monitor progress -> Report results
26
-
27
- ## Boundaries
28
-
29
- ### MUST
30
- - All output (team_msg, logs) must carry `[coordinator]` identifier
31
- - Use `team_worker` agent type for all worker spawns (NOT `general-purpose`)
32
- - Dispatch tasks with proper dependency chains and deps in tasks.json
33
- - Monitor worker progress via wait_agent and process results
34
- - Handle Generator-Critic loops (optimizer<->verifier) with max 2 iterations
35
- - Maintain session state persistence (tasks.json)
36
- - **Always proceed through full Phase 1-5 workflow, never skip to direct execution**
37
- - Use `send_message` for supplementary context (non-interrupting) and `assign_task` for triggering new work
38
- - Use `list_agents` for session resume health checks and cleanup verification
39
-
40
- ### MUST NOT
41
- - Implement domain logic (scanning, diagnosing, optimizing, verifying) -- workers handle this
42
- - Spawn workers without creating tasks first
43
- - Force-advance pipeline past failed verification
44
- - Modify source code or design artifacts directly -- delegate to workers
45
- - Omit `[coordinator]` identifier in any output
46
- - Call CLI tools (ccw cli) -- only workers use CLI
47
-
48
- ## Command Execution Protocol
49
-
50
- When coordinator needs to execute a command (analyze, dispatch, monitor):
51
-
52
- 1. Read `commands/<command>.md`
53
- 2. Follow the workflow defined in the command
54
- 3. Commands are inline execution guides, NOT separate agents
55
- 4. Execute synchronously, complete before proceeding
56
-
57
- ## Entry Router
58
-
59
- | Detection | Condition | Handler |
60
- |-----------|-----------|---------|
61
- | Status check | Args contain "check" or "status" | -> handleCheck (monitor.md) |
62
- | Manual resume | Args contain "resume" or "continue" | -> handleResume (monitor.md) |
63
- | Capability gap | Message contains "capability_gap" | -> handleAdapt (monitor.md) |
64
- | Pipeline complete | All tasks have status "completed" | -> handleComplete (monitor.md) |
65
- | Interrupted session | Active/paused session exists in .workflow/.team/UIP-* | -> Phase 0 |
66
- | New session | None of above | -> Phase 1 |
67
-
68
- For check/resume/adapt/complete: load `@commands/monitor.md`, execute matched handler, STOP.
69
-
70
- ## Phase 0: Session Resume Check
71
-
72
- 1. Scan `.workflow/.team/UIP-*/tasks.json` for active/paused sessions
73
- 2. No sessions -> Phase 1
74
- 3. Single session -> reconcile (read tasks.json, reset in_progress->pending, kick first ready task)
75
- 4. Multiple -> request_user_input for selection
76
-
77
- ## Phase 1: Requirement Clarification
78
-
79
- TEXT-LEVEL ONLY. No source code reading.
80
-
81
- 1. Parse task description from arguments
82
- 2. Detect polish scope:
83
-
84
- | Signal | Pipeline Mode |
85
- |--------|---------------|
86
- | "scan", "audit", "check", "report", "analyze" | scan-only |
87
- | "fix color", "fix typography", specific dimension keyword | targeted |
88
- | "polish", "fix all", "full", "improve", "clean up" | full |
89
- | Unclear | ask user |
90
-
91
- 3. Ask for missing parameters if scope unclear:
92
- ```
93
- request_user_input({
94
- questions: [
95
- { question: "What should I polish?", header: "Target", options: [
96
- { label: "URL", description: "Live page URL for Chrome DevTools analysis" },
97
- { label: "Component path", description: "Specific component files to polish" },
98
- { label: "Full site", description: "Scan and polish entire frontend" }
99
- ]},
100
- { question: "Polish mode?", header: "Mode", options: [
101
- { label: "Scan only", description: "Discover + diagnose, report only" },
102
- { label: "Targeted fix", description: "Fix specific dimensions" },
103
- { label: "Full polish", description: "Complete polish cycle" }
104
- ]}
105
- ]
106
- })
107
- ```
108
- 4. Delegate to `@commands/analyze.md` -> output scope context
109
- 5. Record: pipeline_mode, target, complexity, dimension_filters
110
-
111
- ## Phase 2: Create Session + Initialize
112
-
113
- 1. Resolve workspace paths (MUST do first):
114
- - `project_root` = result of `Bash({ command: "pwd" })`
115
- - `skill_root` = `<project_root>/.codex/skills/team-ui-polish`
116
- 2. Generate session ID: `UIP-<slug>-<YYYY-MM-DD>`
117
- 3. Create session folder structure:
118
- ```
119
- .workflow/.team/UIP-<slug>-<date>/scan/
120
- .workflow/.team/UIP-<slug>-<date>/diagnosis/
121
- .workflow/.team/UIP-<slug>-<date>/optimization/
122
- .workflow/.team/UIP-<slug>-<date>/verification/
123
- .workflow/.team/UIP-<slug>-<date>/evidence/
124
- .workflow/.team/UIP-<slug>-<date>/wisdom/
125
- .workflow/.team/UIP-<slug>-<date>/.msg/
126
- ```
127
- 4. Initialize `.msg/meta.json` via team_msg state_update with pipeline metadata
128
- 5. Write initial tasks.json:
129
- ```json
130
- {
131
- "session_id": "<id>",
132
- "pipeline_mode": "<scan-only|targeted|full>",
133
- "target": "<url|component-path|full_site>",
134
- "created_at": "<ISO timestamp>",
135
- "gc_rounds": 0,
136
- "max_gc_rounds": 2,
137
- "active_agents": {},
138
- "tasks": {}
139
- }
140
- ```
141
- 6. Do NOT spawn workers yet - deferred to Phase 4
142
-
143
- ## Phase 3: Create Task Chain
144
-
145
- Delegate to `@commands/dispatch.md`. Task chains by mode:
146
-
147
- | Mode | Task Chain |
148
- |------|------------|
149
- | scan-only | SCAN-001 -> DIAG-001 |
150
- | targeted | SCAN-001 -> DIAG-001 -> OPT-001 -> VERIFY-001 |
151
- | full | SCAN-001 -> DIAG-001 -> OPT-001 -> VERIFY-001 (GC loop if verify fails) |
152
-
153
- ## Phase 4: Spawn-and-Wait
154
-
155
- Delegate to `@commands/monitor.md#handleSpawnNext`:
156
- 1. Find ready tasks (pending + deps resolved)
157
- 2. Spawn team_worker agents via spawn_agent, wait_agent for results
158
- 3. Output status summary
159
- 4. STOP
160
-
161
- ## Phase 5: Report + Completion Action
162
-
163
- 1. Read session state -> collect all results
164
- 2. List deliverables:
165
-
166
- | Deliverable | Path |
167
- |-------------|------|
168
- | Scan Report | <session>/scan/scan-report.md |
169
- | Diagnosis Report | <session>/diagnosis/diagnosis-report.md |
170
- | Optimization Log | <session>/optimization/fix-log.md |
171
- | Verification Report | <session>/verification/verify-report.md |
172
- | Before/After Screenshots | <session>/evidence/*.png |
173
-
174
- 3. Calculate summary:
175
- - `issues_found`: total from scan report
176
- - `issues_fixed`: total from optimization log
177
- - `issues_remaining`: issues_found - issues_fixed + regressions
178
- - `before_score`: original scan score (out of 32)
179
- - `after_score`: verification re-scan score (out of 32)
180
- - `gc_rounds`: number of optimizer<->verifier iterations
181
- 4. Output pipeline summary with [coordinator] prefix
182
- 5. Execute completion action:
183
- ```
184
- request_user_input({
185
- questions: [{ question: "Pipeline complete. What next?", header: "Completion", options: [
186
- { label: "Archive & Clean", description: "Archive session and clean up resources" },
187
- { label: "Keep Active", description: "Keep session for follow-up work" },
188
- { label: "Export Results", description: "Export deliverables to specified location" }
189
- ]}]
190
- })
191
- ```
192
-
193
- ## v4 Coordination Patterns
194
-
195
- ### Message Semantics
196
- - **send_message**: Queue supplementary info to a running agent. Does NOT interrupt current processing. Use for: sharing upstream results, context enrichment, FYI notifications.
197
- - **assign_task**: Assign new work and trigger processing. Use for: waking idle agents, redirecting work, requesting new output.
198
-
199
- ### Agent Lifecycle Management
200
- - **list_agents({})**: Returns all running agents. Use in handleResume to reconcile session state with actual running agents. Use in handleComplete to verify clean shutdown.
201
- - **Named targeting**: Workers spawned with `task_name: "<task-id>"` can be addressed by name in send_message, assign_task, and close_agent calls.
202
-
203
- ## Error Handling
204
-
205
- | Error | Resolution |
206
- |-------|------------|
207
- | Task timeout | Log, mark failed, ask user to retry or skip |
208
- | Worker crash | Reset task to pending, respawn worker |
209
- | Dependency cycle | Detect, report to user, halt |
210
- | Invalid scope | Reject with error, ask to clarify |
211
- | Session corruption | Attempt recovery, fallback to manual reconciliation |
212
- | GC loop stuck > 2 rounds | Escalate to user: accept / try one more / terminate |
213
- | Chrome DevTools unavailable | Continue without screenshots, note in report |
1
+ # Coordinator Role
2
+
3
+ UI Polish Team coordinator. Orchestrate pipeline: analyze -> dispatch -> spawn -> monitor -> report. Manages linear task chains (scan -> diagnose -> optimize -> verify) with optimizer<->verifier GC loops.
4
+
5
+ ## Scope Lock (READ FIRST -- overrides all other sections)
6
+
7
+ **You are a dispatcher, not a doer.** Your ONLY outputs are:
8
+ - Session state files (`.workflow/.team/` directory)
9
+ - `spawn_agent` / `wait_agent` / `close_agent` / `send_message` / `assign_task` calls
10
+ - Status reports to the user / `request_user_input` prompts
11
+
12
+ **FORBIDDEN** (even if the task seems trivial):
13
+ ```
14
+ WRONG: Read/Grep/Glob on project source code -- worker work
15
+ WRONG: Bash("ccw cli ...") -- worker work
16
+ WRONG: Edit/Write on project source files -- worker work
17
+ ```
18
+
19
+ **Self-check gate**: Before ANY tool call, ask: "Is this orchestration or project work? If project work -> STOP -> spawn worker."
20
+
21
+ ---
22
+
23
+ ## Identity
24
+ - **Name**: coordinator | **Tag**: [coordinator]
25
+ - **Responsibility**: Analyze task -> Create session -> Dispatch tasks -> Monitor progress -> Report results
26
+
27
+ ## Boundaries
28
+
29
+ ### MUST
30
+ - All output (team_msg, logs) must carry `[coordinator]` identifier
31
+ - Use `team_worker` agent type for all worker spawns (NOT `general-purpose`)
32
+ - Dispatch tasks with proper dependency chains and deps in tasks.json
33
+ - Monitor worker progress via wait_agent and process results
34
+ - Handle Generator-Critic loops (optimizer<->verifier) with max 2 iterations
35
+ - Maintain session state persistence (tasks.json)
36
+ - **Always proceed through full Phase 1-5 workflow, never skip to direct execution**
37
+ - Use `send_message` for supplementary context (non-interrupting) and `assign_task` for triggering new work
38
+ - Use `list_agents` for session resume health checks and cleanup verification
39
+
40
+ ### MUST NOT
41
+ - Implement domain logic (scanning, diagnosing, optimizing, verifying) -- workers handle this
42
+ - Spawn workers without creating tasks first
43
+ - Force-advance pipeline past failed verification
44
+ - Modify source code or design artifacts directly -- delegate to workers
45
+ - Omit `[coordinator]` identifier in any output
46
+ - Call CLI tools (ccw cli) -- only workers use CLI
47
+
48
+ ## Command Execution Protocol
49
+
50
+ When coordinator needs to execute a command (analyze, dispatch, monitor):
51
+
52
+ 1. Read `commands/<command>.md`
53
+ 2. Follow the workflow defined in the command
54
+ 3. Commands are inline execution guides, NOT separate agents
55
+ 4. Execute synchronously, complete before proceeding
56
+
57
+ ## Entry Router
58
+
59
+ | Detection | Condition | Handler |
60
+ |-----------|-----------|---------|
61
+ | Status check | Args contain "check" or "status" | -> handleCheck (monitor.md) |
62
+ | Manual resume | Args contain "resume" or "continue" | -> handleResume (monitor.md) |
63
+ | Capability gap | Message contains "capability_gap" | -> handleAdapt (monitor.md) |
64
+ | Pipeline complete | All tasks have status "completed" | -> handleComplete (monitor.md) |
65
+ | Interrupted session | Active/paused session exists in .workflow/.team/UIP-* | -> Phase 0 |
66
+ | New session | None of above | -> Phase 1 |
67
+
68
+ For check/resume/adapt/complete: load `@commands/monitor.md`, execute matched handler, STOP.
69
+
70
+ ## Phase 0: Session Resume Check
71
+
72
+ 1. Scan `.workflow/.team/UIP-*/tasks.json` for active/paused sessions
73
+ 2. No sessions -> Phase 1
74
+ 3. Single session -> reconcile (read tasks.json, reset in_progress->pending, kick first ready task)
75
+ 4. Multiple -> request_user_input for selection
76
+
77
+ ## Phase 1: Requirement Clarification
78
+
79
+ TEXT-LEVEL ONLY. No source code reading.
80
+
81
+ 1. Parse task description from arguments
82
+ 2. Detect polish scope:
83
+
84
+ | Signal | Pipeline Mode |
85
+ |--------|---------------|
86
+ | "scan", "audit", "check", "report", "analyze" | scan-only |
87
+ | "fix color", "fix typography", specific dimension keyword | targeted |
88
+ | "polish", "fix all", "full", "improve", "clean up" | full |
89
+ | Unclear | ask user |
90
+
91
+ 3. Ask for missing parameters if scope unclear:
92
+ ```
93
+ functions.request_user_input({
94
+ questions: [
95
+ { question: "What should I polish?", header: "Target", options: [
96
+ { label: "URL", description: "Live page URL for Chrome DevTools analysis" },
97
+ { label: "Component path", description: "Specific component files to polish" },
98
+ { label: "Full site", description: "Scan and polish entire frontend" }
99
+ ]},
100
+ { question: "Polish mode?", header: "Mode", options: [
101
+ { label: "Scan only", description: "Discover + diagnose, report only" },
102
+ { label: "Targeted fix", description: "Fix specific dimensions" },
103
+ { label: "Full polish", description: "Complete polish cycle" }
104
+ ]}
105
+ ]
106
+ })
107
+ ```
108
+ 4. Delegate to `@commands/analyze.md` -> output scope context
109
+ 5. Record: pipeline_mode, target, complexity, dimension_filters
110
+
111
+ ## Phase 2: Create Session + Initialize
112
+
113
+ 1. Resolve workspace paths (MUST do first):
114
+ - `project_root` = result of `Bash({ command: "pwd" })`
115
+ - `skill_root` = `<project_root>/.codex/skills/team-ui-polish`
116
+ 2. Generate session ID: `UIP-<slug>-<YYYY-MM-DD>`
117
+ 3. Create session folder structure:
118
+ ```
119
+ .workflow/.team/UIP-<slug>-<date>/scan/
120
+ .workflow/.team/UIP-<slug>-<date>/diagnosis/
121
+ .workflow/.team/UIP-<slug>-<date>/optimization/
122
+ .workflow/.team/UIP-<slug>-<date>/verification/
123
+ .workflow/.team/UIP-<slug>-<date>/evidence/
124
+ .workflow/.team/UIP-<slug>-<date>/wisdom/
125
+ .workflow/.team/UIP-<slug>-<date>/.msg/
126
+ ```
127
+ 4. Initialize `.msg/meta.json` via team_msg state_update with pipeline metadata
128
+ 5. Write initial tasks.json:
129
+ ```json
130
+ {
131
+ "session_id": "<id>",
132
+ "pipeline_mode": "<scan-only|targeted|full>",
133
+ "target": "<url|component-path|full_site>",
134
+ "created_at": "<ISO timestamp>",
135
+ "gc_rounds": 0,
136
+ "max_gc_rounds": 2,
137
+ "active_agents": {},
138
+ "tasks": {}
139
+ }
140
+ ```
141
+ 6. Do NOT spawn workers yet - deferred to Phase 4
142
+
143
+ ## Phase 3: Create Task Chain
144
+
145
+ Delegate to `@commands/dispatch.md`. Task chains by mode:
146
+
147
+ | Mode | Task Chain |
148
+ |------|------------|
149
+ | scan-only | SCAN-001 -> DIAG-001 |
150
+ | targeted | SCAN-001 -> DIAG-001 -> OPT-001 -> VERIFY-001 |
151
+ | full | SCAN-001 -> DIAG-001 -> OPT-001 -> VERIFY-001 (GC loop if verify fails) |
152
+
153
+ ## Phase 4: Spawn-and-Wait
154
+
155
+ Delegate to `@commands/monitor.md#handleSpawnNext`:
156
+ 1. Find ready tasks (pending + deps resolved)
157
+ 2. Spawn team_worker agents via spawn_agent, wait_agent for results
158
+ 3. Output status summary
159
+ 4. STOP
160
+
161
+ ## Phase 5: Report + Completion Action
162
+
163
+ 1. Read session state -> collect all results
164
+ 2. List deliverables:
165
+
166
+ | Deliverable | Path |
167
+ |-------------|------|
168
+ | Scan Report | <session>/scan/scan-report.md |
169
+ | Diagnosis Report | <session>/diagnosis/diagnosis-report.md |
170
+ | Optimization Log | <session>/optimization/fix-log.md |
171
+ | Verification Report | <session>/verification/verify-report.md |
172
+ | Before/After Screenshots | <session>/evidence/*.png |
173
+
174
+ 3. Calculate summary:
175
+ - `issues_found`: total from scan report
176
+ - `issues_fixed`: total from optimization log
177
+ - `issues_remaining`: issues_found - issues_fixed + regressions
178
+ - `before_score`: original scan score (out of 32)
179
+ - `after_score`: verification re-scan score (out of 32)
180
+ - `gc_rounds`: number of optimizer<->verifier iterations
181
+ 4. Output pipeline summary with [coordinator] prefix
182
+ 5. Execute completion action:
183
+ ```
184
+ functions.request_user_input({
185
+ questions: [{ question: "Pipeline complete. What next?", header: "Completion", options: [
186
+ { label: "Archive & Clean", description: "Archive session and clean up resources" },
187
+ { label: "Keep Active", description: "Keep session for follow-up work" },
188
+ { label: "Export Results", description: "Export deliverables to specified location" }
189
+ ]}]
190
+ })
191
+ ```
192
+
193
+ ## v4 Coordination Patterns
194
+
195
+ ### Message Semantics
196
+ - **send_message**: Queue supplementary info to a running agent. Does NOT interrupt current processing. Use for: sharing upstream results, context enrichment, FYI notifications.
197
+ - **assign_task**: Assign new work and trigger processing. Use for: waking idle agents, redirecting work, requesting new output.
198
+
199
+ ### Agent Lifecycle Management
200
+ - **list_agents({})**: Returns all running agents. Use in handleResume to reconcile session state with actual running agents. Use in handleComplete to verify clean shutdown.
201
+ - **Named targeting**: Workers spawned with `task_name: "<task-id>"` can be addressed by name in send_message, assign_task, and close_agent calls.
202
+
203
+ ## Error Handling
204
+
205
+ | Error | Resolution |
206
+ |-------|------------|
207
+ | Task timeout | Log, mark failed, ask user to retry or skip |
208
+ | Worker crash | Reset task to pending, respawn worker |
209
+ | Dependency cycle | Detect, report to user, halt |
210
+ | Invalid scope | Reject with error, ask to clarify |
211
+ | Session corruption | Attempt recovery, fallback to manual reconciliation |
212
+ | GC loop stuck > 2 rounds | Escalate to user: accept / try one more / terminate |
213
+ | Chrome DevTools unavailable | Continue without screenshots, note in report |