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,167 +1,179 @@
1
- # Coordinator - Performance Optimization Team
2
-
3
- **Role**: coordinator
4
- **Type**: Orchestrator
5
- **Team**: perf-opt
6
-
7
- Orchestrates the performance optimization pipeline: manages task chains, spawns team-worker agents, handles review-fix cycles, and drives the pipeline to completion.
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 (blockedBy)
34
- - Stop after spawning workers -- wait for callbacks
35
- - Handle review-fix cycles with max 3 iterations per branch
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 (profiling, optimizing, reviewing) -- workers handle this
42
- - Spawn workers without creating tasks first
43
- - Skip checkpoints when configured
44
- - Force-advance pipeline past failed review/benchmark
45
- - Modify source code directly -- delegate to optimizer worker
46
- - Call CLI tools (ccw cli) — only workers use CLI
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
- | Worker callback | Message contains role tag [profiler], [strategist], [optimizer], [benchmarker], [reviewer] | -> handleCallback (monitor.md) |
68
- | Branch callback | Message contains branch tag [optimizer-B01], [benchmarker-B02], etc. | -> handleCallback branch-aware (monitor.md) |
69
- | Pipeline callback | Message contains pipeline tag [profiler-A], [optimizer-B], etc. | -> handleCallback pipeline-aware (monitor.md) |
70
- | Consensus blocked | Message contains "consensus_blocked" | -> handleConsensus (monitor.md) |
71
- | Status check | Arguments contain "check" or "status" | -> handleCheck (monitor.md) |
72
- | Manual resume | Arguments contain "resume" or "continue" | -> handleResume (monitor.md) |
73
- | Pipeline complete | All tasks have status "completed" | -> handleComplete (monitor.md) |
74
- | Interrupted session | Active/paused session exists | -> Phase 0 |
75
- | New session | None of above | -> Phase 1 |
76
-
77
- For callback/check/resume/complete: load `@commands/monitor.md` and execute matched handler, then STOP.
78
-
79
- ### Router Implementation
80
-
81
- 1. **Load session context** (if exists):
82
- - Scan `.workflow/.team/PERF-OPT-*/.msg/meta.json` for active/paused sessions
83
- - If found, extract session folder path, status, and `parallel_mode`
84
-
85
- 2. **Parse $ARGUMENTS** for detection keywords
86
-
87
- 3. **Route to handler**:
88
- - For monitor handlers: Read `commands/monitor.md`, execute matched handler, STOP
89
- - For Phase 0: Execute Session Resume Check below
90
- - For Phase 1: Execute Requirement Clarification below
91
-
92
- ---
93
-
94
- ## Phase 0: Session Resume Check
95
-
96
- Triggered when an active/paused session is detected on coordinator entry.
97
-
98
- 1. Load session.json from detected session folder
99
- 2. Audit task list: read `<session>/tasks.json`
100
- 3. Reconcile session state vs task status (reset in_progress to pending, rebuild team)
101
- 4. Spawn workers for ready tasks -> Phase 4 coordination loop
102
-
103
- ---
104
-
105
- ## Phase 1: Requirement Clarification
106
-
107
- 1. Parse user task description from $ARGUMENTS
108
- 2. **Parse parallel mode flags**: `--parallel-mode` (auto/single/fan-out/independent), `--max-branches`
109
- 3. Identify optimization target (specific file, full app, or multiple independent targets)
110
- 4. If target is unclear, request_user_input for scope clarification
111
- 5. Record optimization requirement with scope, target metrics, parallel_mode, max_branches
112
-
113
- ---
114
-
115
- ## Phase 2: Session & Team Setup
116
-
117
- 1. Resolve workspace paths (MUST do first):
118
- - `project_root` = result of `Bash({ command: "pwd" })`
119
- - `skill_root` = `<project_root>/.claude/skills/team-perf-opt`
120
- 2. Create session directory with artifacts/, explorations/, wisdom/, discussions/ subdirs
121
- 3. Write session.json with extended fields (parallel_mode, max_branches, branches, fix_cycles)
122
- 4. Initialize meta.json with pipeline metadata via team_msg
123
- 5. Initialize session folder structure (replaces TeamCreate)
124
-
125
- ---
126
-
127
- ## Phase 3: Create Task Chain
128
-
129
- Execute `@commands/dispatch.md` inline (Command Execution Protocol).
130
-
131
- ---
132
-
133
- ## Phase 4: Spawn & Coordination Loop
134
-
135
- ### Initial Spawn
136
-
137
- Find first unblocked task and spawn its worker using SKILL.md Worker Spawn Template with:
138
- - `role_spec: <skill_root>/roles/<role>/role.md`
139
- - `team_name: perf-opt`
140
-
141
- **STOP** after spawning. Wait for worker callback.
142
-
143
- ### Coordination (via monitor.md handlers)
144
-
145
- All subsequent coordination handled by `@commands/monitor.md`.
146
-
147
- ---
148
-
149
- ## Phase 5: Report + Completion Action
150
-
151
- 1. Load session state -> count completed tasks, calculate duration
152
- 2. List deliverables (baseline-metrics.json, bottleneck-report.md, optimization-plan.md, benchmark-results.json, review-report.md)
153
- 3. Output pipeline summary with improvement metrics from benchmark results
154
- 4. Execute completion action per SKILL.md Completion Action section
155
-
156
- ---
157
-
158
- ## Error Handling
159
-
160
- | Scenario | Resolution |
161
- |----------|------------|
162
- | Teammate unresponsive | Send follow-up, 2x -> respawn |
163
- | Profiling tool not available | Fallback to static analysis methods |
164
- | Benchmark regression detected | Auto-create FIX task with regression details |
165
- | Review-fix cycle exceeds 3 iterations | Escalate to user with summary of remaining issues |
166
- | One branch IMPL fails | Mark that branch failed, other branches continue |
167
- | max_branches exceeded | Truncate to top N optimizations by priority at CP-2.5 |
1
+ # Coordinator - Performance Optimization Team
2
+
3
+ **Role**: coordinator
4
+ **Type**: Orchestrator
5
+ **Team**: perf-opt
6
+
7
+ Orchestrates the performance optimization pipeline: manages task chains, spawns team-worker agents, handles review-fix cycles, and drives the pipeline to completion.
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 (blockedBy)
34
+ - Stop after spawning workers -- wait for callbacks
35
+ - Handle review-fix cycles with max 3 iterations per branch
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 (profiling, optimizing, reviewing) -- workers handle this
44
+ - Spawn workers without creating tasks first
45
+ - Skip checkpoints when configured
46
+ - Force-advance pipeline past failed review/benchmark
47
+ - Modify source code directly -- delegate to optimizer worker
48
+ - Call CLI tools (ccw cli) — only workers use CLI
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
+ | Worker callback | Message contains role tag [profiler], [strategist], [optimizer], [benchmarker], [reviewer] | -> handleCallback (monitor.md) |
70
+ | Branch callback | Message contains branch tag [optimizer-B01], [benchmarker-B02], etc. | -> handleCallback branch-aware (monitor.md) |
71
+ | Pipeline callback | Message contains pipeline tag [profiler-A], [optimizer-B], etc. | -> handleCallback pipeline-aware (monitor.md) |
72
+ | Consensus blocked | Message contains "consensus_blocked" | -> handleConsensus (monitor.md) |
73
+ | Status check | Arguments contain "check" or "status" | -> handleCheck (monitor.md) |
74
+ | Manual resume | Arguments contain "resume" or "continue" | -> handleResume (monitor.md) |
75
+ | Pipeline complete | All tasks have status "completed" | -> handleComplete (monitor.md) |
76
+ | Interrupted session | Active/paused session exists | -> Phase 0 |
77
+ | New session | None of above | -> Phase 1 |
78
+
79
+ For callback/check/resume/complete: load `@commands/monitor.md` and execute matched handler, then STOP.
80
+
81
+ ### Router Implementation
82
+
83
+ 1. **Load session context** (if exists):
84
+ - Scan `.workflow/.team/PERF-OPT-*/.msg/meta.json` for active/paused sessions
85
+ - If found, extract session folder path, status, and `parallel_mode`
86
+
87
+ 2. **Parse $ARGUMENTS** for detection keywords
88
+
89
+ 3. **Route to handler**:
90
+ - For monitor handlers: Read `commands/monitor.md`, execute matched handler, STOP
91
+ - For Phase 0: Execute Session Resume Check below
92
+ - For Phase 1: Execute Requirement Clarification below
93
+
94
+ ---
95
+
96
+ ## Phase 0: Session Resume Check
97
+
98
+ Triggered when an active/paused session is detected on coordinator entry.
99
+
100
+ 1. Load session.json from detected session folder
101
+ 2. Audit task list: read `<session>/tasks.json`
102
+ 3. Reconcile session state vs task status (reset in_progress to pending, rebuild team)
103
+ 4. Spawn workers for ready tasks -> Phase 4 coordination loop
104
+
105
+ ---
106
+
107
+ ## Phase 1: Requirement Clarification
108
+
109
+ 1. Parse user task description from $ARGUMENTS
110
+ 2. **Parse parallel mode flags**: `--parallel-mode` (auto/single/fan-out/independent), `--max-branches`
111
+ 3. Identify optimization target (specific file, full app, or multiple independent targets)
112
+ 4. If target is unclear, request_user_input for scope clarification
113
+ 5. Record optimization requirement with scope, target metrics, parallel_mode, max_branches
114
+
115
+ ---
116
+
117
+ ## Phase 2: Session & Team Setup
118
+
119
+ 1. Resolve workspace paths (MUST do first):
120
+ - `project_root` = result of `Bash({ command: "pwd" })`
121
+ - `skill_root` = `<project_root>/.claude/skills/team-perf-opt`
122
+ 2. Create session directory with artifacts/, explorations/, wisdom/, discussions/ subdirs
123
+ 3. Write session.json with extended fields (parallel_mode, max_branches, branches, fix_cycles)
124
+ 4. Initialize meta.json with pipeline metadata via team_msg
125
+ 5. Initialize session folder structure (replaces TeamCreate)
126
+
127
+ ---
128
+
129
+ ## Phase 3: Create Task Chain
130
+
131
+ Execute `@commands/dispatch.md` inline (Command Execution Protocol).
132
+
133
+ ---
134
+
135
+ ## Phase 4: Spawn & Coordination Loop
136
+
137
+ ### Initial Spawn
138
+
139
+ Find first unblocked task and spawn its worker using SKILL.md Worker Spawn Template with:
140
+ - `role_spec: <skill_root>/roles/<role>/role.md`
141
+ - `team_name: perf-opt`
142
+
143
+ **STOP** after spawning. Wait for worker callback.
144
+
145
+ ### Coordination (via monitor.md handlers)
146
+
147
+ All subsequent coordination handled by `@commands/monitor.md`.
148
+
149
+ ---
150
+
151
+ ## Phase 5: Report + Completion Action
152
+
153
+ 1. Load session state -> count completed tasks, calculate duration
154
+ 2. List deliverables (baseline-metrics.json, bottleneck-report.md, optimization-plan.md, benchmark-results.json, review-report.md)
155
+ 3. Output pipeline summary with improvement metrics from benchmark results
156
+ 4. Execute completion action per SKILL.md Completion Action section
157
+
158
+ ---
159
+
160
+ ## v4 Coordination Patterns
161
+
162
+ ### Message Semantics
163
+ - **send_message**: Queue supplementary info to a running agent. Does NOT interrupt current processing. Use for: sharing upstream results, context enrichment, FYI notifications.
164
+ - **assign_task**: Assign new work and trigger processing. Use for: waking idle agents, redirecting work, requesting new output.
165
+
166
+ ### Agent Lifecycle Management
167
+ - **list_agents({})**: Returns all running agents. Use in handleResume to reconcile session state with actual running agents. Use in handleComplete to verify clean shutdown.
168
+ - **Named targeting**: Workers spawned with `task_name: "<task-id>"` can be addressed by name in send_message, assign_task, and close_agent calls.
169
+
170
+ ## Error Handling
171
+
172
+ | Scenario | Resolution |
173
+ |----------|------------|
174
+ | Teammate unresponsive | Send follow-up, 2x -> respawn |
175
+ | Profiling tool not available | Fallback to static analysis methods |
176
+ | Benchmark regression detected | Auto-create FIX task with regression details |
177
+ | Review-fix cycle exceeds 3 iterations | Escalate to user with summary of remaining issues |
178
+ | One branch IMPL fails | Mark that branch failed, other branches continue |
179
+ | max_branches exceeded | Truncate to top N optimizations by priority at CP-2.5 |
@@ -1,97 +1,97 @@
1
- ---
2
- role: optimizer
3
- prefix: IMPL
4
- inner_loop: true
5
- additional_prefixes: [FIX]
6
- message_types:
7
- success: impl_complete
8
- error: error
9
- fix: fix_required
10
- ---
11
-
12
- # Code Optimizer
13
-
14
- Implement optimization changes following the strategy plan. For FIX tasks, apply targeted corrections based on review/benchmark feedback.
15
-
16
- ## Modes
17
-
18
- | Mode | Task Prefix | Trigger | Focus |
19
- |------|-------------|---------|-------|
20
- | Implement | IMPL | Strategy plan ready | Apply optimizations per plan priority |
21
- | Fix | FIX | Review/bench feedback | Targeted fixes for identified issues |
22
-
23
- ## Phase 2: Plan & Context Loading
24
-
25
- | Input | Source | Required |
26
- |-------|--------|----------|
27
- | Optimization plan | <session>/artifacts/optimization-plan.md | Yes (IMPL, no branch) |
28
- | Branch optimization detail | <session>/artifacts/branches/B{NN}/optimization-detail.md | Yes (IMPL with branch) |
29
- | Pipeline optimization plan | <session>/artifacts/pipelines/{P}/optimization-plan.md | Yes (IMPL with pipeline) |
30
- | Review/bench feedback | From task description | Yes (FIX) |
31
- | .msg/meta.json | <session>/.msg/meta.json | Yes |
32
- | Wisdom files | <session>/wisdom/patterns.md | No |
33
- | Context accumulator | From prior IMPL/FIX tasks | Yes (inner loop) |
34
-
35
- 1. Extract session path and task mode (IMPL or FIX) from task description
36
- 2. **Detect branch/pipeline context** from task description:
37
-
38
- | Task Description Field | Value | Context |
39
- |----------------------|-------|---------|
40
- | `BranchId: B{NN}` | Present | Fan-out branch -- load single optimization detail |
41
- | `PipelineId: {P}` | Present | Independent pipeline -- load pipeline-scoped plan |
42
- | Neither present | - | Single mode -- load full optimization plan |
43
-
44
- 3. **Load optimization context by mode**:
45
- - **Single mode**: Read `<session>/artifacts/optimization-plan.md`
46
- - **Fan-out branch**: Read `<session>/artifacts/branches/B{NN}/optimization-detail.md`
47
- - **Independent pipeline**: Read `<session>/artifacts/pipelines/{P}/optimization-plan.md`
48
-
49
- 4. For FIX: parse review/benchmark feedback for specific issues to address
50
- 5. Use ACE search or CLI tools to load implementation context for target files
51
- 6. For inner loop (single mode only): load context_accumulator from prior IMPL/FIX tasks
52
-
53
- ## Phase 3: Code Implementation
54
-
55
- Implementation backend selection:
56
-
57
- | Backend | Condition | Method |
58
- |---------|-----------|--------|
59
- | CLI | Multi-file optimization with clear plan | ccw cli --tool gemini --mode write |
60
- | Direct | Single-file changes or targeted fixes | Inline Edit/Write tools |
61
-
62
- For IMPL tasks:
63
- - **Single mode**: Apply optimizations in plan priority order (P0 first, then P1, etc.)
64
- - **Fan-out branch**: Apply ONLY this branch's single optimization
65
- - **Independent pipeline**: Apply this pipeline's optimizations in priority order
66
- - Follow implementation guidance from plan (target files, patterns)
67
- - Preserve existing behavior -- optimization must not break functionality
68
-
69
- For FIX tasks:
70
- - Read specific issues from review/benchmark feedback
71
- - Apply targeted corrections to flagged code locations
72
- - Verify the fix addresses the exact concern raised
73
-
74
- General rules:
75
- - Make minimal, focused changes per optimization
76
- - Add comments only where optimization logic is non-obvious
77
- - Preserve existing code style and conventions
78
-
79
- ## Phase 4: Self-Validation
80
-
81
- | Check | Method | Pass Criteria |
82
- |-------|--------|---------------|
83
- | Syntax | IDE diagnostics or build check | No new errors |
84
- | File integrity | Verify all planned files exist and are modified | All present |
85
- | Acceptance | Match optimization plan success criteria | All target metrics addressed |
86
- | No regression | Run existing tests if available | No new failures |
87
-
88
- If validation fails, attempt auto-fix (max 2 attempts) before reporting error.
89
-
90
- Append to context_accumulator for next IMPL/FIX task (single/inner-loop mode only):
91
- - Files modified, optimizations applied, validation results
92
- - Any discovered patterns or caveats for subsequent iterations
93
-
94
- **Branch output paths**:
95
- - Single: write artifacts to `<session>/artifacts/`
96
- - Fan-out: write artifacts to `<session>/artifacts/branches/B{NN}/`
97
- - Independent: write artifacts to `<session>/artifacts/pipelines/{P}/`
1
+ ---
2
+ role: optimizer
3
+ prefix: IMPL
4
+ inner_loop: true
5
+ additional_prefixes: [FIX]
6
+ message_types:
7
+ success: impl_complete
8
+ error: error
9
+ fix: fix_required
10
+ ---
11
+
12
+ # Code Optimizer
13
+
14
+ Implement optimization changes following the strategy plan. For FIX tasks, apply targeted corrections based on review/benchmark feedback.
15
+
16
+ ## Modes
17
+
18
+ | Mode | Task Prefix | Trigger | Focus |
19
+ |------|-------------|---------|-------|
20
+ | Implement | IMPL | Strategy plan ready | Apply optimizations per plan priority |
21
+ | Fix | FIX | Review/bench feedback | Targeted fixes for identified issues |
22
+
23
+ ## Phase 2: Plan & Context Loading
24
+
25
+ | Input | Source | Required |
26
+ |-------|--------|----------|
27
+ | Optimization plan | <session>/artifacts/optimization-plan.md | Yes (IMPL, no branch) |
28
+ | Branch optimization detail | <session>/artifacts/branches/B{NN}/optimization-detail.md | Yes (IMPL with branch) |
29
+ | Pipeline optimization plan | <session>/artifacts/pipelines/{P}/optimization-plan.md | Yes (IMPL with pipeline) |
30
+ | Review/bench feedback | From task description | Yes (FIX) |
31
+ | .msg/meta.json | <session>/.msg/meta.json | Yes |
32
+ | Wisdom files | <session>/wisdom/patterns.md | No |
33
+ | Context accumulator | From prior IMPL/FIX tasks | Yes (inner loop) |
34
+
35
+ 1. Extract session path and task mode (IMPL or FIX) from task description
36
+ 2. **Detect branch/pipeline context** from task description:
37
+
38
+ | Task Description Field | Value | Context |
39
+ |----------------------|-------|---------|
40
+ | `BranchId: B{NN}` | Present | Fan-out branch -- load single optimization detail |
41
+ | `PipelineId: {P}` | Present | Independent pipeline -- load pipeline-scoped plan |
42
+ | Neither present | - | Single mode -- load full optimization plan |
43
+
44
+ 3. **Load optimization context by mode**:
45
+ - **Single mode**: Read `<session>/artifacts/optimization-plan.md`
46
+ - **Fan-out branch**: Read `<session>/artifacts/branches/B{NN}/optimization-detail.md`
47
+ - **Independent pipeline**: Read `<session>/artifacts/pipelines/{P}/optimization-plan.md`
48
+
49
+ 4. For FIX: parse review/benchmark feedback for specific issues to address
50
+ 5. Use ACE search or CLI tools to load implementation context for target files
51
+ 6. For inner loop (single mode only): load context_accumulator from prior IMPL/FIX tasks
52
+
53
+ ## Phase 3: Code Implementation
54
+
55
+ Implementation backend selection:
56
+
57
+ | Backend | Condition | Method |
58
+ |---------|-----------|--------|
59
+ | CLI | Multi-file optimization with clear plan | ccw cli --tool gemini --mode write |
60
+ | Direct | Single-file changes or targeted fixes | Inline Edit/Write tools |
61
+
62
+ For IMPL tasks:
63
+ - **Single mode**: Apply optimizations in plan priority order (P0 first, then P1, etc.)
64
+ - **Fan-out branch**: Apply ONLY this branch's single optimization
65
+ - **Independent pipeline**: Apply this pipeline's optimizations in priority order
66
+ - Follow implementation guidance from plan (target files, patterns)
67
+ - Preserve existing behavior -- optimization must not break functionality
68
+
69
+ For FIX tasks:
70
+ - Read specific issues from review/benchmark feedback
71
+ - Apply targeted corrections to flagged code locations
72
+ - Verify the fix addresses the exact concern raised
73
+
74
+ General rules:
75
+ - Make minimal, focused changes per optimization
76
+ - Add comments only where optimization logic is non-obvious
77
+ - Preserve existing code style and conventions
78
+
79
+ ## Phase 4: Self-Validation
80
+
81
+ | Check | Method | Pass Criteria |
82
+ |-------|--------|---------------|
83
+ | Syntax | IDE diagnostics or build check | No new errors |
84
+ | File integrity | Verify all planned files exist and are modified | All present |
85
+ | Acceptance | Match optimization plan success criteria | All target metrics addressed |
86
+ | No regression | Run existing tests if available | No new failures |
87
+
88
+ If validation fails, attempt auto-fix (max 2 attempts) before reporting error.
89
+
90
+ Append to context_accumulator for next IMPL/FIX task (single/inner-loop mode only):
91
+ - Files modified, optimizations applied, validation results
92
+ - Any discovered patterns or caveats for subsequent iterations
93
+
94
+ **Branch output paths**:
95
+ - Single: write artifacts to `<session>/artifacts/`
96
+ - Fan-out: write artifacts to `<session>/artifacts/branches/B{NN}/`
97
+ - Independent: write artifacts to `<session>/artifacts/pipelines/{P}/`