git:20260823.3699cb8 to git:20260913.8b79211

34 added, 110 removed. Audit A to A.

---
- name: "model-selection"
- description: "Determines which LLM model to use for each agent spawn"
- domain: "orchestration"
- confidence: "medium"
- source: "extracted"
+ name: model-selection
+ description: Resolve explicit and persistent model preferences for Squad spawns without pinning stale defaults
+ domain: orchestration
+ confidence: high
+ source: retained pre-recast procedure, narrowed for the descriptive cast
---
# Model Selection
- > Determines which LLM model to use for each agent spawn.
-
- ## SCOPE
-
- ✅ THIS SKILL PRODUCES:
- - A resolved `model` parameter for every `task` tool call
- - Persistent model preferences in `.squad/config.json`
- - Spawn acknowledgments that include the resolved model
-
- ❌ THIS SKILL DOES NOT PRODUCE:
- - Code, tests, or documentation
- - Model performance benchmarks
- - Cost reports or billing artifacts
-
- ## Context
-
- Squad supports a curated model catalog across three tiers (premium, standard, fast). The coordinator must select the right model for each agent spawn. Users can set persistent preferences that survive across sessions.
-
- ## 5-Layer Model Resolution Hierarchy
-
- Resolution is **first-match-wins** — the highest layer with a value wins.
-
- | Layer | Name | Source | Persistence |
- |-------|------|--------|-------------|
- | **0a** | Per-Agent Config | `.squad/config.json` → `agentModelOverrides.{name}` | Persistent (survives sessions) |
- | **0b** | Global Config | `.squad/config.json` → `defaultModel` | Persistent (survives sessions) |
- | **1** | Session Directive | User said "use X" in current session | Session-only |
- | **2** | Charter Preference | Agent's `charter.md` → `## Model` section | Persistent (in charter) |
- | **3** | Task-Aware Auto | Code/prompts → Terra, docs → Luna, visual → Sol | Computed per-spawn |
- | **4** | Default | `gpt-5.6-luna` | Hardcoded fallback |
-
- **Key principle:** Layer 0 (persistent config) beats everything. If the user said "always use opus" and it was saved to config.json, every agent gets opus regardless of role or task type. This is intentional — the user explicitly chose quality over cost.
-
- ## AGENT WORKFLOW
-
- ### On Session Start
-
- 1. READ `.squad/config.json`
- 2. CHECK for `defaultModel` field — if present, this is the Layer 0 override for all spawns
- 3. CHECK for `agentModelOverrides` field — if present, these are per-agent Layer 0a overrides
- 4. STORE both values in session context for the duration
-
- ### On Every Agent Spawn
-
- 1. CHECK Layer 0a: Is there an `agentModelOverrides.{agentName}` in config.json? → Use it.
- 2. CHECK Layer 0b: Is there a `defaultModel` in config.json? → Use it.
- 3. CHECK Layer 1: Did the user give a session directive? → Use it.
- 4. CHECK Layer 2: Does the agent's charter have a `## Model` section? → Use it.
- 5. CHECK Layer 3: Determine task type:
- - Code (implementation, tests, refactoring, bug fixes) → `gpt-5.6-terra`
- - Prompts, agent designs → `gpt-5.6-terra`
- - Visual/design with image analysis → `gpt-5.6-sol`
- - Non-code (docs, planning, triage, changelogs) → `gpt-5.6-luna`
- 6. FALLBACK Layer 4: `gpt-5.6-luna`
- 7. INCLUDE model in spawn acknowledgment: `🔧 {Name} ({resolved_model}) — {task}`
-
- ### When User Sets a Preference
-
- **Trigger phrases:** "always use X", "use X for everything", "switch to X", "default to X"
-
- 1. VALIDATE the model ID against the catalog
- 2. WRITE `defaultModel` to `.squad/config.json` (merge, don't overwrite)
- 3. ACKNOWLEDGE: `✅ Model preference saved: {model} — all future sessions will use this until changed.`
-
- **Per-agent trigger:** "use X for {agent}"
-
- 1. VALIDATE model ID
- 2. WRITE to `agentModelOverrides.{agent}` in `.squad/config.json`
- 3. ACKNOWLEDGE: `✅ {Agent} will always use {model} — saved to config.`
-
- ### When User Clears a Preference
-
- **Trigger phrases:** "switch back to automatic", "clear model preference", "use default models"
-
- 1. REMOVE `defaultModel` from `.squad/config.json`
- 2. ACKNOWLEDGE: `✅ Model preference cleared — returning to automatic selection.`
+ Use this skill when the user requests a model, the team configuration contains a saved model
+ preference, or a specialist charter explicitly requires one.
- ### STOP
+ ## Resolution Order
- After resolving the model and including it in the spawn template, this skill is done. Do NOT:
- - Generate model comparison reports
- - Run benchmarks or speed tests
- - Create new config files (only modify existing `.squad/config.json`)
- - Change the model after spawn (fallback chains handle runtime failures)
+ Apply the first available value:
- ## Config Schema
+ 1. Explicit model requested for the current spawn.
+ 2. Current-session model directive from the user.
+ 3. `.squad/config.json` `agentModelOverrides.{specialist-id}`.
+ 4. `.squad/config.json` `defaultModel`.
+ 5. The specialist charter's explicit model requirement.
+ 6. Runtime automatic selection by omitting the model parameter.
- `.squad/config.json` model-related fields:
+ An explicit current request always overrides older persistent configuration. Do not invent a model
+ preference from task type alone, and do not pin a hardcoded fallback that can become obsolete.
- ```json
- {
- "version": 1,
- "defaultModel": "claude-opus-4.6",
- "agentModelOverrides": {
- "fenster": "claude-sonnet-4.6",
- "mcmanus": "claude-haiku-4.5"
- }
- }
- ```
+ ## Persistent Preferences
- - `defaultModel` — applies to ALL agents unless overridden by `agentModelOverrides`
- - `agentModelOverrides` — per-agent overrides that take priority over `defaultModel`
- - Both fields are optional. When absent, Layers 1-4 apply normally.
+ - Save `defaultModel` or `agentModelOverrides` only when the user explicitly asks for persistence.
+ - Merge model fields into the existing `.squad/config.json`; do not replace unrelated settings.
+ - Use active specialist IDs from `.squad/casting/registry.json`.
+ - Validate a requested model against the runtime's currently supported model list.
+ - To return to automatic routing, remove the applicable override rather than writing an `"auto"`
+ sentinel unless the runtime schema explicitly supports it.
- ## Fallback Chains
+ ## Spawn Behavior
- If a model is unavailable (rate limit, plan restriction), retry within the same tier:
+ - Pass a model only when resolution steps 1-5 produce a supported value.
+ - Otherwise omit the model parameter and allow the runtime to select.
+ - Preserve the user's requested reasoning effort or context tier only when the runtime supports it.
+ - If a requested model is unavailable, report that failure and fall back to runtime automatic
+ selection unless the user supplied a different fallback.
- ```
- Premium: gpt-5.6-sol → claude-opus-5 → claude-opus-4.8 → claude-opus-4.7 → claude-opus-4.6 → claude-sonnet-4.6 → (omit model param)
- Standard: gpt-5.6-terra → claude-sonnet-5 → claude-sonnet-4.6 → gpt-5.5 → gpt-5.4 → gpt-5.3-codex → claude-sonnet-4.5 → gemini-3.1-pro → (omit model param)
- Fast: gpt-5.6-luna → claude-haiku-4.5 → gpt-5.4-mini → gpt-5-mini → (omit model param)
- ```
+ ## Stop Conditions
- **Never fall UP in tier.** A fast task won't land on a premium model via fallback.
+ - Stop if the requested model is not supported and no automatic fallback is acceptable.
+ - Stop rather than rewriting configuration when `.squad/config.json` cannot be parsed safely.
+ - Do not benchmark models, estimate billing, or modify specialist responsibilities under this skill.