SKILL.md (4972B)
1 # Model Selection 2 3 > Determines which LLM model to use for each agent spawn. 4 5 ## SCOPE 6 7 ✅ THIS SKILL PRODUCES: 8 - A resolved `model` parameter for every `task` tool call 9 - Persistent model preferences in `.squad/config.json` 10 - Spawn acknowledgments that include the resolved model 11 12 ❌ THIS SKILL DOES NOT PRODUCE: 13 - Code, tests, or documentation 14 - Model performance benchmarks 15 - Cost reports or billing artifacts 16 17 ## Context 18 19 Squad supports 18+ models 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. 20 21 ## 5-Layer Model Resolution Hierarchy 22 23 Resolution is **first-match-wins** — the highest layer with a value wins. 24 25 | Layer | Name | Source | Persistence | 26 |-------|------|--------|-------------| 27 | **0a** | Per-Agent Config | `.squad/config.json` → `agentModelOverrides.{name}` | Persistent (survives sessions) | 28 | **0b** | Global Config | `.squad/config.json` → `defaultModel` | Persistent (survives sessions) | 29 | **1** | Session Directive | User said "use X" in current session | Session-only | 30 | **2** | Charter Preference | Agent's `charter.md` → `## Model` section | Persistent (in charter) | 31 | **3** | Task-Aware Auto | Code → sonnet, docs → haiku, visual → opus | Computed per-spawn | 32 | **4** | Default | `claude-haiku-4.5` | Hardcoded fallback | 33 34 **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. 35 36 ## AGENT WORKFLOW 37 38 ### On Session Start 39 40 1. READ `.squad/config.json` 41 2. CHECK for `defaultModel` field — if present, this is the Layer 0 override for all spawns 42 3. CHECK for `agentModelOverrides` field — if present, these are per-agent Layer 0a overrides 43 4. STORE both values in session context for the duration 44 45 ### On Every Agent Spawn 46 47 1. CHECK Layer 0a: Is there an `agentModelOverrides.{agentName}` in config.json? → Use it. 48 2. CHECK Layer 0b: Is there a `defaultModel` in config.json? → Use it. 49 3. CHECK Layer 1: Did the user give a session directive? → Use it. 50 4. CHECK Layer 2: Does the agent's charter have a `## Model` section? → Use it. 51 5. CHECK Layer 3: Determine task type: 52 - Code (implementation, tests, refactoring, bug fixes) → `claude-sonnet-4.6` 53 - Prompts, agent designs → `claude-sonnet-4.6` 54 - Visual/design with image analysis → `claude-opus-4.6` 55 - Non-code (docs, planning, triage, changelogs) → `claude-haiku-4.5` 56 6. FALLBACK Layer 4: `claude-haiku-4.5` 57 7. INCLUDE model in spawn acknowledgment: `🔧 {Name} ({resolved_model}) — {task}` 58 59 ### When User Sets a Preference 60 61 **Trigger phrases:** "always use X", "use X for everything", "switch to X", "default to X" 62 63 1. VALIDATE the model ID against the catalog (18+ models) 64 2. WRITE `defaultModel` to `.squad/config.json` (merge, don't overwrite) 65 3. ACKNOWLEDGE: `✅ Model preference saved: {model} — all future sessions will use this until changed.` 66 67 **Per-agent trigger:** "use X for {agent}" 68 69 1. VALIDATE model ID 70 2. WRITE to `agentModelOverrides.{agent}` in `.squad/config.json` 71 3. ACKNOWLEDGE: `✅ {Agent} will always use {model} — saved to config.` 72 73 ### When User Clears a Preference 74 75 **Trigger phrases:** "switch back to automatic", "clear model preference", "use default models" 76 77 1. REMOVE `defaultModel` from `.squad/config.json` 78 2. ACKNOWLEDGE: `✅ Model preference cleared — returning to automatic selection.` 79 80 ### STOP 81 82 After resolving the model and including it in the spawn template, this skill is done. Do NOT: 83 - Generate model comparison reports 84 - Run benchmarks or speed tests 85 - Create new config files (only modify existing `.squad/config.json`) 86 - Change the model after spawn (fallback chains handle runtime failures) 87 88 ## Config Schema 89 90 `.squad/config.json` model-related fields: 91 92 ```json 93 { 94 "version": 1, 95 "defaultModel": "claude-opus-4.6", 96 "agentModelOverrides": { 97 "fenster": "claude-sonnet-4.6", 98 "mcmanus": "claude-haiku-4.5" 99 } 100 } 101 ``` 102 103 - `defaultModel` — applies to ALL agents unless overridden by `agentModelOverrides` 104 - `agentModelOverrides` — per-agent overrides that take priority over `defaultModel` 105 - Both fields are optional. When absent, Layers 1-4 apply normally. 106 107 ## Fallback Chains 108 109 If a model is unavailable (rate limit, plan restriction), retry within the same tier: 110 111 ``` 112 Premium: claude-opus-4.6 → claude-opus-4.6-fast → claude-opus-4.5 → claude-sonnet-4.6 113 Standard: claude-sonnet-4.6 → gpt-5.4 → claude-sonnet-4.5 → gpt-5.3-codex → claude-sonnet-4 114 Fast: claude-haiku-4.5 → gpt-5.1-codex-mini → gpt-4.1 → gpt-5-mini 115 ``` 116 117 **Never fall UP in tier.** A fast task won't land on a premium model via fallback.