| 1 | # Model Selection Reference |
| 2 | |
| 3 | ### Per-Agent Model Selection |
| 4 | |
| 5 | Before spawning an agent, determine which model to use. Check these layers in order — first match wins: |
| 6 | |
| 7 | **Layer 0 — Persistent Config (`.squad/config.json`):** On session start, read `.squad/config.json`. If `agentModelOverrides.{agentName}` exists, use that model for this specific agent. Otherwise, if `defaultModel` exists, use it for ALL agents. This layer survives across sessions — the user set it once and it sticks. |
| 8 | |
| 9 | - **When user says "always use X" / "use X for everything" / "default to X":** Write `defaultModel` to `.squad/config.json`. Acknowledge: `✅ Model preference saved: {model} — all future sessions will use this until changed.` |
| 10 | - **When user says "use X for {agent}":** Write to `agentModelOverrides.{agent}` in `.squad/config.json`. Acknowledge: `✅ {Agent} will always use {model} — saved to config.` |
| 11 | - **When user says "switch back to automatic" / "clear model preference":** Remove `defaultModel` (and optionally `agentModelOverrides`) from `.squad/config.json`. Acknowledge: `✅ Model preference cleared — returning to automatic selection.` |
| 12 | |
| 13 | **Layer 1 — Session Directive:** Did the user specify a model for this session? ("use opus for this session", "save costs"). If yes, use that model. Session-wide directives persist until the session ends or contradicted. |
| 14 | |
| 15 | **Layer 2 — Charter Preference:** Does the agent's charter have a `## Model` section with `Preferred` set to a specific model (not `auto`)? If yes, use that model. |
| 16 | |
| 17 | **Layer 3 — Task-Aware Auto-Selection:** Use the governing principle: **cost first, unless code is being written.** Match the agent's task to determine output type, then select accordingly: |
| 18 | |
| 19 | | Task Output | Model | Tier | Rule | |
| 20 | |-------------|-------|------|------| |
| 21 | | Writing code (implementation, refactoring, test code, bug fixes) | `claude-sonnet-4.6` | Standard | Quality and accuracy matter for code. Use standard tier. | |
| 22 | | Writing prompts or agent designs (structured text that functions like code) | `claude-sonnet-4.6` | Standard | Prompts are executable — treat like code. | |
| 23 | | NOT writing code (docs, planning, triage, logs, changelogs, mechanical ops) | `claude-haiku-4.5` | Fast | Cost first. Haiku handles non-code tasks. | |
| 24 | | Visual/design work requiring image analysis | `claude-opus-4.5` | Premium | Vision capability required. Overrides cost rule. | |
| 25 | |
| 26 | **Role-to-model mapping** (applying cost-first principle): |
| 27 | |
| 28 | | Role | Default Model | Why | Override When | |
| 29 | |------|--------------|-----|---------------| |
| 30 | | Core Dev / Backend / Frontend | `claude-sonnet-4.6` | Writes code — quality first | Heavy code gen → `gpt-5.3-codex` | |
| 31 | | Tester / QA | `claude-sonnet-4.6` | Writes test code — quality first | Simple test scaffolding → `claude-haiku-4.5` | |
| 32 | | Lead / Architect | auto (per-task) | Mixed: code review needs quality, planning needs cost | Architecture proposals → premium; triage/planning → haiku | |
| 33 | | Prompt Engineer | auto (per-task) | Mixed: prompt design is like code, research is not | Prompt architecture → sonnet; research/analysis → haiku | |
| 34 | | Copilot SDK Expert | `claude-sonnet-4.6` | Technical analysis that often touches code | Pure research → `claude-haiku-4.5` | |
| 35 | | Designer / Visual | `claude-opus-4.5` | Vision-capable model required | — (never downgrade — vision is non-negotiable) | |
| 36 | | DevRel / Writer | `claude-haiku-4.5` | Docs and writing — not code | — | |
| 37 | | Scribe / Logger | `claude-haiku-4.5` | Mechanical file ops — cheapest possible | — (never bump Scribe) | |
| 38 | | Git / Release | `claude-haiku-4.5` | Mechanical ops — changelogs, tags, version bumps | — (never bump mechanical ops) | |
| 39 | |
| 40 | **Task complexity adjustments** (apply at most ONE — no cascading): |
| 41 | - **Bump UP to premium:** architecture proposals, reviewer gates, security audits, multi-agent coordination (output feeds 3+ agents) |
| 42 | - **Bump DOWN to fast/cheap:** typo fixes, renames, boilerplate, scaffolding, changelogs, version bumps |
| 43 | - **Switch to code specialist (`gpt-5.3-codex`):** large multi-file refactors, complex implementation from spec, heavy code generation (500+ lines) |
| 44 | - **Switch to analytical diversity (`gemini-3-pro-preview`):** code reviews where a second perspective helps, security reviews, architecture reviews after a rejection |
| 45 | |
| 46 | **Layer 4 — Default:** If nothing else matched, use `claude-haiku-4.5`. Cost wins when in doubt, unless code is being produced. |
| 47 | |
| 48 | **Fallback chains — when a model is unavailable:** |
| 49 | |
| 50 | If a spawn fails because the selected model is unavailable (plan restriction, org policy, rate limit, deprecation, or any other reason), silently retry with the next model in the chain. Do NOT tell the user about fallback attempts. Maximum 3 retries before jumping to the nuclear fallback. |
| 51 | |
| 52 | ``` |
| 53 | Premium: claude-opus-4.6 → claude-opus-4.5 → claude-sonnet-4.6 → claude-sonnet-4.5 → (omit model param) |
| 54 | Standard: claude-sonnet-4.6 → claude-sonnet-4.5 → gpt-5.4 → gpt-5.3-codex → claude-sonnet-4 → (omit model param) |
| 55 | Fast: claude-haiku-4.5 → gpt-5.4-mini → gpt-5.1-codex-mini → gpt-4.1 → (omit model param) |
| 56 | ``` |
| 57 | |
| 58 | `(omit model param)` = call the `task` tool WITHOUT the `model` parameter. The platform uses its built-in default. This is the nuclear fallback — it always works. |
| 59 | |
| 60 | **Fallback rules:** |
| 61 | - If the user specified a provider ("use Claude"), fall back within that provider only before hitting nuclear |
| 62 | - Never fall back UP in tier — a fast/cheap task should not land on a premium model |
| 63 | - Log fallbacks to the orchestration log for debugging, but never surface to the user unless asked |
| 64 | |
| 65 | **Passing the model to spawns:** |
| 66 | |
| 67 | Pass the resolved model as the `model` parameter on every `task` tool call: |
| 68 | |
| 69 | ``` |
| 70 | agent_type: "general-purpose" |
| 71 | model: "{resolved_model}" |
| 72 | mode: "background" |
| 73 | name: "{name}" |
| 74 | description: "{emoji} {Name}: {brief task summary}" |
| 75 | prompt: | |
| 76 | ... |
| 77 | ``` |
| 78 | |
| 79 | Only set `model` when it differs from the platform default (`claude-sonnet-4.6`). If the resolved model IS `claude-sonnet-4.6`, you MAY omit the `model` parameter — the platform uses it as default. |
| 80 | |
| 81 | If you've exhausted the fallback chain and reached nuclear fallback, omit the `model` parameter entirely. |
| 82 | |
| 83 | **Spawn output format — show the model choice:** |
| 84 | |
| 85 | When spawning, include the model in your acknowledgment: |
| 86 | |
| 87 | ``` |
| 88 | 🔧 Fenster (claude-sonnet-4.6) — refactoring auth module |
| 89 | 🎨 Redfoot (claude-opus-4.5 · vision) — designing color system |
| 90 | 📋 Scribe (claude-haiku-4.5 · fast) — logging session |
| 91 | ⚡ Keaton (claude-opus-4.6 · bumped for architecture) — reviewing proposal |
| 92 | 📝 McManus (claude-haiku-4.5 · fast) — updating docs |
| 93 | ``` |
| 94 | |
| 95 | Include tier annotation only when the model was bumped or a specialist was chosen. Default-tier spawns just show the model name. |
| 96 | |
| 97 | **Valid models (current platform catalog):** |
| 98 | |
| 99 | Premium: `claude-opus-4.6`, `claude-opus-4.6-1m` (Internal only), `claude-opus-4.5` |
| 100 | Standard: `claude-sonnet-4.6`, `claude-sonnet-4.5`, `claude-sonnet-4`, `gpt-5.4`, `gpt-5.3-codex`, `gpt-5.2-codex`, `gpt-5.2`, `gpt-5.1-codex-max`, `gpt-5.1-codex`, `gpt-5.1`, `gemini-3-pro-preview` |
| 101 | Fast/Cheap: `claude-haiku-4.5`, `gpt-5.4-mini`, `gpt-5.1-codex-mini`, `gpt-5-mini`, `gpt-4.1` |