Built-in always-visible context usage indicator in status bar

Resolved 💬 3 comments Opened Dec 24, 2025 by KhushT Closed Dec 27, 2025

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

The current context indicator ("Context left till auto-compact") only appears when you're near ~95% capacity. By then, it's often too late to gracefully wrap up work - users get surprise auto-compacted mid-task, losing conversation continuity.

Current Workaround:
Users can create a custom status line script that always displays context percentage. Here's how:

  1. Create a PowerShell script (~/.claude/statusline.ps1):

$inputData = $input | Out-String
$data = $inputData | ConvertFrom-Json

$usage = $data.context_window.current_usage
$model = $data.model.display_name

if ($null -eq $usage) {
Write-Output "$model | Context: waiting..."
} else {
$current = $usage.input_tokens + $usage.cache_creation_input_tokens + $usage.cache_read_input_tokens + $usage.output_tokens
$size = $data.context_window.context_window_size
$pct_used = [Math]::Floor(($current * 100) / $size)
$pct_remaining = 100 - $pct_used

if ($pct_remaining -le 25) {
Write-Output "$model | Context: $pct_used% used | $pct_remaining% LEFT - COMPACT SOON!"
} else {
Write-Output "$model | Context: $pct_used% used | $pct_remaining% remaining"
}
}

  1. Configure in settings.json (~/.claude/settings.json):

{
"statusLine": {
"type": "command",
"command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"C:\\Users\\USERNAME\\.claude\\statusline.ps1\""
}
}

Bash version for Mac/Linux (~/.claude/statusline.sh):
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
CONTEXT_SIZE=$(echo "$input" | jq -r '.context_window.context_window_size')
USAGE=$(echo "$input" | jq '.context_window.current_usage')

if [ "$USAGE" != "null" ]; then
CURRENT=$(echo "$USAGE" | jq '.input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens + .output_tokens')
PERCENT=$((CURRENT * 100 / CONTEXT_SIZE))
REMAINING=$((100 - PERCENT))
echo "[$MODEL] Context: ${PERCENT}% used | ${REMAINING}% remaining"
else
echo "[$MODEL] Context: 0%"
fi

Proposed Solution

Make this a built-in toggle in Claude Code settings - no custom scripts required. Something like:

{
"showContextUsage": true
}

Or even better, always show it by default with color-coded thresholds:

  • 🟢 Green: 0-50% used
  • 🟡 Yellow: 50-75% used
  • 🔴 Red: 75%+ used (with "COMPACT SOON" warning)

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

Performance and speed

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗