# Plan: Per-task model override via MCP + cheapest-model prompt guidance Spec: `docs/superpowers/specs/2026-06-09-per-task-model-override-design.md` TDD, one focused commit per task. Build with `-c Release` per project; run `ClaudeDo.Worker.Tests` (and `Data.Tests` if touched). ## Task 1 — ModelRegistry: cost ordering + alias validation - Add `ByCostAscending = ["haiku","sonnet","opus"]`. - Add `string? NormalizeAlias(string? model)`: trim; null/blank → null; case-insensitive match against `Aliases` → canonical lowercase; else throw `ArgumentException($"Unknown model '{model}'. Allowed: {join(Aliases)}.")`. - Tests (Data.Tests): "sonnet"/"OPUS"/" haiku " → normalized; ""/null/" " → null; "gpt4" → throws. ## Task 2 — CreateChildAsync accepts model - `TaskRepository.CreateChildAsync`: add `string? model = null` (before the trailing `CancellationToken ct = default`); set `child.Model = ModelRegistry.NormalizeAlias(model)`. - Update the two existing callers to compile (named pass-through added in Tasks 3–4; keep default null here). ## Task 3 — Planning + improvement MCP tools forward model - `PlanningMcpService.CreateChildTask`: add `string? model` param after `commitType`; pass to `CreateChildAsync`. Extend `[Description]` to document the model arg (haiku/sonnet/opus; cheapest capable). - `TaskRunMcpService.SuggestImprovement`: add `string? model` param after `description`; pass to `CreateChildAsync`. Extend `[Description]`. - Tests: each tool persists the model; invalid value throws. ## Task 4 — External AddTask forwards model - `ExternalMcpService.AddTask`: add `string? model = null` param (before the trailing `CancellationToken`); `entity.Model = ModelRegistry.NormalizeAlias(model)`. Extend `[Description]`. - Test: AddTask persists model; invalid value rejected. ## Task 5 — Prompt guidance - `PromptFiles.PlanningSystemDefault`: add a short paragraph — assign each subtask the cheapest model that does it well, with ordering haiku < sonnet < opus and the heuristic; pass it as `CreateChildTask(model=...)`. - `PromptFiles.SystemDefault` Out-of-scope section: when filing via `SuggestImprovement`, pass the cheapest capable `model`. - `PromptFiles.ImprovementChildDefault`: one-line minimality reminder. - No test (static prompt text); verify build only. ## Task 6 — Verify - Build App + Worker `-c Release`; run Worker.Tests + Data.Tests. - Update `ClaudeDo.Worker/CLAUDE.md` (ConfigMcpTools/creation-tool notes) and `ClaudeDo.Data/CLAUDE.md` (ModelRegistry) if needed.