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,267 @@
1
+ ---
2
+ name: team-coordinate
3
+ description: Universal team coordination skill with dynamic role generation. Uses team-worker agent architecture with role-spec files. Only coordinator is built-in -- all worker roles are generated at runtime as role-specs and spawned via team-worker agent. Beat/cadence model for orchestration. Triggers on "Team Coordinate ".
4
+ allowed-tools:
5
+ - ask_question
6
+ - define_subagent
7
+ - grep_search
8
+ - invoke_subagent
9
+ - manage_subagents
10
+ - replace_file_content
11
+ - run_command
12
+ - send_message
13
+ - view_file
14
+ - write_to_file
15
+ agy-subagents:
16
+ - team-worker
17
+ ---
18
+
19
+ ## Sub-Agent Registration (Antigravity)
20
+
21
+ Before any `invoke_subagent` call below, register each sub-agent type once per session by reading the system_prompt from `<agy-agents-dir>/<name>.md` and passing it to `define_subagent`. The `<agy-agents-dir>` is:
22
+ - global install: `~/.gemini/antigravity-cli/agents/`
23
+ - workspace install: `<project>/.agents/agents/`
24
+
25
+ - `define_subagent(name="team-worker", description="<from agents/team-worker.md frontmatter>", system_prompt=<contents of agents/team-worker.md body>, enable_write_tools=true, enable_mcp_tools=true, enable_subagent_tools=false)`
26
+
27
+ **ConversationId tracking**: `invoke_subagent` returns a ConversationId per spawned instance. Subsequent `send_message(Recipient=<ConversationId>, Message=...)` calls require that ConversationId — never use the role name as the recipient.
28
+
29
+ ---
30
+
31
+ # Team Coordinate
32
+
33
+ Universal team coordination skill: analyze task -> generate role-specs -> dispatch -> execute -> deliver. Only the **coordinator** is built-in. All worker roles are **dynamically generated** as lightweight role-spec files and spawned via the `team-worker` agent.
34
+
35
+
36
+ ## Architecture
37
+
38
+ ```
39
+ +---------------------------------------------------+
40
+ | view_file(AbsolutePath="<agy-skills-dir>/team-coordinate/SKILL.md") + execute inline |
41
+ | args="task description" |
42
+ +-------------------+-------------------------------+
43
+ |
44
+ Orchestration Mode (auto -> coordinator)
45
+ |
46
+ Coordinator (built-in)
47
+ Phase 0-5 orchestration
48
+ |
49
+ +-------+-------+-------+-------+
50
+ v v v v v
51
+ [team-worker agents, each loaded with a dynamic role-spec]
52
+ (roles generated at runtime from task analysis)
53
+
54
+ CLI Tools (callable by any worker):
55
+ maestro delegate --mode analysis - analysis and exploration
56
+ maestro delegate --mode write - code generation and modification
57
+ ```
58
+
59
+ ## Shared Constants
60
+
61
+ | Constant | Value |
62
+ |----------|-------|
63
+ | Session prefix | `TC` |
64
+ | Session path | `.workflow/.team/TC-<slug>-<date>/` |
65
+ | Worker agent | `team-worker` |
66
+ | Message bus | `mcp__ccw-tools__team_msg(session_id=<session-id>, ...)` |
67
+ | CLI analysis | `maestro delegate --mode analysis` |
68
+ | CLI write | `maestro delegate --mode write` |
69
+ | Max roles | 5 |
70
+
71
+ ## Role Router
72
+
73
+ This skill is **coordinator-only**. Workers do NOT invoke this skill -- they are spawned as `team-worker` agents directly.
74
+
75
+ ### Input Parsing
76
+
77
+ Parse `$ARGUMENTS`. No `--role` needed -- always routes to coordinator.
78
+
79
+ ### Role Registry
80
+
81
+ Only coordinator is statically registered. All other roles are dynamic, stored as role-specs in session.
82
+
83
+ | Role | File | Type |
84
+ |------|------|------|
85
+ | coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | built-in orchestrator |
86
+ | (dynamic) | `<session>/role-specs/<role-name>.md` | runtime-generated role-spec |
87
+
88
+ ### CLI Tool Usage
89
+
90
+ Workers can use CLI tools for analysis and code operations:
91
+
92
+ | Tool | Purpose |
93
+ |------|---------|
94
+ | maestro delegate --mode analysis | Analysis, exploration, pattern discovery |
95
+ | maestro delegate --mode write | Code generation, modification, refactoring |
96
+
97
+ ### Dispatch
98
+
99
+ Always route to coordinator. Coordinator reads `roles/coordinator/role.md` and executes its phases.
100
+
101
+ ### Orchestration Mode
102
+
103
+ User just provides task description.
104
+
105
+ **Invocation**: `view_file(AbsolutePath="<agy-skills-dir>/team-coordinate/SKILL.md") + execute inline (args: "task description")`
106
+
107
+ **Lifecycle**:
108
+ ```
109
+ User provides task description
110
+ -> coordinator Phase 1: task analysis (detect capabilities, build dependency graph)
111
+ -> coordinator Phase 2: generate role-specs + initialize session
112
+ -> coordinator Phase 3: create task chain from dependency graph
113
+ -> coordinator Phase 4: spawn first batch workers (background) -> STOP
114
+ -> Worker executes -> send_message callback -> coordinator advances next step
115
+ -> Loop until pipeline complete -> Phase 5 report + completion action
116
+ ```
117
+
118
+ **User Commands** (wake paused coordinator):
119
+
120
+ | Command | Action |
121
+ |---------|--------|
122
+ | `check` / `status` | Output execution status graph, no advancement |
123
+ | `resume` / `continue` | Check worker states, advance next step |
124
+ | `revise <TASK-ID> [feedback]` | Revise specific task with optional feedback |
125
+ | `feedback <text>` | Inject feedback into active pipeline |
126
+ | `improve [dimension]` | Auto-improve weakest quality dimension |
127
+
128
+ ---
129
+
130
+ ## Coordinator Spawn Template
131
+
132
+ ### v2 Worker Spawn (all roles)
133
+
134
+ When coordinator spawns workers, use `team-worker` agent with role-spec path:
135
+
136
+ ```
137
+ invoke_subagent([{ TypeName: "team-worker", Role: "<role>", Prompt: "<Prompt>", Workspace: "inherit" }])
138
+ ```
139
+
140
+ **Inner Loop roles** (role has 2+ serial same-prefix tasks): Set `inner_loop: true`. The team-worker agent handles the loop internally.
141
+
142
+ **Single-task roles**: Set `inner_loop: false`.
143
+
144
+ ---
145
+
146
+ ## Completion Action
147
+
148
+ When pipeline completes (all tasks done), coordinator presents an interactive choice:
149
+
150
+ ```
151
+ ask_question({
152
+ questions: [{
153
+ question: "Team pipeline complete. What would you like to do?",
154
+ header: "Completion",
155
+ multiSelect: false,
156
+ options: [
157
+ { label: "Archive & Clean (Recommended)", description: "Archive session, clean up team" },
158
+ { label: "Keep Active", description: "Keep session for follow-up work" },
159
+ { label: "Export Results", description: "Export deliverables to target directory, then clean" }
160
+ ]
161
+ }]
162
+ })
163
+ ```
164
+
165
+ ### Action Handlers
166
+
167
+ | Choice | Steps |
168
+ |--------|-------|
169
+ | Archive & Clean | Update session status="completed" -> TeamDelete -> output final summary with artifact paths |
170
+ | Keep Active | Update session status="paused" -> output: "Resume with: view_file(AbsolutePath="<agy-skills-dir>/team-coordinate/SKILL.md") + execute inline (args: "resume")" |
171
+ | Export Results | ask_question(target path) -> copy artifacts to target -> Archive & Clean |
172
+
173
+ ---
174
+
175
+ ## Specs Reference
176
+
177
+ | Spec | Purpose |
178
+ |------|---------|
179
+ | [specs/pipelines.md](specs/pipelines.md) | Dynamic pipeline model, task naming, dependency graph |
180
+ | [specs/role-spec-template.md](specs/role-spec-template.md) | Template for dynamic role-spec generation |
181
+ | [specs/quality-gates.md](specs/quality-gates.md) | Quality thresholds and scoring dimensions |
182
+ | [specs/knowledge-transfer.md](specs/knowledge-transfer.md) | Context transfer protocols between roles |
183
+
184
+ ---
185
+
186
+ ## Session Directory
187
+
188
+ ```
189
+ .workflow/.team/TC-<slug>-<date>/
190
+ +-- team-session.json # Session state + dynamic role registry
191
+ +-- task-analysis.json # Phase 1 output: capabilities, dependency graph
192
+ +-- role-specs/ # Dynamic role-spec definitions (generated Phase 2)
193
+ | +-- <role-1>.md # Lightweight: frontmatter + Phase 2-4 only
194
+ | +-- <role-2>.md
195
+ +-- artifacts/ # All MD deliverables from workers
196
+ | +-- <artifact>.md
197
+ +-- .msg/ # Team message bus + state
198
+ | +-- messages.jsonl # Message log
199
+ | +-- meta.json # Session metadata + cross-role state
200
+ +-- wisdom/ # Cross-task knowledge
201
+ | +-- learnings.md
202
+ | +-- decisions.md
203
+ | +-- issues.md
204
+ +-- explorations/ # Shared explore cache
205
+ | +-- cache-index.json
206
+ | +-- explore-<angle>.json
207
+ +-- discussions/ # Inline discuss records
208
+ | +-- <round>.md
209
+ ```
210
+
211
+ ### team-session.json Schema
212
+
213
+ ```json
214
+ {
215
+ "session_id": "TC-<slug>-<date>",
216
+ "task_description": "<original user input>",
217
+ "status": "active | paused | completed",
218
+ "team_name": "<team-name>",
219
+ "roles": [
220
+ {
221
+ "name": "<role-name>",
222
+ "prefix": "<PREFIX>",
223
+ "responsibility_type": "<type>",
224
+ "inner_loop": false,
225
+ "role_spec": "role-specs/<role-name>.md"
226
+ }
227
+ ],
228
+ "pipeline": {
229
+ "dependency_graph": {},
230
+ "tasks_total": 0,
231
+ "tasks_completed": 0
232
+ },
233
+ "active_workers": [],
234
+ "completed_tasks": [],
235
+ "completion_action": "interactive",
236
+ "created_at": "<timestamp>"
237
+ }
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Session Resume
243
+
244
+ Coordinator supports `resume` / `continue` for interrupted sessions:
245
+
246
+ 1. Scan `.workflow/.team/TC-*/team-session.json` for active/paused sessions
247
+ 2. Multiple matches -> ask_question for selection
248
+ 3. Audit TaskList -> reconcile session state <-> task status
249
+ 4. Reset in_progress -> pending (interrupted tasks)
250
+ 5. Rebuild team and spawn needed workers only
251
+ 6. Create missing tasks, set dependencies via TaskUpdate({ addBlockedBy })
252
+ 7. Kick first executable task -> Phase 4 coordination loop
253
+
254
+ ---
255
+
256
+ ## Error Handling
257
+
258
+ | Scenario | Resolution |
259
+ |----------|------------|
260
+ | Unknown command | Error with available command list |
261
+ | Dynamic role-spec not found | Error, coordinator may need to regenerate |
262
+ | Command file not found | Fallback to inline execution |
263
+ | CLI tool fails | Worker proceeds with direct implementation, logs warning |
264
+ | Explore cache corrupt | Clear cache, re-explore |
265
+ | Fast-advance spawns wrong task | Coordinator reconciles on next callback |
266
+ | capability_gap reported | Coordinator generates new role-spec via handleAdapt |
267
+ | Completion action fails | Default to Keep Active, log warning |
@@ -0,0 +1,247 @@
1
+ # Command: analyze-task
2
+
3
+ ## Purpose
4
+
5
+ Parse user task description -> detect required capabilities -> build dependency graph -> design dynamic roles with role-spec metadata. Outputs structured task-analysis.json with frontmatter fields for role-spec generation.
6
+
7
+ ## CRITICAL CONSTRAINT
8
+
9
+ **TEXT-LEVEL analysis only. MUST NOT read source code or explore codebase.**
10
+
11
+ **Allowed:**
12
+ - Parse user task description text
13
+ - ask_question for clarification
14
+ - Keyword-to-capability mapping
15
+ - Write `task-analysis.json`
16
+
17
+ If task context requires codebase knowledge, set `needs_research: true`. Phase 2 will spawn researcher worker.
18
+
19
+ ## When to Use
20
+
21
+ | Trigger | Condition |
22
+ |---------|-----------|
23
+ | New task | Coordinator Phase 1 receives task description |
24
+ | Re-analysis | User provides revised requirements |
25
+ | Adapt | handleAdapt extends analysis for new capability |
26
+
27
+ ## Strategy
28
+
29
+ - **Delegation**: Inline execution (coordinator processes directly)
30
+ - **Mode**: Text-level analysis only (no codebase reading)
31
+ - **Output**: `<session>/task-analysis.json`
32
+
33
+ ## Phase 2: Context Loading
34
+
35
+ | Input | Source | Required |
36
+ |-------|--------|----------|
37
+ | Task description | User input from Phase 1 | Yes |
38
+ | Clarification answers | ask_question results (if any) | No |
39
+ | Session folder | From coordinator Phase 2 | Yes |
40
+
41
+ ## Phase 3: Task Analysis
42
+
43
+ ### Step 1: Signal Detection
44
+
45
+ Scan task description for capability keywords:
46
+
47
+ | Signal | Keywords | Capability | Prefix | Responsibility Type |
48
+ |--------|----------|------------|--------|---------------------|
49
+ | Research | investigate, explore, compare, survey, find, research, discover, benchmark, study | researcher | RESEARCH | orchestration |
50
+ | Writing | write, draft, document, article, report, blog, describe, explain, summarize, content | writer | DRAFT | code-gen (docs) |
51
+ | Coding | implement, build, code, fix, refactor, develop, create app, program, migrate, port | developer | IMPL | code-gen (code) |
52
+ | Design | design, architect, plan, structure, blueprint, model, schema, wireframe, layout | designer | DESIGN | orchestration |
53
+ | Analysis | analyze, review, audit, assess, evaluate, inspect, examine, diagnose, profile | analyst | ANALYSIS | read-only |
54
+ | Testing | test, verify, validate, QA, quality, check, assert, coverage, regression | tester | TEST | validation |
55
+ | Planning | plan, breakdown, organize, schedule, decompose, roadmap, strategy, prioritize | planner | PLAN | orchestration |
56
+
57
+ **Multi-match**: A task may trigger multiple capabilities.
58
+
59
+ **No match**: Default to a single `general` capability with `TASK` prefix.
60
+
61
+ ### Step 2: Artifact Inference
62
+
63
+ Each capability produces default output artifacts:
64
+
65
+ | Capability | Default Artifact | Format |
66
+ |------------|-----------------|--------|
67
+ | researcher | Research findings | `<session>/artifacts/research-findings.md` |
68
+ | writer | Written document(s) | `<session>/artifacts/<doc-name>.md` |
69
+ | developer | Code implementation | Source files + `<session>/artifacts/implementation-summary.md` |
70
+ | designer | Design document | `<session>/artifacts/design-spec.md` |
71
+ | analyst | Analysis report | `<session>/artifacts/analysis-report.md` |
72
+ | tester | Test results | `<session>/artifacts/test-report.md` |
73
+ | planner | Execution plan | `<session>/artifacts/execution-plan.md` |
74
+
75
+ ### Step 2.5: Key File Inference
76
+
77
+ For each task, infer relevant files based on capability type and task keywords:
78
+
79
+ | Capability | File Inference Strategy |
80
+ |------------|------------------------|
81
+ | researcher | Extract domain keywords → map to likely directories (e.g., "auth" → `src/auth/**`, `middleware/auth.ts`) |
82
+ | developer | Extract feature/module keywords → map to source files (e.g., "payment" → `src/payments/**`, `types/payment.ts`) |
83
+ | designer | Look for architecture/config keywords → map to config/schema files |
84
+ | analyst | Extract target keywords → map to files under analysis |
85
+ | tester | Extract test target keywords → map to source + test files |
86
+ | writer | Extract documentation target → map to relevant source files for context |
87
+ | planner | No specific files (planning is abstract) |
88
+
89
+ **Inference rules:**
90
+ - Extract nouns and verbs from task description
91
+ - Match against common directory patterns (src/, lib/, components/, services/, utils/)
92
+ - Include related type definition files (types/, *.d.ts)
93
+ - For "fix bug" tasks, include error-prone areas (error handlers, validation)
94
+ - For "implement feature" tasks, include similar existing features as reference
95
+
96
+ ### Step 3: Dependency Graph Construction
97
+
98
+ Build a DAG of work streams using natural ordering tiers:
99
+
100
+ | Tier | Capabilities | Description |
101
+ |------|-------------|-------------|
102
+ | 0 | researcher, planner | Knowledge gathering / planning |
103
+ | 1 | designer | Design (requires context from tier 0 if present) |
104
+ | 2 | writer, developer | Creation (requires design/plan if present) |
105
+ | 3 | analyst, tester | Validation (requires artifacts to validate) |
106
+
107
+ ### Step 4: Complexity Scoring
108
+
109
+ | Factor | Weight | Condition |
110
+ |--------|--------|-----------|
111
+ | Capability count | +1 each | Number of distinct capabilities |
112
+ | Cross-domain factor | +2 | Capabilities span 3+ tiers |
113
+ | Parallel tracks | +1 each | Independent parallel work streams |
114
+ | Serial depth | +1 per level | Longest dependency chain length |
115
+
116
+ | Total Score | Complexity | Role Limit |
117
+ |-------------|------------|------------|
118
+ | 1-3 | Low | 1-2 roles |
119
+ | 4-6 | Medium | 2-3 roles |
120
+ | 7+ | High | 3-5 roles |
121
+
122
+ ### Step 5: Role Minimization
123
+
124
+ Apply merging rules to reduce role count (cap at 5).
125
+
126
+ ### Step 6: Role-Spec Metadata Assignment
127
+
128
+ For each role, determine frontmatter and generation hints:
129
+
130
+ | Field | Derivation |
131
+ |-------|------------|
132
+ | `prefix` | From capability prefix (e.g., RESEARCH, DRAFT, IMPL) |
133
+ | `inner_loop` | `true` if role has 2+ serial same-prefix tasks |
134
+ | `CLI tools` | Suggested, not mandatory — coordinator may adjust based on task needs |
135
+ | `pattern_hint` | Reference pattern name from role-spec-template (research/document/code/analysis/validation) — guides coordinator's Phase 2-4 composition, NOT a rigid template selector |
136
+ | `output_type` | `artifact` (new files in session/artifacts/) / `codebase` (modify existing project files) / `mixed` (both) — determines verification strategy in Behavioral Traits |
137
+ | `message_types.success` | `<prefix>_complete` |
138
+ | `message_types.error` | `error` |
139
+
140
+ **output_type derivation**:
141
+
142
+ | Task Signal | output_type | Example |
143
+ |-------------|-------------|---------|
144
+ | "write report", "analyze", "research" | `artifact` | New analysis-report.md in session |
145
+ | "update docs", "modify code", "fix bug" | `codebase` | Modify existing project files |
146
+ | "implement feature + write summary" | `mixed` | Code changes + implementation summary |
147
+
148
+ ## Phase 4: Output
149
+
150
+ Write `<session-folder>/task-analysis.json`:
151
+
152
+ ```json
153
+ {
154
+ "task_description": "<original user input>",
155
+ "capabilities": [
156
+ {
157
+ "name": "researcher",
158
+ "prefix": "RESEARCH",
159
+ "responsibility_type": "orchestration",
160
+ "tasks": [
161
+ {
162
+ "id": "RESEARCH-001",
163
+ "goal": "What this task achieves and why",
164
+ "steps": [
165
+ "step 1: specific action with clear verb",
166
+ "step 2: specific action with clear verb",
167
+ "step 3: specific action with clear verb"
168
+ ],
169
+ "key_files": [
170
+ "src/path/to/relevant.ts",
171
+ "src/path/to/other.ts"
172
+ ],
173
+ "upstream_artifacts": [],
174
+ "success_criteria": "Measurable completion condition",
175
+ "constraints": "Scope limits, focus areas"
176
+ }
177
+ ],
178
+ "artifacts": ["research-findings.md"]
179
+ }
180
+ ],
181
+ "dependency_graph": {
182
+ "RESEARCH-001": [],
183
+ "DRAFT-001": ["RESEARCH-001"],
184
+ "ANALYSIS-001": ["DRAFT-001"]
185
+ },
186
+ "roles": [
187
+ {
188
+ "name": "researcher",
189
+ "prefix": "RESEARCH",
190
+ "responsibility_type": "orchestration",
191
+ "task_count": 1,
192
+ "inner_loop": false,
193
+ "role_spec_metadata": {
194
+ "CLI tools": ["explore"],
195
+ "pattern_hint": "research",
196
+ "output_type": "artifact",
197
+ "message_types": {
198
+ "success": "research_complete",
199
+ "error": "error"
200
+ }
201
+ }
202
+ }
203
+ ],
204
+ "complexity": {
205
+ "capability_count": 2,
206
+ "cross_domain_factor": false,
207
+ "parallel_tracks": 0,
208
+ "serial_depth": 2,
209
+ "total_score": 3,
210
+ "level": "low"
211
+ },
212
+ "needs_research": false,
213
+ "artifacts": [
214
+ { "name": "research-findings.md", "producer": "researcher", "path": "artifacts/research-findings.md" }
215
+ ]
216
+ }
217
+ ```
218
+
219
+ ## Complexity Interpretation
220
+
221
+ **CRITICAL**: Complexity score is for **role design optimization**, NOT for skipping team workflow.
222
+
223
+ | Complexity | Team Structure | Coordinator Action |
224
+ |------------|----------------|-------------------|
225
+ | Low (1-2 roles) | Minimal team | Generate 1-2 role-specs, create team, spawn workers |
226
+ | Medium (2-3 roles) | Standard team | Generate role-specs, create team, spawn workers |
227
+ | High (3-5 roles) | Full team | Generate role-specs, create team, spawn workers |
228
+
229
+ **All complexity levels use team-worker architecture**:
230
+ - Single-role tasks still spawn team-worker agent
231
+ - Coordinator NEVER executes task work directly
232
+ - Team infrastructure provides session management, message bus, fast-advance
233
+
234
+ **Purpose of complexity score**:
235
+ - ✅ Determine optimal role count (merge vs separate)
236
+ - ✅ Guide dependency graph design
237
+ - ✅ Inform user about task scope
238
+ - ❌ NOT for deciding whether to use team workflow
239
+
240
+ ## Error Handling
241
+
242
+ | Scenario | Resolution |
243
+ |----------|------------|
244
+ | No capabilities detected | Default to single `general` role with TASK prefix |
245
+ | Circular dependency in graph | Break cycle at lowest-tier edge, warn |
246
+ | Task description too vague | Return minimal analysis, coordinator will ask_question |
247
+ | All capabilities merge into one | Valid -- single-role execution via team-worker |
@@ -0,0 +1,131 @@
1
+ # Command: dispatch
2
+
3
+ ## Purpose
4
+
5
+ Create task chains from dynamic dependency graphs. Builds pipelines from the task-analysis.json produced by Phase 1. Workers are spawned as team-worker agents with role-spec paths.
6
+
7
+ ## When to Use
8
+
9
+ | Trigger | Condition |
10
+ |---------|-----------|
11
+ | After analysis | Phase 1 complete, task-analysis.json exists |
12
+ | After adapt | handleAdapt created new roles, needs new tasks |
13
+ | Re-dispatch | Pipeline restructuring (rare) |
14
+
15
+ ## Strategy
16
+
17
+ - **Delegation**: Inline execution (coordinator processes directly)
18
+ - **Inputs**: task-analysis.json + team-session.json
19
+ - **Output**: TaskCreate calls with dependency chains
20
+
21
+ ## Phase 2: Context Loading
22
+
23
+ | Input | Source | Required |
24
+ |-------|--------|----------|
25
+ | Task analysis | `<session-folder>/task-analysis.json` | Yes |
26
+ | Session file | `<session-folder>/team-session.json` | Yes |
27
+ | Role registry | `team-session.json#roles` | Yes |
28
+ | Scope | User requirements description | Yes |
29
+
30
+ ## Phase 3: Task Chain Creation
31
+
32
+ ### Workflow
33
+
34
+ 1. **Read dependency graph** from `task-analysis.json#dependency_graph`
35
+ 2. **Topological sort** tasks to determine creation order
36
+ 3. **Validate** all task owners exist in role registry
37
+ 4. **For each task** (in topological order):
38
+
39
+ ```
40
+ TaskCreate({
41
+ subject: "<PREFIX>-<NNN>",
42
+ description: "PURPOSE: <goal> | Success: <success_criteria>
43
+ TASK:
44
+ - <step 1>
45
+ - <step 2>
46
+ - <step 3>
47
+ CONTEXT:
48
+ - Session: <session-folder>
49
+ - Upstream artifacts: <artifact-1.md>, <artifact-2.md>
50
+ - Key files: <file1>, <file2>
51
+ - Shared state: team_msg(operation="get_state", session_id=<session-id>)
52
+ EXPECTED: <deliverable path> + <quality criteria>
53
+ CONSTRAINTS: <scope limits>
54
+ ---
55
+ InnerLoop: <true|false>
56
+ RoleSpec: <session-folder>/role-specs/<role-name>.md"
57
+ })
58
+ TaskUpdate({ taskId: "<PREFIX>-<NNN>", addBlockedBy: [<dependency-list from graph>], owner: "<role-name>" })
59
+ ```
60
+
61
+ 5. **Update team-session.json** with pipeline and tasks_total
62
+ 6. **Validate** created chain
63
+
64
+ ### Task Description Template
65
+
66
+ Every task description includes structured fields for clarity:
67
+
68
+ ```
69
+ PURPOSE: <goal from task-analysis.json#tasks[].goal> | Success: <success_criteria from task-analysis.json#tasks[].success_criteria>
70
+ TASK:
71
+ - <step 1 from task-analysis.json#tasks[].steps[]>
72
+ - <step 2 from task-analysis.json#tasks[].steps[]>
73
+ - <step 3 from task-analysis.json#tasks[].steps[]>
74
+ CONTEXT:
75
+ - Session: <session-folder>
76
+ - Upstream artifacts: <comma-separated list from task-analysis.json#tasks[].upstream_artifacts[]>
77
+ - Key files: <comma-separated list from task-analysis.json#tasks[].key_files[]>
78
+ - Shared state: team_msg(operation="get_state", session_id=<session-id>)
79
+ EXPECTED: <artifact path from task-analysis.json#capabilities[].artifacts[]> + <quality criteria based on capability type>
80
+ CONSTRAINTS: <constraints from task-analysis.json#tasks[].constraints>
81
+ ---
82
+ InnerLoop: <true|false>
83
+ RoleSpec: <session-folder>/role-specs/<role-name>.md
84
+ ```
85
+
86
+ **Field Mapping**:
87
+ - `PURPOSE`: From `task-analysis.json#capabilities[].tasks[].goal` + `success_criteria`
88
+ - `TASK`: From `task-analysis.json#capabilities[].tasks[].steps[]`
89
+ - `CONTEXT.Upstream artifacts`: From `task-analysis.json#capabilities[].tasks[].upstream_artifacts[]`
90
+ - `CONTEXT.Key files`: From `task-analysis.json#capabilities[].tasks[].key_files[]`
91
+ - `EXPECTED`: From `task-analysis.json#capabilities[].artifacts[]` + quality criteria
92
+ - `CONSTRAINTS`: From `task-analysis.json#capabilities[].tasks[].constraints`
93
+
94
+ ### InnerLoop Flag Rules
95
+
96
+ | Condition | InnerLoop |
97
+ |-----------|-----------|
98
+ | Role has 2+ serial same-prefix tasks | true |
99
+ | Role has 1 task | false |
100
+ | Tasks are parallel (no dependency between them) | false |
101
+
102
+ ### Dependency Validation
103
+
104
+ | Check | Criteria |
105
+ |-------|----------|
106
+ | No orphan tasks | Every task is reachable from at least one root |
107
+ | No circular deps | Topological sort succeeds without cycle |
108
+ | All owners valid | Every task owner exists in team-session.json#roles |
109
+ | All blockedBy valid | Every blockedBy references an existing task subject |
110
+ | Session reference | Every task description contains `Session: <session-folder>` |
111
+ | RoleSpec reference | Every task description contains `RoleSpec: <path>` |
112
+
113
+ ## Phase 4: Validation
114
+
115
+ | Check | Criteria |
116
+ |-------|----------|
117
+ | Task count | Matches dependency_graph node count |
118
+ | Dependencies | Every blockedBy references an existing task subject |
119
+ | Owner assignment | Each task owner is in role registry |
120
+ | Session reference | Every task description contains `Session:` |
121
+ | Pipeline integrity | No disconnected subgraphs (warn if found) |
122
+
123
+ ## Error Handling
124
+
125
+ | Scenario | Resolution |
126
+ |----------|------------|
127
+ | Circular dependency detected | Report cycle, halt task creation |
128
+ | Owner not in role registry | Error, coordinator must fix roles first |
129
+ | TaskCreate fails | Log error, report to coordinator |
130
+ | Duplicate task subject | Skip creation, log warning |
131
+ | Empty dependency graph | Error, task analysis may have failed |