claude-statusbar

skill
Security Audit
Fail
Health Pass
  • License Ò€” License: MIT
  • Description Ò€” Repository has a description
  • Active repo Ò€” Last push 0 days ago
  • Community trust Ò€” 20 GitHub stars
Code Fail
  • rm -rf Ò€” Recursive force deletion command in uninstall.sh
Permissions Pass
  • Permissions Ò€” No dangerous permissions requested
Purpose

This is a shell script that generates a rich, informational status bar for the Claude Code CLI. It displays real-time session metrics such as token usage, cost, duration, and git branch information directly in the terminal.

Security Assessment

Overall risk: Low. The script processes JSON data piped to it via stdin by Claude Code and formats it for terminal output. It does not request dangerous system permissions. However, there are a few points to note. It requires `curl` and makes network requests to fetch subscription usage limits via an API. Additionally, the `uninstall.sh` script contains a recursive force deletion command (`rm -rf`), which is standard for cleaning up installations but warrants a quick manual review to ensure it only targets the intended directories. No hardcoded secrets were found, though the tool does rely on system keychain/libsecret for OAuth token access.

Quality Assessment

The project is actively maintained, with the most recent push occurring today. It uses the permissive MIT license, making it safe for most projects. The repository has a clear description and adequate documentation, including detailed installation instructions and feature explanations. It has garnered 20 GitHub stars, indicating a small but growing base of community trust among early adopters.

Verdict

Safe to use β€” it is a lightweight, MIT-licensed terminal script that is transparent in its operations and safe to integrate into your workflow.
SUMMARY

πŸ–₯️ A rich, two-line status bar for Claude Code CLI β€” real-time model, context usage, tokens, cost, duration, git branch, cache stats and more in your terminal

README.md

claude-statusline

A rich, three-line status bar for Claude Code CLI.

Displays real-time session metrics directly in your terminal β€” model, context usage, tokens, cost, duration, git branch, cache stats, subscription usage limits, and more.

Claude Opus 4.6 | [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘] 42% of 200.0K #1 | ↓156.8K ↑23.4K | cache r:89.0K w:45.0K
$1.47 | ⏱ 5m42s (api 3m18s) | +245/-31 | βŽ‡ main | πŸ“‚ my-project | [N]
5h [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘] 68% ↻2h41m | 7d [β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘] 48% ↻1d20h

Features

  • Model name β€” which Claude model is active
  • Context usage bar β€” 20-char visual progress bar with color thresholds (green β†’ yellow β†’ red)
  • Token counts β€” input/output tokens with human-readable formatting (K/M)
  • Cache stats β€” cache read/write token counts
  • Cost β€” total session cost in USD
  • Duration β€” total time and API time separately
  • Lines changed β€” added/removed lines count
  • Git branch β€” current branch (when in a repo)
  • Working directory β€” project folder name
  • Vim mode β€” shows [N] or [I] indicator when vim mode is active
  • Agent name β€” shows active sub-agent name
  • Usage limits β€” 5-hour and 7-day subscription quota with progress bars and reset countdown
  • 200K warning β€” warns when context exceeds 200K tokens
  • Context threshold alerts β€” optional flag files at 70/85/95% for hook integration
  • macOS notifications β€” optional native alerts at 85% and 95% thresholds

Requirements

  • jq β€” JSON processor (brew install jq / apt install jq)
  • curl β€” for usage limits API calls (pre-installed on most systems)
  • Claude Code CLI β€” v1.0+ with status line support
  • bash β€” works with macOS bash 3.2+ and modern bash 4/5
  • Keychain/libsecret β€” for OAuth token access (usage limits feature)

Installation

Quick install

git clone https://github.com/anthropics/claude-statusline.git
cd claude-statusline
bash install.sh

The installer will:

  1. Copy statusline.sh to ~/.claude/statusline.sh
  2. Add the statusLine config to ~/.claude/settings.json
  3. Prompt before overwriting existing files

Manual install

  1. Copy the script:
cp statusline.sh ~/.claude/statusline.sh
chmod +x ~/.claude/statusline.sh
  1. Add to ~/.claude/settings.json:
{
  "statusLine": {
    "type": "command",
    "command": "/Users/YOUR_USERNAME/.claude/statusline.sh",
    "padding": 2
  }
}
  1. Restart Claude Code.

How It Works

Claude Code pipes a JSON object to stdin on every status update. The JSON contains all session metrics:

{
  "model": { "display_name": "Claude Opus 4.6" },
  "cwd": "/Users/dev/project",
  "vim": { "mode": "NORMAL" },
  "agent": { "name": "" },
  "exceeds_200k_tokens": false,
  "context_window": {
    "used_percentage": 42.5,
    "total_input_tokens": 156800,
    "total_output_tokens": 23400,
    "context_window_size": 200000,
    "current_usage": {
      "cache_creation_input_tokens": 45000,
      "cache_read_input_tokens": 89000
    }
  },
  "cost": {
    "total_cost_usd": 1.47,
    "total_duration_ms": 342000,
    "total_api_duration_ms": 198000,
    "total_lines_added": 245,
    "total_lines_removed": 31
  }
}

The script:

  1. Parses all 16 fields in a single jq call using @sh for safe eval
  2. Formats values with pure bash (no subshells, no bc, no awk)
  3. Fetches usage limits via background API call with 2-minute cache
  4. Outputs three ANSI-colored lines

Total execution: ~20ms on macOS (usage limits cached, fetched in background).

Configuration

Padding

The padding value in settings.json controls vertical space around the status line:

{
  "statusLine": {
    "type": "command",
    "command": "/path/to/statusline.sh",
    "padding": 2
  }
}

Context threshold flags

By default, the script writes flag files to ~/.claude/.context-flags/ when context usage crosses 70%, 85%, and 95%. These can be consumed by Claude Code hooks to trigger auto-save or other actions.

Disable this feature:

# In your shell profile or wrapper
export STATUSLINE_FLAGS=0

Custom flag directory:

export STATUSLINE_FLAG_DIR=/tmp/claude-flags

macOS notifications

At 85% context usage, a "Glass" notification sounds. At 95%, a "Sosumi" alert fires. These use osascript and fail silently on Linux.

Usage limits

Fetches subscription quota data from https://api.anthropic.com/api/oauth/usage using your OAuth token. Cached for 2 minutes with background refresh β€” does not block the status line.

Requires claude.ai OAuth login. Token is read from:

  • macOS: Keychain (security find-generic-password)
  • Linux: libsecret (secret-tool lookup)
  • Windows: Credential Manager (via PowerShell)

Disable this feature:

export STATUSLINE_USAGE_LIMITS=0

Output Layout

Line 1

Model | [β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘] PCT% of SIZE #W | ↓input ↑output | cache r:READ w:WRITE
Segment Color Description
Model Cyan bold Active model display name
Progress bar Green/Yellow/Red 20-char block bar based on context %
Window counter Dim Context compaction count (#1, #2, ...)
Tokens Green/Magenta Input (↓) and output (↑) token counts
Cache Dim Cache read/write token stats

Line 2

$COST | ⏱ DURATION (api API_DUR) | +ADDED/-REMOVED | βŽ‡ BRANCH | πŸ“‚ DIR | [N]
Segment Color Shown when
Cost Yellow Always
Duration Blue Always
Lines Green/Red Always
Git branch Magenta Inside a git repo
Directory Dim Always
Vim mode Blue/Green Vim mode is active
Agent Cyan Sub-agent is running
>200K warning Red Tokens exceed 200K

Line 3

5h [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘] 68% ↻2h41m | 7d [β–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘] 48% ↻1d20h
Segment Color Description
5h bar Green/Yellow/Red 5-hour usage remaining (fuel gauge style)
5h reset Dim Time until 5-hour quota resets
7d bar Green/Yellow/Red 7-day usage remaining
7d reset Dim Time until 7-day quota resets

Color thresholds: green (>50% remaining), yellow (20-50%), red (<20%).

Line 3 only appears when usage data is available (OAuth login, not API key).

Uninstall

bash uninstall.sh

Or manually:

rm ~/.claude/statusline.sh
# Remove "statusLine" key from ~/.claude/settings.json

Testing

Test with sample data:

cat examples/sample-input.json | bash statusline.sh

Support

If you find this useful, you can buy me a coffee:

PayPal

License

MIT

Reviews (0)

No results found