| name | team |
| 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. |
| context | fork |
| agent | general-purpose |
| metadata | {"author":"runedev","version":"1.1.0","layer":"L1","model":"opus","group":"orchestrator","tools":"Read, Write, Edit, Bash, Glob, Grep","emit":"phase.complete","listen":"context.preview"} |
team
Purpose
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.
- MAX 3 PARALLEL AGENTS: Never launch more than 3 Task calls simultaneously. If more than 3 streams exist, batch them.
- No merge without conflict resolution complete (Phase 3 clean).
- Full integration tests MUST run before reporting success.
Triggers
/rune team <task> — manual invocation for large features
- Auto-trigger: when task affects 5+ files or spans 3+ modules
Mode Selection (Auto-Detect)
IF streams ≤ 2 AND total files ≤ 5:
→ LITE MODE (lightweight parallel, no worktrees)
ELSE:
→ FULL MODE (worktree isolation, opus coordination)
Lite Mode
For small parallel tasks that don't warrant full worktree isolation:
Lite Mode Rules:
- Max 2 parallel agents (haiku coordination, sonnet workers)
- NO worktree creation — agents work on same branch
- File ownership still enforced (disjoint file sets)
- Simplified merge: sequential git add (no merge conflicts possible with disjoint files)
- Skip Phase 3 (COORDINATE) — no conflicts with disjoint files
- Skip integrity-check — small scope, direct output review
- Coordinator model: haiku (not opus) — saves cost
Lite Mode Phases:
Phase 1: DECOMPOSE (haiku) — identify 2 streams with disjoint files
Phase 2: ASSIGN — launch 2 parallel Task agents (sonnet, no worktree)
Phase 4: MERGE — sequential git add (no merge needed)
Phase 5: VERIFY — integration tests on result
Announce mode: "Team lite mode: 2 streams, ≤5 files, no worktrees needed."
Override: User can say "full mode" to force worktree isolation.
Full Mode
Standard team workflow with worktree isolation (Phases 1-5 as documented below).
Complexity Tiers (DAG Stage Selection)
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.
| Tier | Signals | DAG Stages | Context Windows |
|---|
| Trivial | ≤3 files, single module, no shared contracts | impl → test | 1 (single cook) |
| Medium | 4-10 files, 2-3 modules, shared interfaces | research → plan → impl → test → review → fix | 3 (plan, impl+test, review+fix) |
| 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) |
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.
Stage → Context Window mapping:
research + plan = Context Window 1 (opus — architectural reasoning)
impl + test = Context Window 2 (sonnet — code writing)
review₁ + fix = Context Window 3 (sonnet — fresh eyes, no impl context)
review₂ + merge = Context Window 4 (sonnet — final verification, Large tier only)
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.
Calls (outbound)
plan (L2): high-level task decomposition into independent workstreams
scout (L2): understand full project scope and module boundaries
Exception: L1→L1 meta-orchestration (team is the only L1 that calls other L1s)
cook (L1): delegate feature tasks to parallel instances (worktree isolation)
launch (L1): delegate deployment/marketing when build is complete
rescue (L1): delegate legacy refactoring when rescue work detected
integrity-check (L3): verify cook report integrity before merge
completion-gate (L3): validate workstream completion claims against evidence
constraint-check (L3): audit HARD-GATE compliance across parallel streams
scope-guard (L3): pre-merge scope verification — validate each stream's actual file changes against declared ownership
worktree (L3): create isolated worktrees for parallel cook instances
context-pack (L3): create structured handoff briefings before spawning subagents
- L4 extension packs: domain-specific patterns when context matches (e.g., @rune/mobile when porting web to mobile)
Called By (inbound)
scaffold (L1): decompose scaffolding into parallel workstreams
- User:
/rune team <task> direct invocation only
Execution
Step 0 — Initialize TodoWrite
TodoWrite([
{ content: "DECOMPOSE: Scout modules and plan workstreams", status: "pending", activeForm: "Decomposing task into workstreams" },
{ content: "ASSIGN: Launch parallel cook agents in worktrees", status: "pending", activeForm: "Assigning streams to cook agents" },
{ content: "COORDINATE: Monitor streams, resolve conflicts", status: "pending", activeForm: "Coordinating parallel streams" },
{ content: "MERGE: Merge worktrees back to main", status: "pending", activeForm: "Merging worktrees to main" },
{ content: "VERIFY: Run integration tests on merged result", status: "pending", activeForm: "Verifying integration" }
])
Phase 1 — DECOMPOSE
Mark todo[0] in_progress.
1a. Map module boundaries.
REQUIRED SUB-SKILL: rune:scout
→ Invoke `scout` with the full task description.
→ Scout returns: module list, file ownership map, dependency graph.
→ Capture: which modules are independent vs. coupled.
1b. Break into workstreams.
REQUIRED SUB-SKILL: rune:plan
→ Invoke `plan` with scout output + task description.
→ Plan returns: ordered list of workstreams, each with:
- stream_id: "A" | "B" | "C" (max 3)
- task: specific sub-task description
- files: list of files this stream owns
- depends_on: [] | ["B"] (empty = parallel-safe)
1c. Validate decomposition.
GATE CHECK — before proceeding:
[ ] Each stream owns disjoint file sets (no overlap)
[ ] No coupled modules across streams:
→ Use Grep to find import/require statements in each stream's owned files
→ If stream A files import from stream B files → flag as COUPLED
→ COUPLED modules MUST be moved to same stream OR stream B added to A's depends_on
[ ] Dependent streams have explicit depends_on declared
[ ] Total streams ≤ 3
[ ] Change Stacking check: no file appears in touches[] of 2+ parallel streams
[ ] Every stream's requires[] is satisfied by a prior stream's provides[] or existing code
[ ] Shared Contract Gate: if 2+ parallel streams consume the same interface/type/API, the contract MUST be defined before any stream starts (see below)
If any check fails → re-invoke plan with conflict notes.
**Shared Contract Gate:**
When parallel streams both depend on a shared interface (types, API contract, database schema), that contract must be locked before streams start. Otherwise two agents may independently define incompatible versions.
Detection:
→ Grep each stream's file list for shared imports (types, interfaces, API clients)
→ If stream A and stream B both import from the same module:
EITHER: move that module to a dependency stream (depends_on: [])
OR: define the contract inline in the NEXUS Handoff as "Code Contracts" section
Contract format in NEXUS Handoff:
Code Contracts (locked — do not modify)
interface OrderResult {
orderId: string;
status: 'pending' | 'filled' | 'cancelled';
filledAt?: Date;
}
Streams may consume this contract but MUST NOT modify it.
If a stream discovers the contract is insufficient → status = NEEDS_CONTEXT, not silent modification.
1d. Question Gate (non-trivial tasks only).
From superpowers (obra/superpowers, 84k★): "Subagents that start work without asking questions produce the wrong thing 40% of the time."
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."
- If a cook agent returns questions instead of starting work → answer them, then re-dispatch
- If a cook agent starts work without questions → proceed normally (questions are invited, not required)
- Skip if: Lite mode (2 streams, ≤5 files) — overhead exceeds value
Mark todo[0] completed.
Phase 2 — ASSIGN
Mark todo[1] in_progress.
2a. Launch parallel streams.
Launch independent streams (depends_on: []) in parallel using Task tool with worktree isolation.
From agency-agents (msitarzewski/agency-agents, 50.8k★): "Structured handoff docs prevent the #1 multi-agent failure: context loss between agents."
Each stream receives a NEXUS Handoff Template — not a bare prompt:
For each stream where depends_on == []:
Task(
subagent_type: "general-purpose",
model: "sonnet",
isolation: "worktree",
prompt: <NEXUS Handoff below>
)
NEXUS Handoff Template (sent to each cook instance):
## NEXUS Handoff: Stream [id]
### Metadata
- Stream: [id] of [total]
- Depends on: [none | stream ids]
- File ownership: [list — ONLY these files may be modified]
- Model: sonnet
### Context
- Project: [project name and type]
- Overall goal: [1-line feature description]
- This stream's goal: [specific sub-task]
- Conventions: [key patterns from scout — naming, file structure, test framework]
### Deliverable
- [ ] [specific outcome 1 — e.g., "AuthService with login/register/reset methods"]
- [ ] [specific outcome 2 — e.g., "Unit tests covering happy path + 3 error cases"]
- [ ] [specific outcome 3 — e.g., "Types exported for Phase 2 consumers"]
### Quality Expectations
- Tests: must pass with evidence (stdout captured)
- Types: no `any`, strict mode
- Security: no hardcoded secrets, parameterized queries
- Conventions: [project-specific — from scout output]
### Evidence Required
Return a Cook Report with:
- Exact files modified (git diff --stat)
- Test output (stdout — not just "tests pass")
- Any CONCERNS discovered during implementation
2b. Launch dependent streams sequentially.
For each stream where depends_on != []:
WAIT for all depends_on streams to complete.
Then launch with NEXUS Handoff that includes:
- Completed stream's deliverables as "Available Context"
- Exported interfaces/types from prior streams in "Code Contracts" section
- Any CONCERNS from prior streams in "Known Issues" section
2b.5. Pre-merge scope verification.
After each stream completes (before collecting final report):
Bash: git diff --name-only main...[worktree-branch]
→ Compare actual modified files vs stream's planned file ownership list.
→ If agent modified files OUTSIDE its declared scope:
FLAG: "Stream [id] modified [file] outside its scope."
Present to user for approval before proceeding to merge.
→ If all files within scope: proceed normally.
This catches scope creep BEFORE merge — much cheaper to fix than after.
2c. Collect cook reports.
Wait for all Task calls to return. Store each cook report keyed by stream_id.
Error recovery:
If a Task fails or returns error report:
→ Log failure: "Stream [id] failed: [error]"
→ If stream is non-blocking: continue with other streams
→ If stream is blocking (others depend on it): STOP, report to user with partial results
Mark todo[1] completed.
Phase 3 — COORDINATE
Mark todo[2] in_progress.
3a-pre0. Output density honoring. During Phase 2 dispatch, any worker that hits context ORANGE / RED has emitted output.density.set with mode=caveman, scope=workstream (auto from rune:context-engine). Coordination output respects per-workstream density: when summarizing a caveman-active worker's report into the merge plan, preserve its terse format rather than re-expanding to verbose. If 3+ workers are caveman-active simultaneously, the team-level summary itself should adopt caveman until merge completes (announce to user once: "Team output in caveman mode — N workers under context pressure"). Reverts to normal after Phase 5.
3a-pre. Oracle reattach sweep. Before merge coordination, glob .rune/oracle-pending/*.json. For any worker stream that emitted oracle.dispatched during Phase 2, invoke session-bridge --reattach <sessionId>. Worker streams with status=pending past their timeoutAt are unblocked via oracle.failed so coordination can proceed. Workers with status=complete consume the response before merge.
3a. Check for file conflicts.
Bash: git diff --name-only [worktree-a-branch] [worktree-b-branch]
If overlapping files detected between completed worktrees:
- Identify the conflict source from cook reports
- Determine which stream's version takes precedence (later stream wins by default)
- Flag for manual resolution if ambiguous — present to user before merge
3a.5. Verify cook report integrity.
REQUIRED SUB-SKILL: rune:integrity-check
→ Invoke integrity-check on each cook report text.
→ If any report returns TAINTED:
BLOCK this stream from merge.
Report: "Stream [id] cook report contains adversarial content."
→ If SUSPICIOUS: warn user, ask for confirmation before merge.
3b. Review cook report summaries.
For each completed stream, verify cook report contains:
- Files modified
- Tests passing
- No unresolved TODOs or sentinel CRITICAL flags
Error recovery:
If cook report contains sentinel CRITICAL:
→ BLOCK this stream from merge
→ Report: "Stream [id] blocked: CRITICAL issue in [file] — [details]"
→ Present to user for decision before continuing
3c. Evaluate subagent status per stream.
Each cook instance MUST have returned one of four statuses. Team handles them as follows:
| Cook Status | Team Action |
|---|
DONE | Stream cleared for merge — proceed normally |
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. |
NEEDS_CONTEXT | Stream paused — present the specific question to user. Resume that stream after answer. Other independent streams may continue in parallel. |
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. |
Cross-workstream review (triggered by any DONE_WITH_CONCERNS):
1. Read the concern from the cook report
2. Check if the concern touches shared contracts, interfaces, or shared files
→ Use Grep to find the concern's affected symbols/files across all worktrees
3. If concern is isolated to stream's own files → proceed to merge (concern logged only)
4. If concern crosses stream boundaries → resolve before merge:
→ Present to user with: affected streams, concern details, two remediation options
→ Do NOT merge any stream until user decides
Mark todo[2] completed.
Phase 4 — MERGE
Mark todo[3] in_progress.
4a. Merge each worktree sequentially.
# Bookmark before any merge
Bash: git tag pre-team-merge
For each stream in dependency order (independent first, dependent last):
Bash: git checkout main
Bash: git merge --no-ff [worktree-branch] -m "merge: stream [id] — [stream.task]"
If merge conflict:
Bash: git status (identify conflicting files)
If ≤3 conflicting files:
→ Resolve using cook report guidance (stream's intended change wins)
Bash: git add [resolved-files]
Bash: git merge --continue
If >3 conflicting files OR ambiguous ownership:
→ STOP merge
Bash: git merge --abort
→ Present to user: "Stream [id] has [N] conflicts. Manual resolution required."
4b. Cleanup worktrees.
Bash: git worktree remove [worktree-path] --force
(Repeat for each worktree after its branch is merged.)
Mark todo[3] completed.
Phase 5 — VERIFY
Mark todo[4] in_progress.
REQUIRED SUB-SKILL: rune:verification
→ Invoke `verification` on the merged main branch.
→ verification runs: type check, lint, unit tests, integration tests.
→ Capture: passed count, failed count, coverage %.
Error recovery:
If verification fails after merge:
→ Rollback all merges:
Bash: git reset --hard pre-team-merge
Bash: git tag -d pre-team-merge
Report: "Integration tests failed. All merges reverted to pre-team-merge state."
→ Present fix options to user
Mark todo[4] completed.
Constraints
- MUST NOT launch more than 3 parallel agents — batch if more streams exist
- MUST define clear scope boundaries per agent before dispatch — no overlapping file ownership
- MUST resolve all merge conflicts before declaring completion — no "fix later"
- MUST NOT let agents modify the same file — split by file ownership
- MUST collect and review all agent outputs before merging — no blind merge
- MUST NOT skip the integration verification after merge
Mesh Gates
| Gate | Requires | If Missing |
|---|
| Scope Gate | Each agent has explicit file ownership list | Define boundaries before dispatch |
| Conflict Gate | Zero merge conflicts after integration | Resolve all conflicts, re-verify |
| Verification Gate | All tests pass after merge | Fix regressions before completion |
Output Format
## Team Report: [Task Name]
- **Streams**: [count]
- **Status**: complete | partial | blocked
- **Duration**: [time across streams]
### Streams
| Stream | Task | Status | Deliverables | Concerns |
|--------|------|--------|-------------|----------|
| A | [task] | DONE | 3/3 delivered | None |
| B | [task] | DONE_WITH_CONCERNS | 2/2 delivered | Perf regression on large input |
| C | [task] | DONE | 2/2 delivered | None |
### Acceptance Criteria
| # | Criterion | Stream | Evidence | Verdict |
|---|-----------|--------|----------|---------|
| 1 | Auth endpoints return JWT | A | Test stdout: "3 passed" | PASS |
| 2 | No SQL injection | A | Sentinel: PASS | PASS |
| 3 | Dashboard loads < 2s | B | No perf test run | UNVERIFIED |
### Integration
- Merge conflicts: [count]
- Integration tests: [passed]/[total]
- Coverage: [%]
- Unresolved concerns: [count — from DONE_WITH_CONCERNS streams]
Parallel Execution Rules
Independent streams → PARALLEL (max 3 sonnet agents)
Dependent streams → SEQUENTIAL (respecting dependency order)
All streams done → MERGE sequentially (avoid conflicts)
Returns
| Artifact | Format | Location |
|---|
| Workstream assignments | Markdown (inline) | NEXUS Handoff Templates emitted per stream |
| Cook Reports (per stream) | Markdown (inline) | Collected from each parallel cook instance |
| Merged implementation | Source files | main branch after Phase 4 merge |
| Integration test results | Inline stdout | Captured in Phase 5 verify |
| Team Report | Markdown (inline) | Emitted at end of session |
Document Ownership
| Scope | Access | Files |
|---|
| Owns (read + write) | .rune/team-report-*.md, worktree branches, merge commits | |
| Reads (never writes) | .rune/plan-*.md, .rune/contract.md, CLAUDE.md, cook reports from sub-agents | |
| Never modifies | Source files directly (delegates to cook instances), SKILL.md files, compiler/** | |
Each cook instance owns its declared file set (disjoint). Team owns coordination artifacts only — never touches source code directly.
Monorepo Awareness
When the project is a monorepo (signals: pnpm-workspace.yaml, turbo.json, nx.json, or packages/ directory with multiple package.json):
Stream assignment rules for monorepos:
- Assign streams by package boundary, not by file type — one stream per package (e.g., Stream A =
packages/api, Stream B = packages/web)
- 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
- 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
Dependency stream pattern for cross-package changes:
Stream A (depends_on: []): packages/core — shared types + utilities
Stream B (depends_on: ["A"]): packages/api — consumes updated core types
Stream C (depends_on: ["A"]): packages/web — consumes updated core types
B and C run in parallel after A completes.
Anti-Patterns
Common multi-agent orchestration failures. These cause the most expensive rework in team workflows.
| Anti-Pattern | Why It Fails | Correct Approach |
|---|
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
Sharp Edges
Known failure modes for this skill. Check these before declaring done.
| Failure Mode | Severity | Mitigation |
|---|
| Launching more than 3 parallel agents (full mode) / 2 (lite mode) | CRITICAL | HARD-GATE blocks this — batch into ≤3 streams (full) or ≤2 (lite) |
| Using full mode with worktrees for ≤2 streams, ≤5 files | MEDIUM | Auto-detect triggers lite mode — saves opus cost and worktree overhead |
| Agents with overlapping file ownership | HIGH | Scope Gate: define disjoint file sets before dispatch — never leave overlap unresolved |
| Merging without running integration tests | HIGH | Verification Gate: integration tests on merged result are mandatory |
| Ignoring sentinel CRITICAL flag in agent cook report | HIGH | Stream blocked from merge — present to user before any merge action |
| Launching dependent streams before their dependencies complete | MEDIUM | Respect depends_on ordering — sequential after parallel, not parallel throughout |
| Coupled modules split across streams | HIGH | Dependency graph check in Phase 1c — move coupled files to same stream or add depends_on |
| Agent modified files outside declared scope | HIGH | Pre-merge scope verification in Phase 2b.5 — flag before merge, not after |
| Merge failure with no rollback path | HIGH | pre-team-merge tag created before merges — git reset --hard on failure |
| Poisoned cook report merged blindly | HIGH | Phase 3a.5 integrity-check on all cook reports before merge |
| 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 |
| Cook returns "done" with no acceptance criteria tracking | MEDIUM | Team Report includes Acceptance Criteria table with per-criterion evidence and PASS/FAIL/UNVERIFIED verdict |
| 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 |
| Parallel streams touch same files causing merge conflicts | HIGH | Change Stacking check in Step 1c: validate disjoint touches[] across all parallel streams |
Done When
- Task decomposed into ≤3 workstreams each with disjoint file ownership
- All cook agents completed and returned reports
- All merge conflicts resolved (zero unresolved before merge commit)
- Integration tests pass on merged main branch
- All worktrees cleaned up
- Team Report emitted with stream statuses and integration results
Cost Profile
~$0.20-0.50 per session. Opus for coordination. Most expensive orchestrator but handles largest tasks.
Scope guardrail: Do not invoke launch, rescue, or scaffold autonomously unless explicitly delegated by the parent agent.