Statusline: context_window.used_percentage always 0 on native Windows (Git Bash)
Environment
- Claude Code version: 2.1.138
- OS: Windows 10 (MINGW64 / Git Bash / MSYS2)
- Bash version: 5.3.9
- Node.js: v25.0.0
Description
When using a custom statusline command on native Windows (Git Bash / MSYS2), the JSON data passed via stdin has incorrect context_window values:
used_percentageis always0remaining_percentageis always100total_input_tokens/total_output_tokensreflect only the most recent API call, not cumulative session values
The same script on WSL (same Claude Code version) works correctly — used_percentage reflects the real cumulative window occupancy.
Steps to Reproduce
- On native Windows with Git Bash, configure a statusline command in
~/.claude/settings.json:
``json``
"statusLine": {
"type": "command",
"command": "path/to/statusline-command.sh"
}
- Add debug logging to the script to dump the raw JSON from stdin
- Have a multi-turn conversation (accumulating significant cost, e.g. $0.50+)
- Inspect the logged JSON
Actual Behavior
After multiple turns with cost.total_cost_usd reaching ~$1.00:
"context_window": {
"total_input_tokens": 354,
"total_output_tokens": 136,
"context_window_size": 200000,
"used_percentage": 0,
"remaining_percentage": 100
}
Note: cost.total_cost_usd in the same JSON payload is correctly cumulative ($1.00+), confirming the session has significant token usage.
Expected Behavior
used_percentage should reflect the actual context window occupancy (as it does on WSL/Linux), and total_input_tokens/total_output_tokens should be cumulative session values.
Additional Context
- The statusline command is called at a normal frequency (~14s intervals) — not a call frequency issue
- The script executes correctly (confirmed via process listing and debug logs)
- Only the data passed to the script is incorrect on Windows
cost.total_cost_usdin the same JSON payload is accurate and cumulative, suggesting the issue is specific tocontext_windowfield population on Windows- WSL on the same machine with the same script and same Claude Code version works correctly
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗