[BUG] model changes automatically during one task

Resolved 💬 3 comments Opened Mar 20, 2026 by bxw91 Closed Apr 17, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I am using Claude Code as extenstion in VS Code.

I have started new chat and set model to Haiku.

After few prompts I have run /context to see details and noticed that model shown in context details output : claude-sonnet-4-6

After asking Sonnet to explore why and when model changed from Haiku to Sonnet, here is what Sonnet wrote :

Looking at the timeline in this conversation:

/model haiku set at the start
Conversation continued (Phase 1 work, AskUserQuestion tool, skill review, etc.)
/context → showed sonnet
The most likely cause: autocompact reset the model preference.

Your /context output shows:

Autocompact buffer | 33k | 16.5%

When Claude Code's autocompact triggers (to manage context limits), it starts a fresh underlying session — and that session defaults back to the configured default model (sonnet), discarding the temporary /model haiku switch.

In short: /model haiku is a per-session override. If autocompact fires mid-conversation, it resets to the default model.

If you want haiku permanently for this project, the right approach is to set it in config rather than using /model:

Use /update-config to set model in settings.json or settings.local.json
Or check if there's a project-level .claude/settings.json where you can pin the model

What Should Happen?

Model should not change without asking.

Error Messages/Logs

Steps to Reproduce

Set Haiku model, do few prompts (probably hit context autocompact), use /context to see details and check what model is written in context details table and also check what model is currently selected.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Code for VS Code 2.1.79

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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