Bug: injected system context hardcodes model name, ignores --model flag override
Summary
When launching Claude Code with --model claude-opus-4-7, the CLI correctly displays the model as Opus 4.7 in the welcome banner. However, the system prompt injected into the model's context hardcodes \"You are powered by the model named Sonnet 4.6. The exact model ID is claude-sonnet-4-6.\" — causing the model to incorrectly self-identify when asked about its version.
Steps to Reproduce
- Run:
claude --model claude-opus-4-7 - CLI shows:
Opus 4.7 · Claude ProandWelcome to Opus 4.7 xhigh! - Ask the model:
which model do you use? - Model responds: Sonnet 4.6 (wrong)
Expected Behavior
The injected system context should reflect the actual model being used. When --model claude-opus-4-7 is passed, the system prompt should say "You are powered by the model named Opus 4.7. The exact model ID is claude-opus-4-7."
Actual Behavior
The system prompt contains a hardcoded model name (claude-sonnet-4-6) that is not updated when --model overrides the default. The model self-identifies incorrectly.
Environment
- Claude Code version: 2.1.114
- Model flag used:
--model claude-opus-4-7 - Platform: Windows 11 (PowerShell)
Root Cause (Hypothesis)
The harness that constructs the system prompt appears to use a static string for the model name rather than dynamically substituting the resolved model ID at runtime.
Impact
- Model self-reports incorrect version when users ask
- Any harness logic that branches on the model name string would also behave incorrectly
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗