[FEATURE] Feature: Auto model-switching with user approval (Sonnet → Opus on complexity)

Resolved 💬 3 comments Opened Apr 15, 2026 by ywlee861009 Closed Apr 18, 2026

Preflight Checklist

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

Problem Statement

## Summary

Claude Code currently runs on a single fixed model per session. I'd like a feature where Claude Code starts with Sonnet by default and automatically detects when a task
is complex enough to warrant Opus — then asks the user for permission before switching.

## Proposed Behavior

  1. Default model: claude-sonnet-4-6 (fast, cost-effective)
  2. Complexity detection: Claude Code internally estimates whether the current task (e.g. deep algorithmic design, multi-file refactoring, complex debugging) exceeds

Sonnet's optimal range

  1. Permission prompt: Before switching, show a confirmation like:

> "This task may benefit from Opus. Switch model? (costs ~5× more) [y/N]"

  1. Switch: If approved, continue the task with claude-opus-4-6
  2. Optional auto-revert: Switch back to Sonnet after the complex task completes

## Motivation

  • Gemini CLI already does something similar — lightweight model by default, escalates when needed
  • Most tasks don't need Opus; paying for it always is wasteful
  • Users want control over cost without manually running /model before every hard task

## Configuration (suggested)

```json
{
"defaultModel": "claude-sonnet-4-6",
"autoUpgrade": {
"enabled": true,
"upgradeModel": "claude-opus-4-6",
"requireConfirmation": true
}
}

Alternatives Considered

  • Manual /model switching — works but requires the user to predict complexity upfront
  • Always use Opus — too expensive for routine tasks

Proposed Solution

Proposed Solution

Introduce a lightweight complexity classifier that runs before each tool-use cycle:

  • Heuristics: task involves >3 files, algorithmic design, multi-step reasoning, or the user prompt explicitly asks for architecture/planning
  • When complexity score exceeds a threshold, Claude Code pauses and prompts:

> "⚡ This task looks complex. Switch to Opus for better results? (costs ~5× more) [y/N]"

  • If the user approves, the current session context is carried over and the request is re-sent with claude-opus-4-6
  • After the response, revert to Sonnet automatically (or keep Opus for the session — user's choice)

This can be implemented as a client-side routing layer in Claude Code without changes to the Claude API itself.

Alternative Solutions

_No response_

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗