claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Default Model Not Updating Correctly After Switching

Open ruijayfeng opened this issue 1 year ago • 5 comments

Problem Description

When using claude, after switching the model using the /model command, the default model does not update correctly upon re-entering claude. The specific steps and issue are as follows:

  1. Initial State: Enter claude, and the default model is opus.
  2. Switch Model: Use the /model sonnet command to switch the model to sonnet.
  3. Re-enter: Exit and re-enter claude, and the default model is still opus, not the previously switched sonnet.
  4. Manual Fix: It is necessary to manually edit the setting.json file in the .claude directory to set the default model to sonnet.

Expected Behavior

  • After switching the model using the /model command, the default model should automatically be the one previously switched to, without needing to manually edit the configuration file.

Current Behavior

  • Every time claude is entered, the default model is always opus, even after switching the model using the /model command.

Environment Information

  • Operating System: Ubuntu 20.04
  • claude Version: lasted

Reproduction Steps

  1. Enter claude.

    $ claude
    
  2. Check the current default model:

    $ /model
    

    Output:

    Current model: opus
    
  3. Switch the model to sonnet:

    $ /model sonnet
    

    Output:

    Model switched to sonnet
    
  4. Exit claude.

    $ exit
    
  5. Re-enter claude.

    $ claude
    
  6. Check the current default model again:

    $ /model
    

    Output:

    Current model: opus
    

Temporary Solution

  • Manually edit the setting.json file in the .claude directory to set the default model to sonnet.

Impact of the Issue

  • Poor user experience, as users need to manually edit the configuration file each time they enter claude.
  • There may be an issue with the configuration file not updating correctly or a problem with the command logic.

Priority

  • Medium

ruijayfeng avatar Jul 17 '25 13:07 ruijayfeng

Changing it in settings.json does not solve the issue. It is very annoying that it forces Opus which is just burning quota without providing any value. We need a way to set sonnet permanently.

dmitryrechkin avatar Jul 24 '25 04:07 dmitryrechkin

AI Assistant:

I strongly support this issue and have created a related feature request #4807 that extends this concept further.

With the upcoming weekly rate limits (24-40 hours for Opus 4 starting August 28), the need for proper model persistence and granular control has become critical. The fact that model changes affect all sessions globally is particularly problematic when:

  1. Running multiple sub-agents in parallel (4 agents = 4x faster quota consumption)
  2. Different parts of a project require different models (e.g., Rust code needs Opus, documentation can use Sonnet)
  3. We need to optimize model usage per task type to conserve precious Opus hours

Our issue proposes extending model selection beyond just persistence to include:

  • Per-sub-agent model configuration
  • Rule-based model selection (by file type, task type)
  • Dynamic model switching based on task complexity

This would work alongside fixing the persistence issue you've identified here. Without these features, the new rate limits will make Claude Code unusable for many professional workflows.

Please see #4807 for a comprehensive proposal on granular model selection to address these urgent challenges.

gwpl avatar Jul 30 '25 22:07 gwpl


Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/1523
  2. https://github.com/anthropics/claude-code/issues/5558

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 16 '25 04:08 github-actions[bot]

This issue has been automatically closed as a duplicate of #1523.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 20 '25 09:08 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 28 '25 14:08 github-actions[bot]