[FEATURE] Automatic Model Switching for Plan Mode

Open 💬 26 comments Opened Dec 29, 2025 by generik0

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Feature Request: Automatic Model Switching for Plan Mode

Summary

Add configuration to automatically switch between models based on workflow phase (planning vs execution), optimizing for both cost and capability.

Problem

Currently, users must manually switch models using /model command when transitioning between planning and execution phases. This leads to:

  1. Suboptimal model usage: Users often stay on one model for entire session
  2. Cost inefficiency: Using Opus 4.5 for simple execution tasks burns budget ~5x faster
  3. Missed opportunities: Not using Opus for complex planning when it would add value
  4. Manual overhead: Remembering to switch models interrupts flow

Proposed Solution

Enable automatic model switching based on workflow phase:

  • Plan Mode (EnterPlanMode) → Use specified planning model (e.g., Opus 4.5)
  • Execution Mode (normal operation) → Use specified execution model (e.g., Sonnet 4.5)
  • Quick Tasks (optional) → Use fast model (e.g., Haiku)

Use Cases

Use Case 1: Architecture & Implementation

User: "Implement user authentication with OAuth"

Claude Code:
1. Enters plan mode → AUTO-SWITCHES to Opus 4.5
2. Creates comprehensive architectural plan
3. Exits plan mode → AUTO-SWITCHES to Sonnet 4.5
4. Executes implementation efficiently

Benefit: Best model for planning, cost-effective execution

Use Case 2: Complex Refactoring

User: "Refactor this monolith into microservices"

Claude Code:
1. Plan mode (Opus) → Design service boundaries, data flow, migration strategy
2. Execution mode (Sonnet) → Implement refactoring, run tests, create PRs

Benefit: Opus for complex decisions, Sonnet for code changes

Use Case 3: Simple Tasks

User: "Fix this typo in README"

Claude Code:
→ Stays in Sonnet/Haiku (no plan mode needed)

Benefit: No unnecessary model escalation

Proposed Solution

Proposed Configuration

Option A: Settings File

.claude/settings.json:

{
  "models": {
    "plan_mode": "opus",
    "execution_mode": "sonnet",
    "quick_tasks": "haiku"
  },
  "auto_switch_models": true
}

Option B: Environment Variables

export CLAUDE_PLAN_MODEL="opus"
export CLAUDE_EXEC_MODEL="sonnet"
export CLAUDE_AUTO_SWITCH="true"

Option C: CLI Flag

claude code --plan-model opus --exec-model sonnet --auto-switch

Implementation Details

When to Switch

Switch to Plan Model:

  • EnterPlanMode tool is invoked
  • User explicitly requests planning ("plan the implementation...")
  • Task complexity score exceeds threshold (optional)

Switch to Execution Model:

  • ExitPlanMode tool is invoked
  • Plan is approved by user
  • Direct code modification commands (Write, Edit, Bash for git operations)

Switch to Quick Model (optional):

  • Simple read operations (Read, Glob, Grep)
  • Documentation-only changes
  • Running tests/linting

User Control

Users should be able to:

  1. Override: Manual /model command always takes precedence
  2. Disable: Set auto_switch_models: false
  3. Lock: /model opus --lock prevents auto-switching for session
  4. Review: See which model is active in status line/prompt

Status Line Integration

Show active model and switching events:

[Opus 4.5] Planning... → Implementation plan ready
[Switching to Sonnet 4.5]
[Sonnet 4.5] Executing... → 5 files modified

Cost/Performance Analysis

Example Session: "Implement OAuth Authentication"

Without Auto-Switching (All Opus):

  • Planning: 50K tokens @ Opus rates = $3.75
  • Execution: 200K tokens @ Opus rates = $15.00
  • Total: $18.75

With Auto-Switching (Opus → Sonnet):

  • Planning: 50K tokens @ Opus rates = $3.75
  • Execution: 200K tokens @ Sonnet rates = $3.00
  • Total: $6.75 (64% cost reduction)

Without Auto-Switching (All Sonnet):

  • Planning: 50K tokens @ Sonnet rates = $0.75
  • Execution: 200K tokens @ Sonnet rates = $3.00
  • Total: $3.75
  • Trade-off: Lower quality planning, potential rework costs

Benefits

  1. Cost Optimization: Use expensive models only when needed
  2. Quality Optimization: Best model for each phase
  3. User Experience: Seamless transitions, no manual intervention
  4. Flexibility: User can override or disable as needed
  5. Transparency: Clear visibility into model usage

Alternative Solutions

Alternatives Considered

Alternative 1: Always Ask User

Claude: "This looks complex. Switch to Opus for planning? (y/n)"

Drawback: Interrupts flow, requires user decision

Alternative 2: Token Budget Thresholds

Automatically downgrade when approaching token limits.
Drawback: Doesn't optimize for task type, reactive not proactive

Alternative 3: Per-Tool Model Selection

Each tool (Read, Write, Bash) specifies preferred model.
Drawback: Too granular, hard to maintain

Related Features

  • [ ] Model performance analytics (track which model was used for what)
  • [ ] Cost tracking per session
  • [ ] Recommend model switches based on task complexity
  • [ ] Custom model presets (e.g., "architect" = opus+sonnet)

Questions for Maintainers

  1. Should auto-switching be opt-in or opt-out?
  2. Should quick_tasks auto-switching be a separate flag?
  3. How should this interact with MCP servers that might specify model preferences?
  4. Should project-level settings override user-level settings?

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

Example User Stories

As a solo developer, I want Opus for architecture decisions and Sonnet for implementation, so I can maximize quality while managing costs.

As a team lead, I want to configure default models for my team's projects, so everyone follows cost-effective best practices.

As a cost-conscious user, I want to use Haiku for simple tasks and Sonnet for complex ones, reserving Opus only for critical planning.

Success Metrics

  • % of users who enable auto-switching
  • Average cost reduction per session
  • User satisfaction with automatic transitions
  • Frequency of manual overrides (high = poor auto-detection)

Additional Context

Additional Context

This feature would be particularly valuable for:

  • Large refactoring projects (plan with Opus, execute with Sonnet)
  • API design (plan with Opus, implement with Sonnet)
  • Architecture decisions (Opus) vs bug fixes (Sonnet/Haiku)
  • Complex CI/CD setup (plan with Opus) vs routine updates (Sonnet)

View original on GitHub ↗

26 Comments

github-actions[bot] · 5 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

dcieslak19973 · 5 months ago

I like this!

adam-kiss-sg · 5 months ago

Just in case someone else stumbles here, I think this has been added: https://code.claude.com/docs/en/model-config#opusplan-model-setting

sholub89 · 4 months ago

opusplan is currently totally broken. It selects Opus 4.1 for planning while Opus 4.6 is available and Sonnet 4.5 for execution, while Sonnet 4.5 is available

dsilverio-gcmlp · 4 months ago

this would be very useful!

silversurfer562 · 4 months ago

Multi tier routing has been part of attune-ai for Claude-code for quite
some time.

On Thu, Mar 5, 2026 at 9:32 PM Douglas Silverio @.***>
wrote:

dsilverio-gcmlp left a comment (anthropics/claude-code#15721) <https://github.com/anthropics/claude-code/issues/15721#issuecomment-4009143775> this would be very useful! — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/15721#issuecomment-4009143775>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BVMXZYM7AWWPMLSZURVOANL4PI2EHAVCNFSM6AAAAACQIIEKD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DAMBZGE2DGNZXGU> . You are receiving this because you are subscribed to this thread.Message ID: @.***>
adam-kiss-sg · 4 months ago

@sholub89

I use the following setup (atlhough I use it for AWS Bedrock, never tried it with Antrophic's cloud)

ANTHROPIC_DEFAULT_OPUS_MODEL='global.anthropic.claude-opus-4-6-v1'
ANTHROPIC_DEFAULT_SONNET_MODEL='global.anthropic.claude-sonnet-4-5-20250929-v1:0' 
ANTHROPIC_DEFAULT_HAIKU_MODEL='global.anthropic.claude-haiku-4-5-20251001-v1:0' 
ANTHROPIC_MODEL='opusplan' 

This uses the correct models. Maybe something similar could work for you as well.

sholub89 · 4 months ago

@adam-kiss-sg , thank you. I noticed that the subscription version works perfectly fine, and it selects the right models, while the API version is bugged

nitaiaharoni1 · 4 months ago

Adding weight here — this remains one of the highest-friction points in a cost-conscious Claude Code workflow.

Current state (March 2026): The opusplan shorthand exists (documented at code.claude.com/docs/en/model-config#opusplan-model-setting) but as @sholub89 noted, it resolves to hardcoded model versions rather than latest Opus/Sonnet. On the API path this means you may get Opus 4.1 + Sonnet 4.5 when Opus 4.6 and Sonnet 4.6 are available. The workaround (@adam-kiss-sg's env var approach) works for Bedrock but is clunky for direct API users.

What's still missing:

  1. A planModel / executeModel config pair that resolves model aliases dynamically (not hardcoded versions)
  2. Visual indicator in the TUI showing which model is currently active (plan vs. execute phase)
  3. Auto-switch on plan mode entry/exit without any user action

The core ask is simple: make the model follow the mode, not the user's memory. Planning benefits from maximum reasoning capacity; execution of already-decided steps is a throughput problem where Sonnet/Haiku excel.

This pattern is now widely documented as best practice in the community — native support would validate and normalize it.

chrisjenx · 4 months ago

I agree this would be super helpful, and probably something that would save anthropic cost on there subscription plans, as most people would probably leave it to auto switch. Sonnet with a really well defined plan can smash it out no problem, so this is for sure something we need.

Is there any third party plugins for CC that can do this?

tony-stark-eth · 3 months ago

Would be very helpful indeed!

valentinoPereira · 3 months ago

Any update on this? I am on an enterprise subscription and opusplan mode is not switching the models correctly. I go to plan mode and it still says sonnet is being used.

chrisjenx · 3 months ago

I don't think so but they do take pull requests but looking at the things they shoul are fixing seems to be focusing on Enterprise users right now

oussama-kh · 3 months ago

Could this solve your issue? https://github.com/oussama-kh/mcp-llama-swap
Currently works for local llm models only, but maybe you can fork and adapt it to your case.

hurtjan · 3 months ago

The (in my opinion) cleanest and most obvious implementation of this would be to offer the sonnet switch when the user is asked if the Edits should be implemented, so like this:

Claude has written up a plan and is ready to execute. Would you like to
 proceed?

 ❯ 1. Yes, switch to Sonnet and auto-accept edits
   2. Yes, stay with Opus and auto-accept edits
   3. Yes, manually approve edits
   4. No, refine with Ultraplan on Claude Code on the web
   5. Tell Claude what to change
      shift+tab to approve with this feedback
svcrashh · 2 months ago

The plan/execute split is leakier than it looks. Real "execution" isn't a flat pipe of mechanical edits — it's punctuated by mini-planning moments: a test fails and the model needs to reason about why, an interface decision forces a tradeoff the plan didn't anticipate, a refactor surfaces a question that wasn't visible upfront. If the switch flips to Sonnet on ExitPlanMode and stays there, those moments silently get the cheaper brain — and the user sees worse output without knowing the model changed under them.
Worth defining re-escalation signals beyond plan-mode boundaries: repeated tool-call failures, the model itself flagging uncertainty, cross-file reasoning, or N+ edits converging on the same region.

MacDaddyKoffi · 1 month ago

+1 on this. One thing worth keeping in mind for the implementation: the existing opusplan preset is effectively hardcoded to a specific Opus↔Sonnet pair. As new models are released, that approach doesn't scale — every new model would need its own bespoke "X-plan" alias.

It would be great if the eventual implementation generalized opusplan into a configurable pair (e.g. plan_model / exec_model as proposed in Option A), so users could set any model for either role:

{
  "models": {
    "plan_mode": "<any-model-id>",
    "execution_mode": "<any-model-id>"
  },
  "auto_switch_models": true
}

This way, as future models are added to Claude Code, users get an "X-plan" style preset for free without waiting for a new hardcoded alias. Today there's no hook event for EnterPlanMode/ExitPlanMode and no way to switch models automatically based on plan-mode state, so this currently has to be done manually via /model.

valentinoPereira · 1 month ago

I agree, especially with the new Fable models released, it people might want to use that for planning instead of opus.

cmirandajr · 27 days ago

+1, and I'd add a data center angle to this: I'm a daily subscriber using chat, Code, and Cowork. I manually switch between Haiku/Sonnet/Opus depending on the task, but I forget, and end up running simple stuff on a bigger model than it needs. Multiply that by however many subscribers do the same thing — auto-routing wouldn't just save users' usage allowance, it'd cut unnecessary load on Anthropic's compute too. Seems like a win on both sides of the table.

dannytrue · 26 days ago

I'm not sure why this issue is still open because this already works on my local machine, just type /model opusplan


❯ /model                                                                                                                                                                                                                                                                                                            

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Select model
  Switch between Claude models. Your pick becomes the default for new sessions. For other/previous model names, specify with --model.
                                             
    1. Default (recommended)  Sonnet 4.6 · Efficient for routine tasks
    2. Sonnet                 Sonnet 4.6 · Efficient for routine tasks
    3. Sonnet (1M context)    Sonnet 4.6 with 1M context · Draws from usage credits · $3/$15 per Mtok
    4. Opus                   Opus 4.8 · Best for everyday, complex tasks · ~2× usage vs Sonnet
    5. Haiku                  Haiku 4.5 · Fastest for quick answers
  ❯ 6. Opus Plan Mode ✔       Use Opus in plan mode, Sonnet otherwise
PaulRBerg · 13 days ago

+1 — this is even more important now that Fable is out, since Fable is quite expensive to run for an entire session. Being able to use it just for planning (falling back to a cheaper model for execution) is exactly the use case this issue is asking for.

Worth noting: Codex CLI already supports this pattern natively (distinct planning vs. execution model config), so there's precedent for it working well in practice.

Related: #8358, #26556

@dannytrue this issue should stay open — opusplan and this request solve different problems. opusplan is a hardcoded Opus↔Sonnet pair; it doesn't let you choose which models are used for planning vs. execution. This request is about a generic plan_model/exec_model setting that works with any model pair — e.g. I want Fable 5 for planning and Sonnet 5 for implementation, which opusplan can't do no matter how it's configured.

mspoonauer · 9 days ago

This must also support the ability to specify an effort level per model for planning versus execution. :-)

dimension-zero · 8 days ago

Yes please I would like to see

  • Plan mode Model and Effort e.g. Opus Max
  • Execution mode Model and Effort e.g. Sonnet High
alexgvozden · 7 days ago
Just in case someone else stumbles here, I think this has been added: https://code.claude.com/docs/en/model-config#opusplan-model-setting

this is not really it, it's similar but new model came out Fable 5 and this doesn't work any more during regular sessions, only if Fable 5 reaches limit.

+1 for this to become a real feature

dimension-zero · 7 days ago

Actually we could go all the way and specify

  • Planning Model and Effort
  • Coding Model and Effort
  • Prose-only non-coding Model and Effort
  • Subagent Model and Effort
  • Test-runner Model and Effort (no need to use Fable to run & evaluate unit-test results)
maxritter · 6 days ago

+1, we definitely need this!