Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claude-mine

Neon multi-line status line for Claude Code — session, model health, and account + Codex usage.

Opus 4.8 │ 101K/1.0M 10% │ fast │ 1h16m
.claude git:(main) +37,-30 · sskys18/claude-config
● claude │ 5h 29% (2h13m) │ 7d 6% (5d18h)
● codex  │ 5h 15% (46m) │ 7d 17% (3d)

Layout

Line 1 — session

  • model name, context tokens used/total + % (autocompact-aware: adds the ~45K buffer CC reserves before it compacts)
  • fast badge when fast mode is on; output-style name when non-default
  • live session timer (1h16m) — real wall-clock since the transcript was created, ticked by refreshInterval (see Setup). Minute granularity.

Line 2 — project

  • basename(cwd), git:(branch), +ins,-del working-tree diff, owner/repo

Line 3 — Claude

  • service-health dot (Anthropic Statuspage indicator)
  • 5h / 7d account rate limits: used% (time-to-reset) from CC's rate_limits payload

Line 4 — Codex

  • service-health dot (OpenAI Statuspage indicator)
  • 5h / 7d Codex usage used% (time-to-reset) from the ChatGPT backend usage endpoint (wham/usage), authed with the OAuth token in ~/.codex/auth.json — fresh every probe. Falls back to the latest ~/.codex session rollout's rate_limits snapshot when the call fails (offline / expired token), which is dimmed + marked stale past 6h.

Health dot color: green = operational, gold = minor, red = major/critical, gray = unknown/not-yet-probed.

How it works

  • Session/context/limits come from the JSON Claude Code feeds the status line on stdin (context_window, cost, rate_limits, effort, fast_mode, workspace.repo, transcript_path). No API calls, no credentials.
  • Service health (Claude + Codex) and Codex usage are gathered by a detached probe (dist/health-probe.js) that the status line spawns out-of-band when its cache is stale (120s TTL, shared across all sessions via $TMPDIR/claude-statusline-health.json, with a spawn-lock so concurrent sessions fire only one probe). The render only reads the cache — it never blocks on the network.
    • Claude: https://anthropic.statuspage.io/api/v2/status.json
    • Codex: https://status.openai.com/api/v2/status.json (Codex CLI runs on the OpenAI API)
    • Codex usage: GET https://chatgpt.com/backend-api/wham/usage (Bearer from ~/.codex/auth.json); fallback to newest ~/.codex/sessions/**/rollout-*.jsonl → last rate_limits event

Setup

1. Clone & build

git clone https://github.com/sskys18/claude-mine.git ~/claude-mine
cd ~/claude-mine
bun install && bun run build   # builds dist/index.js + dist/health-probe.js

No bun? npm install && npx tsc works, but the build script uses bun build; adjust to emit both dist/index.js and dist/health-probe.js.

2. Enable the status line

Add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "node ~/claude-mine/dist/index.js",
    "refreshInterval": 60
  }
}

refreshInterval (seconds) re-runs the status line on a timer so the session clock and health dots stay current while idle. Use 60 for the minute timer; drop to 1 for a per-second clock. Without it, the line only updates on activity (new message / tool / keystroke). Settings reload on your next interaction — no restart needed.

3. Verify

Open or interact with a Claude Code session; the four lines appear below the input. The health dots are gray on the first frame, then populate once the probe writes its cache (~1s).

Requirements

  • Claude Code v2.1.132+ (provides context_window + rate_limits on stdin)
  • Node.js 22+ (probe uses global fetch, node:fs recursive readdir) or Bun
  • Optional: codex CLI on PATH for the Codex usage line

Colors

Color Usage
Neon green 0–50% used / operational
Electric gold 51–80% / minor
Hot red 81–100% / major-critical
Gray labels, separators, stale/unknown

License

MIT

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages