Statusline reports wrong model after /model switch
Bug description
The statusline command receives incorrect model data after switching models mid-session with /model. The model field in the JSON passed to the statusline script reflects the global default from settings.json, not the actual model active in the session.
Steps to reproduce
- Set
"model": "sonnet"in~/.claude/settings.json - Start a new Claude Code session (statusline correctly shows "Sonnet 4.6")
- Use
/modelto switch to Opus - Observe: statusline still shows "Sonnet 4.6"
- Verify the session is actually using Opus (system prompt confirms
claude-opus-4-6)
Evidence
Added a debug log to the statusline script to capture raw stdin:
fs.writeFileSync('statusline-debug.json', JSON.stringify(d, null, 2));
After switching to Opus via /model, the statusline still receives:
{
"model": {
"id": "claude-sonnet-4-6",
"display_name": "Sonnet 4.6"
}
}
Meanwhile, the session's system prompt confirms: "You are powered by the model named Opus 4.6. The exact model ID is claude-opus-4-6."
Expected behavior
The model field passed to the statusline command should reflect the actual model being used in the current session, not the global default from settings.json. This is especially important when running multiple sessions with different models.
Environment
- Claude Code version: 2.1.74
- OS: Windows 11
- Shell: bash (Git Bash)
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗