Fix statusline to show actual current model instead of hardcoded Opus 4.5#1071
Open
thewoolleyman wants to merge 2 commits intoruvnet:mainfrom
Open
Fix statusline to show actual current model instead of hardcoded Opus 4.5#1071thewoolleyman wants to merge 2 commits intoruvnet:mainfrom
thewoolleyman wants to merge 2 commits intoruvnet:mainfrom
Conversation
…s 4.5" The statusline command was showing a hardcoded "Opus 4.5" model name regardless of which model the user was actually using in Claude Code. Root cause: - getUserInfo() function had `const modelName = 'Opus 4.5'` hardcoded - No detection of actual model from Claude Code's session state Fix: - Read ~/.claude.json to find the current project's lastModelUsage - Prefer the most specific (longest) matching project path - Calculate total token usage including cache tokens to find most-used model - Parse model ID to human-readable name (Opus 4.5, Sonnet 4.5, Haiku 4.5) - Fallback to "Unknown" if detection fails Result: - Statusline now correctly shows the actual model being used - Works across all Claude models (Opus, Sonnet, Haiku) - Handles nested project directories correctly Fixes: User switching to Sonnet but statusline still showing Opus
Change 'Unknown' to 'Model unknown (no usage yet)' to better communicate why the model isn't detected and that it will be once usage data is recorded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
claude-flow hooks statuslinecommand was showing a hardcoded "Opus 4.5" model name regardless of which model the user was actually using in Claude Code. This caused confusion when users switched models (e.g., to Sonnet or Haiku) but the statusline continued to display "Opus 4.5".Root Cause
In
v3/@claude-flow/cli/src/commands/hooks.ts, thegetUserInfo()function had:There was no detection of the actual model from Claude Code's session state.
Solution
Updated the
getUserInfo()function to:~/.claude.jsonto find the current project'slastModelUsagecacheReadInputTokens+cacheCreationInputTokens) to accurately determine the most-used modelclaude-sonnet-4-5-20250929to human-readable names like "Sonnet 4.5"Changes
osimport for accessing home directoryconst modelName = 'Opus 4.5'withlet modelName = 'Unknown'Testing
Tested with:
Impact
Screenshot
Before:
After (when using Sonnet):
🤖 Generated with assistance from Claude Code