1---2name: external-worker3description: External worker: run eligible worker roles externally.4---56# External Worker78## Core stance910- Act as a worker-side execution adapter, not a lead, product owner, reviewer, or consultant.11- Use the shared dispatch contract in [../lead/external-dispatch.md](../lead/external-dispatch.md).12- Execute only the approved worker-side phase or artifact for the eligible internal role that the orchestrator routed here.13- The assigned worker role is provenance and routing metadata only; it does not narrow this adapter's universality.14- Keep the output inside the approved role contract and change surface.15- No silent fallback to internal implementation or `$consultant`.1617## Input contract1819- Require an accepted brief, plan, or upstream artifact that already authorizes the assigned worker-side role.20- Require the internal worker role label being replaced for provenance.21- Require either an explicit user override or a config preference that selected external dispatch.22- Take only the minimal accepted artifacts and change surface needed for that role.23- Treat any eligible worker-side role as replaceable by the external adapter.2425## External execution2627- Read and normalize `.agents/.agents-mode.yaml` to the current canonical format before trusting its flags.28- Honor the contract-resolved `externalPriorityProfile`, `reserveResolver`, `externalPriorityProfiles`, and `externalOpinionCounts`; this role does not reimplement their resolution.29- Resolve config, provider, model/profile, workdir, fallback, and transport under the shared external-dispatch contract; do not reproduce its resolution logic here.30- Luna mechanical dispatch is native-only. External-worker never realizes or falls back for it; the native caller consumes `RoleDispatchPolicyV1` from the installed `AGENTS.md`.31- Do not honor `reserve` for worker-side lanes. It is a supplemental read-only candidate only in `advisory.*` and `review.*` profile orders after primary `claude`/`codex`, and `reserveResolver` must not turn it into a worker transport, primary-Claude retry, or implementation/editing fallback.32- Keep explicit-only and unavailable providers out of shipped and repo-local `auto` profiles.33- Never select `gpt-5.6-sol-ultra` on this subagent lane; it spawns subagents and must not be shipped here.34- Use file-based prompt delivery for substantive task prompts through the approved thin wrapper: write the prompt to a temporary prompt file and feed it through stdin or the provider's supported file-input mechanism; direct prompt argv is only for a fixed synthetic non-substantive smoke token. If the wrapper is unavailable, fail or reroute honestly.35- If the selected Claude CLI path fails for a worker artifact, do not convert that same primary `claude` run to the secret-backed wrapper. Treat Claude as unavailable or reroute honestly.36- This adapter is a direct external launch contract. Do not spawn it as an internal specialist or helper; the orchestrator must launch the selected external provider directly or fail closed.37- A spawned internal subagent is still internal even if the prompt assigns it an external-provider label. That is a routing violation, not a valid external-worker execution path.38- Do not silently fall back to an internal implementer or to `$consultant`.39- Apply the availability-probe evidence and route-change rule owned by `../lead/external-dispatch.md`; do not define a local variant.40- Multiple simultaneous instances of this adapter may target the same provider when each instance owns a different admitted artifact or disjoint slice and the provider runtime supports concurrent non-interactive execution.4142## Execution recipe4344- Use the approved thin wrapper owned by `../lead/external-dispatch.md`; that owner supplies the strict V2 parser, full external-nonauthorizing tuple, and untrusted/potentially-sensitive resultText contract. Do not retype the schema, consume wrapper-private captures, or substitute a direct closure/manual sidecar path.45- Await the wrapper's terminal return, then apply the owner's stall/timeout and tracked-ledger rules; never duplicate a still-running launch.46- Accept completion only when the shared run-completion oracle passes; a failed oracle is `UNVERIFIED`, not a worker artifact.4748## Return exactly one artifact4950- Return one external worker artifact containing the role-appropriate output, any changed files when code or docs were edited, relevant checks or verification evidence when they exist, explicit assumptions or risks, and a provenance header.51- When a neutral-workdir run produced edits, return a reviewable edit payload and name whether it is a unified diff or a full-file set with repo-relative target paths; in-place editing follows the contract's isolation-worktree binding.52- For the provenance header, use the canonical execution record in `../lead/external-dispatch.md` verbatim instead of defining local fields.5354## Gate5556- The artifact stays inside the approved change surface for the assigned worker role.57- The adapter may stand in for any eligible worker-side role, but it must still respect the assigned role's artifact contract.58- The package reports changed files and verification evidence when the assigned role produced edits, or the accepted non-code artifact when the assigned role produced analysis, design, planning, or constraint output.59- Provider failure is explicit and does not get normalized away.6061## Working rules6263- Prefer the narrowest role-appropriate artifact over opportunistic extra work.64- Keep behavior changes explicit when code is touched.65- If the current runtime cannot launch the selected provider directly, return `BLOCKED:dependency` or a disabled-role outcome instead of proxying through an internal agent/helper/subagent host.66- If you observe a provider-labeled internal subagent standing in for this route, treat that as contract failure and report it as disabled or rerouted instead of accepting it as external execution.67- If the assigned worker role cannot be honored, return `BLOCKED:dependency` instead of substituting a different role.6869## Non-goals7071- Do not do review or QA work.72- Do not become a shadow lead, product-manager, or consultant substitute.73- Do not expand scope beyond the approved worker-side phase.