agent-orchestration
Multi-agent work exists to land the user's real intent faster across genuinely independent slices — never to multiply handoff ceremony, review ping-pong, or defensive code. Identify your active role from the prompt and session context first — Coordinator (Master) or Worker — and honor the user's delegation, read/write, and merge boundaries throughout. A worker executes its assigned slice without spawning further agents unless its brief explicitly authorizes sub-delegation.
Coordinator: verify authorization, lock intent, and share context once
Confirm first that the request and host authorize delegation; when delegation is prohibited, read-only, or small and tightly coupled, execute directly. When authorized, use the fewest workers that cover genuinely independent subsystem or file-ownership seams. When one slice defines an interface another consumes (such as backend RPC shape -> frontend UI), freeze or stub that contract before launching downstream consumers.
Gather shared context once before dispatching: inspect AGENTS.md / CLAUDE.md, project docs (llmdoc when present), real product entry points, baseline branch/worktree paths, and shared runtime bottlenecks (such as a single local test database, tmpfs, or port). Frame every slice around observable user or caller behavior — who enters through which real surface, performs what action, and observes what end-to-end result (including write -> read-back consistency) — separating user-confirmed rules from reversible working assumptions.
When building from scratch or introducing a moderately complex UI/UX interaction, assign one owner to align on a playable visual demo first, then pass the reviewed demo and settled behavior into downstream briefs so workers do not duplicate demos; dispatch routine or settled slices straight to their assigned work. Carry verbatim user constraints and non-goals into templates/WORKER-BRIEF.md and operate hc, subagent, or worktree channels per references/dispatch-channels.md.
Worker: deliver the slice and verify real behavior without bloat
Confirm your workspace/worktree, baseline branch, allowed write paths, and referenced inputs before acting. Close read-only investigation or audit briefs with source-backed findings; for implementation briefs, build the agreed behavior directly (creating an upfront demo only when your brief explicitly assigns that demo) and verify end-to-end functional behavior on the real caller or product entry point. Follow existing repository conventions and enforce invariants once at the owning boundary rather than stacking per-layer defensive guards, speculative fallback branches, or single-use abstractions.
Keep verification proportional to your blast radius: exercise the live UI/CLI flow, write -> read-back path, targeted reproducer, and directly affected checks rather than authoring sprawling mock-heavy unit-test matrices or repeatedly running slow full-repository suites across rounds. Separate pre-existing unrelated baseline failures from your own changes once with evidence instead of chasing out-of-scope red checks.
Escalate uncertainty to Coordinator; resolve forks without polling
As Worker, investigate discoverable repository facts yourself and complete pre-authorized mechanical wiring inside your assigned scope. Whenever instructions conflict (such as a brief clashing with a stated user rule), required inputs are missing, a fix crosses into another worker's files or shared contract, scope would expand, or an acceptance gate is skewed by environment load, report back immediately via templates/WORKER-REPORT.md while continuing orthogonal unblocked work — never guess product semantics, silently relax acceptance criteria, or bypass the Coordinator to question the user directly.