maestro-flow 0.4.9 → 0.4.10

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 (187) hide show
  1. package/.agy/agents/cli-explore-agent.md +186 -0
  2. package/.agy/agents/conceptual-planning-agent.md +244 -0
  3. package/.agy/agents/impeccable-agent.md +97 -0
  4. package/.agy/agents/team-supervisor.md +142 -0
  5. package/.agy/agents/team-worker.md +236 -0
  6. package/.agy/agents/ui-design-agent.md +286 -0
  7. package/.agy/agents/workflow-analyzer.md +114 -0
  8. package/.agy/agents/workflow-codebase-mapper.md +76 -0
  9. package/.agy/agents/workflow-collab-planner.md +142 -0
  10. package/.agy/agents/workflow-debugger.md +102 -0
  11. package/.agy/agents/workflow-executor.md +131 -0
  12. package/.agy/agents/workflow-external-researcher.md +86 -0
  13. package/.agy/agents/workflow-integration-checker.md +82 -0
  14. package/.agy/agents/workflow-nyquist-auditor.md +84 -0
  15. package/.agy/agents/workflow-phase-researcher.md +84 -0
  16. package/.agy/agents/workflow-plan-checker.md +89 -0
  17. package/.agy/agents/workflow-planner.md +194 -0
  18. package/.agy/agents/workflow-project-researcher.md +73 -0
  19. package/.agy/agents/workflow-research-synthesizer.md +70 -0
  20. package/.agy/agents/workflow-reviewer.md +81 -0
  21. package/.agy/agents/workflow-roadmapper.md +81 -0
  22. package/.agy/agents/workflow-verifier.md +119 -0
  23. package/.agy/skills/codify-to-knowhow/SKILL.md +172 -0
  24. package/.agy/skills/codify-to-knowhow/phases/01-load-manifest.md +101 -0
  25. package/.agy/skills/codify-to-knowhow/phases/02-generate-knowhow.md +97 -0
  26. package/.agy/skills/codify-to-knowhow/phases/03-generate-specs.md +92 -0
  27. package/.agy/skills/codify-to-knowhow/phases/04-index-verify.md +119 -0
  28. package/.agy/skills/learn-decompose/SKILL.md +118 -0
  29. package/.agy/skills/learn-follow/SKILL.md +129 -0
  30. package/.agy/skills/learn-investigate/SKILL.md +154 -0
  31. package/.agy/skills/learn-retro/SKILL.md +159 -0
  32. package/.agy/skills/learn-second-opinion/SKILL.md +124 -0
  33. package/.agy/skills/maestro/SKILL.md +221 -0
  34. package/.agy/skills/maestro-amend/SKILL.md +162 -0
  35. package/.agy/skills/maestro-analyze/SKILL.md +135 -0
  36. package/.agy/skills/maestro-brainstorm/SKILL.md +118 -0
  37. package/.agy/skills/maestro-collab/SKILL.md +174 -0
  38. package/.agy/skills/maestro-composer/SKILL.md +180 -0
  39. package/.agy/skills/maestro-execute/SKILL.md +133 -0
  40. package/.agy/skills/maestro-fork/SKILL.md +88 -0
  41. package/.agy/skills/maestro-guard/SKILL.md +101 -0
  42. package/.agy/skills/maestro-help/SKILL.md +267 -0
  43. package/.agy/skills/maestro-help/index/catalog.json +184 -0
  44. package/.agy/skills/maestro-help/phases/01-parse-intent.md +122 -0
  45. package/.agy/skills/maestro-help/phases/02-search-present.md +181 -0
  46. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +186 -0
  47. package/.agy/skills/maestro-impeccable/SKILL.md +250 -0
  48. package/.agy/skills/maestro-init/SKILL.md +80 -0
  49. package/.agy/skills/maestro-learn/SKILL.md +142 -0
  50. package/.agy/skills/maestro-merge/SKILL.md +66 -0
  51. package/.agy/skills/maestro-milestone-audit/SKILL.md +70 -0
  52. package/.agy/skills/maestro-milestone-complete/SKILL.md +77 -0
  53. package/.agy/skills/maestro-milestone-release/SKILL.md +98 -0
  54. package/.agy/skills/maestro-overlay/SKILL.md +177 -0
  55. package/.agy/skills/maestro-plan/SKILL.md +172 -0
  56. package/.agy/skills/maestro-player/SKILL.md +176 -0
  57. package/.agy/skills/maestro-quick/SKILL.md +67 -0
  58. package/.agy/skills/maestro-ralph/SKILL.md +546 -0
  59. package/.agy/skills/maestro-ralph-execute/SKILL.md +255 -0
  60. package/.agy/skills/maestro-roadmap/SKILL.md +170 -0
  61. package/.agy/skills/maestro-tools-execute/SKILL.md +119 -0
  62. package/.agy/skills/maestro-tools-register/SKILL.md +159 -0
  63. package/.agy/skills/maestro-ui-codify/SKILL.md +81 -0
  64. package/.agy/skills/maestro-update/SKILL.md +175 -0
  65. package/.agy/skills/maestro-verify/SKILL.md +111 -0
  66. package/.agy/skills/manage-codebase-rebuild/SKILL.md +77 -0
  67. package/.agy/skills/manage-codebase-refresh/SKILL.md +59 -0
  68. package/.agy/skills/manage-harvest/SKILL.md +96 -0
  69. package/.agy/skills/manage-issue/SKILL.md +72 -0
  70. package/.agy/skills/manage-issue-discover/SKILL.md +83 -0
  71. package/.agy/skills/manage-knowhow/SKILL.md +76 -0
  72. package/.agy/skills/manage-knowhow-capture/SKILL.md +78 -0
  73. package/.agy/skills/manage-learn/SKILL.md +64 -0
  74. package/.agy/skills/manage-status/SKILL.md +51 -0
  75. package/.agy/skills/manage-wiki/SKILL.md +61 -0
  76. package/.agy/skills/quality-auto-test/SKILL.md +135 -0
  77. package/.agy/skills/quality-debug/SKILL.md +122 -0
  78. package/.agy/skills/quality-refactor/SKILL.md +69 -0
  79. package/.agy/skills/quality-retrospective/SKILL.md +79 -0
  80. package/.agy/skills/quality-review/SKILL.md +130 -0
  81. package/.agy/skills/quality-sync/SKILL.md +53 -0
  82. package/.agy/skills/quality-test/SKILL.md +119 -0
  83. package/.agy/skills/security-audit/SKILL.md +157 -0
  84. package/.agy/skills/skill-iter-tune/SKILL.md +381 -0
  85. package/.agy/skills/skill-iter-tune/phases/01-setup.md +144 -0
  86. package/.agy/skills/skill-iter-tune/phases/02-execute.md +292 -0
  87. package/.agy/skills/skill-iter-tune/phases/03-evaluate.md +312 -0
  88. package/.agy/skills/skill-iter-tune/phases/04-improve.md +198 -0
  89. package/.agy/skills/skill-iter-tune/phases/05-report.md +166 -0
  90. package/.agy/skills/skill-iter-tune/specs/evaluation-criteria.md +63 -0
  91. package/.agy/skills/skill-iter-tune/templates/eval-prompt.md +134 -0
  92. package/.agy/skills/skill-iter-tune/templates/execute-prompt.md +97 -0
  93. package/.agy/skills/spec-add/SKILL.md +67 -0
  94. package/.agy/skills/spec-load/SKILL.md +70 -0
  95. package/.agy/skills/spec-remove/SKILL.md +50 -0
  96. package/.agy/skills/spec-setup/SKILL.md +47 -0
  97. package/.agy/skills/team-coordinate/SKILL.md +267 -0
  98. package/.agy/skills/team-coordinate/roles/coordinator/commands/analyze-task.md +247 -0
  99. package/.agy/skills/team-coordinate/roles/coordinator/commands/dispatch.md +131 -0
  100. package/.agy/skills/team-coordinate/roles/coordinator/commands/monitor.md +348 -0
  101. package/.agy/skills/team-coordinate/roles/coordinator/role.md +362 -0
  102. package/.agy/skills/team-coordinate/specs/knowledge-transfer.md +111 -0
  103. package/.agy/skills/team-coordinate/specs/pipelines.md +97 -0
  104. package/.agy/skills/team-coordinate/specs/quality-gates.md +112 -0
  105. package/.agy/skills/team-coordinate/specs/role-spec-template.md +198 -0
  106. package/.agy/skills/team-executor/SKILL.md +180 -0
  107. package/.agy/skills/team-executor/roles/executor/commands/monitor.md +235 -0
  108. package/.agy/skills/team-executor/roles/executor/role.md +171 -0
  109. package/.agy/skills/team-executor/specs/session-schema.md +264 -0
  110. package/.agy/skills/team-lifecycle-v4/SKILL.md +189 -0
  111. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +92 -0
  112. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/analyze.md +56 -0
  113. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/dispatch.md +56 -0
  114. package/.agy/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +206 -0
  115. package/.agy/skills/team-lifecycle-v4/roles/coordinator/role.md +130 -0
  116. package/.agy/skills/team-lifecycle-v4/roles/executor/commands/fix.md +35 -0
  117. package/.agy/skills/team-lifecycle-v4/roles/executor/commands/implement.md +62 -0
  118. package/.agy/skills/team-lifecycle-v4/roles/executor/role.md +64 -0
  119. package/.agy/skills/team-lifecycle-v4/roles/planner/role.md +82 -0
  120. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-code.md +34 -0
  121. package/.agy/skills/team-lifecycle-v4/roles/reviewer/commands/review-spec.md +44 -0
  122. package/.agy/skills/team-lifecycle-v4/roles/reviewer/role.md +65 -0
  123. package/.agy/skills/team-lifecycle-v4/roles/supervisor/role.md +188 -0
  124. package/.agy/skills/team-lifecycle-v4/roles/tester/role.md +84 -0
  125. package/.agy/skills/team-lifecycle-v4/roles/writer/role.md +92 -0
  126. package/.agy/skills/team-lifecycle-v4/specs/knowledge-transfer.md +114 -0
  127. package/.agy/skills/team-lifecycle-v4/specs/pipelines.md +140 -0
  128. package/.agy/skills/team-lifecycle-v4/specs/quality-gates.md +130 -0
  129. package/.agy/skills/team-lifecycle-v4/templates/architecture.md +254 -0
  130. package/.agy/skills/team-lifecycle-v4/templates/epics.md +196 -0
  131. package/.agy/skills/team-lifecycle-v4/templates/product-brief.md +133 -0
  132. package/.agy/skills/team-lifecycle-v4/templates/requirements.md +224 -0
  133. package/.agy/skills/team-quality-assurance/SKILL.md +148 -0
  134. package/.agy/skills/team-quality-assurance/roles/analyst/role.md +85 -0
  135. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/analyze.md +72 -0
  136. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/dispatch.md +111 -0
  137. package/.agy/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +235 -0
  138. package/.agy/skills/team-quality-assurance/roles/coordinator/role.md +143 -0
  139. package/.agy/skills/team-quality-assurance/roles/executor/role.md +62 -0
  140. package/.agy/skills/team-quality-assurance/roles/generator/role.md +65 -0
  141. package/.agy/skills/team-quality-assurance/roles/scout/role.md +72 -0
  142. package/.agy/skills/team-quality-assurance/roles/strategist/role.md +69 -0
  143. package/.agy/skills/team-quality-assurance/specs/pipelines.md +115 -0
  144. package/.agy/skills/team-quality-assurance/specs/team-config.json +131 -0
  145. package/.agy/skills/team-review/SKILL.md +149 -0
  146. package/.agy/skills/team-review/roles/coordinator/commands/analyze.md +71 -0
  147. package/.agy/skills/team-review/roles/coordinator/commands/dispatch.md +91 -0
  148. package/.agy/skills/team-review/roles/coordinator/commands/monitor.md +209 -0
  149. package/.agy/skills/team-review/roles/coordinator/role.md +132 -0
  150. package/.agy/skills/team-review/roles/fixer/role.md +74 -0
  151. package/.agy/skills/team-review/roles/reviewer/role.md +66 -0
  152. package/.agy/skills/team-review/roles/scanner/role.md +77 -0
  153. package/.agy/skills/team-review/specs/dimensions.md +82 -0
  154. package/.agy/skills/team-review/specs/finding-schema.json +82 -0
  155. package/.agy/skills/team-review/specs/pipelines.md +102 -0
  156. package/.agy/skills/team-review/specs/team-config.json +27 -0
  157. package/.agy/skills/team-tech-debt/SKILL.md +133 -0
  158. package/.agy/skills/team-tech-debt/roles/assessor/role.md +76 -0
  159. package/.agy/skills/team-tech-debt/roles/coordinator/commands/analyze.md +47 -0
  160. package/.agy/skills/team-tech-debt/roles/coordinator/commands/dispatch.md +156 -0
  161. package/.agy/skills/team-tech-debt/roles/coordinator/commands/monitor.md +198 -0
  162. package/.agy/skills/team-tech-debt/roles/coordinator/role.md +123 -0
  163. package/.agy/skills/team-tech-debt/roles/executor/role.md +76 -0
  164. package/.agy/skills/team-tech-debt/roles/planner/role.md +68 -0
  165. package/.agy/skills/team-tech-debt/roles/scanner/role.md +90 -0
  166. package/.agy/skills/team-tech-debt/roles/validator/role.md +78 -0
  167. package/.agy/skills/team-tech-debt/specs/pipelines.md +47 -0
  168. package/.agy/skills/team-tech-debt/specs/team-config.json +129 -0
  169. package/.agy/skills/team-testing/SKILL.md +144 -0
  170. package/.agy/skills/team-testing/roles/analyst/role.md +101 -0
  171. package/.agy/skills/team-testing/roles/coordinator/commands/analyze.md +70 -0
  172. package/.agy/skills/team-testing/roles/coordinator/commands/dispatch.md +108 -0
  173. package/.agy/skills/team-testing/roles/coordinator/commands/monitor.md +242 -0
  174. package/.agy/skills/team-testing/roles/coordinator/role.md +134 -0
  175. package/.agy/skills/team-testing/roles/executor/role.md +95 -0
  176. package/.agy/skills/team-testing/roles/generator/role.md +95 -0
  177. package/.agy/skills/team-testing/roles/strategist/role.md +81 -0
  178. package/.agy/skills/team-testing/specs/pipelines.md +101 -0
  179. package/.agy/skills/team-testing/specs/team-config.json +93 -0
  180. package/.agy/skills/wiki-connect/SKILL.md +64 -0
  181. package/.agy/skills/wiki-digest/SKILL.md +70 -0
  182. package/.agy/skills/workflow-skill-designer/SKILL.md +506 -0
  183. package/.agy/skills/workflow-skill-designer/phases/01-requirements-analysis.md +356 -0
  184. package/.agy/skills/workflow-skill-designer/phases/02-orchestrator-design.md +444 -0
  185. package/.agy/skills/workflow-skill-designer/phases/03-phase-design.md +458 -0
  186. package/.agy/skills/workflow-skill-designer/phases/04-validation.md +471 -0
  187. package/package.json +3 -1
@@ -0,0 +1,362 @@
1
+ ---
2
+ ---
3
+
4
+ # Coordinator Role
5
+
6
+ Orchestrate the team-coordinate workflow: task analysis, dynamic role-spec generation, task dispatching, progress monitoring, session state, and completion action. The sole built-in role -- all worker roles are generated at runtime as role-specs and spawned via team-worker agent.
7
+
8
+ ## Identity
9
+
10
+ - **Name**: `coordinator` | **Tag**: `[coordinator]`
11
+ - **Responsibility**: Analyze task -> Generate role-specs -> Create team -> Dispatch tasks -> Monitor progress -> Completion action -> Report results
12
+
13
+ ## Boundaries
14
+
15
+ ### MUST
16
+ - Parse task description (text-level: keyword scanning, capability inference, dependency design)
17
+ - Dynamically generate worker role-specs from specs/role-spec-template.md
18
+ - Create team and spawn team-worker agents in background
19
+ - Dispatch tasks with proper dependency chains from task-analysis.json
20
+ - Monitor progress via worker callbacks and route messages
21
+ - Maintain session state persistence (team-session.json)
22
+ - Handle capability_gap reports (generate new role-specs mid-pipeline)
23
+ - Handle consensus_blocked HIGH verdicts (create revision tasks or pause)
24
+ - Detect fast-advance orphans on resume/check and reset to pending
25
+ - Execute completion action when pipeline finishes
26
+
27
+ ### MUST NOT
28
+ - **Read source code or perform codebase exploration** (delegate to worker roles)
29
+ - Execute task work directly (delegate to workers)
30
+ - Modify task output artifacts (workers own their deliverables)
31
+ - Call implementation agents (code-developer, etc.) directly
32
+ - Skip dependency validation when creating task chains
33
+ - Generate more than 5 worker roles (merge if exceeded)
34
+ - Override consensus_blocked HIGH without user confirmation
35
+ - Spawn workers with `general-purpose` agent (MUST use `team-worker`)
36
+
37
+ ---
38
+
39
+ ## Message Types
40
+
41
+ | Type | Direction | Trigger |
42
+ |------|-----------|---------|
43
+ | state_update | outbound | Session init, pipeline progress |
44
+ | task_unblocked | outbound | Task ready for execution |
45
+ | fast_advance | inbound | Worker skipped coordinator |
46
+ | capability_gap | inbound | Worker needs new capability |
47
+ | error | inbound | Worker failure |
48
+ | impl_complete | inbound | Worker task done |
49
+ | consensus_blocked | inbound | Discussion verdict conflict |
50
+
51
+ ## Message Bus Protocol
52
+
53
+ All coordinator state changes MUST be logged to team_msg BEFORE send_message:
54
+
55
+ 1. `team_msg(operation="log", ...)` — log the event
56
+ 2. `send_message(...)` — communicate to worker/user
57
+ 3. `TaskUpdate(...)` — update task state
58
+
59
+ Read state before every handler: `team_msg(operation="get_state", session_id=<session-id>)`
60
+
61
+ ---
62
+
63
+ ## Command Execution Protocol
64
+
65
+ When coordinator needs to execute a command (analyze-task, dispatch, monitor):
66
+
67
+ 1. **Read the command file**: `roles/coordinator/commands/<command-name>.md`
68
+ 2. **Follow the workflow** defined in the command file (Phase 2-4 structure)
69
+ 3. **Commands are inline execution guides** - NOT separate agents or subprocesses
70
+ 4. **Execute synchronously** - complete the command workflow before proceeding
71
+
72
+ Example:
73
+ ```
74
+ Phase 1 needs task analysis
75
+ -> Read roles/coordinator/commands/analyze-task.md
76
+ -> Execute Phase 2 (Context Loading)
77
+ -> Execute Phase 3 (Task Analysis)
78
+ -> Execute Phase 4 (Output)
79
+ -> Continue to Phase 2
80
+ ```
81
+
82
+ ## Toolbox
83
+
84
+ | Tool | Type | Purpose |
85
+ |------|------|---------|
86
+ | commands/analyze-task.md | Command | Task analysis and role design |
87
+ | commands/dispatch.md | Command | Task chain creation |
88
+ | commands/monitor.md | Command | Pipeline monitoring and handlers |
89
+ | team-worker | Subagent | Worker spawning |
90
+ | TeamCreate / TeamDelete | System | Team lifecycle |
91
+ | TaskCreate / TaskList / TaskGet / TaskUpdate | System | Task lifecycle |
92
+ | team_msg | System | Message bus operations |
93
+ | send_message | System | Inter-agent communication |
94
+ | ask_question | System | User interaction |
95
+
96
+ ---
97
+
98
+ ## Entry Router
99
+
100
+ When coordinator is invoked, first detect the invocation type:
101
+
102
+ | Detection | Condition | Handler |
103
+ |-----------|-----------|---------|
104
+ | Worker callback | Message contains `[role-name]` from session roles | -> handleCallback |
105
+ | Status check | Arguments contain "check" or "status" | -> handleCheck |
106
+ | Manual resume | Arguments contain "resume" or "continue" | -> handleResume |
107
+ | Capability gap | Message contains "capability_gap" | -> handleAdapt |
108
+ | Pipeline complete | All tasks completed, no pending/in_progress | -> handleComplete |
109
+ | Interrupted session | Active/paused session exists in `.workflow/.team/TC-*` | -> Phase 0 (Resume Check) |
110
+ | New session | None of above | -> Phase 1 (Task Analysis) |
111
+
112
+ For callback/check/resume/adapt/complete: load `@commands/monitor.md` and execute the appropriate handler, then STOP.
113
+
114
+ ### Router Implementation
115
+
116
+ 1. **Load session context** (if exists):
117
+ - Scan `.workflow/.team/TC-*/team-session.json` for active/paused sessions
118
+ - If found, extract `session.roles[].name` for callback detection
119
+
120
+ 2. **Parse $ARGUMENTS** for detection keywords
121
+
122
+ 3. **Route to handler**:
123
+ - For monitor handlers: Read `commands/monitor.md`, execute matched handler section, STOP
124
+ - For Phase 0: Execute Session Resume Check below
125
+ - For Phase 1: Execute Task Analysis below
126
+
127
+ ---
128
+
129
+ ## Phase 0: Session Resume Check
130
+
131
+ **Objective**: Detect and resume interrupted sessions before creating new ones.
132
+
133
+ **Workflow**:
134
+ 1. Scan `.workflow/.team/TC-*/team-session.json` for sessions with status "active" or "paused"
135
+ 2. No sessions found -> proceed to Phase 1
136
+ 3. Single session found -> resume it (-> Session Reconciliation)
137
+ 4. Multiple sessions -> ask_question for user selection
138
+
139
+ **Session Reconciliation**:
140
+ 1. Audit TaskList -> get real status of all tasks
141
+ 2. Reconcile: session.completed_tasks <-> TaskList status (bidirectional sync)
142
+ 3. Reset any in_progress tasks -> pending (they were interrupted)
143
+ 4. Detect fast-advance orphans (in_progress without recent activity) -> reset to pending
144
+ 5. Determine remaining pipeline from reconciled state
145
+ 6. Rebuild team if disbanded (TeamCreate + spawn needed workers only)
146
+ 7. Create missing tasks, set dependencies via TaskUpdate({ addBlockedBy })
147
+ 8. Verify dependency chain integrity
148
+ 9. Update session file with reconciled state
149
+ 10. Kick first executable task's worker -> Phase 4
150
+
151
+ ---
152
+
153
+ ## Phase 1: Task Analysis
154
+
155
+ **Objective**: Parse user task, detect capabilities, build dependency graph, design roles.
156
+
157
+ **Constraint**: This is TEXT-LEVEL analysis only. No source code reading, no codebase exploration.
158
+
159
+ **Workflow**:
160
+
161
+ 1. **Parse user task description**
162
+
163
+ 2. **Clarify if ambiguous** via ask_question:
164
+ - What is the scope? (specific files, module, project-wide)
165
+ - What deliverables are expected? (documents, code, analysis reports)
166
+ - Any constraints? (timeline, technology, style)
167
+
168
+ 3. **Delegate to `@commands/analyze-task.md`**:
169
+ - Signal detection: scan keywords -> infer capabilities
170
+ - Artifact inference: each capability -> default output type (.md)
171
+ - Dependency graph: build DAG of work streams
172
+ - Complexity scoring: count capabilities, cross-domain factor, parallel tracks
173
+ - Role minimization: merge overlapping, absorb trivial, cap at 5
174
+ - **Role-spec metadata**: Generate frontmatter fields (prefix, inner_loop, additional_members, message_types)
175
+
176
+ 4. **Output**: Write `<session>/task-analysis.json`
177
+
178
+ 5. **If `needs_research: true`**: Phase 2 will spawn researcher worker first
179
+
180
+ **Success**: Task analyzed, capabilities detected, dependency graph built, roles designed with role-spec metadata.
181
+
182
+ **CRITICAL - Team Workflow Enforcement**:
183
+
184
+ Regardless of complexity score or role count, coordinator MUST:
185
+ - ✅ **Always proceed to Phase 2** (generate role-specs)
186
+ - ✅ **Always create team** and spawn workers via team-worker agent
187
+ - ❌ **NEVER execute task work directly**, even for single-role low-complexity tasks
188
+ - ❌ **NEVER skip team workflow** based on complexity assessment
189
+
190
+ **Single-role execution is still team-based** - just with one worker. The team architecture provides:
191
+ - Consistent message bus communication
192
+ - Session state management
193
+ - Artifact tracking
194
+ - Fast-advance capability
195
+ - Resume/recovery mechanisms
196
+
197
+ ---
198
+
199
+ ## Phase 2: Generate Role-Specs + Initialize Session
200
+
201
+ **Objective**: Create session, generate dynamic role-spec files, initialize shared infrastructure.
202
+
203
+ **Workflow**:
204
+
205
+ 1. Resolve workspace paths (MUST do first):
206
+ - `project_root` = result of `run_command({ command: "pwd" })`
207
+ - `skill_root` = `<project_root>/.claude/skills/team-coordinate`
208
+
209
+ 2. **Check `needs_research` flag** from task-analysis.json:
210
+ - If `true`: **Spawn researcher worker first** to gather codebase context
211
+ - Wait for researcher callback
212
+ - Merge research findings into task context
213
+ - Update task-analysis.json with enriched context
214
+
215
+ 3. **Generate session ID**: `TC-<slug>-<date>` (slug from first 3 meaningful words of task)
216
+
217
+ 4. **Create session folder structure**:
218
+ ```
219
+ .workflow/.team/<session-id>/
220
+ +-- role-specs/
221
+ +-- artifacts/
222
+ +-- wisdom/
223
+ +-- explorations/
224
+ +-- discussions/
225
+ +-- .msg/
226
+ ```
227
+
228
+ 5. **Call TeamCreate** with team name derived from session ID
229
+
230
+ 6. **Read `specs/role-spec-template.md`** for Behavioral Traits + Reference Patterns
231
+
232
+ 7. **For each role in task-analysis.json#roles**:
233
+ - Fill YAML frontmatter: role, prefix, inner_loop, additional_members, message_types
234
+ - **Compose Phase 2-4 content** (NOT copy from template):
235
+ - Phase 2: Derive input sources and context loading steps from **task description + upstream dependencies**
236
+ - Phase 3: Describe **execution goal** (WHAT to achieve) from task description — do NOT prescribe specific CLI tool or approach
237
+ - Phase 4: Combine **Behavioral Traits** (from template) + **output_type** (from task analysis) to compose verification steps
238
+ - Reference Patterns may guide phase structure, but task description determines specific content
239
+ - Write generated role-spec to `<session>/role-specs/<role-name>.md`
240
+
241
+ 8. **Register roles** in team-session.json#roles (with `role_spec` path instead of `role_file`)
242
+
243
+ 9. **Initialize shared infrastructure**:
244
+ - `wisdom/learnings.md`, `wisdom/decisions.md`, `wisdom/issues.md` (empty with headers)
245
+ - `explorations/cache-index.json` (`{ "entries": [] }`)
246
+ - `discussions/` (empty directory)
247
+
248
+ 10. **Initialize pipeline metadata** via team_msg:
249
+ ```typescript
250
+ // 使用 team_msg 将 pipeline 元数据写入 .msg/meta.json
251
+ // 注意: 此处为动态角色,执行时需将 <placeholders> 替换为 task-analysis.json 中生成的实际角色列表
252
+ mcp__ccw-tools__team_msg({
253
+ operation: "log",
254
+ session_id: "<session-id>",
255
+ from: "coordinator",
256
+ type: "state_update",
257
+ summary: "Session initialized",
258
+ data: {
259
+ pipeline_mode: "<mode>",
260
+ pipeline_stages: ["<role1>", "<role2>", "<...dynamic-roles>"],
261
+ roles: ["coordinator", "<role1>", "<role2>", "<...dynamic-roles>"],
262
+ team_name: "<team-name>" // 从 session ID 或任务描述中提取
263
+ }
264
+ })
265
+ ```
266
+
267
+ 11. **Write team-session.json** with: session_id, task_description, status="active", roles, pipeline (empty), active_workers=[], completion_action="interactive", created_at
268
+
269
+ **Success**: Session created, role-spec files generated, shared infrastructure initialized.
270
+
271
+ ---
272
+
273
+ ## Phase 3: Create Task Chain
274
+
275
+ **Objective**: Dispatch tasks based on dependency graph with proper dependencies.
276
+
277
+ Delegate to `@commands/dispatch.md` which creates the full task chain:
278
+ 1. Reads dependency_graph from task-analysis.json
279
+ 2. Topological sorts tasks
280
+ 3. Creates tasks via TaskCreate, then sets dependencies via TaskUpdate({ addBlockedBy })
281
+ 4. Assigns owner based on role mapping from task-analysis.json
282
+ 5. Includes `Session: <session-folder>` in every task description
283
+ 6. Sets InnerLoop flag for multi-task roles
284
+ 7. Updates team-session.json with pipeline and tasks_total
285
+
286
+ **Success**: All tasks created with correct dependency chains, session updated.
287
+
288
+ ---
289
+
290
+ ## Phase 4: Spawn-and-Stop
291
+
292
+ **Objective**: Spawn first batch of ready workers in background, then STOP.
293
+
294
+ **Design**: Spawn-and-Stop + Callback pattern, with worker fast-advance.
295
+
296
+ **Workflow**:
297
+ 1. Load `@commands/monitor.md`
298
+ 2. Find tasks with: status=pending, blockedBy all resolved, owner assigned
299
+ 3. For each ready task -> spawn team-worker (see SKILL.md Coordinator Spawn Template)
300
+ 4. Output status summary with execution graph
301
+ 5. STOP
302
+
303
+ **Pipeline advancement** driven by three wake sources:
304
+ - Worker callback (automatic) -> Entry Router -> handleCallback
305
+ - User "check" -> handleCheck (status only)
306
+ - User "resume" -> handleResume (advance)
307
+
308
+ ---
309
+
310
+ ## Phase 5: Report + Completion Action
311
+
312
+ **Objective**: Completion report, interactive completion choice, and follow-up options.
313
+
314
+ **Workflow**:
315
+ 1. Load session state -> count completed tasks, duration
316
+ 2. List all deliverables with output paths in `<session>/artifacts/`
317
+ 3. Include discussion summaries (if inline discuss was used)
318
+ 4. Summarize wisdom accumulated during execution
319
+ 5. Output report:
320
+
321
+ ```
322
+ [coordinator] ============================================
323
+ [coordinator] TASK COMPLETE
324
+ [coordinator]
325
+ [coordinator] Deliverables:
326
+ [coordinator] - <artifact-1.md> (<producer role>)
327
+ [coordinator] - <artifact-2.md> (<producer role>)
328
+ [coordinator]
329
+ [coordinator] Pipeline: <completed>/<total> tasks
330
+ [coordinator] Roles: <role-list>
331
+ [coordinator] Duration: <elapsed>
332
+ [coordinator]
333
+ [coordinator] Session: <session-folder>
334
+ [coordinator] ============================================
335
+ ```
336
+
337
+ 6. **Execute Completion Action** (based on session.completion_action):
338
+
339
+ | Mode | Behavior |
340
+ |------|----------|
341
+ | `interactive` | ask_question with Archive/Keep/Export options |
342
+ | `auto_archive` | Execute Archive & Clean without prompt |
343
+ | `auto_keep` | Execute Keep Active without prompt |
344
+
345
+ **Interactive handler**: See SKILL.md Completion Action section.
346
+
347
+ ---
348
+
349
+ ## Error Handling
350
+
351
+ | Error | Resolution |
352
+ |-------|------------|
353
+ | Task timeout | Log, mark failed, ask user to retry or skip |
354
+ | Worker crash | Respawn worker, reassign task |
355
+ | Dependency cycle | Detect in task analysis, report to user, halt |
356
+ | Task description too vague | ask_question for clarification |
357
+ | Session corruption | Attempt recovery, fallback to manual reconciliation |
358
+ | Role-spec generation fails | Fall back to single general-purpose role |
359
+ | capability_gap reported | handleAdapt: generate new role-spec, create tasks, spawn |
360
+ | All capabilities merge to one | Valid: single-role execution, reduced overhead |
361
+ | No capabilities detected | Default to single general role with TASK prefix |
362
+ | Completion action fails | Default to Keep Active, log warning |
@@ -0,0 +1,111 @@
1
+ # Knowledge Transfer Protocols
2
+
3
+ ## 1. Transfer Channels
4
+
5
+ | Channel | Scope | Mechanism | When to Use |
6
+ |---------|-------|-----------|-------------|
7
+ | **Artifacts** | Producer -> Consumer | Write to `<session>/artifacts/<name>.md`, consumer reads in Phase 2 | Structured deliverables (reports, plans, specs) |
8
+ | **State Updates** | Cross-role | `team_msg(operation="log", type="state_update", data={...})` / `team_msg(operation="get_state", session_id=<session-id>)` | Key findings, decisions, metadata (small, structured data) |
9
+ | **Wisdom** | Cross-task | Append to `<session>/wisdom/{learnings,decisions,conventions,issues}.md` | Patterns, conventions, risks discovered during execution |
10
+ | **Context Accumulator** | Intra-role (inner loop) | In-memory array, passed to each subsequent task in same-prefix loop | Prior task summaries within same role's inner loop |
11
+ | **Exploration Cache** | Cross-role | `<session>/explorations/cache-index.json` + per-angle JSON | Codebase discovery results, prevents duplicate exploration |
12
+
13
+ ## 2. Context Loading Protocol (Phase 2)
14
+
15
+ Every role MUST load context in this order before starting work.
16
+
17
+ | Step | Action | Required |
18
+ |------|--------|----------|
19
+ | 1 | Extract session path from task description | Yes |
20
+ | 2 | `team_msg(operation="get_state", session_id=<session-id>)` | Yes |
21
+ | 3 | Read artifact files from upstream state's `ref` paths | Yes |
22
+ | 4 | Read `<session>/wisdom/*.md` if exists | Yes |
23
+ | 5 | Check `<session>/explorations/cache-index.json` before new exploration | If exploring |
24
+ | 6 | For inner_loop roles: load context_accumulator from prior tasks | If inner_loop |
25
+
26
+ **Loading rules**:
27
+ - Never skip step 2 -- state contains key decisions and findings
28
+ - If `ref` path in state does not exist, log warning and continue
29
+ - Wisdom files are append-only -- read all entries, newest last
30
+
31
+ ## 3. Context Publishing Protocol (Phase 4)
32
+
33
+ | Step | Action | Required |
34
+ |------|--------|----------|
35
+ | 1 | Write deliverable to `<session>/artifacts/<task-id>-<name>.md` | Yes |
36
+ | 2 | Send `team_msg(type="state_update")` with payload (see schema below) | Yes |
37
+ | 3 | Append wisdom entries for learnings, decisions, issues found | If applicable |
38
+
39
+ ## 4. State Update Schema
40
+
41
+ Sent via `team_msg(type="state_update")` on task completion.
42
+
43
+ ```json
44
+ {
45
+ "status": "task_complete",
46
+ "task_id": "<TASK-NNN>",
47
+ "ref": "<session>/artifacts/<filename>",
48
+ "key_findings": [
49
+ "Finding 1",
50
+ "Finding 2"
51
+ ],
52
+ "decisions": [
53
+ "Decision with rationale"
54
+ ],
55
+ "files_modified": [
56
+ "path/to/file.ts"
57
+ ],
58
+ "verification": "self-validated | peer-reviewed | tested"
59
+ }
60
+ ```
61
+
62
+ **Field rules**:
63
+ - `ref`: Always an artifact path, never inline content
64
+ - `key_findings`: Max 5 items, each under 100 chars
65
+ - `decisions`: Include rationale, not just the choice
66
+ - `files_modified`: Only for implementation tasks
67
+ - `verification`: One of `self-validated`, `peer-reviewed`, `tested`
68
+
69
+ **Write state** (namespaced by role):
70
+ ```
71
+ team_msg(operation="log", session_id=<session-id>, from=<role>, type="state_update", data={
72
+ "<role_name>": { "key_findings": [...], "scope": "..." }
73
+ })
74
+ ```
75
+
76
+ **Read state**:
77
+ ```
78
+ team_msg(operation="get_state", session_id=<session-id>)
79
+ // Returns merged state from all state_update messages
80
+ ```
81
+
82
+ ## 5. Exploration Cache Protocol
83
+
84
+ Prevents redundant research across tasks and discussion rounds.
85
+
86
+ | Step | Action |
87
+ |------|--------|
88
+ | 1 | Read `<session>/explorations/cache-index.json` |
89
+ | 2 | If angle already explored, read cached result from `explore-<angle>.json` |
90
+ | 3 | If not cached, perform exploration |
91
+ | 4 | Write result to `<session>/explorations/explore-<angle>.json` |
92
+ | 5 | Update `cache-index.json` with new entry |
93
+
94
+ **cache-index.json format**:
95
+ ```json
96
+ {
97
+ "entries": [
98
+ {
99
+ "angle": "competitor-analysis",
100
+ "file": "explore-competitor-analysis.json",
101
+ "created_by": "RESEARCH-001",
102
+ "timestamp": "2026-01-15T10:30:00Z"
103
+ }
104
+ ]
105
+ }
106
+ ```
107
+
108
+ **Rules**:
109
+ - Cache key is the exploration `angle` (normalized to kebab-case)
110
+ - Cache entries never expire within a session
111
+ - Any role can read cached explorations; only the creator updates them
@@ -0,0 +1,97 @@
1
+ # Pipeline Definitions — Team Coordinate
2
+
3
+ ## Dynamic Pipeline Model
4
+
5
+ team-coordinate does NOT have a static pipeline. All pipelines are generated at runtime from task-analysis.json based on the user's task description.
6
+
7
+ ## Pipeline Generation Process
8
+
9
+ ```
10
+ Phase 1: analyze-task.md
11
+ -> Signal detection -> capability mapping -> dependency graph
12
+ -> Output: task-analysis.json
13
+
14
+ Phase 2: dispatch.md
15
+ -> Read task-analysis.json dependency graph
16
+ -> Create TaskCreate entries per dependency node
17
+ -> Set blockedBy chains from graph edges
18
+ -> Output: TaskList with correct DAG
19
+
20
+ Phase 3-N: monitor.md
21
+ -> handleSpawnNext: spawn ready tasks as team-worker agents
22
+ -> handleCallback: mark completed, advance pipeline
23
+ -> Repeat until all tasks done
24
+ ```
25
+
26
+ ## Dynamic Task Naming
27
+
28
+ | Capability | Prefix | Example |
29
+ |------------|--------|---------|
30
+ | researcher | RESEARCH | RESEARCH-001 |
31
+ | developer | IMPL | IMPL-001 |
32
+ | analyst | ANALYSIS | ANALYSIS-001 |
33
+ | designer | DESIGN | DESIGN-001 |
34
+ | tester | TEST | TEST-001 |
35
+ | writer | DRAFT | DRAFT-001 |
36
+ | planner | PLAN | PLAN-001 |
37
+ | (default) | TASK | TASK-001 |
38
+
39
+ ## Dependency Graph Structure
40
+
41
+ task-analysis.json encodes the pipeline:
42
+
43
+ ```json
44
+ {
45
+ "dependency_graph": {
46
+ "RESEARCH-001": { "role": "researcher", "blockedBy": [], "priority": "P0" },
47
+ "IMPL-001": { "role": "developer", "blockedBy": ["RESEARCH-001"], "priority": "P1" },
48
+ "TEST-001": { "role": "tester", "blockedBy": ["IMPL-001"], "priority": "P2" }
49
+ }
50
+ }
51
+ ```
52
+
53
+ ## Role-Worker Map
54
+
55
+ Dynamic — loaded from session role-specs at runtime:
56
+
57
+ ```
58
+ <session>/role-specs/<role-name>.md -> team-worker agent
59
+ ```
60
+
61
+ Role-spec files contain YAML frontmatter:
62
+ ```yaml
63
+ ---
64
+ role: <role-name>
65
+ prefix: <PREFIX>
66
+ inner_loop: <true|false>
67
+ message_types:
68
+ success: <type>
69
+ error: error
70
+ ---
71
+ ```
72
+
73
+ ## Checkpoint
74
+
75
+ | Trigger | Behavior |
76
+ |---------|----------|
77
+ | capability_gap reported | handleAdapt: generate new role-spec, spawn new worker |
78
+ | consensus_blocked HIGH | Create REVISION task or pause for user |
79
+ | All tasks complete | handleComplete: interactive completion action |
80
+
81
+ ## Specs Reference
82
+
83
+ - [role-spec-template.md](role-spec-template.md) — Template for generating dynamic role-specs
84
+ - [quality-gates.md](quality-gates.md) — Quality thresholds and scoring dimensions
85
+ - [knowledge-transfer.md](knowledge-transfer.md) — Context transfer protocols between roles
86
+
87
+ ## Quality Gate Integration
88
+
89
+ Dynamic pipelines reference quality thresholds from [specs/quality-gates.md](quality-gates.md).
90
+
91
+ | Gate Point | Trigger | Criteria Source |
92
+ |------------|---------|----------------|
93
+ | After artifact production | Producer role Phase 4 | Behavioral Traits in role-spec |
94
+ | After validation tasks | Tester/analyst completion | quality-gates.md thresholds |
95
+ | Pipeline completion | All tasks done | Aggregate scoring |
96
+
97
+ Issue classification: Error (blocks) > Warning (proceed with justification) > Info (log for future).
@@ -0,0 +1,112 @@
1
+ # Quality Gates
2
+
3
+ ## 1. Quality Thresholds
4
+
5
+ | Result | Score | Action |
6
+ |--------|-------|--------|
7
+ | Pass | >= 80% | Report completed |
8
+ | Review | 60-79% | Report completed with warnings |
9
+ | Fail | < 60% | Retry Phase 3 (max 2 retries) |
10
+
11
+ ## 2. Scoring Dimensions
12
+
13
+ | Dimension | Weight | Criteria |
14
+ |-----------|--------|----------|
15
+ | Completeness | 25% | All required outputs present with substantive content |
16
+ | Consistency | 25% | Terminology, formatting, cross-references are uniform |
17
+ | Accuracy | 25% | Outputs are factually correct and verifiable against sources |
18
+ | Depth | 25% | Sufficient detail for downstream consumers to act on deliverables |
19
+
20
+ **Score** = weighted average of all dimensions (0-100 per dimension).
21
+
22
+ ## 3. Dynamic Role Quality Checks
23
+
24
+ Quality checks vary by `output_type` (from task-analysis.json role metadata).
25
+
26
+ ### output_type: artifact
27
+
28
+ | Check | Pass Criteria |
29
+ |-------|---------------|
30
+ | Artifact exists | File written to `<session>/artifacts/` |
31
+ | Content non-empty | Substantive content, not just headers |
32
+ | Format correct | Expected format (MD, JSON) matches deliverable |
33
+ | Cross-references | All references to upstream artifacts resolve |
34
+
35
+ ### output_type: codebase
36
+
37
+ | Check | Pass Criteria |
38
+ |-------|---------------|
39
+ | Files modified | Claimed files actually changed (Read to confirm) |
40
+ | Syntax valid | No syntax errors in modified files |
41
+ | No regressions | Existing functionality preserved |
42
+ | Summary artifact | Implementation summary written to artifacts/ |
43
+
44
+ ### output_type: mixed
45
+
46
+ All checks from both `artifact` and `codebase` apply.
47
+
48
+ ## 4. Verification Protocol
49
+
50
+ Derived from Behavioral Traits in [role-spec-template.md](role-spec-template.md).
51
+
52
+ | Step | Action | Required |
53
+ |------|--------|----------|
54
+ | 1 | Verify all claimed files exist via Read | Yes |
55
+ | 2 | Confirm artifact written to `<session>/artifacts/` | Yes |
56
+ | 3 | Check verification summary fields present | Yes |
57
+ | 4 | Score against quality dimensions | Yes |
58
+ | 5 | Apply threshold -> Pass/Review/Fail | Yes |
59
+
60
+ **On Fail**: Retry Phase 3 (max 2 retries). After 2 retries, report `partial_completion`.
61
+
62
+ **On Review**: Proceed with warnings logged to `<session>/wisdom/issues.md`.
63
+
64
+ ## 5. Code Review Dimensions
65
+
66
+ For REVIEW-* or validation tasks during implementation pipelines.
67
+
68
+ ### Quality
69
+
70
+ | Check | Severity |
71
+ |-------|----------|
72
+ | Empty catch blocks | Error |
73
+ | `as any` type casts | Warning |
74
+ | `@ts-ignore` / `@ts-expect-error` | Warning |
75
+ | `console.log` in production code | Warning |
76
+ | Unused imports/variables | Info |
77
+
78
+ ### Security
79
+
80
+ | Check | Severity |
81
+ |-------|----------|
82
+ | Hardcoded secrets/credentials | Error |
83
+ | SQL injection vectors | Error |
84
+ | `eval()` or `Function()` usage | Error |
85
+ | `innerHTML` assignment | Warning |
86
+ | Missing input validation | Warning |
87
+
88
+ ### Architecture
89
+
90
+ | Check | Severity |
91
+ |-------|----------|
92
+ | Circular dependencies | Error |
93
+ | Deep cross-boundary imports (3+ levels) | Warning |
94
+ | Files > 500 lines | Warning |
95
+ | Functions > 50 lines | Info |
96
+
97
+ ### Requirements Coverage
98
+
99
+ | Check | Severity |
100
+ |-------|----------|
101
+ | Core functionality implemented | Error if missing |
102
+ | Acceptance criteria covered | Error if missing |
103
+ | Edge cases handled | Warning |
104
+ | Error states handled | Warning |
105
+
106
+ ## 6. Issue Classification
107
+
108
+ | Class | Label | Action |
109
+ |-------|-------|--------|
110
+ | Error | Must fix | Blocks progression, must resolve before proceeding |
111
+ | Warning | Should fix | Should resolve, can proceed with justification |
112
+ | Info | Nice to have | Optional improvement, log for future |