Skip to main content

Intelligent Model Selection

Intelligent Model Selection is SpecWeave's automatic system for choosing the right AI model (Claude Haiku, Sonnet, or Opus) based on task complexity. This optimizes both cost and quality by using cheaper models for simple tasks and more capable models for complex ones.


How It Works


Model Tiers

ModelCostBest ForUse Cases
Haiku$Quick tasksFile search, simple questions, log parsing
Sonnet$$Standard workPlanning, code review, implementation
Opus$$$Complex tasksArchitecture, multi-file refactoring, novel problems

Phase Detection

SpecWeave detects the current phase to select the appropriate model:

PhaseTypical ModelWhy
ExplorationHaikuFast file search, codebase navigation
ResearchHaiku/SonnetReading docs, understanding context
PlanningSonnetGenerating specs, breaking down work
ArchitectureSonnet/OpusDesign decisions, ADRs
ImplementationSonnetWriting code, tests
ReviewSonnetCode review, validation
DebuggingSonnet/OpusComplex problem solving

Cost Impact

Intelligent model selection can reduce AI costs by 40-60%:

Without intelligent selection:
10 tasks × Opus = 10 × $15 = $150

With intelligent selection:
3 research tasks × Haiku = 3 × $0.25 = $0.75
5 standard tasks × Sonnet = 5 × $3 = $15
2 complex tasks × Opus = 2 × $15 = $30
Total: $45.75 (70% savings)

Configuration

Model selection is automatic but can be influenced:

// .specweave/config.json
{
"ai": {
"default_model": "sonnet",
"use_intelligent_selection": true,
"prefer_cost_optimization": true
}
}

Override Model Selection

Force a specific model when needed:

# Force Opus for complex task
/specweave:do --model opus

# Use Haiku for simple search
Task agent with model: haiku