Claude Code Statusline (ccs): Real-time usage stats in Claude Code's status line — see your session limit, weekly limit, remaining time, context usage, and cost at a glance.
[Opus 4.6] 📁 my-project | ✹main | $0.3595
▓▓▓▓░░░░░░░░░░░░░░░░ ctx 20% | sess: ▓▓▓▓▓▓▓▓░░ 75% 3h19m | week: ▓▓▓▓▓▓▓░░░░░░░░░░░░░ 34% 3d20h
Progress bars are color-coded: green (<70%), yellow (70-89%), red (>=90%).
npx ccs-stats installThat's it. Restart Claude Code and the status line appears.
| Requirement | Details |
|---|---|
| OS | macOS, Linux (verified), Windows (experimental) |
| Claude Code | Logged in via OAuth — Pro or Max plan |
| Node.js | >= 18 |
Zero external dependencies — uses only Node.js built-ins.
npx ccs-stats installnpm install -g ccs-stats
ccs install- Checks Node.js version (>= 18 required)
- Copies
statusline.jsto~/.claude/statusline.js - Adds
statusLineconfig to~/.claude/settings.json(creates a backup first) - Cleans up old
statusline.shif present (from previous versions)
Existing settings are preserved — only the
statusLinekey is added. Running install multiple times is safe (idempotent).
Re-run install to update to the latest version:
npx ccs-stats installThis overwrites ~/.claude/statusline.js with the latest script while leaving your other settings untouched.
ccs install # Install script & configure settings
ccs uninstall # Remove script & clean up settings
ccs status # Check if statusline is activeccs and ccs-stats are interchangeable.
Line 1 — Session info:
| Segment | Description |
|---|---|
[Opus 4.6] |
Active model (cyan) |
📁 my-project |
Current workspace folder |
✹main |
Current git branch (green) — ✹ (purple) appears when there are uncommitted changes; hidden outside git repos |
$0.3595 |
Current session cost (yellow) |
Line 2 — Usage bars:
| Segment | Description |
|---|---|
▓▓▓▓░░░░ ctx 20% |
Context window usage with color-coded progress bar |
sess: 75% 3h19m |
5-hour rolling window utilization + time until reset |
week: 34% 3d20h |
7-day rolling window utilization + time until reset |
Progress bars are color-coded: green (<70%), yellow (70-89%), red (>=90%). If usage data is unavailable, line 2 shows only the context bar.
Claude Code response
→ triggers statusline.js via stdin
→ parses model, cost, context from JSON input
→ reads OAuth token from platform credential store
→ fetches usage from api.anthropic.com/api/oauth/usage (cached 60s)
→ outputs formatted status line with progress bars
The script caches API responses at <tmpdir>/claude_usage_cache_<session_id>.json (5-minute TTL, isolated per session) to avoid hitting the API on every response.
OAuth token is read in priority order:
CLAUDE_CODE_OAUTH_TOKENenvironment variable~/.claude/.credentials.jsonfile — primary on Linux; present on macOS and Windows when available- macOS Keychain via
securitycommand — fallback when macOS removes the credentials file after login
Verified on macOS and Linux. Windows credential access is experimental.
- Endpoint:
GET https://api.anthropic.com/api/oauth/usage - Auth: OAuth token from platform credential store
- Required header:
anthropic-beta: oauth-2025-04-20
ccs uninstallThis removes ~/.claude/statusline.js and deletes the statusLine key from ~/.claude/settings.json (with backup). No other settings are modified.
- OAuth login only — API key authentication does not have access to the usage endpoint.
- Beta header may change —
anthropic-beta: oauth-2025-04-20could be updated by Anthropic in the future. If the status line stops showing usage data, check for an updated version of this package. - Windows support is experimental — credential access on Windows has not been verified. macOS and Linux are tested.
| Problem | Solution |
|---|---|
| Usage data not showing | Make sure you're logged in via OAuth (claude command), not API key |
| Usage data not showing on Windows | Credential access is experimental on Windows; try setting the CLAUDE_CODE_OAUTH_TOKEN env var manually |
| Stale data | Delete /tmp/claude_usage_cache_*.json (macOS/Linux) or %TEMP%\claude_usage_cache_*.json (Windows) |
| Status line not appearing | Run ccs status to check, then restart Claude Code |
git clone https://github.com/yusufalikync/ccs.git
cd ccs
npm test # Run smoke tests
node bin/cli.js install # Test install locallySee CLAUDE.md for architecture details and coding conventions.
Yusuf Ali Koyuncu — GitHub
