Claude Context Indicator
A VS Code extension that shows your Claude Code context window usage in the status bar — updated in real time as you work.

What it does
Displays a live percentage in the bottom-right status bar:
| Usage |
Appearance |
| Below warning threshold |
● Claude 9% (default colour) |
| Warning zone |
⚠ Claude 55% (yellow) |
| Critical zone |
⊘ Claude 75% (red) |
The indicator is hidden until Claude Code writes its first context update.
Prerequisites
- Claude Code installed and configured.
- Statusline hook — Claude Code must be configured to write context data to
~/.claude/context-bridge.json on each interaction.
Option A — WSL / terminal (statusLine hook)
Create ~/.claude/statusline-command.sh:
#!/bin/bash
input=$(cat)
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
WIN_BRIDGE="/mnt/c/Users/<your-windows-username>/.claude/context-bridge.json"
mkdir -p "$(dirname "$WIN_BRIDGE")" 2>/dev/null
printf '{"context_percent":%s}' "$PCT" > "$WIN_BRIDGE"
Then add to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline-command.sh"
}
}
Option B — VS Code / Windows (Stop hook)
Create ~/.claude/context-bridge-hook.sh (use forward slashes, e.g. /c/Users/<you>/):
#!/bin/bash
input=$(cat)
TRANSCRIPT=$(echo "$input" | python3 -c "import sys,json; print(json.load(sys.stdin).get('transcript_path',''))" 2>/dev/null)
if [ -z "$TRANSCRIPT" ]; then exit 0; fi
PCT=$(python3 - "$TRANSCRIPT" <<'EOF'
import sys, json, os
path = sys.argv[1]
if not os.path.exists(path): sys.exit(0)
last_usage = None
with open(path, 'r', encoding='utf-8') as f:
for line in f:
try:
entry = json.loads(line)
msg = entry.get('message', {})
if msg.get('role') == 'assistant' and 'usage' in msg:
last_usage = msg['usage']
except: pass
if not last_usage: sys.exit(0)
total = (last_usage.get('input_tokens', 0) +
last_usage.get('cache_read_input_tokens', 0) +
last_usage.get('cache_creation_input_tokens', 0))
print(max(0, min(100, round(total / 200000 * 100))))
EOF
)
if [ -n "$PCT" ] && [ "$PCT" -eq "$PCT" ] 2>/dev/null; then
printf '{"context_percent":%s}' "$PCT" > "/c/Users/<your-username>/.claude/context-bridge.json"
fi
Then add to C:\Users\<you>\.claude\settings.json:
{
"hooks": {
"Stop": [{
"hooks": [{
"type": "command",
"command": "bash /c/Users/<your-username>/.claude/context-bridge-hook.sh",
"timeout": 5
}]
}]
}
}
The hook fires after each Claude response and writes:
{"context_percent": 42}
Install
Option A — From VSIX (GitHub Releases)
- Download
claude-context-indicator-vscode-*.vsix from the Releases page.
- In VS Code:
Ctrl+Shift+P → Extensions: Install from VSIX… → select the downloaded file.
- Reload VS Code when prompted.
Option B — From the Marketplace
Search "Claude Context Indicator" in the VS Code Extensions tab, or install via:
ext install onelostmuppet.claude-context-indicator-vscode
Configuration
| Setting |
Default |
Description |
claudeContext.warningThreshold |
50 |
% at which the status bar turns yellow |
claudeContext.criticalThreshold |
60 |
% at which the status bar turns red |
Set these in File → Preferences → Settings (search claudeContext).
How it works
Claude Code's statusline hook writes ~/.claude/context-bridge.json after every interaction. The extension watches that directory with fs.watch (native NTFS, reliable on Windows) and reads the file on each change. No polling, no network calls.
License
MIT