[BUG] Model provider switch resets conversation context and memory state
Preflight Checklist
- [x] I have searched existing issues and this has not been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
Switching between model providers (e.g., from default provider to a custom ANTHROPIC_BASE_URL endpoint, or switching between two different configured models) causes complete loss of conversation context, memory state, and in-progress understanding.
This happens even when:
- The session is within normal context window limits
- No
/clearor explicit reset command was issued - Both models are configured with the same API credentials
Reproduction
- Start a conversation with Model A (default provider or configured endpoint)
- Establish context, load project memory files, develop an understanding of the codebase
- Switch to Model B (different provider or different model on the same provider)
- All context is lost — the model starts "fresh" with no memory of prior conversation
Observed Behavior
The following patterns are lost across a model switch:
- Memory files:
.claude/learnings/andMEMORY.mdentries from the session are not recalled - Conversation history: Previous messages are not visible in the new model's context
- In-progress understanding: Key findings discovered earlier in the session are forgotten
- Tool use memory: The new model does not know what tools have been used or their results
This forces users to write critical findings to memory files before any model switch — which is a fragile workaround, not a solution.
Expected Behavior
Switching models within the same session should preserve:
- Access to memory files (they were already loaded by the system)
- Conversation context (same session ID, same conversation history)
- In-progress work (same state, just a different model processing it)
Root Cause Hypothesis
Model providers maintain isolated conversation states. Each new model session starts fresh unless explicitly handed off. When Claude Code switches providers mid-session, the context handoff does not occur.
Workaround
Users must:
- Write all critical findings to
MEMORY.mdbefore any model switch - Use
/clear+ explicit command before starting new work in a different model context - Reference files rather than conversation history for continuity
Impact
- Broken multi-provider workflows: Teams using different providers for cost/performance optimization lose all context when routing between them
- Forced write-before-switch pattern: Requires discipline that breaks natural conversation flow
- Context loss on model rotation: Even rotating between the same model family on the same provider causes context loss
Suggested Labels
area:providers, area:core, bug
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗