Specification

Automatic Model Selection Specification

Version: 1.2.0
Status: Draft
Publication Date: 2026-12-01
Editor: GitHub Agentic Workflows Team
This Version: automatic-model-selection-specification
Latest Published Version: This document


This specification defines automatic model selection in GitHub Agentic Workflows (gh-aw), covering both routed selection (model: router, router/*, engine.model-routing, and implicit default routing) and non-routed tier-fallback selection (POST /select-model) across main agents, threat detection, and sub-agents. It is organized around the shared built-in engine capability table (pkg/workflow/data/model_routing_engines.json, synced to actions/setup/js/model_routing_engines.json at build time), with concise engine-specific rules where runtime harnesses differ.

Model identifier grammar, URL-style parameter encoding, alias map format, merge precedence, and explicit alias resolution remain in the Model Alias Format Specification. Unified session projection of model.resolution, model.config, and firewall.model_routing events is defined in the Unified Agent Session Specification.

This is a GitHub Agentic Workflows project specification, written using W3C-inspired document conventions. It is not an official W3C standard, W3C publication, or W3C-endorsed recommendation.

Version 1.0.0 splits automatic model selection out of the Model Alias Format Specification (versions 1.9.0 through 1.16.0) into a standalone contract. It may be updated, replaced, or made obsolete at any time under the project’s review process.

  1. Introduction
  2. Conformance
  3. Terminology
  4. Built-In Engine Capability Table
  5. Triggering and Precedence
  6. Routed Selection
  7. Non-Routed Selector Protocol
  8. Role Rules
  9. Engine-Specific Notes
  10. Compliance Testing
  11. Sync Notes
  12. References
  13. Change Log

When a workflow omits a concrete model or selects router or auto, gh-aw and the Agent Workflow Firewall (AWF) choose a concrete model, wire API endpoint, and reasoning effort that the configured engine can actually drive. Separating automatic selection from the alias syntax specification keeps identifier and alias-map rules stable while giving compiler routing configuration, AWF POST /select-model selection, and engine capability constraints one normative home.

This specification covers:

  • The shared built-in engine capability table (model_routing_engines.json) and workflow/runtime narrowing rules
  • Precedence between concrete pins, authored models[""], shadowed models.auto, routed selection, and non-routed POST /select-model selection
  • Routed main-agent selection (router, router/*, implicit routing, model-routing: false, model-routing.allowed-models, AWF version gates, and compiled apiProxy.routing constraints)
  • Non-routed automatic selection through AWF POST /select-model, including request constraints, response validation, failure causes, and agent/model-resolution.json provenance
  • Role-specific rules for the main agent, threat detection, and sub-agents
  • Engine-specific runtime notes for Copilot (CLI and SDK), Claude, Codex, Pi, Goose, and OpenCode
  • Conformance tests (T-MAF-060 through T-MAF-089, preserving migrated IDs)

This specification does NOT cover:

  • Model identifier grammar, query-parameter syntax, alias map YAML, three-layer merge precedence, or explicit alias/glob resolution (see Model Alias Format Specification)
  • AWF internal router classification, coding-tier tables, or /reflect admission logic (see AWF configuration specification)
  • usage/aw_session.jsonl serialization or collector projection schemas (see Unified Agent Session Specification)

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

A conforming gh-aw implementation MUST satisfy all normative requirements in Sections 4 through 9 for the built-in engines and roles it supports, and MUST emit the failure causes and provenance records specified in Sections 7 through 9.


Automatic Selection: Choosing a concrete model, wire endpoint, and reasoning effort without naming a specific model ID or explicit non-auto alias. Includes both routed selection and non-routed tier-fallback selection.

Routed Selection: Per-run main-agent selection driven by AWF’s model router (model: router, router/economy, router/balanced, router/robust, deprecated engine.model-routing, or implicit default routing), with deterministic tier fallback on AWF v0.29.21+.

Non-Routed Tier-Fallback Selection: Read-only selection via AWF’s POST /select-model endpoint (AWF v0.29.22+) that applies the same admission, endpoint, and effort constraints as router fallback without invoking the router classifier.

Engine Capability Table: The single JSON data file (pkg/workflow/data/model_routing_engines.json, copied to actions/setup/js/model_routing_engines.json at build time) declaring static automatic-selection capabilities per built-in engine.

Selector Effort Vocabulary: The seven AWF reasoning effort values (none, minimal, low, medium, high, xhigh, max), distinct from the compile-time alias ?effort= validation values (low, medium, high) defined in the Model Alias Format Specification.

Authored Default Policy (models[""]): An empty-string alias entry declared in the main workflow frontmatter or an imported workflow.

Shadowed auto: At compile time, any authored models.auto declaration suppresses the auto-to-router rewrite. At runtime, auto is shadowed when the effective models.auto alias list differs from the built-in ["copilot/auto", "large"] definition (the compiler omits unchanged built-in entries), routing auto through explicit alias resolution instead of POST /select-model.

Compatibility Path: Pre-selector behavior preserved for non-routed selection when AWF is disabled, the catalogue is disabled, the AWF or apiProxy pin lacks POST /select-model, /reflect omits model_selector, a pre-AW-2a Pi lock is used, or POST /select-model returns unsupported_provider.


Static per-engine automatic-selection capabilities MUST be maintained in one shared data file, pkg/workflow/data/model_routing_engines.json, and synced byte-identically to actions/setup/js/model_routing_engines.json at build time (make sync-model-routing-engines / make build). Both the compiler (pkg/workflow/model_routing_endpoints.go) and runtime harnesses (actions/setup/js/awf_model_routing.cjs) MUST read static defaults from this table rather than maintaining separate copies.

  • reasoning_efforts: ["none", "minimal", "low", "medium", "high", "xhigh", "max"]
  • endpoints: ["/v1/messages", "/responses", "/chat/completions"]

4.2 Per-Engine Fields and Built-In Entries

Section titled “4.2 Per-Engine Fields and Built-In Entries”

Each entry under engines.<id> declares:

  • endpoints: Ordered wire API paths the engine can drive.
  • allow_endpoint_override: Whether a routed runtime harness may reconcile AWF’s reported endpoint with a verified engine-compatible endpoint advertised in /reflect routing_models (when candidate_metadata_complete: true). This flag does not relax non-routed POST /select-model validation, which always requires the returned endpoint to be in the requested endpoints.
  • candidate_models (optional): Model-family glob patterns restricting eligible models.
  • supported_efforts: Subset of reasoning_efforts accepted by the engine.
  • effort_min_versions (optional): Map of effort name to minimum engine version required to accept that effort.
  • effort_map (optional): Map of canonical selector effort names to engine-native spellings.
  • selector_providers (optional): Providers for which the engine may use the non-routed selector.
EngineEndpointsAllow Endpoint OverrideCandidate ModelsSupported EffortsSelector ProvidersVersion Gates / Effort Map
copilot/responses, /chat/completionsfalse(none)none, minimal, low, medium, high, xhigh, max(none)(none)
claude/v1/messagestrueclaude-*low, medium, high, xhigh, max(none)(none)
codex/responsestrue(none)none, minimal, low, medium, high, xhigh, max(none)(none)
pi/v1/messages, /responses, /chat/completionstrue(none)none, minimal, low, medium, high, xhigh, max(none)max requires >= 1.3.0; none maps to off
crush/chat/completionsfalse(none)none, minimal, low, medium, high, xhigh, maxcopilot(none)
goose/chat/completionsfalse(none)(none)copilot(none)
opencode/chat/completionsfalse(none)none, minimal, low, medium, high, xhigh, maxcopilot(none)

Future engines opting into automatic selection (such as native Gemini launches) SHOULD add their static defaults to this table rather than introducing parallel engine switches. An engine’s selector_providers declaration MUST restrict non-routed POST /select-model selection to the listed providers.

Inputs that depend on workflow configuration or launch state stay in code and MUST narrow (never widen beyond what the engine supports) the defaults from model_routing_engines.json:

  • Copilot: Copilot SDK on native anthropic narrows endpoints to ["/v1/messages"]. A configured Copilot CLI wire API narrows endpoints to its single path (messages -> /v1/messages, responses -> /responses, completions -> /chat/completions).
  • Pi: A static engine.config.model.api narrows endpoints to its matching path (anthropic-messages -> /v1/messages, openai-responses -> /responses, openai-completions -> /chat/completions). When a workflow pins a Pi version below effort_min_versions.max (1.3.0) or uses an expression-valued version, max MUST be excluded from supported_efforts. Canonical none maps to off when applying to Pi, and off maps back to none in selector requests.
  • Claude and Codex: Static table entries apply directly unless narrowed by a sub-agent or session effort rule in Section 9.

Precedence is evaluated per role against that role’s effective model (for example, a pinned main model does not suppress an explicit auto sub-agent):

  1. Authored default policy (models[""]): An authored models: { "": [...] } entry in the main workflow frontmatter or an imported workflow counts as an explicit model choice for omitted models. It MUST suppress implicit default routing in every phase (including threat detection) and MUST bypass omitted-model POST /select-model selection. It does NOT shadow an explicit auto for any role.
  2. Shadowed models.auto: Any authored models.auto declaration suppresses the compile-time auto-to-router rewrite. At runtime, an effective models.auto list that differs from the built-in ["copilot/auto", "large"] definition shadows built-in auto and routes auto through explicit alias resolution (Model Alias Format Specification) with zero POST /select-model calls. Restating the identical built-in models.auto list does not shadow runtime selection because unchanged built-in entries are omitted from the runtime alias overlay.
  3. Compile-time auto normalization to routing: On a main-agent workflow eligible for routing on AWF and apiProxy v0.29.21+ without an authored models.auto or existing routing config, bare auto or copilot/auto normalizes at compile time to explicit-style routing (model: router, preserving GitHub Copilot inference for copilot/auto on Claude and Codex when no explicit engine.model-provider is set). Workflows that fail routing eligibility or validation roll back to their non-routed auto behavior and are evaluated under rules 4 and 5 below.
  4. Concrete pins and runtime overrides: For the role they target, concrete model IDs, non-auto aliases, and concrete runtime overrides (GH_AW_MODEL_AGENT_*, GH_AW_DEFAULT_MODEL_*, COPILOT_PROVIDER_WIRE_MODEL, concrete CLI -m / --model / -c model= flags, or a top-level Codex config.toml model) bypass automatic selection. A runtime model override may take precedence over implicit default routing, but MUST NOT bypass an explicit model: router.
  5. Unshadowed automatic inputs: When none of the applicable bypasses in rules 1 through 4 applies to that role’s effective model, automatic selection is triggered by:
    • An explicit router value (router, router/economy, router/balanced, router/robust) or implicit default routing on the main agent (Section 6);
    • An omitted main model (without models[""]) on a non-routed built-in engine (Section 8.1); or
    • An unshadowed auto spelling (auto, copilot/auto, github-copilot/auto, github/auto, or <engineProvider>/auto for native openai or anthropic, with optional ?effort=...) for main agent, threat detection, or supported sub-agents (Sections 7 through 9).

5.2 Non-Routed Selector Compatibility Gate

Section titled “5.2 Non-Routed Selector Compatibility Gate”

Non-routed POST /select-model selection applies only when all required runtime capabilities are present. Implementations MUST keep the engine’s compatibility path when any of the following holds:

  • AWF sandboxing is disabled (sandbox.agent: false or AWF_REFLECT_ENABLED is not 1);
  • engine.model-catalog: false is set (zero selector calls; configured model passes through verbatim);
  • The workflow pins an AWF or apiProxy release older than v0.29.22, or uses a pre-AW-2a Pi lock;
  • /reflect omits model_selector; or
  • POST /select-model returns unsupported_provider.

Outside the applicable selector path, auto retains each engine’s compatibility behavior: a Copilot gateway sentinel on Pi and Codex, Claude’s own selection on Claude, or the newest advertised Claude Sonnet, Opus, or Haiku model when Claude uses the Copilot provider while skipping models marked automatic_selection_eligible: false (Model Alias Format Specification §8.4.4).

Routed eligibility and routed AWF version gates are separate from this non-routed gate and are defined in Section 6.


Routed selection applies to the main agent only. Router values MUST be rejected for sub-agents, threat detection, evals, and other jobs (Model Alias Format Specification §9.4).

6.1 Router Selectors, Eligibility, and Opt-Out

Section titled “6.1 Router Selectors, Eligibility, and Opt-Out”
  • Explicit router values: router (mode: auto), router/economy, router/balanced, and router/robust all normalize to engine.model-routing with goal: cost and MUST NOT be passed to the engine as literal model identifiers. Explicit model: router requires AWF sandboxing and engine.model-catalog enabled; disabling AWF or setting engine.model-catalog: false fails compilation rather than silently falling back to a compatibility path. Explicit and expression-driven routing remain valid on routing-capable AWF pins older than v0.29.21 (such as v0.29.20), omitting only the newer fields gated in Section 6.2.
  • Authored auto normalization: As in Section 5.1 rule 3, eligible main-agent workflows authoring auto or copilot/auto normalize to model: router when both AWF and apiProxy are v0.29.21+; ineligible workflows roll back to non-routed behavior.
  • Implicit default routing: Eligible workflows using GitHub Copilot inference route automatically when both AWF and apiProxy are v0.29.21+ and no model and no models[""] entry are set. With engine.model-catalog: false, or when either AWF or apiProxy is older than v0.29.21 (lacking router fallback), implicit routing is not applied and the workflow keeps its non-routed default.
  • Top-level opt-out: model-routing: false (in the workflow or a shared import) MUST disable implicit routing without selecting a model or changing model override precedence. It MUST NOT be combined with a literal router selector or a shortlist. true is not a valid selector.
  • Shortlist: A literal router value MAY be combined with one top-level model-routing.allowed-models shortlist in the workflow or a shared import. It MUST narrow only the main agent’s router candidates, matching the nested shortlist behavior. It MUST NOT enable implicit routing, restrict sub-agents, override models.allowed or models.blocked, or be silently ignored when the effective model is fixed or expression-valued. The top-level model-routing: block does not accept goal or mode.
  • Deprecated nested syntax and cost-speed: Compilers SHOULD warn on authored engine.model-routing declarations (including imports). For goal: cost-speed, compilers MUST NOT substitute cost or advertise an equivalent router selector; AWF v0.29.17 and newer reject cost-speed, so compilers MUST diagnose it for those effective AWF versions while preserving support for older AWF pins.
  • Runtime expression resolution: A main-agent model that is a single expression reading only contexts the activation job resolves identically to later jobs, on a workflow eligible for routing, MAY resolve to a router value at run time. The activation job MUST resolve it once, route the run at that level, and pass the resolved value to later jobs; any other reserved identifier, variable, or ineligible workflow resolving to a router value MUST stop the run before the agent starts.

6.2 Compiled Constraints, Native Providers, and Fallback

Section titled “6.2 Compiled Constraints, Native Providers, and Fallback”
  • Endpoints (apiProxy.routing.endpoints): On AWF and apiProxy v0.29.21+, the compiler MUST emit apiProxy.routing.endpoints from Section 4 (with workflow narrowing) so AWF excludes incompatible models before router ranking or fallback. Older AWF or apiProxy pins MUST omit this field for strict config-schema compatibility.
  • Supported efforts (apiProxy.routing.supportedEfforts): On AWF and apiProxy v0.29.22+, the compiler MUST emit apiProxy.routing.supportedEfforts from Section 4 (applying effort_min_versions). Naturally effort-free models remain eligible. Older pins MUST omit this field.
  • Native providers: Copilot and Pi route on GitHub Copilot; Claude and Codex route on GitHub Copilot with model-provider: github, or on native anthropic (Claude) and openai (Codex) when given an explicit router value. Native routing uses the configured provider (apiProxy.routing.provider) and MUST NOT switch accounts or providers.
  • Router fallback: When both AWF and apiProxy are v0.29.21+, if no eligible model is in AWF’s router tables or the router cannot choose, AWF falls back deterministically to the highest-tier eligible model and records selection_source: "fallback" with the triggering fallback_reason (for example router_unavailable when the router cannot respond, or no_route when no eligible model is in the router tables or no more specific reason applies). A run fails before launch only when no compatible model exists.

Non-routed automatic selection uses AWF’s read-only POST /select-model endpoint through one shared runtime helper (selectModelFromAWF, wrapped by selectSubagentModelFromAWF for sub-agents, in actions/setup/js/awf_model_routing.cjs).

When the compatibility gate in Section 5.2 is satisfied, the selector helper builds constraints from Section 4 (getAWFSelectorConstraints) and sends a JSON POST request to /select-model on the /reflect management origin. The advertised URL must resolve to that HTTP(S) endpoint without credentials, query, or fragment. The request does not follow redirects:

FieldRequiredSemantics
providerYesCanonical target provider (copilot, anthropic, openai, etc.)
endpointsYesNon-empty list of allowed wire API paths from Section 4 (narrowed)
supported_effortsYesAllowed effort values from the selector vocabulary (may be [] when only omission is allowed)
candidate_modelsOptionalGlob patterns restricting eligible model IDs (for example ["claude-*"])
allow_no_effortOptionalSent as false when an omitted (null) effort is disallowed; defaults to true when omitted
effort_overrideOptionalCanonical selector effort requested explicitly (engine spellings such as Pi off are mapped back before sending; ?effort=auto requests no override)
objectiveOptionalSelection objective when applicable

The execution role (main, detection, or sub-agent name) is NOT a field in the AWF request body.

7.2 Answer Validation and Failure Handling

Section titled “7.2 Answer Validation and Failure Handling”

Before returning a selected answer to any caller, the shared selector helper MUST validate every field against the canonical vocabularies (Section 4.1) and the request constraints:

  1. wire_model is a valid wire model ID: 1 to 128 characters matching [A-Za-z0-9._/:@-].
  2. endpoint is a canonical endpoint from Section 4.1.
  3. provider matches the requested provider.
  4. endpoint is a member of the requested endpoints.
  5. wire_model matches at least one requested candidate_models pattern when candidate_models was sent.
  6. If effort is present and non-null, it is a non-empty string in the canonical selector effort vocabulary (Section 4.1).
  7. effort matches effort_override when effort_override was set.
  8. effort is non-null when allow_no_effort is false.
  9. When effort is non-null, it is a member of supported_efforts and maps cleanly through any engine effort_map.

Failure handling MUST follow these rules:

  • unsupported_provider: Return a compatibility signal; the harness MUST fall back to its compatibility path (Section 5.2).
  • Terminal failures: no_eligible_candidate, catalog_unavailable, HTTP or transport errors, and out-of-constraint selector answers are terminal. The harness MUST fail before launch and MUST NOT fall back to wildcard alias guessing.
  • Consistent failure causes: Any rejected or failed selector call MUST produce a failed model.resolution record (except when suppressed for detection or repository agents as noted in Sections 8 and 9) carrying selection_source: "tier_fallback" and cause:
    • catalog_unavailable: HTTP/network errors, malformed payloads, invalid wire model IDs, missing or mismatched providers, or non-canonical endpoint/effort values outside Section 4.1;
    • unsupported_endpoint: a canonical endpoint outside the requested endpoints;
    • no_eligible_candidate: AWF no_eligible_candidate, or canonical model/effort values violating candidate_models, effort_override, allow_no_effort: false, or supported_efforts.

Agent-phase selector outcomes are written to agent/model-resolution.json and projected into usage/aw_session.jsonl as model.resolution events (Unified Agent Session Specification, T-UAS-074).

  • Successful records carry engine, role, configured_model (empty "" for omitted main-agent defaults), resolved_model, provider, status: "resolved", effort (canonical selector value or null), tier, and selection_source: "tier_fallback".
  • Failed records carry resolved_model: null, status: "failed", the normalized cause, selection_source: "tier_fallback", and omit or null effort and tier.
  • Sub-agent harnesses MUST defer publishing the resolved record until applying or staging the child definition succeeds.

For non-routed native main-agent launches (copilot, claude, codex, pi) meeting the Section 5.2 gate, an omitted model (without models[""] or a concrete override pin) or an unshadowed auto selector MUST invoke POST /select-model with the engine’s constraints from Section 4, launch with the selected concrete model, endpoint, and effort, and record provenance under role: "main" in agent/model-resolution.json. Crush uses the explicit opt-in in Section 9.5 instead.

For a declarative Goose main-agent launch, an unshadowed copilot/auto selector MUST invoke POST /select-model only when the AWF model catalogue and selector are available. The request MUST use the Goose capability entry (provider: "copilot", endpoints: ["/chat/completions"], and supported_efforts: []). The harness MUST validate the selected endpoint and effort using the shared selector helper, fail closed on terminal selector errors, bind the selected wire model, clear inherited effort environment variables, and publish standard model.resolution provenance under role: "main". Explicit pins, shadowed aliases, non-Copilot providers, a disabled catalogue, or a missing selector MUST retain compatibility passthrough.

For an OpenCode launch meeting the Section 5.2 gate, unshadowed copilot/auto with or without ?effort=... MUST use the shared declarative selector with provider copilot and endpoint /chat/completions. The harness MUST bind the selected wire model and mapped effort to OpenCode’s Chat Completions adapter, omit effort from the request when the selector returns null, and publish main-agent provenance only after the launch configuration is ready. This opt-in MUST NOT enable task-level routing, change optional roster entries, or change selection for other providers.

When a main-agent harness receives an unlisted concrete pin that it can bind unambiguously to a configured provider and wire API and AWF runtime recovery or apiProxy.fallbackModels is active for that provider, it hands the pin off to AWF rather than failing with model_unavailable (see Model Alias Format Specification §8.8 rule 3).

Shared bypasses and compatibility paths follow Sections 5.1 and 5.2. During the threat-detection phase, POST /select-model applies ONLY when the effective detector model is an explicit or inherited, unshadowed auto value.

  • An empty or omitted detector model retains the lightweight built-in detection default (Model Alias Format Specification §9.2) and MUST NOT invoke POST /select-model solely because detection is running.
  • Local selector diagnostics MUST identify role=detection. The harness MUST NOT write the main-agent agent/model-resolution.json record.
  • Phases other than agent or detection MUST bypass the selector.

Shared bypasses and compatibility paths follow Sections 5.1 and 5.2. Automatic sub-agent selection across built-in engines (claude, codex, copilot CLI and SDK, and pi) MUST use one shared selection path (selectSubagentModelFromAWF over selectModelFromAWF). That shared path enforces:

  • Reserved name main: Workflow-declared sub-agents named main MUST be rejected, including when they declare no model.
  • Parent inheritance: A sub-agent with no model declaration (or Claude/Codex explicit inherit) inherits the resolved parent model and MUST make zero POST /select-model calls.
  • Gating and scoping: Enforces the Section 5.2 gate, models.auto shadowing, and provider-prefix matching against the parent’s configured provider before calling AWF.
  • Answer validation and deferred provenance: Applies Section 7.2 validation on every answer and lets each engine supply only its request constraints, apply the selected model and effort to the child definition, and publish resolved provenance under role: <child-name> only after applying or staging succeeds.

All built-in engines inherit the Section 4 capability table (endpoints, candidate_models, supported_efforts, effort_min_versions, and effort_map) and Sections 5 through 8. The subsections below specify only engine-specific launch, effort, and conflict rules.

  • Main-first scoping (CLI): The harness MUST resolve the main launch before selecting Copilot CLI sub-agents. A CLI sub-agent declaring explicit unshadowed auto restricts selection to the session’s configured provider, active wire endpoint (including when inferred or using the CLI default), and the main model’s family when identifiable. An unknown main-model family omits only the family constraint and MUST NOT relax provider or endpoint constraints.
  • Session effort constraint (CLI): Copilot CLI cannot set a separate effort in a generated sub-agent definition. When a session effort is configured, the selector MUST require that effort and exclude omission. When no session effort is configured, selection MUST allow only the CLI’s actual default (medium for reasoning-capable models on the pinned CLI) or omission for an effort-free model; the harness MUST NOT select an effort and discard it. A child explicitly requesting a different effort from the session fails resolution. auto?effort=auto requests no override; the native CLI flag --reasoning-effort auto is invalid and prevents child selection.
  • Definition rewrites and repository children (CLI): Only automatic children receive rewritten definitions. A terminal selector error stops startup for a workflow-declared child, while a repository child is warned and left unchanged.
  • Reserved main in both drivers: Both Copilot CLI and Copilot SDK drivers MUST reject a workflow-declared sub-agent named main (even without a model) and warn and skip model resolution (recording no child provenance) for a repository child named main.
  • Mixed families and provider-registration endpoint binding (SDK): A Copilot SDK sub-agent declaring explicit unshadowed auto (including a configured <provider>/auto prefix and optional ?effort=...) uses the shared selection path without restricting candidate_models to the main model’s family. The selector request MUST constrain endpoints to the routing endpoints backed by the SDK’s registered NamedProviderConfig entries for that provider (for example, /responses and /chat/completions when copilot-responses and copilot-completions are registered; only /chat/completions or only /responses for a single-wire-API native OpenAI registration; only /v1/messages for native Anthropic). A child MUST NOT be qualified onto an SDK provider whose bound wire API does not match the selected endpoint.
  • SDK model registration, per-agent effort, and provenance (SDK): After sibling pins are qualified and any catalog refresh completes, the harness MUST bind each selected wire model to a matching SDK provider registration, ensure its { id, provider } entry is present in inference.models without making sibling bare pins ambiguous, forward any non-null selected effort to the custom agent’s reasoningEffort field in agents.definitions, and omit reasoningEffort when AWF returns effort: null. If AWF returns effort: null for the exact same qualified model as the main session while the main session sets a non-null reasoningEffort, the harness MUST reject the selection with no_eligible_candidate rather than silently inheriting the session effort. Unloadable agent files (such as malformed tools) MUST be skipped before selection. The harness MUST publish resolved provenance under the child’s role in usage/aw_session.jsonl only after the SDK provider and sub-agent environment contracts are bound and validated. A terminal selector error stops startup for a workflow-declared child and warns while falling back to the session model for a repository child.
  • Scoping: Inline sub-agents declaring unshadowed auto (with optional same-provider prefix and ?effort=) stay within the parent’s configured provider alongside Claude’s Section 4 defaults.
  • Environment override: If CLAUDE_CODE_EFFORT_LEVEL is set in the final Claude launch environment, child selection MUST match that override (including omission for auto or unset), even when per-agent effort is available.
  • Per-agent effort and version compatibility: Without an environment override, Claude Code 2.1.257+ MUST write a non-null selected effort into both the generated workspace agent definition and the bare-mode plugin copy when used, and omit the effort field when AWF returns null. Older Claude Code versions without an override MUST request supported_efforts: [] with omission allowed. An explicit child ?effort= value MUST be honored or rejected with a diagnostic.
  • CLI --effort session default: The CLI --effort flag is a session default, not a per-agent override. Without an environment override, a non-null CLI default applies only when a child without its own effort selects the same concrete model as the main agent:
    • On Claude Code 2.1.257+, where the first request already offered all supported Claude efforts, an omitted-effort answer means that model supports none of them; the harness MUST fail directly with a failed model.resolution record (no_eligible_candidate) without making a second request.
    • On older Claude Code, where the first request sent supported_efforts: [], the harness MUST confirm with AWF that the exact selected model admits the inherited effort before launch; the child definition omits the effort field and provenance records the inherited value.
  • Tracked repository agents: The Claude selector MUST NOT modify, call AWF for, or record a resolved model for a tracked repository agent declaring built-in auto; the harness warns that the file is unchanged.
  • Provider prefix matching: Unprefixed auto or auto?effort=... uses the configured provider. A prefixed selector MUST match that provider (openai/auto for OpenAI, copilot/auto for GitHub Copilot); a mismatched prefix (such as copilot/auto on an OpenAI run) MUST fail before making a selector request.
  • Required explicit effort: Alongside Codex’s Section 4 defaults, workflow-declared Codex sub-agents MUST send allow_no_effort: false, because omitting model_reasoning_effort in a TOML role can inherit the parent or spawn-default effort. An explicit none effort is distinct from omission; an explicit ?effort= constrains selection.
  • Staged TOML role: Codex MUST write both model and model_reasoning_effort to the generated TOML role and publish resolved provenance under the child’s role only after role staging succeeds.
  • Routed main endpoint: When apiProxy.routing.endpoints is present, Pi MUST honor AWF’s selected endpoint for the main agent even if Pi’s local model catalogue prefers another API, stopping before launch on conflict with engine.config.model.api. Without endpoint constraints (or with a warning when the runtime AWF configuration file is absent), Pi keeps catalogue-based API resolution and verifies the endpoint against AWF.
  • Non-routed main effort and capability evidence: For a non-routed Pi main launch selected by POST /select-model, the implementation MUST apply the selected effort as gateway-model capability evidence (using the Section 4 effort_map) even when /reflect or Pi’s local catalog is stale or lacks that capability, taking precedence over engine.config.model.reasoning. An omitted effort (effort: null) MUST disable reasoning and prevent Pi from supplying a default thinking level. Explicit thinking-level requests and configured thinkingLevelMap entries MUST retain precedence. For a resumed durable SDK main agent only, the current AWF selection takes precedence over model-specific settings (matching the SDK driver’s effective-thinking resolver); this resume precedence MUST NOT be applied to CLI or RPC main agents.
  • Sub-agent metadata: Selected endpoint and thinking level MUST be applied to child model metadata, using the selection as capability evidence when local metadata is absent; missing capability metadata MUST NOT be treated as an explicit negative capability. Both none and null MUST disable child thinking explicitly rather than inheriting a shared default.
  • Shared gateway entry conflicts and bounded retry: Pi shares one gateway entry per model ID across main and child consumers. Compatibility MUST be evaluated using each consumer’s effective thinking level (inherited arguments, model-specific settings, and shared default); an unused catalogue mapping MUST NOT reject compatible selections, and applying a selection MUST NOT change the wire effort of a pinned sibling.
    • When only the main agent uses the selector, the implementation MUST reject a main selection that would change the effective reasoning of an explicitly configured child sharing that entry.
    • When an automatic child selection conflicts with the endpoint or effective reasoning settings of the main agent, a pinned, inherited, or alias-resolved child, or an earlier accepted automatic child, the implementation MUST retry with AWF over the same provider’s advertised alternative model IDs, retaining the original constraints and AWF policy, excluding already rejected model IDs, and remaining bounded by advertised candidates. Main, pins, and earlier accepted children MUST NOT be reselected, and only the accepted choice is recorded.
    • If no compatible alternative exists or a conflict cannot be resolved by reselecting an automatic child, startup MUST fail with an actionable error identifying the conflicting model ID and incompatible settings.
  • Provider and endpoint: Crush automatic non-routed selection requires an explicit, unshadowed provider-qualified auto model such as copilot/auto. An omitted model or bare auto does not opt in. Crush MUST use AWF POST /select-model only with the GitHub Copilot provider and MUST accept a selected result only when its endpoint is /chat/completions.
  • Selection and launch binding: On AWF reflection, the Crush harness MUST invoke selectDeclarativeModelFromAWF with engine crush, the configured model, the provider, and reflection data. A successful result MUST bind the selected model to Crush’s OpenAI-compatible awf-proxy provider.
  • Effort handling: The harness MUST configure selected reasoning metadata and pass --reasoning-effort only when the selected effort is non-null. A null effort MUST omit that flag. This path supports the effort model parameter only.
  • Provenance and failure handling: The harness MUST attempt to publish selector provenance before launch. The shared session writer is best effort. Selector failures, unsupported endpoints, and an empty eligible pool MUST prevent launch and attempt to record failed provenance.
  • Compatibility: Concrete pins and existing compatibility paths remain unchanged.

Goose is a declarative, non-routed selector engine. Its capability entry permits only the Copilot provider, /chat/completions, and omission of reasoning effort. A Goose harness MUST use the shared selector path for an unshadowed copilot/auto selector only when the AWF model catalogue and model_selector are available.

The harness MUST validate the selector answer through the shared helper, fail closed on terminal selector errors, bind the selected wire model, and clear inherited effort environment variables before launch. It MUST publish the standard model.resolution provenance record after successful binding.

Explicit model pins, shadowed aliases, non-Copilot providers, a disabled model catalogue, and a missing selector MUST bypass selection and preserve compatibility passthrough.


All conformance tests listed below (T-MAF-060 through T-MAF-089) are Required for conforming implementations. T-MAF-060 through T-MAF-080 originated in the Model Alias Format Specification (versions 1.9.0 through 1.16.0); their IDs are preserved verbatim here so existing test suites and implementation references continue to resolve.

  • T-MAF-080: Out-of-constraint selector answers (provider, endpoint, candidate model, effort override, disallowed omission, or unsupported effort) are rejected by the shared selector helper and produce matching failed model.resolution events in usage/aw_session.jsonl across Claude, Codex, Copilot CLI, Copilot SDK, and Pi.
  • T-MAF-060: A sandboxed Pi sub-agent with unshadowed auto, copilot/auto, github-copilot/auto, or auto?effort=..., AWF v0.29.22+ advertising model_selector, and an enabled catalogue invokes POST /select-model; the request contains Pi endpoint and supported-effort constraints.
  • T-MAF-061: Pi automatic-selector efforts accept none, minimal, low, medium, high, xhigh, and max for supported Pi versions; Pi 1.0 to 1.2 omits or rejects max. Ordinary alias parsing and validation remain unchanged.
  • T-MAF-062: A successful Pi child selection applies the selected concrete endpoint and thinking level to child metadata and records provenance with role equal to the child name, configured selector, resolved model, effort, tier, and selection_source.
  • T-MAF-063: A child with no model declaration inherits the resolved parent and produces zero POST /select-model calls.
  • T-MAF-064: Shadowed models.auto, catalogue-disabled or older-AWF runs, unsandboxed execution, and concrete child pins make zero selector calls. An unsupported_provider selector response preserves compatibility resolution.
  • T-MAF-065: no_eligible_candidate, catalog_unavailable, and request failures do not trigger wildcard guessing; the eligible selector path fails before child launch.
  • T-MAF-066: Automatic Pi children sharing a model ID with the main agent or a pinned, alias-resolved, or automatic sibling retain compatible selections, including when initial capability metadata is absent. Incompatible automatic choices are retried through AWF with the original constraints and rejected model IDs excluded. A compatible alternative is used and recorded in the unified session; when no compatible alternative exists, the shared-entry conflict still prevents launch.
  • T-MAF-067: A sub-agent named main is rejected.
  • T-MAF-068: A non-routed Pi main launch applies selected medium, xhigh, none, and null efforts correctly, including endpoint selection, gateway settings, stale capability metadata, and unified-session selection provenance; none maps to off, null disables default thinking, and explicit Pi thinking overrides retain precedence. An incompatible child pin sharing the main gateway entry is rejected, while compatible pins and inherited choices continue to work.
  • T-MAF-069: An eligible Codex auto child requests /responses, the configured provider and supported efforts, and excludes omitted-effort selections. An explicit child effort is enforced.
  • T-MAF-070: Codex writes the selected model and effort to the child’s TOML role and publishes the applied choice under that child’s role. An invalid selection or role-staging failure produces no successful selection record.
  • T-MAF-071: Codex inheritance, concrete child pins, reserved names, and compatibility paths do not invoke the selector. A mismatched provider prefix fails without a selector request. An unsupported_provider response retains compatibility resolution.

The Copilot harness regression suite (actions/setup/js/copilot_harness.test.cjs) exercises these runtime cases:

  • T-MAF-072: Main selection precedes child selection. The request keeps the configured provider and active endpoint, including when the wire API is inferred or uses the CLI default. It adds a family constraint for a known main model and omits only that constraint for an unknown model.
  • T-MAF-073: An explicit session effort excludes omission and other effort values. Without a flag, the CLI’s default medium and omission for an effort-free child both remain eligible; auto?effort=auto requests no override. An invalid native effort flag prevents child selection.
  • T-MAF-074: Only the automatic child receives a rewritten definition. Its applied model and effort are recorded under its role in the unified session. Omitted and inherited models make no selector calls.
  • T-MAF-075: An incompatible selector result stops a workflow-declared child but leaves a repository child unchanged with a warning. unsupported_provider keeps legacy resolution.
  • T-MAF-076: A workflow declaration named main fails, including without a model. A repository declaration named main produces a warning but no child resolution record in either Copilot driver.
  • T-MAF-077: Claude inline auto selects a Claude Messages model on the configured provider. A session-wide medium override governs the child even when per-agent effort is available.
  • T-MAF-078: Without an override, Claude Code 2.1.257+ receives selected effort in the generated workspace and bare-mode copies, or has no effort field when AWF selects omission. Older versions request only omitted effort. When a child without its own effort lands on the main model under a CLI --effort default, Claude Code 2.1.257+ fails directly with a failed model.resolution record without a second request, while older versions confirm the exact model and effort with AWF. The unified session records the resulting effort under the child role, and an incompatible explicit effort fails before launch.
  • T-MAF-079: A tracked Claude repository agent with built-in auto is left unchanged, warns, and makes no selector call or resolved-model record.

The Copilot harness and SDK session regression suites (actions/setup/js/copilot_harness.test.cjs, actions/setup/js/copilot_sdk_session.test.cjs, actions/setup/js/engine_subagent_models.test.cjs) exercise these runtime cases:

  • T-MAF-081: Mixed model families and endpoints on GitHub Copilot SDK (copilot-responses and copilot-completions) bind the selected wire model to the matching SDK provider registration, populate inference.models without making sibling bare pins ambiguous, populate agents.definitions, and publish model.resolution under the child role in usage/aw_session.jsonl only after binding succeeds.
  • T-MAF-082: Single-wire-API native OpenAI and native Anthropic SDK registrations narrow the selector request to the bound endpoint (for example, /chat/completions when openai binds completions), never send a Responses-only child down a Chat Completions binding, and verify the actual SDK createSession configuration (inference.providers, inference.models, agents.definitions).
  • T-MAF-083: Selected per-agent effort is applied to CustomAgentConfig.reasoningEffort (or omitted for effort-free selections); an omitted-effort answer matching the main model while the main session sets a reasoning effort fails with no_eligible_candidate; invalid repository-agent effort warns without aborting; unloadable agent files are skipped before selection; and explicit pins, omitted or inherited models, reserved main, shadowed models.auto, engine.model-catalog: false, unsupported_provider, and older-AWF or unsandboxed runs preserve existing behavior.
  • T-MAF-084: OpenCode restricts automatic Copilot selection to Chat Completions, binds the selected wire model and mapped or omitted effort in the launch configuration, preserves the optional roster, and records the applied selection in usage/aw_session.jsonl. Explicit pins, other providers, shadowed models.auto, disabled catalogs, and older AWF proxies retain their existing behavior.

The Crush workflow and model-routing regression suites exercise these runtime cases:

  • T-MAF-085: Crush automatic selection invokes POST /select-model through selectDeclarativeModelFromAWF only for the GitHub Copilot provider, requests /chat/completions, and preserves the configured model and reflection inputs.
  • T-MAF-086: A selected model whose name suggests another API is still forced to /chat/completions; an unsupported endpoint or empty eligible pool fails closed before launch and records failed provenance.
  • T-MAF-087: A null selected effort omits --reasoning-effort; a non-null effort configures the corresponding reasoning metadata and CLI argument.
  • T-MAF-088: Successful selection binds the selected model to Crush’s awf-proxy OpenAI-compatible provider and publishes selector provenance before launch. Concrete pins and compatibility paths remain unchanged.
  • T-MAF-089: An eligible Goose copilot/auto selection sends /chat/completions with supported_efforts: [], validates the selected endpoint and effort through the shared helper, binds the selected wire model, clears inherited effort environment variables, publishes standard model.resolution provenance, fails closed on terminal selector errors, and preserves compatibility passthrough for explicit pins, shadowed aliases, non-Copilot providers, a disabled catalogue, or a missing selector.

This table maps specification sections to their primary implementation files and regression suites.

Last verified: 2026-12-01

Spec SectionDescriptionImplementation File(s)
§4 Engine Capability TableStatic engine capabilities and build-time syncpkg/workflow/data/model_routing_engines.json, actions/setup/js/model_routing_engines.json
§4.3, §6.2 Compiler Routing ConstraintsWorkflow narrowing, apiProxy.routing.endpoints, supportedEfforts, and AWF version gatespkg/workflow/model_routing_endpoints.go, pkg/workflow/model_routing.go
§5, §7, §8 Shared Selector PathparseAutomaticModelSelector, getAWFSelectorConstraints, selectModelFromAWF, selectSubagentModelFromAWF, and answer validationactions/setup/js/awf_model_routing.cjs, actions/setup/js/awf_model_routing.test.cjs
§9.1 Copilot CLI & SDKMain-first selection, session effort, SDK provider/endpoint/effort binding, reserved mainactions/setup/js/copilot_harness.cjs, actions/setup/js/copilot_sdk_session.cjs, actions/setup/js/copilot_harness.test.cjs, actions/setup/js/copilot_sdk_session.test.cjs
§9.2 ClaudeInline sub-agent selection, CLAUDE_CODE_EFFORT_LEVEL, CLI --effort, version gatingactions/setup/js/engine_subagent_models.cjs, actions/setup/js/claude_runtime.cjs, actions/setup/js/engine_subagent_models.test.cjs
§9.3 CodexProvider matching, required explicit effort, TOML role stagingactions/setup/js/engine_subagent_models.cjs, actions/setup/js/engine_subagent_models.test.cjs
§9.4 PiMain-launch capability evidence, none to off, sub-agent metadata, shared-entry conflict retryactions/setup/js/pi_models_json.cjs, actions/setup/js/pi_runtime.cjs, actions/setup/js/pi_models_json.test.cjs
§9.5 CrushCopilot-only non-routed selection, Chat Completions binding, effort handling, provenance, and compatibility paths.github/workflows/shared/crush.md, pkg/workflow/crush_workflow_test.go, actions/setup/js/awf_model_routing.test.cjs
§8.1, §9.6 GooseDeclarative non-routed selection, shared selector validation, wire-model binding, effort-environment clearing, and provenance.github/workflows/shared/goose.md, actions/setup/js/awf_model_routing.cjs, pkg/workflow/goose_workflow_test.go, pkg/workflow/goose_runtime_test.go


  • Added: Goose as a declarative non-routed selector engine with Copilot-only selection, /chat/completions endpoint constraints, no supported reasoning efforts, shared selector validation, fail-closed terminal errors, selected wire-model binding, inherited-effort environment clearing, and standard model.resolution provenance.
  • Added: Goose conformance requirement T-MAF-089 and compatibility-path coverage for explicit pins, shadowed aliases, non-Copilot providers, disabled catalogues, and missing selectors.
  • Added: Sections 4.2 and 8.1 specify OpenCode’s non-routed Copilot selector opt-in, with conformance coverage in T-MAF-084.
  • Added: Crush declarative-engine automatic non-routed tier selection through AWF POST /select-model for GitHub Copilot, constrained to /chat/completions, with selected-model binding, effort handling, pre-launch provenance, and fail-closed selector behavior (§4.2, §8.1, §9.5, §10.1.8).
  • Added: §8.3, §9.1, and §10.1.6 (T-MAF-081 through T-MAF-083) extend the shared automatic sub-agent selection path (selectSubagentModelFromAWF) to Copilot SDK sub-agents with mixed-family support, SDK provider-registration endpoint narrowing and model binding, per-agent CustomAgentConfig.reasoningEffort application, and post-binding usage/aw_session.jsonl provenance.
  • Added: Standalone specification for routed and non-routed automatic model selection across main agents, threat detection, and sub-agents, built around the shared built-in engine capability table (pkg/workflow/data/model_routing_engines.json).
  • Moved: Automatic-selection requirements, engine-specific selector rules, conformance tests T-MAF-060 through T-MAF-080 (preserving IDs), and the v1.9.0 through v1.16.0 history migrated from the Model Alias Format Specification.

Migrated History (from Model Alias Format Specification)

Section titled “Migrated History (from Model Alias Format Specification)”

The following entries record automatic-selection changes originally tracked in model-alias-specification.md before the 1.0.0 split:

  • MAF 1.16.0: Consolidated automatic sub-agent selection and selector answer validation (provider, endpoints, candidate_models, effort_override, allow_no_effort, supported_efforts, and wire model ID) into one shared path (selectSubagentModelFromAWF over selectModelFromAWF) with consistent deferred resolved and failed model.resolution provenance across Claude, Codex, Copilot CLI, and Pi (T-MAF-080). Settled the Claude CLI --effort case when an automatic child lands on the main model without its own effort: Claude Code 2.1.257+ fails directly without a second selector request, while older versions that requested supported_efforts: [] retain the AWF confirmation check (T-MAF-078).
  • MAF 1.15.0: Defined gated Claude inline sub-agent auto selection (provider, endpoint, effort precedence, version compatibility, generated definitions, and unchanged tracked repository agents). Added bounded AWF reselection when a Pi automatic child conflicts with a shared gateway entry (T-MAF-066).
  • MAF 1.14.0: Defined Copilot CLI automatic child selection within the main session’s provider, endpoint, model family when known, and effective effort; reserved the Copilot child name main in both drivers (T-MAF-072 through T-MAF-076).
  • MAF 1.13.0: Defined gated automatic tier selection for workflow-declared Codex sub-agents (provider, /responses, supported efforts, required explicit effort, TOML role staging, provenance, and compatibility paths; T-MAF-069 through T-MAF-071).
  • MAF 1.12.0: Specified Pi main-launch application of the selected POST /select-model effort as gateway capability evidence, including stale /reflect or local-catalog handling, none to off, null-effort reasoning disablement, and precedence for explicit Pi thinking overrides (T-MAF-068).
  • MAF 1.11.0: Defined gated automatic selection for explicit Pi sub-agent auto selectors via AWF v0.29.22+ POST /select-model (endpoint and effort constraints, Pi 1.0 to 1.2 max exclusion, child metadata, provenance, parent inheritance with zero selector calls, reserved main, and shared-entry conflicts; T-MAF-060 through T-MAF-067).
  • MAF 1.10.0: Defined the detection-phase selector boundary: explicit or inherited unshadowed auto invokes POST /select-model with local diagnostics identifying role=detection, while an empty effective detector model retains the lightweight detection default.
  • MAF 1.9.0: Added AWF v0.29.22+ POST /select-model delegation for non-routed sandboxed built-in main-agent runs (copilot, claude, codex, pi) on omitted models (without models[""]) and unshadowed auto, preserving compatibility paths for unsandboxed runs, older AWF pins, pre-AW-2a locks, engine.model-catalog: false, and unsupported_provider.

Copyright 2026 GitHub Agentic Workflows Team. All rights reserved.