# Subagent selection and handoff Use Implementation ownership before choosing who will edit. Use the handoff procedure once delegation is permitted or required. The calling workflow owns delegation triggers, scope, grants, and acceptance rules. 1. Read the user's instructions, repository agent guidance, and the calling workflow's role, scope, and permission requirements. Keep the selected lead model unchanged. If delegation is optional, stay in the current agent for small or tightly coupled work without an independent task. 2. Choose by required capability before runtime role name or cost. Match the task to bounded discovery, predetermined checking, implementation and repair ownership, or independent judgment-based review. Use an exceptional investigator for a concrete unresolved question backed by evidence, not a broad topic or large task. Respect configured agent and model choices; this reference does not pin a model or reasoning level. Confirm the chosen agent's actual read/write access, tools, isolation, capacity, and ability to persist or resume for the required work. 3. Give the agent one bounded assignment using the handoff brief below. Prefer pointers to existing plans, instructions, checkout state, and evidence over copying their contents when each recipient can retrieve the referenced material. Keep task-specific scope and permission differences explicit in the brief. Verify that every recipient can access each reference and that it still describes the assigned state; replace an inaccessible or stale pointer with a corrected reference or the smallest necessary excerpt. A pointer does not supply missing scope, action authority, acceptance criteria, or source authority. A fresh independent audit must still receive a self-contained brief, including the approved source, fixed base and candidate, review standard, and required verdict and coverage; pointers may provide supporting context but cannot make those essentials depend on inherited conversation. 4. After bounding the assignment, select model and reasoning together under the user's subagent model-selection policy. Classify the actual delegated work independently of the parent ticket, caller's model, or role name: worker and independent reviewer describe responsibilities, not model tiers. Preserve explicit configured selections and apply that policy to unspecified settings before dispatch; do not duplicate its model table here. 5. Retain the agent handle when follow-up or repair may be needed. Inspect its returned work and evidence under the calling workflow's acceptance rules; an agent's success report is not independent acceptance. Return failed work to the same owner when the calling workflow requires that continuity. Finish this handoff with the selected capability and actual runtime role, the model and reasoning level only when exposed, the bounded brief, and the result or blocker. If a required capability is unavailable, report it to the caller; if delegation was optional, the caller may continue solo within its own rules. ## Implementation ownership 1. Classify the approved work under the calling workflow's ownership rules and the applicable runtime model and effort policy. For an otherwise solo-eligible item or serial chain, assess the judgment needed for the entire assignment. For parallel work, assess each worker assignment under the existing graph rules. Read the lead's effective settings from exposed runtime evidence, including the user's picker selection. Keep those settings fixed. Use the existing runtime-specific guidance from `subagent-delegation` or the caller's configured policy. If an opt-in requires a policy choice that cannot be resolved, report it in step 4. 2. Resolve required implementation settings field by field. Apply explicit implementation pins first. With automatic implementation routing enabled, require the applicable policy's effective choice for each unpinned field, accounting for eligible configured profiles and installed role pins. With a pin alone, only its specified fields constrain solo eligibility and the usual worker policy fills open fields if a worker is needed. Without either request, treat the policy recommendation as advisory for eligible solo work. Keep the existing worker policy for work already requiring delegation. A picker choice, installed worker pin or profile default alone does not opt the caller into automatic implementation routing. 3. Keep the lead when the work qualifies for solo and the lead is verified to meet all required fields. Otherwise, for a solo-eligible item or chain with required settings, select one authorized, isolated, resumable worker that meets them. Keep the worker for every item and repair, retaining per-item commit, acceptance, integration and affected-check gates. For parallel work, retain the existing frontier and worker ownership rules and match required settings for each assignment. Treat unavailable or unverified settings as a mismatch. Use actual runtime support and preserve installed role pins when testing whether a route is possible. 4. Record the owner, reason and exposed effective model and effort in the existing preflight or delivery record. If a compatible route is temporarily busy, retain it and wait under the calling workflow's capacity rules. Treat a route that cannot fit the configured limits as unavailable. If no authorized route can satisfy the request, pause affected work before edits. Record the required model and effort where resolved, the mismatch or missing evidence, and the supported resume action, such as selecting matching lead settings or authorizing a compatible worker. Ask for explicit acceptance before using different settings. Continue unrelated ready work where supported. On resume, reconcile prior work and keep the repair owner under the existing recovery rules. Use the reviewer's existing policy independently of implementation routing. ## Handoff brief Fill every field, by value or by an accessible pointer to an existing record; mark a non-applicable field `n/a`. Do not create a new plan, packet, or other document solely to avoid a short inline detail when no suitable record exists. - Objective or question. Specify the concrete method, primary evidence source, and checks to run; do not use persona roleplay in place of methods. - **Workspace.** Exact checkout path and state, including branch and base SHA when applicable. In an editing brief, include “Preserve others' edits, including concurrent changes in your owned files.” In every brief, include “Create scratch files, logs and backups with `mktemp`, or restore from Git (`HEAD` or a WIP commit); never use a fixed name in a shared temp directory, because parallel agents share `/tmp` when the sandbox is off.” - Relevant instructions and evidence. - Allowed actions and forbidden actions. - Acceptance criteria and expected result. - Blocker to report if it cannot proceed. - **Remote writes.** Include “Remote writes are reserved to the root task and require user authorization.” State the current grant separately. - **Further delegation.** State the lead's explicit grant or include “Further delegation is forbidden.” - Implementation only: owned files, focused validation, and escalation triggers. Stop and return to the lead, keeping ownership, when the plan or requirements are ambiguous, an unowned file needs changing, an interface outside the task must change, or an approved test seam does not fit. - Review only: approved source, fixed base and exact candidate head, standards, and verdict format: `ship`, `fix-first`, or `rethink` with a coverage account. ## Return - Each validation or check command: command, exit code, tested SHA, short output tail, and path to a log holding the complete output. A read-only agent may cite an existing log or mark the log path `n/a`. - Blockers. - Decisions returned to the lead. - Implementation only: commit SHA, base SHA, files changed, and whether the worktree is clean. - Review only: verdict, findings with evidence, and coverage account. The complete log, not the tail, is the evidence the caller inspects when acceptance needs it. When a governing skill or wrapper forbids reading raw output, such as `gradle-run`, report its bounded summary and run identifier instead of a log path; that summary is the evidence, and no one reopens the raw log. ## Claude Code - Resume an owner with `SendMessage` to its agent ID. - Nesting is on by default: forbid the Agent tool in the brief unless the caller grants further delegation. - With no user model-selection policy, leave `model` unset so it is inherited; set effort only when the user asks. - A top-level session runs workers in the background and waits for the completion notification; do not poll or sleep. - Check the session's completion behavior before launching nested work. Interactive nested calls normally wait for results. In headless `-p` or SDK sessions with fork mode off, nested agents can default to background and report to the main agent after the parent returns. When the parent needs a result before returning, use the runtime's foreground/wait mechanism (`run_in_background: false` where exposed); put independent launches in one message to keep them parallel. - Before dispatching background writers, establish permission for the commit and validation commands they will run, reusing existing authorization. A worker denied permission reports a blocker and does not seek a workaround. - `Explore` and `Plan` are one-shot; do not use them for owners that may need repair or follow-up. Verify runtime mechanics against [Claude Code subagent documentation](https://code.claude.com/docs/en/sub-agents); session mode and exposed tool capabilities govern result delivery. ## Antigravity - Resume an owner with `send_message` using its returned `conversationId`; inspect or stop subagents with `manage_subagents`. - Subagents (`invoke_subagent`) and background commands (`run_command`) deliver completions via reactive wakeup: end the turn with no tool calls to wait; do not poll, sleep, or call a nonexistent `wait_agent`. - `invoke_subagent` exposes abstract `Model` tiers (`inherit`, `flash_lite`, `flash`, `pro`) and no per-call effort parameter. Use built-in `research` (read-only, no network access) or a custom type created with `define_subagent` (`EnableWriteTools: false`, `EnableSubagentTools: false`) for fresh independent read-only reviews. Built-in `self` inherits full parent write and subagent tools, so forbid further delegation in the brief unless the caller explicitly grants it. - `invoke_subagent` and `swarm` support `workspace: "inherit"`, `"share"`, and `"branch"`. Killing a subagent (`manage_subagents`) or swarm worker (`swarm` `kill`) permanently deletes its `share` or `branch` workspace. Prefer `share` (shared repository metadata) over `branch` (isolated clone) when task branch refs must remain in the parent repository, and land or verify required commits and branch refs before killing the worker. - On `swarm`, CLI (`agy`), or ACP/host orchestration surfaces that expose concrete model slugs (`agy models` or `swarm` `models`), apply concrete Gemini model and effort selections directly rather than translating Codex or Claude names. Verify runtime mechanics against [Antigravity CLI documentation](https://antigravity.google/docs/cli/features); exposed tool capabilities govern model selection, workspace isolation, and result delivery.