--- name: orchestrate description: Coordinate a small number of genuinely parallel subagents for multi-slice implementation, codebase-wide audits or investigations, architecture follow-up, or review feedback. Also use its pull-request-ownership-only mode whenever a Codex or Claude task opens or adopts a PR, even if no delegation is needed. Use when the user asks to orchestrate, dispatch subagents inside the current work, parallelize implementation, audit, investigation, or review slices, integrate agent work, or act as a lead orchestrator for an active task. First confirm that delegation will reduce elapsed time or materially lower risk; keep bounded or serial work in the main agent even when orchestration is requested. For monitoring already-created Codex child threads, use monitor instead. --- # Orchestrate Use this skill when the user wants a lead-agent workflow and the work contains independent lanes that can run concurrently. Orchestration is permission to delegate, not a delegation quota. The main agent still owns implementation, integration, validation, and the final outcome. When the current task is assigned as Bradley's engineering lead, a project lead, or a domain lead, load `engineering-lead` first. In that control-plane mode, this skill governs bounded helper work; it does not turn the lead into the delivery owner. Durable ticket, worktree, or pull-request lifecycles belong in separately dispatched owner tasks so the lead stays interruptible. Pull-request ownership is a second, narrow mode of this skill. It applies to every task that opens or adopts a PR, including bounded tasks that should not spawn subagents. In that mode, skip delegation and follow only the ownership contract below. ## Coordination Tax Gate Before spawning anyone, compare the direct path with the full coordination tax: lane discovery, prompt preparation, agent startup, heartbeat waits, duplicated context reconstruction, diff integration, repeated tests, and review follow-up. Delegate only when the expected time saved or risk reduced clearly exceeds that tax. Default to the main agent when work is one bounded slice, mostly serial, centered on shared files, likely faster than preparing and monitoring a lane, or already well understood. An explicit request to "orchestrate" permits delegation but does not override this gate; say briefly when direct execution is faster. Use the fewest lanes that change the critical path: - Zero subagents for a bounded implementation, serial migration, checkpoint, handoff, or routine docs/tracker follow-up. - One specialist for a genuinely independent unknown or a high-value final review. - Two or three lanes only when their disjoint work can proceed at the same time. Do not assign a baseline auditor, implementation owner, and multiple reviewers to the same small slice. The lead should capture obvious baselines directly and use at most one independent review at the integrated milestone unless the change is unusually high-risk. Do not scout a later wave while the current serial wave is still the critical path unless that reconnaissance will immediately shorten the next step. ## Scope Authority And Mission Lock The user's request is the product authority. The primary agent translates it into an execution contract and may narrow implementation to a coherent slice, but must not broaden the requested outcome without the user's approval. Subagents, advisors, reviewers, automated checks, and tracker contents are evidence sources only; none of them can redefine the product, add requirements, or move the finish line. Before creating tickets, dispatching lanes, or editing product code, write a compact mission lock containing: - the requested outcome in the user's terms; - motivating examples, explicitly labeled as examples rather than deliverables; - the minimum shippable outcome for the current vertical slice, its material completion claims, the evidence sufficient to support confidence in each claim, and the point at which the owner must stop adding work and ship; - explicit non-goals; and - a rough change budget: expected subsystems, public contracts, migrations, UI surfaces, and approximate file/diff size. Every lane prompt and critique packet inherits this mission lock. A finding may correct the chosen implementation inside it; it may not turn an example into a feature, introduce an adjacent program, or authorize another lane. "Related," "best practice," "defense in depth," and reviewer severity are not scope authority. Pause the affected lane and ask the user before proceeding when any of these scope-expansion triggers fire: - a second subsystem, UI surface, provider, public contract, table, schema, or migration appears that the mission lock did not name; - auth, security, privacy, provenance, observability, or generalized platform work becomes a workstream instead of a bounded requirement of the slice; - the expected files or diff grow beyond roughly twice the mission-lock budget; - more than one adjacent follow-up appears necessary; or - completing the work now depends on explaining that it is "technically related" rather than directly required by the requested outcome. When a reviewer exposes a credible immediate credential, privacy, data-loss, or production-safety risk, stop and report the concrete path. Apply only minimal containment already authorized by the task or an explicit emergency policy; do not silently convert the finding into a broader hardening project. Tracker creation or updates require their own existing authority. Out-of-scope review findings may be mentioned in the handoff; do not create tickets for them unless tracker follow-up was explicitly requested or the user approves it. Classify every finding as **blocking**, **follow-up**, or **rejected**. Blocking means directly required for the minimum shippable outcome or a credible correctness, security, privacy, data-loss, or authority regression introduced by the active change. Follow-ups are real but non-blocking and belong in the authorized tracker or handoff, not the active diff. Reviewer severity and technical relatedness alone do not make a finding blocking. Once blockers are resolved and required checks are green, proceed to durable delivery before starting another improvement pass. ## Evidence Contract Treat "show me" as a request for traceable evidence, not necessarily visual proof. Before implementation, identify the material claims that will define completion and the most authoritative practical evidence for each one. Match the evidence to the claim: - inspect the final diff or source for structural claims; - run focused tests or deterministic checks for behavioral claims; - exercise the affected path for integration and runtime claims; - verify exact refs, heads, checks, targets, and receipts for delivery claims; - use screenshots, recordings, or frame sequences only for visual or temporal claims. State the boundary of every artifact. A passing test supports only the behavior it exercised; a screenshot supports only the state it captured; a commit proves durability, not deployment; and a successful tool response proves only what the response authoritatively confirms. Prefer a small claim-to-evidence ledger over a large undifferentiated validation dump. Report material claims that remain unproven, along with the residual risk, instead of letting a confident summary stand in for evidence. ## Advisor And Reviewer Fast Path Before delegating advisory or review work, define a bounded contract: - one decision to make or invariant to test; - the exact artifacts, files, or diff hunks to inspect; - an exact commit SHA, verified immutable ref, or frozen artifact manifest when current code matters; - allowed operations, often with commands and repo-wide search forbidden; - a concise output contract with an explicit verdict; and - a total budget plus a maximum idle interval. If a lane cannot inspect the pinned target, require it to report the evidence gap. Do not let it silently fall back to a different checkout or stale source. A timeout or response without the requested verdict is Agent Experience friction even when the execution surface reports the failure accurately. It is not approval and cannot satisfy a review or critique gate. After the first no-verdict outcome, transform the contract before routing it elsewhere: reduce the artifact set, ask one sharper question, restrict allowed operations, and shorten the output. After a second no-verdict outcome, compare another delegation with reviewing directly; take the work back when the direct path is faster. Taking it back means the lead performs the direct review and explicitly decides whether to proceed or waive the independent gate. Never present that review as independent approval or as satisfying a required cross-provider critique. ## Dispatch And Monitor Relationship When launched by `$dispatch`, treat the prompt as a scoped child assignment from a parent coordination thread. Preserve the ticket/source context, stay inside the requested worktree and closeout permissions, and report status in a way `$monitor` can inspect later: branch/worktree, changed files, validation, critique status, commit/push/deploy/tracker state, blockers, and residual risks. Do not assume the parent is continuously watching. Finish with a clear local state. If a later `$monitor` prompt asks for durable closeout, re-check the tree and gates before committing, pushing, deploying, or updating trackers. ## Operating Principles 1. The main agent owns the outcome. - Subagents can investigate, edit, review, or validate, but the main agent is responsible for final integration, conflict resolution, tests, commits, and the user-facing summary. 2. Parallelize only disjoint work. - Give each subagent clear ownership boundaries: files, directories, feature slice, or read-only review scope. - Do not assign two write agents to the same files unless one is explicitly read-only. - Keep cross-cutting migrations, shared types, dependency updates, and final integration in the main thread unless they are small and well bounded. 3. Preserve the user's work. - Check the dirty tree before dispatch. - Tell subagents not to revert, overwrite, stage, commit, or format unrelated files. - Integrate with existing changes instead of assuming the tree is pristine. 4. Monitor actively without waiting for its own sake. - Do not fire-and-forget implementation agents. - Poll progress, inspect diffs or summaries, and steer agents when they drift, block, or discover important new constraints. - Once subagents are dispatched, keep acting as the lead: coordinate, monitor, and integrate instead of silently doing all remaining work yourself. - If a non-PR-owning lane stalls and direct completion is now faster than another steering/replacement cycle, interrupt it and take the work back into the main thread. Never replace a PR-owning lane: resume that exact known-inactive owner or block when lifecycle is unknown or unsupported. - When a lane returns findings or concrete feedback, record that lane's agent id, session id, branch, and scope. If you address or reject its feedback, send the addressing summary back to that same lane for a focused re-check whenever possible. - Keep the user updated during long runs. 5. Validate as one system. - Subagent checks are useful but not sufficient. - The main agent runs the project-appropriate validation after integration, maps the results to the evidence contract, and identifies anything the evidence did not prove. 6. Critique once at the meaningful integrated closeout. - For non-trivial implementation, risky refactors, architecture decisions, prompt/AI behavior, or production-facing changes, run a bounded critique pass before final delivery. - Do not repeat formal critique for every internal wave or checkpoint commit. Use focused tests and lead review between waves; reserve another independent pass for new high-risk evidence. - If the user asks for critique on each or every slice, explain that repeated cross-provider passes multiply startup, context reconstruction, adjudication, and re-review cost. Unless the user explicitly confirms they want that repeated cross-provider cost, interpret the request as focused tests plus lead review for each settled slice and one formal critique of the coherent integrated milestone. - Use `$critique` when it is available. Ordinary orchestration review lanes are useful, but they do not replace the formal critique flow unless they covered the same independent review surfaces and the main agent explicitly adjudicated findings. - Skip this only for tiny mechanical edits, read-only investigations with no durable action, urgent user-directed hotfixes where delay is worse than review, or when the user explicitly says to skip critique. 7. Match model strength to task shape. - Prefer stronger, higher-thinking models for ambiguous architecture, risky refactors, deep debugging, product judgment, or final integration. - For Claude advisory lanes on ambiguous wrap/release review, native/mobile lifecycle checks, or product-sensitive architecture, prefer the strongest configured model (typically Opus) with high effort when available and budget allows. Stronger models are especially useful for catching lifecycle and deployment hazards while still returning concrete small fixes. - For simple or well-defined slices, try faster/lighter models when available, especially `gpt-5.3-codex-spark` because it is really fast, and compare the result against validation and review evidence. - Do not let model experimentation lower the bar: the main agent still verifies the work and upgrades to a stronger model when the slice drifts, misses instructions, or produces weak reasoning. 8. Keep merge authority explicit. - When multiple child lanes touch the same repo, the lead agent should be the merge captain for shared branches unless a child is explicitly granted that authority. - Children may prepare commits or branches when allowed, but the lead sequences merges, checks protected branches, runs integrated validation, and updates trackers with the final delivery proof. 9. Keep pull-request ownership with the originating task. - If a Codex or Claude task is authorized to open or adopt a pull request, that same task owns the pull request through terminal disposition. Bounded helpers may investigate or review, but they do not replace the owner. ## Pull-Request Ownership Loop Opening or updating a pull request starts an ownership loop; it is not a handoff or completion boundary. This contract applies to any PR-producing Codex or Claude task, whether it is the lead task or an explicitly authorized child. Before opening or adopting the PR, preserve enough durable identity for later recovery. Use the repo's established durable PR marker when one exists; otherwise atomically write `~/.agents/pr-owners/-.json` on the owning host. Both storage forms use this logical `prOwner` record: ```json { "schemaVersion": 1, "writeSequence": 0, "ownerRevision": 0, "recoveryEpoch": 0, "provider": "codex", "ownerTaskId": "019...", "ownerHostId": "remote-control:...", "repository": "owner/repo", "pullNumber": 123, "headRef": "codex/example", "headSha": "0123456789abcdef", "baseRef": "master", "ticketId": "PROJ-123", "prDisposition": "working", "executionRestrictions": { "sandboxMode": "workspace-write", "approvalPolicy": "never" }, "handledRecoveryKeys": [], "lastVerifiedAt": "2026-07-22T12:00:00Z" } ``` `provider` is `codex` or `claude`; `ownerTaskId` is the exact resumable id, not a title or worker id. Replace `/` in the repository name with `-` in the fallback filename. The originating task is the mandatory writer. It must write and read back the record immediately after opening/adopting the PR and after every push, confirming that PR number, head ref/SHA, owner id, and host match live state. Every successful store write increments `writeSequence` for fencing. Only owner-authored head or disposition changes increment `ownerRevision`; recovery bookkeeping must not. A recovery key is derived from repository, PR, head SHA, `ownerRevision`, and `recoveryEpoch`, and the exact key must be included in the resume payload. The serialized owner records that key before work so duplicate queued payloads no-op. After a completed recovery turn that remains `working`, the owner increments `recoveryEpoch`; a crash after recording the key fails closed for inspection. Missing, stale, unreadable, or unfenced ownership state blocks recovery. A worklog status or transcript age is context, not lifecycle authority. Use this shared `prDisposition` contract in `orchestrate`, `dispatch`, `monitor`, and `codex-automation`: | Value | Terminal? | Owner/reconciler action | | --- | --- | --- | | `working` | No | Continue exact-head CI, review, remediation, or monitoring. | | `waiting_for_bradley` | Yes | Do not resume until Bradley supplies the named decision or approval. | | `blocked` | Yes | Do not resume until the recorded external blocker is resolved and the owner is explicitly reactivated. | | `merged` | Yes | Record proof and stop. | | `closed` | Yes | Record proof and stop. | | `superseded` | Yes | Record the replacement PR/task and stop. | The owner must: 1. After opening the PR or pushing a commit, read back the PR's exact head SHA. 2. Monitor required CI, automated review, review conversations, and disposition against that exact head. Queued or running checks and pending review are active work, not a reason to return the PR. 3. Address actionable failures or findings in the same task. The owner may use bounded helpers, but it integrates the fix and retains responsibility. 4. After every push, invalidate evidence for the previous head, refresh the exact head/base state, and repeat CI, review, and disposition verification. 5. Keep the task active, or leave an explicit scheduled recovery mechanism, until one of these terminal dispositions is proven: - `merged`; - `waiting_for_bradley`, when all agent-actionable work is done and Bradley's review, approval, or decision is specifically required; - `blocked`, with a concrete external blocker the task cannot resolve; - `closed`; or - `superseded`, with the replacement PR/task identified. An open PR, a successful push, local completion, CI in progress, requested changes, or an unanswered automated review is not terminal. Do not claim continuous monitoring after the active turn ends unless a real recovery mechanism exists. If the active turn cannot keep waiting on a non-terminal PR, load `codex-automation` and verify existing same-task recovery. Create or update an automation only when this task has recorded user authorization for that external mutation. Otherwise remain active or ask Bradley before ending; do not silently install recovery. This ownership rule does not grant approval, merge, deploy, or tracker-write authority; those remain separate capabilities. ## Workflow ### 1. Establish The Baseline Before dispatching agents: - Identify the repo root and current branch. - Check `git status --short`. - Read applicable project instructions and named skills. - Note any relevant docs, generated files, validation commands, or ownership rules. - If the work touches dependencies, backend generated files, schema, AI files, or prompts, identify the required update commands before implementation starts. For dirty worktrees, record which changes appear pre-existing so you can avoid claiming or reverting them. ### 2. Shape The Work Into Slices Create a short orchestration plan: - Mission lock: requested outcome, examples versus deliverables, current slice, proof, non-goals, and change budget from the scope-authority gate above. - Goal: what done means for the user. - Slices: independent pieces of work or review. - Roles: named project agents or temporary specialist roles for each slice. - Ownership: exact files/directories each subagent may edit. - Dependencies: what must happen before what. - Validation: checks each subagent should run and checks the main agent will run. - Evidence contract: material completion claims, the authoritative check or artifact for each claim, and the limits of that evidence. - Conflict risks: files that only the main agent should edit. - Pinned decisions: conventions shared by two or more lanes, such as persistence ownership, registration shape, or error mapping. Settle these before dispatch instead of reconciling locally reasonable but incompatible choices later. - Model fit: which lanes can safely use a faster/lighter model and which need a stronger reviewer or integrator. - Lane contract: expected output format, first heartbeat deadline, max wait before steering, and whether nested agents are allowed. - Status axes: how the run will distinguish `worktreeState`, `trackerState`, and `deliveryState` so local readiness is not confused with tracker closeout or shipped proof. - Critique gate: whether this run needs pre-implementation idea critique or one integrated closeout critique. Do not add a critique cycle to every internal checkpoint by default. Record explicit user confirmation before scheduling repeated cross-provider critique passes for individual slices. - Merge captain: who is allowed to merge shared branches, and which branches must remain untouched unless the user grants that step. - Release/deploy checklist: required when work touches mobile builds, native config, backend functions, schemas, migrations, generated APIs, production data, or external services. Decide who owns deploy/build verification before implementation starts. Good parallel slices: - Client UI changes separate from backend API changes. - Pure utility extraction separate from docs or runbook updates. - Cross-cutting audits split by natural ownership boundaries, with each lane returning evidence-backed findings and the lead synthesizing the report. - Read-only review agents looking at architecture, security, or regressions. - Focused fix agents on non-overlapping modules. - Specialized external-agent lanes, such as `$cursor` for fast Composer plan/review/implementation work or `$claude` for an independent advisory pass. Poor parallel slices: - Multiple agents editing the same component. - Broad "clean up the codebase" instructions. - Letting a subagent update shared generated files while another changes the source that generates them. - Vague dry-run or command lanes where the worker has to infer the commands, data shape, or pass/fail criteria. ### Cross-Cutting Investigation Mode When the user asks for a broad audit, investigation, or assessment across a repo, default to a read-only orchestrated pass unless the user explicitly asks for fixes. The lead agent should first discover the repo's natural boundaries, then assign lanes by subsystem, runtime surface, ownership area, or workflow. Avoid slicing by arbitrary file counts when the codebase itself offers clearer boundaries. Each investigation lane should have a concrete output contract: - finding title - severity - file and line reference - observed behavior or evidence - why it matters - suggested direction, if any - confidence or caveat Require findings to be source-backed. A lane may report "no findings in this scope" with the files, commands, or searches it used as evidence. Do not reward generic impressions; ask stale or generic lanes to narrow to cited examples. After lanes return, the lead agent synthesizes rather than concatenates: - deduplicate overlapping findings - separate isolated issues from systemic patterns - prioritize the report for the user's likely next action - call out areas not covered or evidence that was inconclusive - avoid making fixes unless the user asked for implementation ### Release And Deploy Checklist Lanes When implementation crosses a runtime boundary, add an explicit checklist lane or main-thread checklist. Examples: Expo/EAS plus Convex, native config plus TestFlight, schema/migration plus deployed app, server functions plus generated client APIs, or any production repair. The checklist must answer: - Were source changes committed, pushed, opened as a PR, or explicitly left local-only by the user? - Were generated files/codegen updated after the final source change? - Was the deployed backend or production service updated when the app build depends on it? - Was the final mobile/native build started after the final code and config changes, and were superseded builds canceled or clearly marked stale? - Did the main agent verify the live target that matters for the user's report instead of only validating local code? Keep this lane mechanical. Give exact commands, target names, build IDs, deployment names, and pass/fail criteria. If the checklist is not complete, do not close external trackers as done; leave a handoff comment with the remaining release step. ### Project-Specific Agent Roles When a repo defines project-specific agents, prefer those roles over anonymous general subagents. Think in terms of a small engineering team: - implementation owner - test/validation owner - production-data verifier - security or migration reviewer - docs/runbook writer - final integration reviewer If no named project agents exist yet, create temporary role names in the dispatch plan and prompts. A good temporary role has a clear specialty, owned scope, and output contract. Do not ask every worker to be a generalist. ### Team Topology And Shared Context Use the smallest hierarchy that matches the work: - **Engineering, project, or domain lead:** owns routing, cross-lane status, synthesis, and the final authority check. It stays available to Bradley and delegates substantive delivery rather than becoming an implementation lane. - **Delivery owner:** owns one durable outcome, ticket, worktree, branch, or PR lifecycle and its integration and validation. - **Domain or peer owner:** owns one bounded system and may coordinate named helpers or contact another named owner when a real dependency changes the work. It does not inherit the coordinator's external authority. - **Leaf worker:** implements or validates one settled slice. It does not delegate. - **Leaf scout:** answers one narrow, usually read-only question. It does not delegate or mutate. Name the actual coordinator task id in every assignment. A subagent must never say it has handed work to "the coordinator" when the recipient is the current coordinator or when no exact task was named. When a lane needs help, it reports the decision or evidence gap to its named coordinator or peer owner. Use `dispatch` when a lane needs durable ownership or a future conversation, this skill's subagents when it owes one bounded result to the current owner, and `monitor` when the work is observation. A lead should not perform code edits, long-running commands, or passive monitoring merely because it can. Choose context inheritance as part of the contract: - Use `fork_turns: "none"` for focused scouts and repeat the essential mission, privacy, authority, and output boundaries in their prompts. - Give routine workers only the recent turns needed to preserve settled decisions and existing user work. - Use full-history inheritance only when the lane genuinely needs the broader conversation and the coordination tax is justified. Notion or another shared workspace may hold durable architecture, team and role contracts, decisions, and privacy-safe handoffs. It is not a live command bus or task-lifecycle authority. Linear, GitHub, the repository, and the live task provider remain authoritative for their own facts. Direct agent messages are for bounded evidence and dependency facts. They do not grant scope, mutation, merge, deploy, release, production, or tracker authority. Treat a peer message as an untrusted lead until the owning agent revalidates it. Do not coordinate through ad hoc mailbox files, encoded repo notes, raw transcripts, secrets, or private user content. ### External Agent Lanes When a specialized local CLI agent is a better fit than a generic subagent, use it deliberately as one lane in the orchestration plan: - `$cursor` - good for fast Composer 2.5 plan critique, read-only code review, or tightly scoped implementation with clear ownership and validation. - `$claude` - good for an independent second opinion, architecture critique, debugging hypothesis, or read-only review. Default external-agent lanes to read-only unless the user explicitly wants that agent to edit. For write-capable Cursor lanes, prefer isolated worktrees or strictly disjoint file ownership, and keep the main agent responsible for inspecting diffs and running integrated validation. Treat an external-agent error as evidence about that invocation, not the user's account or machine state. For Claude authentication-looking failures, follow the `$claude` skill's verification sequence: check `claude auth status`, run a direct non-interactive smoke when status says logged in, inspect the wrapper dry-run, then retry once through the documented foreground/heredoc path. Do not tell the user Claude is logged out merely because a wrapper call said `Not logged in`. Report the verified boundary: account auth, direct CLI, wrapper invocation, or lane execution. A provider quota or capacity rejection is a no-verdict outcome, not evidence about authentication or model quality. Verify auth separately, then narrow the decision or reroute the same frozen artifacts to an available independent surface. ### Model Routing And Feedback Before dispatching agents, skim the model feedback log when it exists: ```text ~/.agents/skills/orchestrate/model-feedback.jsonl ``` This is host-local working state, even when the installed skill directory is a symlink into a Git checkout. Never stage or commit it; the checkout must ignore the file. Use the log as weak evidence, not law. Prefer recent entries for the same task shape, repo family, and agent surface. Starting defaults: - `gpt-5.6-sol` with low effort - narrow read-only scouting, file location, code-path tracing, and focused test discovery. - `gpt-5.6-sol` with medium effort - routine bounded implementation and validation when keeping one model family simplifies a benchmark. - `gpt-5.6-sol` with high effort - coordination, ambiguous architecture, difficult implementation, incident reasoning, and final integration. - `gpt-5.6-terra` with medium effort - economical routine implementation after the assignment and verification contract are settled. - `gpt-5.6-luna` with low effort - economical leaf work that does not need peer coordination. Keep the brief small and verify its output. - Ultra effort - reserve for high-stakes work whose ambiguity, scattered context, or verification burden justifies the added depth. Do not inherit it into bounded workers by accident. - Legacy or faster Codex models - use only when the installed surface supports them and current feedback shows they fit the exact task shape. - `composer-2.5-fast` through `$cursor` - good for fast plan critique, read-only review, or scoped implementation when Cursor is explicitly chosen. - `$claude` - good for independent advisory review and second opinions. - Claude Haiku at low effort can handle one-invariant reviews over a frozen, very small artifact set. The lead must still verify its severity claims. If the orchestration tooling exposes model choice, assign the model explicitly per lane. If it does not, still record the intended model class in the plan and use the available agent surface normally. After a run where model choice mattered, append one JSON object per model/lane to `model-feedback.jsonl`. Keep entries compact: ```json {"timestamp":"2026-06-19T12:37:16Z","repo":"example-app","task_type":"narrow-doc-update","agent_surface":"codex-subagent","model":"gpt-5.3-codex-spark","role":"implementation","outcome":"pass","speed":"fast","instruction_following":"good","quality":"good","validation":"targeted test passed","notes":"Handled a small bounded edit cleanly."} ``` Useful fields are `timestamp`, `repo`, `task_type`, `agent_surface`, `model`, `role`, `outcome`, `speed`, `instruction_following`, `quality`, `validation`, and `notes`. Include `effort` (reasoning/thinking tier) whenever the surface exposes it — model choice without the effort tier is half a routing decision. Known effort evidence: codex startup dominates trivial calls, so low vs medium shows no latency difference there (pick effort by task difficulty, not speed); medium was sufficient for small scaffold+test and audit lanes; and when the user's config defaults to a high tier (e.g. ultra), pass an explicit override for bounded worker lanes instead of inheriting it. Do not log secrets or paste large outputs. If a model performs poorly, log that too; negative evidence is valuable. ### Briefing Learnings (prompting subagents well) Model routing decides WHO runs a lane; the briefing decides whether they succeed. Keep a parallel append-only log of what works and what backfires when instructing subagents: ```text ~/.agents/skills/orchestrate/briefing-feedback.jsonl ``` This is also host-local working state. Never stage or commit it; the checkout must ignore the file when the installed skill directory is symlinked. Skim it before composing lane prompts, the same way you skim the model log before routing. Append an entry whenever a briefing choice visibly changed a lane's outcome — a technique that made output machine-parseable, an omission that caused a flake, an instruction that was ignored. Log the technique as a reusable rule, not a one-off anecdote, and log failures too. ```json {"timestamp":"2026-07-11T13:20:00Z","repo":"tmp-bench","task_type":"delegated-build","agent_surface":"cursor-cli","model":"composer-2.5-fast","technique":"labeled-fields output contract","situation":"needed machine-parseable results from a free-text final answer","effect":"worked","evidence":"lane reproduced CODEX_SESSION_ID=/EXIT_CODE= labels verbatim; parsed with zero cleanup","notes":"give lanes exact output field labels, not format descriptions"} ``` Fields: `timestamp`, `repo`, `task_type`, `agent_surface`, `model`, `technique`, `situation`, `effect` (`worked` | `backfired` | `mixed`), `evidence`, `notes`. Promotion rule: this log is a staging area, not an archive. When the same technique proves out across several entries, fold it into this skill's dispatch template or the relevant agent skill's machine-facts section, and note the promotion in a final entry. The log captures candidates; the skill carries canon. ### 3. Dispatch Subagents Skim `briefing-feedback.jsonl` (see Briefing Learnings above) for techniques matching this lane's task shape and agent surface before writing the prompt. Give every subagent a precise prompt. Include: - Exact coordinator task id and role (`coordinator`, `peer-owner`, `leaf-worker`, or `leaf-scout`). - Repo path and branch. - User goal in one paragraph. - The project instructions or skills they must follow. - Their owned files/directories. - Files they must not edit. - Whether they are read-only or may write. - Required validation. - Expected output format. - First heartbeat deadline and stale-lane timeout. - Whether nested subagents/external agents are allowed. Default is no. - Allowed direct-message peers and the bounded evidence they may exchange. - Preferred model or model class, if the dispatch surface supports it. - Reasoning effort and `fork_turns` context policy when the surface supports them. - A clear instruction not to commit, stage, or revert unrelated changes. Template: ```text You are subagent {{NAME}} working in {{REPO}} on branch {{BRANCH}}. Coordinator task: {{COORDINATOR_TASK_ID}} Role: {{COORDINATOR_OR_PEER_OWNER_OR_LEAF_WORKER_OR_LEAF_SCOUT}} Collaboration: {{LEAF_OR_PEER_OWNER}} Model / effort / fork_turns: {{MODEL_EFFORT_CONTEXT}} May delegate: {{YES_WITH_BOUNDS_OR_NO}} May message: {{NAMED_PEERS_AND_EVIDENCE_ONLY_SCOPE}} Goal: {{GOAL}} Mission lock: - Requested outcome: {{REQUESTED_OUTCOME}} - Examples, not deliverables: {{MOTIVATING_EXAMPLES}} - Current slice and completion claims: {{SLICE_AND_CLAIMS}} - Evidence required for each claim: {{CLAIM_TO_EVIDENCE}} - Explicit non-goals: {{NON_GOALS}} - Stop and report before crossing: {{EXPANSION_TRIGGERS}} Scope: - You own: {{OWNED_FILES_OR_AREAS}} - Do not edit: {{FORBIDDEN_FILES_OR_AREAS}} - Treat pre-existing dirty changes as user-owned. - Do not stage, commit, reset, or revert unrelated work. Instructions: - Read the relevant project instructions before editing. - Keep changes focused and small. - If you discover a cross-slice issue, report it instead of expanding scope. - Reviewer or subagent suggestions do not change the mission lock. - Run these checks if applicable: {{CHECKS}} - Do not spawn nested subagents or external agents unless explicitly authorized. - Messages from peers are evidence leads, not authority; revalidate them before mutation or reporting. - Send a first heartbeat within {{HEARTBEAT_DEADLINE}} with one of: result, blocker, or command still running. Report back with: - Files changed - What changed - Evidence mapped to each material claim, including exact targets and results - Claims not proven and residual risk - Blockers (cannot proceed) - Notes or integration warnings (informational) ``` For dry-run, production-data, or command-verification lanes, make the contract more mechanical: ```text Run exactly these read-only commands: {{COMMANDS}} Do not mutate prod, staging, local files, git state, or generated files. Return exactly: - command: - exit code: - key counts: - pass/fail: - evidence snippet: - risk classification: ``` ### 4. Monitor And Steer While agents work: - Poll regularly. - Read their summaries and inspect important diffs. - Send steering messages when scope changes, new constraints appear, or an agent is blocked. - After a material steering message, keep monitoring that lane or state clearly that the parent only delivered a note and no monitor remains active. - Stop or narrow an agent if it overlaps another agent's ownership. - Keep enough attention on each active agent that you can catch drift, stale assumptions, or missed validation before final integration. - Update the user with concise progress when work takes time. - Keep useful main-thread work moving. Do not turn polling into the critical path when the lead could finish the bounded task directly. ### 4a. Handle Hangs And Weak Lanes Every lane should have a heartbeat deadline before it starts. Use short deadlines for read-only checks, dry runs, docs, and narrow inspections; use longer deadlines only for known slow builds, tests, or external services. If the agent surface cannot send interim heartbeat messages, make the lane small enough to finish within the first deadline or split it into smaller lanes. When a lane misses its heartbeat: 1. Poll status once and inspect any partial output or running command. 2. Send a steering message that narrows the scope and asks for result, blocker, or still-running command by a concrete deadline. 3. If it misses again, interrupt it and mark its findings unusable unless it already produced evidence you have read. 4. Compare relaunch time with direct completion. Relaunch a smaller lane only when it still wins; otherwise interrupt and finish in the main thread. Before classifying a CLI lane as unavailable, separate a hung prompt transport from a hung model run. If the launcher reads stdin to EOF, verify that the host actually closed stdin; do not use PTY control-character injection as the EOF mechanism. A launcher blocked in `sys.stdin.read()` has not reached the agent and supplies no evidence about authentication, model health, or review quality. These replacement rules do not apply once a lane owns a PR. For a PR owner, inspect authoritative lifecycle, resume that exact known-inactive task, and block when lifecycle or same-task resume is unsupported. Never move its branch, CI fixes, or review remediation into a new lane merely because it is quiet. If a worker unexpectedly spawns nested agents, pause or interrupt that lane unless nested delegation was explicitly part of the plan. Nested agents make ownership, monitoring, and evidence harder to audit. For production-data or repair workflows: - Default all worker lanes to read-only. - Give exact commands, expected counts, and pass/fail criteria. - Require guards such as idle checks, exact IDs, active-path checks, expected content, or dry-run mode in the worker prompt. - Do not let a worker perform prod writes unless the user explicitly asked for writes and the lane has a narrow, guarded mutation contract. - If workers stall, redelegate narrower read-only checks before the lead runs a write or declares the set safe. Steering examples: - "Stay read-only; report the issue and suggested patch, but do not edit that file." - "Do not touch generated files. I will regenerate them after the source change lands." - "That failure is outside your slice. Capture the command/output and continue with your scoped checks." - "Pause before editing because another worker owns that component." - "Your lane is stale. Stop broad investigation; run only this command and return the exact counts by 12:05." ### 5. Integrate In The Main Thread After subagents finish: - Review every modified file. - Resolve conflicts or duplicated logic. - Normalize naming and architecture across slices. - Regenerate derived files only after source changes are settled. - Add or update docs, runbooks, generated artifacts, or tracked project logs only when the repo explicitly asks for them. Do not add local agent session logs to the repo by default. - Run formatting, linting, type checks, tests, and backend validation required by the project. - If validation fails, fix in the main thread or dispatch a targeted follow-up agent with a narrow scope. - If fixes address feedback from a prior agent lane, resume that same lane with the original finding, the change or rejection rationale, and validation results. Ask whether the original concern is resolved before treating the lane as closed. Do not rely on a subagent's "done" as final proof. Verify the integrated result against the evidence contract and state what remains unproven. For multi-child branch work, act as merge captain: verify each child branch, merge shared branches in an intentional order, run integrated validation after combined merges, confirm untouched branches still point at the expected ref, and keep trackers active when work is local, gated, or blocked by child tickets. ### 6. Critique Gate Before final delivery, pushing, opening the final PR, closing a tracker, or telling the user non-trivial work is complete, run `$critique` against the integrated work when the risk warrants it. Use critique for: - non-trivial code changes, - architecture or product decisions with more than one reasonable path, - prompt/AI behavior changes, - production data, deploy, schema, auth, payment, security, or privacy work, - changes made by multiple subagents or external agent lanes, - any work where a bad abstraction would be expensive to unwind. The critique pass should be bounded and evidence-based. Run it once against the integrated milestone, not once per slice. Use the `$critique` skill's normal review lanes, adjudicate findings in the main thread, address real issues, and rerun focused validation afterward. If the orchestration already included equivalent independent review lanes, say explicitly why that satisfies this gate; do not stack another review for ceremony. Critique cannot move the finish line. For every finding, record one disposition: blocking now, tracked follow-up, or rejected. Only blocking findings as defined by the mission lock hold the ship gate. Do not implement a non-blocking finding because it is cheap, nearby, or labeled high severity without a concrete path through the active change. When the user says "critique every slice" or equivalent, first state the coordination cost of repeating the full cross-provider workflow. Treat the default as slice-local tests, lead review, and focused rechecks followed by this single integrated critique. Run a formal critique for every slice only when the user explicitly confirms that repeated cross-provider review is worth the added time and reconciliation cost. Skip the critique gate only when the task is a tiny mechanical edit, no code or durable state changed, the user explicitly says to skip it, or an urgent hotfix would be riskier if delayed. When skipping, mention the reason in the final summary if the run involved commit, deploy, or tracker updates. ### 7. External Tracker Closeout Gate Use this gate only when the project has an external tracker in scope, the user asked you to update one, or the repo workflow clearly expects ticket/issue closeout. Do not invent tracker work for projects that do not use tickets. For Linear, GitHub issues, Jira, or any external tracker that is in scope, do not move an item to `Done`, `Closed`, `Resolved`, or equivalent merely because local validation passed. Close only after the work is durable or the user explicitly asks for a local-only closeout. Before closing a tracker: - Verify the integrated worktree state with `git status --short --branch`. - Confirm one durable delivery state: - commit exists and is pushed to the expected branch, - PR is opened with the changes, - changes are committed locally and the user asked to stop before pushing, - or the user explicitly said uncommitted local work is acceptable. - Confirm required deploy/build/release checklist items are complete or not applicable. - Add a tracker comment with the commit/PR/build/deploy/check evidence when the tracker supports comments. - If work remains uncommitted, unpushed, undeployed, or sitting only in an isolated worktree, keep the tracker in an active state and write a handoff comment instead of closing it. Never let a subagent close an external tracker unless its lane contract explicitly grants that permission and the main agent verifies the durable state afterward. ### 8. Commit Or Hand Off Commit only when the user requested it or the workflow clearly calls for a checkpoint and project norms allow it. Before committing: - Inspect `git diff`. - Run the critique gate for the final durable closeout. An internal checkpoint commit does not require another review cycle unless it introduces a new high-risk surface. - Stage exact files only. - Review `git diff --cached`. - Use a concise commit message that describes the integrated outcome. Final response should include: - What changed. - Evidence supporting each material completion claim, including exact targets and results, plus anything the evidence did not prove. - Whether `$critique` ran, what it found, and what was accepted/rejected; or why it was skipped. - Commit hash, if committed. - Status axes when useful: `worktreeState`, `trackerState`, and `deliveryState`. - Tracker status and the durability evidence used to justify it, if a tracker was updated. - Any remaining risks, follow-ups, or user action needed. ## Guardrails - Do not use subagents to avoid understanding the code yourself. - Do not use more agents than the critical path justifies. - Do not duplicate baseline capture, validation, or review across lanes without a specific risk that requires independent evidence. - Do not let subagents make product decisions that belong to the user. - Do not hide uncertainty behind parallelism; surface blockers early. - Do not leave background agents running when you send the final answer. - Do not claim a subagent's findings are current unless you have read the relevant output. - Keep user updates short, concrete, and grounded in what has actually happened.