Skip to content
tinnetPublic

About

A fast status line for Claude Code.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

ccline

A fast status line for Claude Code.

This is a personal tool. It's published as a starting point for forking and customizing, not as a general-purpose library. The layout is hardcoded to my preferences — fork it and make it yours.

example output

Why speed matters

Claude Code's status line command runs on every prompt refresh (300ms debounce). A shell script spawns multiple processes per invocation (bash, jq, git), and popular status line tools take 100–220ms. This Rust binary uses native libraries (libgit2 compiled in, serde) to do the same work in ~4ms — over 12x faster than an equivalent shell script and 25–55x faster than the alternatives.

It's also kinder to your battery. Over a full day of heavy coding, those saved milliseconds add up to less CPU time and less heat. Napkin math puts the annual energy savings at a few cents at Hydro-Québec rates. The API call that just answered your prompt probably used more electricity, but at least your fan stays quiet.

Fork and customize

The layout is hardcoded in src/main.rs (~310 lines plus tests). There's no config file by design — editing source and running cargo build --release is faster than parsing config on every invocation.

Claude Code sends a rich JSON payload on stdin with every refresh. This project currently uses only a subset:

Used: workspace.current_dir, model.display_name, effort.level, context_window.context_window_size, context_window.used_percentage, rate_limits.five_hour.used_percentage, rate_limits.seven_day.used_percentage, rate_limits.*.resets_at, rate_limits.spend_limit.used_percentage/used_usd/limit_usd/period, cost.total_cost_usd, plus git via libgit2.

Available but unused:

Group Fields
Session session_id, session_name, prompt_id, transcript_path, version, output_style.name, agent.name, vim.mode
Model model.id, fast_mode, thinking.enabled
Workspace cwd (same as current_dir), workspace.project_dir, workspace.added_dirs, workspace.git_worktree, workspace.repo.host/owner/name, worktree.*
Cost cost.total_duration_ms, cost.total_api_duration_ms, cost.total_lines_added/removed
Context context_window.total_input_tokens/total_output_tokens, context_window.remaining_percentage, context_window.current_usage.*, exceeds_200k_tokens
Prompt cache prompt_cache.* (warm, hit ratio, misses, TTL, …)
Pull request pr.number, pr.url, pr.review_state, pr.kind

bench/bench-input.json is a sample payload with every field (plus scratchpad_dir, which Claude Code sends but the docs don't list yet).

Fork this repo and add the fields that matter to you. The serde structs in main.rs are easy to extend.

Install

As a Claude Code plugin (downloads the prebuilt binary for your platform):

/plugin marketplace add tinnet/ccline
/plugin install ccline@ccline
/ccline:setup

/ccline:setup points statusLine in ~/.claude/settings.json at the downloaded binary. Plugins can't set the status line themselves, hence the extra step. The binary lives in the plugin's data directory and is refreshed on session start whenever the plugin updates, so the setting stays valid.

With mise:

mise use -g github:tinnet/ccline

Or from source:

git clone https://github.com/tinnet/ccline.git
cd ccline
cargo install --path .

With mise or from source, add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "ccline"
  }
}

Current layout

Segment Color (Monokai Pro ~60%) Source
Model muted green #7a9e56 model.display_name + effort.level (muted yellow)
Repo mark 1 of 6 muted colors Shape × color hashed (FNV-1a) from the repo folder name
Path muted cyan #5a9ea0 Last 2 of workspace.current_dir
Git muted purple #7a6db0 git2 branch + dirty
Context muted yellow #b09a42 used_percentage/context_window_size
Rate limits green / yellow / red at 50% and 80% rate_limits.five_hour and seven_day usage as 24%/5h 41%/7d (Pro/Max only; hidden when absent). From 80%, also the time until reset (↻1h20m)
Spend limit green / yellow / red at 50% and 80% rate_limits.spend_limit (Claude apps gateway only; hidden when absent): $314/$500/mo, or 63% spend until the gateway reports dollars. From 80%, also ↻
Cost gray ~ + light gray cost.total_cost_usd: what the session would cost at API list price (~), not what a subscription pays
Separators dark gray \x1b[90m

Benchmarking

mise run bench

Compares the Rust binary against a POSIX shell equivalent and other status line tools using hyperfine. The sample input is pointed at this checkout, so the timings include the git work (branch, dirty check, repo mark).

Command Mean [ms] Relative
ccline 3.9 ± 0.2 1.00
ccline.sh (via bash) 49.1 ± 1.2 12.6x
ccline.sh (via sh) 50.0 ± 1.2 12.8x
ccline.sh (via zsh) 51.2 ± 1.5 13.1x
starship-claude (defaults) 97.1 ± 1.9 24.8x
claude-powerline (defaults) 134.6 ± 1.5 34.4x
ccstatusline (defaults) 217.2 ± 2.9 55.5x

Versions: claude-powerline 1.32.0, ccstatusline 2.2.30, starship-claude (upstream main, vendored in bench/) with starship 1.26.0. Competitor timings include ~55ms of mise x startup overhead.

Optimizations:

  • ccline.sh: single jq call (inspired by starship-claude) — 169ms → 111ms (-34%)

See also

License

MIT


Made with ❤️ in Montreal

About

A fast status line for Claude Code.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages