@rune-kit/rune 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +8 -6
  3. package/commands/rune.md +168 -168
  4. package/contexts/dev.md +34 -34
  5. package/contexts/research.md +43 -43
  6. package/contexts/review.md +55 -55
  7. package/extensions/ai-ml/PACK.md +88 -88
  8. package/extensions/ai-ml/skills/ai-agents.md +172 -172
  9. package/extensions/ai-ml/skills/code-sandbox.md +187 -187
  10. package/extensions/ai-ml/skills/deep-research.md +146 -146
  11. package/extensions/ai-ml/skills/embedding-search.md +66 -66
  12. package/extensions/ai-ml/skills/fine-tuning-guide.md +74 -74
  13. package/extensions/ai-ml/skills/llm-architect.md +125 -125
  14. package/extensions/ai-ml/skills/llm-integration.md +64 -64
  15. package/extensions/ai-ml/skills/prompt-patterns.md +72 -72
  16. package/extensions/ai-ml/skills/rag-patterns.md +66 -66
  17. package/extensions/ai-ml/skills/web-extraction.md +114 -114
  18. package/extensions/analytics/PACK.md +92 -92
  19. package/extensions/analytics/skills/ab-testing.md +72 -72
  20. package/extensions/analytics/skills/dashboard-patterns.md +83 -83
  21. package/extensions/analytics/skills/data-validation.md +68 -68
  22. package/extensions/analytics/skills/funnel-analysis.md +81 -81
  23. package/extensions/analytics/skills/sql-patterns.md +57 -57
  24. package/extensions/analytics/skills/statistical-analysis.md +79 -79
  25. package/extensions/analytics/skills/tracking-setup.md +71 -71
  26. package/extensions/backend/PACK.md +104 -104
  27. package/extensions/backend/skills/api-patterns.md +84 -84
  28. package/extensions/backend/skills/async-pipeline.md +193 -193
  29. package/extensions/backend/skills/auth-patterns.md +97 -97
  30. package/extensions/backend/skills/background-jobs.md +133 -133
  31. package/extensions/backend/skills/caching-patterns.md +108 -108
  32. package/extensions/backend/skills/cli-generation.md +133 -133
  33. package/extensions/backend/skills/database-patterns.md +87 -87
  34. package/extensions/backend/skills/middleware-patterns.md +104 -104
  35. package/extensions/chrome-ext/PACK.md +93 -93
  36. package/extensions/chrome-ext/skills/cws-preflight.md +143 -143
  37. package/extensions/chrome-ext/skills/cws-publish.md +104 -104
  38. package/extensions/chrome-ext/skills/ext-ai-integration.md +251 -251
  39. package/extensions/chrome-ext/skills/ext-messaging.md +139 -139
  40. package/extensions/chrome-ext/skills/ext-storage.md +133 -133
  41. package/extensions/chrome-ext/skills/mv3-scaffold.md +164 -164
  42. package/extensions/content/PACK.md +96 -96
  43. package/extensions/content/skills/blog-patterns.md +88 -88
  44. package/extensions/content/skills/cms-integration.md +131 -131
  45. package/extensions/content/skills/content-scoring.md +107 -107
  46. package/extensions/content/skills/i18n.md +83 -83
  47. package/extensions/content/skills/mdx-authoring.md +137 -137
  48. package/extensions/content/skills/reference.md +1014 -1014
  49. package/extensions/content/skills/seo-patterns.md +67 -67
  50. package/extensions/content/skills/video-repurpose.md +153 -153
  51. package/extensions/devops/PACK.md +101 -101
  52. package/extensions/devops/skills/chaos-testing.md +67 -67
  53. package/extensions/devops/skills/ci-cd.md +75 -75
  54. package/extensions/devops/skills/docker.md +58 -58
  55. package/extensions/devops/skills/edge-serverless.md +163 -163
  56. package/extensions/devops/skills/infra-as-code.md +158 -158
  57. package/extensions/devops/skills/kubernetes.md +110 -110
  58. package/extensions/devops/skills/monitoring.md +57 -57
  59. package/extensions/devops/skills/server-setup.md +64 -64
  60. package/extensions/devops/skills/ssl-domain.md +42 -42
  61. package/extensions/ecommerce/PACK.md +116 -116
  62. package/extensions/ecommerce/skills/cart-system.md +79 -79
  63. package/extensions/ecommerce/skills/inventory-mgmt.md +102 -102
  64. package/extensions/ecommerce/skills/order-management.md +126 -126
  65. package/extensions/ecommerce/skills/payment-integration.md +472 -472
  66. package/extensions/ecommerce/skills/shopify-dev.md +69 -69
  67. package/extensions/ecommerce/skills/subscription-billing.md +93 -93
  68. package/extensions/ecommerce/skills/tax-compliance.md +117 -117
  69. package/extensions/gamedev/PACK.md +142 -142
  70. package/extensions/gamedev/skills/asset-pipeline.md +74 -74
  71. package/extensions/gamedev/skills/audio-system.md +129 -129
  72. package/extensions/gamedev/skills/camera-system.md +87 -87
  73. package/extensions/gamedev/skills/ecs.md +98 -98
  74. package/extensions/gamedev/skills/game-loops.md +72 -72
  75. package/extensions/gamedev/skills/input-system.md +199 -199
  76. package/extensions/gamedev/skills/multiplayer.md +180 -180
  77. package/extensions/gamedev/skills/particles.md +105 -105
  78. package/extensions/gamedev/skills/physics-engine.md +89 -89
  79. package/extensions/gamedev/skills/scene-management.md +146 -146
  80. package/extensions/gamedev/skills/threejs-patterns.md +90 -90
  81. package/extensions/gamedev/skills/webgl.md +71 -71
  82. package/extensions/mobile/PACK.md +106 -106
  83. package/extensions/mobile/skills/app-store-connect.md +152 -152
  84. package/extensions/mobile/skills/app-store-prep.md +66 -66
  85. package/extensions/mobile/skills/deep-linking.md +109 -109
  86. package/extensions/mobile/skills/flutter.md +60 -60
  87. package/extensions/mobile/skills/ios-build-pipeline.md +142 -142
  88. package/extensions/mobile/skills/native-bridge.md +66 -66
  89. package/extensions/mobile/skills/ota-updates.md +97 -97
  90. package/extensions/mobile/skills/push-notifications.md +111 -111
  91. package/extensions/mobile/skills/react-native.md +82 -82
  92. package/extensions/saas/PACK.md +116 -116
  93. package/extensions/saas/skills/billing-integration.md +200 -200
  94. package/extensions/saas/skills/feature-flags.md +130 -130
  95. package/extensions/saas/skills/multi-tenant.md +103 -103
  96. package/extensions/saas/skills/onboarding-flow.md +139 -139
  97. package/extensions/saas/skills/subscription-flow.md +95 -95
  98. package/extensions/saas/skills/team-management.md +144 -144
  99. package/extensions/security/PACK.md +99 -99
  100. package/extensions/security/skills/api-security.md +140 -140
  101. package/extensions/security/skills/compliance.md +68 -68
  102. package/extensions/security/skills/owasp-audit.md +64 -64
  103. package/extensions/security/skills/pentest-patterns.md +77 -77
  104. package/extensions/security/skills/secret-mgmt.md +65 -65
  105. package/extensions/security/skills/supply-chain.md +65 -65
  106. package/extensions/trading/PACK.md +80 -80
  107. package/extensions/trading/skills/chart-components.md +55 -55
  108. package/extensions/trading/skills/experiment-loop.md +125 -125
  109. package/extensions/trading/skills/fintech-patterns.md +47 -47
  110. package/extensions/trading/skills/indicator-library.md +58 -58
  111. package/extensions/trading/skills/quant-analysis.md +111 -111
  112. package/extensions/trading/skills/realtime-data.md +58 -58
  113. package/extensions/trading/skills/trade-logic.md +104 -104
  114. package/extensions/ui/PACK.md +130 -130
  115. package/extensions/ui/skills/a11y-audit.md +91 -91
  116. package/extensions/ui/skills/animation-patterns.md +127 -127
  117. package/extensions/ui/skills/component-patterns.md +100 -100
  118. package/extensions/ui/skills/design-decision.md +108 -108
  119. package/extensions/ui/skills/design-system.md +68 -68
  120. package/extensions/ui/skills/landing-patterns.md +155 -155
  121. package/extensions/ui/skills/palette-picker.md +173 -173
  122. package/extensions/ui/skills/react-health.md +90 -90
  123. package/extensions/ui/skills/type-system.md +125 -125
  124. package/extensions/ui/skills/web-vitals.md +153 -153
  125. package/extensions/zalo/PACK.md +145 -145
  126. package/extensions/zalo/skills/zalo-oa-mcp.md +317 -317
  127. package/extensions/zalo/skills/zalo-oa-messaging.md +429 -429
  128. package/extensions/zalo/skills/zalo-oa-setup.md +236 -236
  129. package/extensions/zalo/skills/zalo-oa-webhook.md +189 -189
  130. package/extensions/zalo/skills/zalo-personal-messaging.md +194 -194
  131. package/extensions/zalo/skills/zalo-personal-setup.md +153 -153
  132. package/extensions/zalo/skills/zalo-rate-guard.md +219 -219
  133. package/hooks/auto-format/index.cjs +48 -48
  134. package/hooks/hooks.json +111 -111
  135. package/hooks/post-session-reflect/index.cjs +189 -189
  136. package/hooks/pre-compact/index.cjs +95 -95
  137. package/hooks/run-hook.cmd +1 -1
  138. package/hooks/secrets-scan/index.cjs +100 -100
  139. package/hooks/session-start/index.cjs +71 -71
  140. package/hooks/typecheck/index.cjs +65 -65
  141. package/package.json +63 -63
  142. package/references/ui-pro-max-data/LICENSE-UI-PRO-MAX +21 -21
  143. package/references/ui-pro-max-data/charts.csv +26 -26
  144. package/references/ui-pro-max-data/colors.csv +161 -161
  145. package/references/ui-pro-max-data/styles.csv +68 -68
  146. package/references/ui-pro-max-data/typography.csv +74 -74
  147. package/references/ui-pro-max-data/ui-reasoning.csv +162 -162
  148. package/references/ui-pro-max-data/ux-guidelines.csv +99 -99
  149. package/skills/adversary/SKILL.md +283 -283
  150. package/skills/asset-creator/SKILL.md +157 -157
  151. package/skills/audit/SKILL.md +147 -2
  152. package/skills/autopsy/SKILL.md +335 -335
  153. package/skills/brainstorm/SKILL.md +342 -342
  154. package/skills/browser-pilot/SKILL.md +168 -168
  155. package/skills/constraint-check/SKILL.md +165 -165
  156. package/skills/context-engine/SKILL.md +404 -404
  157. package/skills/cook/SKILL.md +917 -863
  158. package/skills/db/SKILL.md +273 -273
  159. package/skills/debug/SKILL.md +465 -465
  160. package/skills/dependency-doctor/SKILL.md +265 -235
  161. package/skills/deploy/SKILL.md +274 -231
  162. package/skills/design/DESIGN-REFERENCE.md +365 -365
  163. package/skills/design/SKILL.md +589 -589
  164. package/skills/doc-processor/SKILL.md +254 -254
  165. package/skills/docs/SKILL.md +374 -374
  166. package/skills/docs-seeker/SKILL.md +177 -177
  167. package/skills/fix/SKILL.md +330 -330
  168. package/skills/git/SKILL.md +339 -339
  169. package/skills/hallucination-guard/SKILL.md +219 -219
  170. package/skills/incident/SKILL.md +254 -253
  171. package/skills/integrity-check/SKILL.md +169 -169
  172. package/skills/journal/SKILL.md +240 -240
  173. package/skills/launch/SKILL.md +344 -344
  174. package/skills/logic-guardian/SKILL.md +251 -251
  175. package/skills/marketing/SKILL.md +290 -289
  176. package/skills/mcp-builder/SKILL.md +425 -425
  177. package/skills/neural-memory/SKILL.md +362 -362
  178. package/skills/onboard/SKILL.md +404 -403
  179. package/skills/perf/SKILL.md +346 -346
  180. package/skills/plan/SKILL.md +433 -428
  181. package/skills/preflight/SKILL.md +415 -415
  182. package/skills/problem-solver/SKILL.md +380 -284
  183. package/skills/rescue/SKILL.md +474 -474
  184. package/skills/retro/SKILL.md +3 -1
  185. package/skills/review/SKILL.md +612 -588
  186. package/skills/review-intake/SKILL.md +249 -249
  187. package/skills/safeguard/SKILL.md +200 -200
  188. package/skills/sast/SKILL.md +190 -190
  189. package/skills/scaffold/SKILL.md +328 -287
  190. package/skills/scope-guard/SKILL.md +180 -180
  191. package/skills/scout/SKILL.md +263 -263
  192. package/skills/sentinel/SKILL.md +382 -381
  193. package/skills/sentinel-env/SKILL.md +254 -254
  194. package/skills/sequential-thinking/SKILL.md +234 -234
  195. package/skills/session-bridge/SKILL.md +543 -543
  196. package/skills/skill-forge/SKILL.md +581 -581
  197. package/skills/skill-router/SKILL.md +3 -0
  198. package/skills/surgeon/SKILL.md +215 -215
  199. package/skills/team/SKILL.md +556 -537
  200. package/skills/test/SKILL.md +614 -614
  201. package/skills/trend-scout/SKILL.md +145 -145
  202. package/skills/verification/SKILL.md +326 -326
  203. package/skills/video-creator/SKILL.md +201 -201
  204. package/skills/watchdog/SKILL.md +168 -168
  205. package/skills/worktree/SKILL.md +140 -140
@@ -1,537 +1,556 @@
1
- ---
2
- name: team
3
- description: "Multi-agent meta-orchestrator. Use when task spans 5+ files or 3+ modules, or when user says 'parallel', 'split this up', 'do all of these'. Decomposes large tasks into parallel workstreams, assigns to isolated cook instances, coordinates merging."
4
- context: fork
5
- agent: general-purpose
6
- metadata:
7
- author: runedev
8
- version: "0.8.0"
9
- layer: L1
10
- model: opus
11
- group: orchestrator
12
- tools: "Read, Write, Edit, Bash, Glob, Grep"
13
- emit: phase.complete
14
- ---
15
-
16
- # team
17
-
18
- ## Purpose
19
-
20
- Meta-orchestrator for complex tasks requiring parallel workstreams. Team decomposes large features into independent subtasks, assigns each to an isolated cook instance (using git worktrees), coordinates progress, and merges results. Uses opus for strategic decomposition and conflict resolution.
21
-
22
- <HARD-GATE>
23
- - MAX 3 PARALLEL AGENTS: Never launch more than 3 Task calls simultaneously. If more than 3 streams exist, batch them.
24
- - No merge without conflict resolution complete (Phase 3 clean).
25
- - Full integration tests MUST run before reporting success.
26
- </HARD-GATE>
27
-
28
- ## Triggers
29
-
30
- - `/rune team <task>` — manual invocation for large features
31
- - Auto-trigger: when task affects 5+ files or spans 3+ modules
32
-
33
- ## Mode Selection (Auto-Detect)
34
-
35
- ```
36
- IF streams ≤ 2 AND total files ≤ 5:
37
- → LITE MODE (lightweight parallel, no worktrees)
38
- ELSE:
39
- → FULL MODE (worktree isolation, opus coordination)
40
- ```
41
-
42
- ### Lite Mode
43
-
44
- For small parallel tasks that don't warrant full worktree isolation:
45
-
46
- ```
47
- Lite Mode Rules:
48
- - Max 2 parallel agents (haiku coordination, sonnet workers)
49
- - NO worktree creation — agents work on same branch
50
- - File ownership still enforced (disjoint file sets)
51
- - Simplified merge: sequential git add (no merge conflicts possible with disjoint files)
52
- - Skip Phase 3 (COORDINATE) — no conflicts with disjoint files
53
- - Skip integrity-check — small scope, direct output review
54
- - Coordinator model: haiku (not opus) — saves cost
55
-
56
- Lite Mode Phases:
57
- Phase 1: DECOMPOSE (haiku) — identify 2 streams with disjoint files
58
- Phase 2: ASSIGN — launch 2 parallel Task agents (sonnet, no worktree)
59
- Phase 4: MERGE — sequential git add (no merge needed)
60
- Phase 5: VERIFY — integration tests on result
61
- ```
62
-
63
- **Announce mode**: "Team lite mode: 2 streams, ≤5 files, no worktrees needed."
64
- **Override**: User can say "full mode" to force worktree isolation.
65
-
66
- ### Full Mode
67
-
68
- Standard team workflow with worktree isolation (Phases 1-5 as documented below).
69
-
70
- ### Complexity Tiers (DAG Stage Selection)
71
-
72
- Before decomposing, classify the task into a complexity tier. Each tier defines a different DAG (directed acyclic graph) of stages, ensuring the right amount of process for the task's complexity.
73
-
74
- | Tier | Signals | DAG Stages | Context Windows |
75
- |------|---------|------------|-----------------|
76
- | **Trivial** | ≤3 files, single module, no shared contracts | impl → test | 1 (single cook) |
77
- | **Medium** | 4-10 files, 2-3 modules, shared interfaces | research → plan → impl → test → review → fix | 3 (plan, impl+test, review+fix) |
78
- | **Large** | 10+ files, 3+ modules, breaking changes or RFC | research → plan → impl → test → review₁ → fix → review₂ → final merge | 4+ (plan, impl+test, review₁+fix, review₂+merge) |
79
-
80
- **Key principle — reviewer isolation**: The agent that writes code MUST NOT review its own code. Each review stage uses a **separate context window** (separate Task invocation) that has never seen the implementation reasoning. This prevents author bias from contaminating the review.
81
-
82
- **Stage → Context Window mapping**:
83
- - `research + plan` = Context Window 1 (opus — architectural reasoning)
84
- - `impl + test` = Context Window 2 (sonnet — code writing)
85
- - `review₁ + fix` = Context Window 3 (sonnet — fresh eyes, no impl context)
86
- - `review₂ + merge` = Context Window 4 (sonnet — final verification, Large tier only)
87
-
88
- **Merge queue**: When multiple streams complete at different times, use dependency order for merging. If a later stream's merge creates conflicts with an already-merged stream, provide the conflicting stream's cook report as **conflict context** to the resolution agent — never resolve blindly.
89
-
90
- ## Calls (outbound)
91
-
92
- - `plan` (L2): high-level task decomposition into independent workstreams
93
- - `scout` (L2): understand full project scope and module boundaries
94
- # Exception: L1→L1 meta-orchestration (team is the only L1 that calls other L1s)
95
- - `cook` (L1): delegate feature tasks to parallel instances (worktree isolation)
96
- - `launch` (L1): delegate deployment/marketing when build is complete
97
- - `rescue` (L1): delegate legacy refactoring when rescue work detected
98
- - `integrity-check` (L3): verify cook report integrity before merge
99
- - `completion-gate` (L3): validate workstream completion claims against evidence
100
- - `constraint-check` (L3): audit HARD-GATE compliance across parallel streams
101
- - `worktree` (L3): create isolated worktrees for parallel cook instances
102
- - `context-pack` (L3): create structured handoff briefings before spawning subagents
103
- - L4 extension packs: domain-specific patterns when context matches (e.g., @rune/mobile when porting web to mobile)
104
-
105
- ## Called By (inbound)
106
-
107
- - User: `/rune team <task>` direct invocation only
108
-
109
- ---
110
-
111
- ## Execution
112
-
113
- ### Step 0 — Initialize TodoWrite
114
-
115
- ```
116
- TodoWrite([
117
- { content: "DECOMPOSE: Scout modules and plan workstreams", status: "pending", activeForm: "Decomposing task into workstreams" },
118
- { content: "ASSIGN: Launch parallel cook agents in worktrees", status: "pending", activeForm: "Assigning streams to cook agents" },
119
- { content: "COORDINATE: Monitor streams, resolve conflicts", status: "pending", activeForm: "Coordinating parallel streams" },
120
- { content: "MERGE: Merge worktrees back to main", status: "pending", activeForm: "Merging worktrees to main" },
121
- { content: "VERIFY: Run integration tests on merged result", status: "pending", activeForm: "Verifying integration" }
122
- ])
123
- ```
124
-
125
- ---
126
-
127
- ### Phase 1 — DECOMPOSE
128
-
129
- Mark todo[0] `in_progress`.
130
-
131
- **1a. Map module boundaries.**
132
-
133
- ```
134
- REQUIRED SUB-SKILL: rune:scout
135
- Invoke `scout` with the full task description.
136
- Scout returns: module list, file ownership map, dependency graph.
137
- Capture: which modules are independent vs. coupled.
138
- ```
139
-
140
- **1b. Break into workstreams.**
141
-
142
- ```
143
- REQUIRED SUB-SKILL: rune:plan
144
- Invoke `plan` with scout output + task description.
145
- Plan returns: ordered list of workstreams, each with:
146
- - stream_id: "A" | "B" | "C" (max 3)
147
- - task: specific sub-task description
148
- - files: list of files this stream owns
149
- - depends_on: [] | ["B"] (empty = parallel-safe)
150
- ```
151
-
152
- **1c. Validate decomposition.**
153
-
154
- ```
155
- GATE CHECK — before proceeding:
156
- [ ] Each stream owns disjoint file sets (no overlap)
157
- [ ] No coupled modules across streams:
158
- Use Grep to find import/require statements in each stream's owned files
159
- If stream A files import from stream B files → flag as COUPLED
160
- COUPLED modules MUST be moved to same stream OR stream B added to A's depends_on
161
- [ ] Dependent streams have explicit depends_on declared
162
- [ ] Total streams 3
163
- [ ] Change Stacking check: no file appears in touches[] of 2+ parallel streams
164
- [ ] Every stream's requires[] is satisfied by a prior stream's provides[] or existing code
165
-
166
- If any check fails → re-invoke plan with conflict notes.
167
- ```
168
-
169
- **1d. Question Gate (non-trivial tasks only).**
170
-
171
- > From superpowers (obra/superpowers, 84k★): "Subagents that start work without asking questions produce the wrong thing 40% of the time."
172
-
173
- Before dispatching streams, include in each NEXUS Handoff: "Before starting, ask up to 3 clarifying questions if anything is unclear about scope, conventions, or expected output."
174
-
175
- - If a cook agent returns questions instead of starting work → answer them, then re-dispatch
176
- - If a cook agent starts work without questions proceed normally (questions are invited, not required)
177
- - **Skip if**: Lite mode (2 streams, ≤5 files) overhead exceeds value
178
-
179
- Mark todo[0] `completed`.
180
-
181
- ---
182
-
183
- ### Phase 2 — ASSIGN
184
-
185
- Mark todo[1] `in_progress`.
186
-
187
- **2a. Launch parallel streams.**
188
-
189
- Launch independent streams (depends_on: []) in parallel using Task tool with worktree isolation.
190
-
191
- > From agency-agents (msitarzewski/agency-agents, 50.8k★): "Structured handoff docs prevent the #1 multi-agent failure: context loss between agents."
192
-
193
- Each stream receives a **NEXUS Handoff Template** — not a bare prompt:
194
-
195
- ```
196
- For each stream where depends_on == []:
197
- Task(
198
- subagent_type: "general-purpose",
199
- model: "sonnet",
200
- isolation: "worktree",
201
- prompt: <NEXUS Handoff below>
202
- )
203
- ```
204
-
205
- **NEXUS Handoff Template** (sent to each cook instance):
206
-
207
- ```markdown
208
- ## NEXUS Handoff: Stream [id]
209
-
210
- ### Metadata
211
- - Stream: [id] of [total]
212
- - Depends on: [none | stream ids]
213
- - File ownership: [list ONLY these files may be modified]
214
- - Model: sonnet
215
-
216
- ### Context
217
- - Project: [project name and type]
218
- - Overall goal: [1-line feature description]
219
- - This stream's goal: [specific sub-task]
220
- - Conventions: [key patterns from scout — naming, file structure, test framework]
221
-
222
- ### Deliverable
223
- - [ ] [specific outcome 1 — e.g., "AuthService with login/register/reset methods"]
224
- - [ ] [specific outcome 2 — e.g., "Unit tests covering happy path + 3 error cases"]
225
- - [ ] [specific outcome 3 — e.g., "Types exported for Phase 2 consumers"]
226
-
227
- ### Quality Expectations
228
- - Tests: must pass with evidence (stdout captured)
229
- - Types: no `any`, strict mode
230
- - Security: no hardcoded secrets, parameterized queries
231
- - Conventions: [project-specific from scout output]
232
-
233
- ### Evidence Required
234
- Return a Cook Report with:
235
- - Exact files modified (git diff --stat)
236
- - Test output (stdout not just "tests pass")
237
- - Any CONCERNS discovered during implementation
238
- ```
239
-
240
- **2b. Launch dependent streams sequentially.**
241
-
242
- ```
243
- For each stream where depends_on != []:
244
- WAIT for all depends_on streams to complete.
245
- Then launch with NEXUS Handoff that includes:
246
- - Completed stream's deliverables as "Available Context"
247
- - Exported interfaces/types from prior streams in "Code Contracts" section
248
- - Any CONCERNS from prior streams in "Known Issues" section
249
- ```
250
-
251
- **2b.5. Pre-merge scope verification.**
252
-
253
- After each stream completes (before collecting final report):
254
-
255
- ```
256
- Bash: git diff --name-only main...[worktree-branch]
257
- Compare actual modified files vs stream's planned file ownership list.
258
- If agent modified files OUTSIDE its declared scope:
259
- FLAG: "Stream [id] modified [file] outside its scope."
260
- Present to user for approval before proceeding to merge.
261
- If all files within scope: proceed normally.
262
- ```
263
-
264
- This catches scope creep BEFORE merge — much cheaper to fix than after.
265
-
266
- **2c. Collect cook reports.**
267
-
268
- Wait for all Task calls to return. Store each cook report keyed by stream_id.
269
-
270
- ```
271
- Error recovery:
272
- If a Task fails or returns error report:
273
- Log failure: "Stream [id] failed: [error]"
274
- If stream is non-blocking: continue with other streams
275
- → If stream is blocking (others depend on it): STOP, report to user with partial results
276
- ```
277
-
278
- Mark todo[1] `completed`.
279
-
280
- ---
281
-
282
- ### Phase 3 — COORDINATE
283
-
284
- Mark todo[2] `in_progress`.
285
-
286
- **3a. Check for file conflicts.**
287
-
288
- ```
289
- Bash: git diff --name-only [worktree-a-branch] [worktree-b-branch]
290
- ```
291
-
292
- If overlapping files detected between completed worktrees:
293
- - Identify the conflict source from cook reports
294
- - Determine which stream's version takes precedence (later stream wins by default)
295
- - Flag for manual resolution if ambiguous present to user before merge
296
-
297
- **3a.5. Verify cook report integrity.**
298
-
299
- ```
300
- REQUIRED SUB-SKILL: rune:integrity-check
301
- Invoke integrity-check on each cook report text.
302
- If any report returns TAINTED:
303
- BLOCK this stream from merge.
304
- Report: "Stream [id] cook report contains adversarial content."
305
- → If SUSPICIOUS: warn user, ask for confirmation before merge.
306
- ```
307
-
308
- **3b. Review cook report summaries.**
309
-
310
- For each completed stream, verify cook report contains:
311
- - Files modified
312
- - Tests passing
313
- - No unresolved TODOs or sentinel CRITICAL flags
314
-
315
- ```
316
- Error recovery:
317
- If cook report contains sentinel CRITICAL:
318
- BLOCK this stream from merge
319
- Report: "Stream [id] blocked: CRITICAL issue in [file] — [details]"
320
- Present to user for decision before continuing
321
- ```
322
-
323
- **3c. Evaluate subagent status per stream.**
324
-
325
- Each cook instance MUST have returned one of four statuses. Team handles them as follows:
326
-
327
- | Cook Status | Team Action |
328
- |-------------|-------------|
329
- | `DONE` | Stream cleared for merge — proceed normally |
330
- | `DONE_WITH_CONCERNS` | Stream cleared for merge, BUT trigger **cross-workstream review**: check if the concern impacts any other stream's files or contracts before merging ALL streams. Log concern in Team Report. |
331
- | `NEEDS_CONTEXT` | Stream paused present the specific question to user. Resume that stream after answer. Other independent streams may continue in parallel. |
332
- | `BLOCKED` | Stream blocked from merge. If stream has no dependents continue with remaining streams and report partial completion. If stream has dependents → STOP all dependent streams, present to user with full blocker details. |
333
-
334
- **Cross-workstream review (triggered by any DONE_WITH_CONCERNS)**:
335
-
336
- ```
337
- 1. Read the concern from the cook report
338
- 2. Check if the concern touches shared contracts, interfaces, or shared files
339
- Use Grep to find the concern's affected symbols/files across all worktrees
340
- 3. If concern is isolated to stream's own files proceed to merge (concern logged only)
341
- 4. If concern crosses stream boundariesresolve before merge:
342
- Present to user with: affected streams, concern details, two remediation options
343
- Do NOT merge any stream until user decides
344
- ```
345
-
346
- Mark todo[2] `completed`.
347
-
348
- ---
349
-
350
- ### Phase 4 — MERGE
351
-
352
- Mark todo[3] `in_progress`.
353
-
354
- **4a. Merge each worktree sequentially.**
355
-
356
- ```
357
- # Bookmark before any merge
358
- Bash: git tag pre-team-merge
359
-
360
- For each stream in dependency order (independent first, dependent last):
361
-
362
- Bash: git checkout main
363
- Bash: git merge --no-ff [worktree-branch] -m "merge: stream [id] — [stream.task]"
364
-
365
- If merge conflict:
366
- Bash: git status (identify conflicting files)
367
- If ≤3 conflicting files:
368
- Resolve using cook report guidance (stream's intended change wins)
369
- Bash: git add [resolved-files]
370
- Bash: git merge --continue
371
- If >3 conflicting files OR ambiguous ownership:
372
- STOP merge
373
- Bash: git merge --abort
374
- → Present to user: "Stream [id] has [N] conflicts. Manual resolution required."
375
- ```
376
-
377
- **4b. Cleanup worktrees.**
378
-
379
- ```
380
- Bash: git worktree remove [worktree-path] --force
381
- ```
382
-
383
- (Repeat for each worktree after its branch is merged.)
384
-
385
- Mark todo[3] `completed`.
386
-
387
- ---
388
-
389
- ### Phase 5 — VERIFY
390
-
391
- Mark todo[4] `in_progress`.
392
-
393
- ```
394
- REQUIRED SUB-SKILL: rune:verification
395
- Invoke `verification` on the merged main branch.
396
- → verification runs: type check, lint, unit tests, integration tests.
397
- Capture: passed count, failed count, coverage %.
398
- ```
399
-
400
- ```
401
- Error recovery:
402
- If verification fails after merge:
403
- Rollback all merges:
404
- Bash: git reset --hard pre-team-merge
405
- Bash: git tag -d pre-team-merge
406
- Report: "Integration tests failed. All merges reverted to pre-team-merge state."
407
- Present fix options to user
408
- ```
409
-
410
- Mark todo[4] `completed`.
411
-
412
- ---
413
-
414
- ## Constraints
415
-
416
- 1. MUST NOT launch more than 3 parallel agents — batch if more streams exist
417
- 2. MUST define clear scope boundaries per agent before dispatch no overlapping file ownership
418
- 3. MUST resolve all merge conflicts before declaring completion — no "fix later"
419
- 4. MUST NOT let agents modify the same filesplit by file ownership
420
- 5. MUST collect and review all agent outputs before merging no blind merge
421
- 6. MUST NOT skip the integration verification after merge
422
-
423
- ## Mesh Gates
424
-
425
- | Gate | Requires | If Missing |
426
- |------|----------|------------|
427
- | Scope Gate | Each agent has explicit file ownership list | Define boundaries before dispatch |
428
- | Conflict Gate | Zero merge conflicts after integration | Resolve all conflicts, re-verify |
429
- | Verification Gate | All tests pass after merge | Fix regressions before completion |
430
-
431
- ## Output Format
432
-
433
- ```
434
- ## Team Report: [Task Name]
435
- - **Streams**: [count]
436
- - **Status**: complete | partial | blocked
437
- - **Duration**: [time across streams]
438
-
439
- ### Streams
440
- | Stream | Task | Status | Deliverables | Concerns |
441
- |--------|------|--------|-------------|----------|
442
- | A | [task] | DONE | 3/3 delivered | None |
443
- | B | [task] | DONE_WITH_CONCERNS | 2/2 delivered | Perf regression on large input |
444
- | C | [task] | DONE | 2/2 delivered | None |
445
-
446
- ### Acceptance Criteria
447
- | # | Criterion | Stream | Evidence | Verdict |
448
- |---|-----------|--------|----------|---------|
449
- | 1 | Auth endpoints return JWT | A | Test stdout: "3 passed" | PASS |
450
- | 2 | No SQL injection | A | Sentinel: PASS | PASS |
451
- | 3 | Dashboard loads < 2s | B | No perf test run | UNVERIFIED |
452
-
453
- ### Integration
454
- - Merge conflicts: [count]
455
- - Integration tests: [passed]/[total]
456
- - Coverage: [%]
457
- - Unresolved concerns: [count — from DONE_WITH_CONCERNS streams]
458
- ```
459
-
460
- ---
461
-
462
- ## Parallel Execution Rules
463
-
464
- ```
465
- Independent streams → PARALLEL (max 3 sonnet agents)
466
- Dependent streams SEQUENTIAL (respecting dependency order)
467
- All streams done MERGE sequentially (avoid conflicts)
468
- ```
469
-
470
- ## Returns
471
-
472
- | Artifact | Format | Location |
473
- |----------|--------|----------|
474
- | Workstream assignments | Markdown (inline) | NEXUS Handoff Templates emitted per stream |
475
- | Cook Reports (per stream) | Markdown (inline) | Collected from each parallel cook instance |
476
- | Merged implementation | Source files | `main` branch after Phase 4 merge |
477
- | Integration test results | Inline stdout | Captured in Phase 5 verify |
478
- | Team Report | Markdown (inline) | Emitted at end of session |
479
-
480
- ## Document Ownership
481
-
482
- | Scope | Access | Files |
483
- |-------|--------|-------|
484
- | **Owns** (read + write) | `.rune/team-report-*.md`, worktree branches, merge commits |
485
- | **Reads** (never writes) | `.rune/plan-*.md`, `.rune/contract.md`, `CLAUDE.md`, cook reports from sub-agents |
486
- | **Never modifies** | Source files directly (delegates to cook instances), `SKILL.md` files, `compiler/**` |
487
-
488
- Each cook instance owns its declared file set (disjoint). Team owns coordination artifacts only — never touches source code directly.
489
-
490
- ## Anti-Patterns
491
-
492
- Common multi-agent orchestration failures. These cause the most expensive rework in team workflows.
493
-
494
- | Anti-Pattern | Why It Fails | Correct Approach |
495
- |---|---|---|
496
- | **Overlapping file ownership** two agents write to the same file | Merge conflicts, lost work, non-deterministic output | Enforce disjoint `touches[]` per stream. Move shared files to a single owner |
497
- | **Blind merge** merging cook reports without reviewing them | Poisoned output propagates. One bad stream corrupts the whole feature | `integrity-check` + `completion-gate` on every cook report before merge |
498
- | **Over-parallelization** launching 5+ agents for a 3-file task | Context fragmentation, coordination overhead > implementation time | Auto-detect: ≤5 files lite mode (max 2 agents). Full mode caps at 3 |
499
- | **Cross-domain implementation** — one agent implements both frontend and backend | Domain expertise diluted. Agent makes shallow choices in unfamiliar territory | Split by domain. Frontend agent ≠ backend agent. Each gets domain context |
500
- | **Missing handoff context** bare prompt to cook instance without scope/conventions | Agent guesses project conventions, uses wrong patterns, produces inconsistent code | NEXUS Handoff Template: always include metadata, deliverables, conventions, quality expectations |
501
- | **Sequential when parallel is safe** — running independent streams one by one | Wastes time. 3 independent streams × 5min = 15min sequential vs 5min parallel | Check dependency graph. Independent streams → parallel. Dependent → sequential |
502
-
503
- ## Sharp Edges
504
-
505
- Known failure modes for this skill. Check these before declaring done.
506
-
507
- | Failure Mode | Severity | Mitigation |
508
- |---|---|---|
509
- | Launching more than 3 parallel agents (full mode) / 2 (lite mode) | CRITICAL | HARD-GATE blocks this — batch into ≤3 streams (full) or ≤2 (lite) |
510
- | Using full mode with worktrees for ≤2 streams, ≤5 files | MEDIUM | Auto-detect triggers lite mode — saves opus cost and worktree overhead |
511
- | Agents with overlapping file ownership | HIGH | Scope Gate: define disjoint file sets before dispatch — never leave overlap unresolved |
512
- | Merging without running integration tests | HIGH | Verification Gate: integration tests on merged result are mandatory |
513
- | Ignoring sentinel CRITICAL flag in agent cook report | HIGH | Stream blocked from merge — present to user before any merge action |
514
- | Launching dependent streams before their dependencies complete | MEDIUM | Respect depends_on ordering — sequential after parallel, not parallel throughout |
515
- | Coupled modules split across streams | HIGH | Dependency graph check in Phase 1c move coupled files to same stream or add depends_on |
516
- | Agent modified files outside declared scope | HIGH | Pre-merge scope verification in Phase 2b.5 flag before merge, not after |
517
- | Merge failure with no rollback path | HIGH | pre-team-merge tag created before merges git reset --hard on failure |
518
- | Poisoned cook report merged blindly | HIGH | Phase 3a.5 integrity-check on all cook reports before merge |
519
- | Bare prompt to cook instance no context, conventions, or scope boundary | HIGH | NEXUS Handoff Template: structured handoff with metadata, deliverables, quality expectations, and evidence requirements |
520
- | Cook returns "done" with no acceptance criteria tracking | MEDIUM | Team Report includes Acceptance Criteria table with per-criterion evidence and PASS/FAIL/UNVERIFIED verdict |
521
- | Subagent builds wrong thing due to ambiguous scope | HIGH | Question Gate (Step 1d): invite questions before work starts. Cost of answering 3 questions << cost of rebuilding 500 LOC |
522
- | Parallel streams touch same files causing merge conflicts | HIGH | Change Stacking check in Step 1c: validate disjoint `touches[]` across all parallel streams |
523
-
524
- ## Done When
525
-
526
- - Task decomposed into ≤3 workstreams each with disjoint file ownership
527
- - All cook agents completed and returned reports
528
- - All merge conflicts resolved (zero unresolved before merge commit)
529
- - Integration tests pass on merged main branch
530
- - All worktrees cleaned up
531
- - Team Report emitted with stream statuses and integration results
532
-
533
- ## Cost Profile
534
-
535
- ~$0.20-0.50 per session. Opus for coordination. Most expensive orchestrator but handles largest tasks.
536
-
537
- **Scope guardrail**: Do not invoke launch, rescue, or scaffold autonomously unless explicitly delegated by the parent agent.
1
+ ---
2
+ name: team
3
+ description: "Multi-agent meta-orchestrator. Use when task spans 5+ files or 3+ modules, or when user says 'parallel', 'split this up', 'do all of these'. Decomposes large tasks into parallel workstreams, assigns to isolated cook instances, coordinates merging."
4
+ context: fork
5
+ agent: general-purpose
6
+ metadata:
7
+ author: runedev
8
+ version: "0.8.0"
9
+ layer: L1
10
+ model: opus
11
+ group: orchestrator
12
+ tools: "Read, Write, Edit, Bash, Glob, Grep"
13
+ emit: phase.complete
14
+ ---
15
+
16
+ # team
17
+
18
+ ## Purpose
19
+
20
+ Meta-orchestrator for complex tasks requiring parallel workstreams. Team decomposes large features into independent subtasks, assigns each to an isolated cook instance (using git worktrees), coordinates progress, and merges results. Uses opus for strategic decomposition and conflict resolution.
21
+
22
+ <HARD-GATE>
23
+ - MAX 3 PARALLEL AGENTS: Never launch more than 3 Task calls simultaneously. If more than 3 streams exist, batch them.
24
+ - No merge without conflict resolution complete (Phase 3 clean).
25
+ - Full integration tests MUST run before reporting success.
26
+ </HARD-GATE>
27
+
28
+ ## Triggers
29
+
30
+ - `/rune team <task>` — manual invocation for large features
31
+ - Auto-trigger: when task affects 5+ files or spans 3+ modules
32
+
33
+ ## Mode Selection (Auto-Detect)
34
+
35
+ ```
36
+ IF streams ≤ 2 AND total files ≤ 5:
37
+ → LITE MODE (lightweight parallel, no worktrees)
38
+ ELSE:
39
+ → FULL MODE (worktree isolation, opus coordination)
40
+ ```
41
+
42
+ ### Lite Mode
43
+
44
+ For small parallel tasks that don't warrant full worktree isolation:
45
+
46
+ ```
47
+ Lite Mode Rules:
48
+ - Max 2 parallel agents (haiku coordination, sonnet workers)
49
+ - NO worktree creation — agents work on same branch
50
+ - File ownership still enforced (disjoint file sets)
51
+ - Simplified merge: sequential git add (no merge conflicts possible with disjoint files)
52
+ - Skip Phase 3 (COORDINATE) — no conflicts with disjoint files
53
+ - Skip integrity-check — small scope, direct output review
54
+ - Coordinator model: haiku (not opus) — saves cost
55
+
56
+ Lite Mode Phases:
57
+ Phase 1: DECOMPOSE (haiku) — identify 2 streams with disjoint files
58
+ Phase 2: ASSIGN — launch 2 parallel Task agents (sonnet, no worktree)
59
+ Phase 4: MERGE — sequential git add (no merge needed)
60
+ Phase 5: VERIFY — integration tests on result
61
+ ```
62
+
63
+ **Announce mode**: "Team lite mode: 2 streams, ≤5 files, no worktrees needed."
64
+ **Override**: User can say "full mode" to force worktree isolation.
65
+
66
+ ### Full Mode
67
+
68
+ Standard team workflow with worktree isolation (Phases 1-5 as documented below).
69
+
70
+ ### Complexity Tiers (DAG Stage Selection)
71
+
72
+ Before decomposing, classify the task into a complexity tier. Each tier defines a different DAG (directed acyclic graph) of stages, ensuring the right amount of process for the task's complexity.
73
+
74
+ | Tier | Signals | DAG Stages | Context Windows |
75
+ |------|---------|------------|-----------------|
76
+ | **Trivial** | ≤3 files, single module, no shared contracts | impl → test | 1 (single cook) |
77
+ | **Medium** | 4-10 files, 2-3 modules, shared interfaces | research → plan → impl → test → review → fix | 3 (plan, impl+test, review+fix) |
78
+ | **Large** | 10+ files, 3+ modules, breaking changes or RFC | research → plan → impl → test → review₁ → fix → review₂ → final merge | 4+ (plan, impl+test, review₁+fix, review₂+merge) |
79
+
80
+ **Key principle — reviewer isolation**: The agent that writes code MUST NOT review its own code. Each review stage uses a **separate context window** (separate Task invocation) that has never seen the implementation reasoning. This prevents author bias from contaminating the review.
81
+
82
+ **Stage → Context Window mapping**:
83
+ - `research + plan` = Context Window 1 (opus — architectural reasoning)
84
+ - `impl + test` = Context Window 2 (sonnet — code writing)
85
+ - `review₁ + fix` = Context Window 3 (sonnet — fresh eyes, no impl context)
86
+ - `review₂ + merge` = Context Window 4 (sonnet — final verification, Large tier only)
87
+
88
+ **Merge queue**: When multiple streams complete at different times, use dependency order for merging. If a later stream's merge creates conflicts with an already-merged stream, provide the conflicting stream's cook report as **conflict context** to the resolution agent — never resolve blindly.
89
+
90
+ ## Calls (outbound)
91
+
92
+ - `plan` (L2): high-level task decomposition into independent workstreams
93
+ - `scout` (L2): understand full project scope and module boundaries
94
+ # Exception: L1→L1 meta-orchestration (team is the only L1 that calls other L1s)
95
+ - `cook` (L1): delegate feature tasks to parallel instances (worktree isolation)
96
+ - `launch` (L1): delegate deployment/marketing when build is complete
97
+ - `rescue` (L1): delegate legacy refactoring when rescue work detected
98
+ - `integrity-check` (L3): verify cook report integrity before merge
99
+ - `completion-gate` (L3): validate workstream completion claims against evidence
100
+ - `constraint-check` (L3): audit HARD-GATE compliance across parallel streams
101
+ - `scope-guard` (L3): pre-merge scope verification validate each stream's actual file changes against declared ownership
102
+ - `worktree` (L3): create isolated worktrees for parallel cook instances
103
+ - `context-pack` (L3): create structured handoff briefings before spawning subagents
104
+ - L4 extension packs: domain-specific patterns when context matches (e.g., @rune/mobile when porting web to mobile)
105
+
106
+ ## Called By (inbound)
107
+
108
+ - User: `/rune team <task>` direct invocation only
109
+
110
+ ---
111
+
112
+ ## Execution
113
+
114
+ ### Step 0 — Initialize TodoWrite
115
+
116
+ ```
117
+ TodoWrite([
118
+ { content: "DECOMPOSE: Scout modules and plan workstreams", status: "pending", activeForm: "Decomposing task into workstreams" },
119
+ { content: "ASSIGN: Launch parallel cook agents in worktrees", status: "pending", activeForm: "Assigning streams to cook agents" },
120
+ { content: "COORDINATE: Monitor streams, resolve conflicts", status: "pending", activeForm: "Coordinating parallel streams" },
121
+ { content: "MERGE: Merge worktrees back to main", status: "pending", activeForm: "Merging worktrees to main" },
122
+ { content: "VERIFY: Run integration tests on merged result", status: "pending", activeForm: "Verifying integration" }
123
+ ])
124
+ ```
125
+
126
+ ---
127
+
128
+ ### Phase 1 — DECOMPOSE
129
+
130
+ Mark todo[0] `in_progress`.
131
+
132
+ **1a. Map module boundaries.**
133
+
134
+ ```
135
+ REQUIRED SUB-SKILL: rune:scout
136
+ Invoke `scout` with the full task description.
137
+ Scout returns: module list, file ownership map, dependency graph.
138
+ → Capture: which modules are independent vs. coupled.
139
+ ```
140
+
141
+ **1b. Break into workstreams.**
142
+
143
+ ```
144
+ REQUIRED SUB-SKILL: rune:plan
145
+ Invoke `plan` with scout output + task description.
146
+ Plan returns: ordered list of workstreams, each with:
147
+ - stream_id: "A" | "B" | "C" (max 3)
148
+ - task: specific sub-task description
149
+ - files: list of files this stream owns
150
+ - depends_on: [] | ["B"] (empty = parallel-safe)
151
+ ```
152
+
153
+ **1c. Validate decomposition.**
154
+
155
+ ```
156
+ GATE CHECK before proceeding:
157
+ [ ] Each stream owns disjoint file sets (no overlap)
158
+ [ ] No coupled modules across streams:
159
+ Use Grep to find import/require statements in each stream's owned files
160
+ If stream A files import from stream B files flag as COUPLED
161
+ COUPLED modules MUST be moved to same stream OR stream B added to A's depends_on
162
+ [ ] Dependent streams have explicit depends_on declared
163
+ [ ] Total streams 3
164
+ [ ] Change Stacking check: no file appears in touches[] of 2+ parallel streams
165
+ [ ] Every stream's requires[] is satisfied by a prior stream's provides[] or existing code
166
+
167
+ If any check fails → re-invoke plan with conflict notes.
168
+ ```
169
+
170
+ **1d. Question Gate (non-trivial tasks only).**
171
+
172
+ > From superpowers (obra/superpowers, 84k★): "Subagents that start work without asking questions produce the wrong thing 40% of the time."
173
+
174
+ Before dispatching streams, include in each NEXUS Handoff: "Before starting, ask up to 3 clarifying questions if anything is unclear about scope, conventions, or expected output."
175
+
176
+ - If a cook agent returns questions instead of starting work answer them, then re-dispatch
177
+ - If a cook agent starts work without questions proceed normally (questions are invited, not required)
178
+ - **Skip if**: Lite mode (2 streams, ≤5 files) — overhead exceeds value
179
+
180
+ Mark todo[0] `completed`.
181
+
182
+ ---
183
+
184
+ ### Phase 2 — ASSIGN
185
+
186
+ Mark todo[1] `in_progress`.
187
+
188
+ **2a. Launch parallel streams.**
189
+
190
+ Launch independent streams (depends_on: []) in parallel using Task tool with worktree isolation.
191
+
192
+ > From agency-agents (msitarzewski/agency-agents, 50.8k★): "Structured handoff docs prevent the #1 multi-agent failure: context loss between agents."
193
+
194
+ Each stream receives a **NEXUS Handoff Template** — not a bare prompt:
195
+
196
+ ```
197
+ For each stream where depends_on == []:
198
+ Task(
199
+ subagent_type: "general-purpose",
200
+ model: "sonnet",
201
+ isolation: "worktree",
202
+ prompt: <NEXUS Handoff below>
203
+ )
204
+ ```
205
+
206
+ **NEXUS Handoff Template** (sent to each cook instance):
207
+
208
+ ```markdown
209
+ ## NEXUS Handoff: Stream [id]
210
+
211
+ ### Metadata
212
+ - Stream: [id] of [total]
213
+ - Depends on: [none | stream ids]
214
+ - File ownership: [list — ONLY these files may be modified]
215
+ - Model: sonnet
216
+
217
+ ### Context
218
+ - Project: [project name and type]
219
+ - Overall goal: [1-line feature description]
220
+ - This stream's goal: [specific sub-task]
221
+ - Conventions: [key patterns from scout — naming, file structure, test framework]
222
+
223
+ ### Deliverable
224
+ - [ ] [specific outcome 1 — e.g., "AuthService with login/register/reset methods"]
225
+ - [ ] [specific outcome 2 — e.g., "Unit tests covering happy path + 3 error cases"]
226
+ - [ ] [specific outcome 3 — e.g., "Types exported for Phase 2 consumers"]
227
+
228
+ ### Quality Expectations
229
+ - Tests: must pass with evidence (stdout captured)
230
+ - Types: no `any`, strict mode
231
+ - Security: no hardcoded secrets, parameterized queries
232
+ - Conventions: [project-specific — from scout output]
233
+
234
+ ### Evidence Required
235
+ Return a Cook Report with:
236
+ - Exact files modified (git diff --stat)
237
+ - Test output (stdout not just "tests pass")
238
+ - Any CONCERNS discovered during implementation
239
+ ```
240
+
241
+ **2b. Launch dependent streams sequentially.**
242
+
243
+ ```
244
+ For each stream where depends_on != []:
245
+ WAIT for all depends_on streams to complete.
246
+ Then launch with NEXUS Handoff that includes:
247
+ - Completed stream's deliverables as "Available Context"
248
+ - Exported interfaces/types from prior streams in "Code Contracts" section
249
+ - Any CONCERNS from prior streams in "Known Issues" section
250
+ ```
251
+
252
+ **2b.5. Pre-merge scope verification.**
253
+
254
+ After each stream completes (before collecting final report):
255
+
256
+ ```
257
+ Bash: git diff --name-only main...[worktree-branch]
258
+ Compare actual modified files vs stream's planned file ownership list.
259
+ If agent modified files OUTSIDE its declared scope:
260
+ FLAG: "Stream [id] modified [file] outside its scope."
261
+ Present to user for approval before proceeding to merge.
262
+ → If all files within scope: proceed normally.
263
+ ```
264
+
265
+ This catches scope creep BEFORE merge — much cheaper to fix than after.
266
+
267
+ **2c. Collect cook reports.**
268
+
269
+ Wait for all Task calls to return. Store each cook report keyed by stream_id.
270
+
271
+ ```
272
+ Error recovery:
273
+ If a Task fails or returns error report:
274
+ Log failure: "Stream [id] failed: [error]"
275
+ → If stream is non-blocking: continue with other streams
276
+ → If stream is blocking (others depend on it): STOP, report to user with partial results
277
+ ```
278
+
279
+ Mark todo[1] `completed`.
280
+
281
+ ---
282
+
283
+ ### Phase 3 — COORDINATE
284
+
285
+ Mark todo[2] `in_progress`.
286
+
287
+ **3a. Check for file conflicts.**
288
+
289
+ ```
290
+ Bash: git diff --name-only [worktree-a-branch] [worktree-b-branch]
291
+ ```
292
+
293
+ If overlapping files detected between completed worktrees:
294
+ - Identify the conflict source from cook reports
295
+ - Determine which stream's version takes precedence (later stream wins by default)
296
+ - Flag for manual resolution if ambiguous — present to user before merge
297
+
298
+ **3a.5. Verify cook report integrity.**
299
+
300
+ ```
301
+ REQUIRED SUB-SKILL: rune:integrity-check
302
+ Invoke integrity-check on each cook report text.
303
+ If any report returns TAINTED:
304
+ BLOCK this stream from merge.
305
+ Report: "Stream [id] cook report contains adversarial content."
306
+ → If SUSPICIOUS: warn user, ask for confirmation before merge.
307
+ ```
308
+
309
+ **3b. Review cook report summaries.**
310
+
311
+ For each completed stream, verify cook report contains:
312
+ - Files modified
313
+ - Tests passing
314
+ - No unresolved TODOs or sentinel CRITICAL flags
315
+
316
+ ```
317
+ Error recovery:
318
+ If cook report contains sentinel CRITICAL:
319
+ BLOCK this stream from merge
320
+ Report: "Stream [id] blocked: CRITICAL issue in [file] — [details]"
321
+ → Present to user for decision before continuing
322
+ ```
323
+
324
+ **3c. Evaluate subagent status per stream.**
325
+
326
+ Each cook instance MUST have returned one of four statuses. Team handles them as follows:
327
+
328
+ | Cook Status | Team Action |
329
+ |-------------|-------------|
330
+ | `DONE` | Stream cleared for merge proceed normally |
331
+ | `DONE_WITH_CONCERNS` | Stream cleared for merge, BUT trigger **cross-workstream review**: check if the concern impacts any other stream's files or contracts before merging ALL streams. Log concern in Team Report. |
332
+ | `NEEDS_CONTEXT` | Stream paused present the specific question to user. Resume that stream after answer. Other independent streams may continue in parallel. |
333
+ | `BLOCKED` | Stream blocked from merge. If stream has no dependents → continue with remaining streams and report partial completion. If stream has dependents → STOP all dependent streams, present to user with full blocker details. |
334
+
335
+ **Cross-workstream review (triggered by any DONE_WITH_CONCERNS)**:
336
+
337
+ ```
338
+ 1. Read the concern from the cook report
339
+ 2. Check if the concern touches shared contracts, interfaces, or shared files
340
+ Use Grep to find the concern's affected symbols/files across all worktrees
341
+ 3. If concern is isolated to stream's own files proceed to merge (concern logged only)
342
+ 4. If concern crosses stream boundaries resolve before merge:
343
+ Present to user with: affected streams, concern details, two remediation options
344
+ → Do NOT merge any stream until user decides
345
+ ```
346
+
347
+ Mark todo[2] `completed`.
348
+
349
+ ---
350
+
351
+ ### Phase 4 — MERGE
352
+
353
+ Mark todo[3] `in_progress`.
354
+
355
+ **4a. Merge each worktree sequentially.**
356
+
357
+ ```
358
+ # Bookmark before any merge
359
+ Bash: git tag pre-team-merge
360
+
361
+ For each stream in dependency order (independent first, dependent last):
362
+
363
+ Bash: git checkout main
364
+ Bash: git merge --no-ff [worktree-branch] -m "merge: stream [id] — [stream.task]"
365
+
366
+ If merge conflict:
367
+ Bash: git status (identify conflicting files)
368
+ If ≤3 conflicting files:
369
+ Resolve using cook report guidance (stream's intended change wins)
370
+ Bash: git add [resolved-files]
371
+ Bash: git merge --continue
372
+ If >3 conflicting files OR ambiguous ownership:
373
+ STOP merge
374
+ Bash: git merge --abort
375
+ → Present to user: "Stream [id] has [N] conflicts. Manual resolution required."
376
+ ```
377
+
378
+ **4b. Cleanup worktrees.**
379
+
380
+ ```
381
+ Bash: git worktree remove [worktree-path] --force
382
+ ```
383
+
384
+ (Repeat for each worktree after its branch is merged.)
385
+
386
+ Mark todo[3] `completed`.
387
+
388
+ ---
389
+
390
+ ### Phase 5 — VERIFY
391
+
392
+ Mark todo[4] `in_progress`.
393
+
394
+ ```
395
+ REQUIRED SUB-SKILL: rune:verification
396
+ Invoke `verification` on the merged main branch.
397
+ verification runs: type check, lint, unit tests, integration tests.
398
+ → Capture: passed count, failed count, coverage %.
399
+ ```
400
+
401
+ ```
402
+ Error recovery:
403
+ If verification fails after merge:
404
+ Rollback all merges:
405
+ Bash: git reset --hard pre-team-merge
406
+ Bash: git tag -d pre-team-merge
407
+ Report: "Integration tests failed. All merges reverted to pre-team-merge state."
408
+ → Present fix options to user
409
+ ```
410
+
411
+ Mark todo[4] `completed`.
412
+
413
+ ---
414
+
415
+ ## Constraints
416
+
417
+ 1. MUST NOT launch more than 3 parallel agentsbatch if more streams exist
418
+ 2. MUST define clear scope boundaries per agent before dispatch — no overlapping file ownership
419
+ 3. MUST resolve all merge conflicts before declaring completionno "fix later"
420
+ 4. MUST NOT let agents modify the same filesplit by file ownership
421
+ 5. MUST collect and review all agent outputs before merging — no blind merge
422
+ 6. MUST NOT skip the integration verification after merge
423
+
424
+ ## Mesh Gates
425
+
426
+ | Gate | Requires | If Missing |
427
+ |------|----------|------------|
428
+ | Scope Gate | Each agent has explicit file ownership list | Define boundaries before dispatch |
429
+ | Conflict Gate | Zero merge conflicts after integration | Resolve all conflicts, re-verify |
430
+ | Verification Gate | All tests pass after merge | Fix regressions before completion |
431
+
432
+ ## Output Format
433
+
434
+ ```
435
+ ## Team Report: [Task Name]
436
+ - **Streams**: [count]
437
+ - **Status**: complete | partial | blocked
438
+ - **Duration**: [time across streams]
439
+
440
+ ### Streams
441
+ | Stream | Task | Status | Deliverables | Concerns |
442
+ |--------|------|--------|-------------|----------|
443
+ | A | [task] | DONE | 3/3 delivered | None |
444
+ | B | [task] | DONE_WITH_CONCERNS | 2/2 delivered | Perf regression on large input |
445
+ | C | [task] | DONE | 2/2 delivered | None |
446
+
447
+ ### Acceptance Criteria
448
+ | # | Criterion | Stream | Evidence | Verdict |
449
+ |---|-----------|--------|----------|---------|
450
+ | 1 | Auth endpoints return JWT | A | Test stdout: "3 passed" | PASS |
451
+ | 2 | No SQL injection | A | Sentinel: PASS | PASS |
452
+ | 3 | Dashboard loads < 2s | B | No perf test run | UNVERIFIED |
453
+
454
+ ### Integration
455
+ - Merge conflicts: [count]
456
+ - Integration tests: [passed]/[total]
457
+ - Coverage: [%]
458
+ - Unresolved concerns: [count — from DONE_WITH_CONCERNS streams]
459
+ ```
460
+
461
+ ---
462
+
463
+ ## Parallel Execution Rules
464
+
465
+ ```
466
+ Independent streams PARALLEL (max 3 sonnet agents)
467
+ Dependent streams SEQUENTIAL (respecting dependency order)
468
+ All streams done → MERGE sequentially (avoid conflicts)
469
+ ```
470
+
471
+ ## Returns
472
+
473
+ | Artifact | Format | Location |
474
+ |----------|--------|----------|
475
+ | Workstream assignments | Markdown (inline) | NEXUS Handoff Templates emitted per stream |
476
+ | Cook Reports (per stream) | Markdown (inline) | Collected from each parallel cook instance |
477
+ | Merged implementation | Source files | `main` branch after Phase 4 merge |
478
+ | Integration test results | Inline stdout | Captured in Phase 5 verify |
479
+ | Team Report | Markdown (inline) | Emitted at end of session |
480
+
481
+ ## Document Ownership
482
+
483
+ | Scope | Access | Files |
484
+ |-------|--------|-------|
485
+ | **Owns** (read + write) | `.rune/team-report-*.md`, worktree branches, merge commits |
486
+ | **Reads** (never writes) | `.rune/plan-*.md`, `.rune/contract.md`, `CLAUDE.md`, cook reports from sub-agents |
487
+ | **Never modifies** | Source files directly (delegates to cook instances), `SKILL.md` files, `compiler/**` |
488
+
489
+ Each cook instance owns its declared file set (disjoint). Team owns coordination artifacts only — never touches source code directly.
490
+
491
+ ## Monorepo Awareness
492
+
493
+ When the project is a monorepo (signals: `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, or `packages/` directory with multiple `package.json`):
494
+
495
+ **Stream assignment rules for monorepos:**
496
+ - Assign streams by **package boundary**, not by file type one stream per package (e.g., Stream A = `packages/api`, Stream B = `packages/web`)
497
+ - Cross-package changes (e.g., shared types in `packages/core` consumed by both api + web) must be in a **dependency stream** that completes before consumer streams start
498
+ - Use `turbo run test --filter=...[HEAD^1]` in Phase 5 (VERIFY) to test only affected packages do NOT run the full test suite when only 1 package changed
499
+
500
+ **Dependency stream pattern for cross-package changes:**
501
+
502
+ ```
503
+ Stream A (depends_on: []): packages/core — shared types + utilities
504
+ Stream B (depends_on: ["A"]): packages/api — consumes updated core types
505
+ Stream C (depends_on: ["A"]): packages/web consumes updated core types
506
+ B and C run in parallel after A completes.
507
+ ```
508
+
509
+ ## Anti-Patterns
510
+
511
+ Common multi-agent orchestration failures. These cause the most expensive rework in team workflows.
512
+
513
+ | Anti-Pattern | Why It Fails | Correct Approach |
514
+ |---|---|---|
515
+ | **Overlapping file ownership** two agents write to the same file | Merge conflicts, lost work, non-deterministic output | Enforce disjoint `touches[]` per stream. Move shared files to a single owner |
516
+ | **Blind merge** merging cook reports without reviewing them | Poisoned output propagates. One bad stream corrupts the whole feature | `integrity-check` + `completion-gate` on every cook report before merge |
517
+ | **Over-parallelization** launching 5+ agents for a 3-file task | Context fragmentation, coordination overhead > implementation time | Auto-detect: ≤5 files lite mode (max 2 agents). Full mode caps at 3 |
518
+ | **Cross-domain implementation** one agent implements both frontend and backend | Domain expertise diluted. Agent makes shallow choices in unfamiliar territory | Split by domain. Frontend agent backend agent. Each gets domain context |
519
+ | **Missing handoff context** — bare prompt to cook instance without scope/conventions | Agent guesses project conventions, uses wrong patterns, produces inconsistent code | NEXUS Handoff Template: always include metadata, deliverables, conventions, quality expectations |
520
+ | **Sequential when parallel is safe** running independent streams one by one | Wastes time. 3 independent streams × 5min = 15min sequential vs 5min parallel | Check dependency graph. Independent streams → parallel. Dependent → sequential |
521
+
522
+ ## Sharp Edges
523
+
524
+ Known failure modes for this skill. Check these before declaring done.
525
+
526
+ | Failure Mode | Severity | Mitigation |
527
+ |---|---|---|
528
+ | Launching more than 3 parallel agents (full mode) / 2 (lite mode) | CRITICAL | HARD-GATE blocks this batch into ≤3 streams (full) or ≤2 (lite) |
529
+ | Using full mode with worktrees for ≤2 streams, ≤5 files | MEDIUM | Auto-detect triggers lite mode saves opus cost and worktree overhead |
530
+ | Agents with overlapping file ownership | HIGH | Scope Gate: define disjoint file sets before dispatch — never leave overlap unresolved |
531
+ | Merging without running integration tests | HIGH | Verification Gate: integration tests on merged result are mandatory |
532
+ | Ignoring sentinel CRITICAL flag in agent cook report | HIGH | Stream blocked from merge — present to user before any merge action |
533
+ | Launching dependent streams before their dependencies complete | MEDIUM | Respect depends_on ordering — sequential after parallel, not parallel throughout |
534
+ | Coupled modules split across streams | HIGH | Dependency graph check in Phase 1c — move coupled files to same stream or add depends_on |
535
+ | Agent modified files outside declared scope | HIGH | Pre-merge scope verification in Phase 2b.5 flag before merge, not after |
536
+ | Merge failure with no rollback path | HIGH | pre-team-merge tag created before merges — git reset --hard on failure |
537
+ | Poisoned cook report merged blindly | HIGH | Phase 3a.5 integrity-check on all cook reports before merge |
538
+ | Bare prompt to cook instance — no context, conventions, or scope boundary | HIGH | NEXUS Handoff Template: structured handoff with metadata, deliverables, quality expectations, and evidence requirements |
539
+ | Cook returns "done" with no acceptance criteria tracking | MEDIUM | Team Report includes Acceptance Criteria table with per-criterion evidence and PASS/FAIL/UNVERIFIED verdict |
540
+ | Subagent builds wrong thing due to ambiguous scope | HIGH | Question Gate (Step 1d): invite questions before work starts. Cost of answering 3 questions << cost of rebuilding 500 LOC |
541
+ | Parallel streams touch same files causing merge conflicts | HIGH | Change Stacking check in Step 1c: validate disjoint `touches[]` across all parallel streams |
542
+
543
+ ## Done When
544
+
545
+ - Task decomposed into ≤3 workstreams each with disjoint file ownership
546
+ - All cook agents completed and returned reports
547
+ - All merge conflicts resolved (zero unresolved before merge commit)
548
+ - Integration tests pass on merged main branch
549
+ - All worktrees cleaned up
550
+ - Team Report emitted with stream statuses and integration results
551
+
552
+ ## Cost Profile
553
+
554
+ ~$0.20-0.50 per session. Opus for coordination. Most expensive orchestrator but handles largest tasks.
555
+
556
+ **Scope guardrail**: Do not invoke launch, rescue, or scaffold autonomously unless explicitly delegated by the parent agent.