Middle-Dot Ledger

One colorless Node line: model, effort, folder and git branch, context size in tokens, the prompt-cache hit rate when Claude Code reports it, five-hour and seven-day usage, and session cost. Node built-ins only, no network calls.

0 copies

In Claude Desktop? Add this status line with statusline-anywhere.

Preview

Clean repo
Opus 4.8 · high · app (main) · ctx 44k · 5h 26% · 7d 7% · $0.41
New session
Opus 4.8 · high · app (main)
Dirty branch
Sonnet 4.6 · medium · app (feat/auth) · ctx 96k · 5h 40% · 7d 18% · $0.41
Near-full
Opus 4.8 · max · app (main) · ctx 182k · 5h 88% · 7d 61% · $4.12
1M context
Fable 5 · xhigh · app (main) · ctx 640k · 5h 33% · 7d 80% · $0.41
Post-compact
Haiku 4.5 · app (main) · 5h 52% · $0.41
Worktree
Opus 4.8 · low · feature (worktree-feature) · ctx 74k · 5h 44% · 7d 20% · $0.41
Non-git
Opus 4.8 · high · scratch · ctx 44k · $0.41

What it does

A colorless line of the model, effort, folder and branch, context size in tokens, five-hour and seven-day usage, and session cost, split by middle dots.

Written in
Node.js
Network access
None
Works in
Terminal

How it works

  1. Reads the model, effort, folder, token counts, rate limits and cost from stdin.
  2. Asks git branch --show-current for the branch, waiting at most one second.
  3. Sums input, cache write and cache read tokens from current_usage and shows ctx 44k.
  4. Empty fields drop out, so a new session shows only model, effort, folder and branch.

Good to know

  • Needs node 14 or newer (it uses ?.) and git on your PATH.
  • Shows cache N% or cache cold only when stdin has a prompt_cache object, which no preview has.
  • Context shows as a raw token count such as ctx 640k, with no percentage or window size.

Source

#!/usr/bin/env node
// Status line: rendered by the Claude Code client, never sent to the model
// (zero tokens). Receives session JSON on stdin, prints one line:
//   Opus · xhigh · .claude (master) · ctx 118k · cache 91% · 5h 23% · 7d 41% · $0.42
// ctx is the absolute token count in context (a % of a 1M window hides real
// size); cache shows the prompt-cache hit ratio, or "cold" once it expires.
const fs = require("fs");
const path = require("path");
const { execFileSync } = require("child_process");

let d = {};
try {
  d = JSON.parse(fs.readFileSync(0, "utf8") || "{}");
} catch {}

const dir = d.workspace?.current_dir || d.cwd || process.cwd();
let branch = "";
try {
  branch = execFileSync("git", ["-C", dir, "branch", "--show-current"], {
    encoding: "utf8",
    stdio: ["ignore", "pipe", "ignore"],
    timeout: 1000,
  }).trim();
} catch {}

const pct = (v) => (typeof v === "number" ? `${Math.round(v)}%` : "");
const kTok = (n) => (n >= 1e6 ? `${(n / 1e6).toFixed(2)}M` : `${Math.round(n / 1000)}k`);
function ctx(w) {
  const u = w?.current_usage;
  const n = u ? (u.input_tokens || 0) + (u.cache_creation_input_tokens || 0) + (u.cache_read_input_tokens || 0) : 0;
  return n > 0 ? `ctx ${kTok(n)}` : "";
}
function cache(c) {
  if (!c?.caching_observed) return "";
  if (!c.warm) return "cache cold";
  return typeof c.hit_ratio === "number" ? `cache ${Math.round(c.hit_ratio * 100)}%` : "";
}
const parts = [
  d.model?.display_name || "Claude",
  d.effort?.level || "",
  path.basename(dir) + (branch ? ` (${branch})` : ""),
  ctx(d.context_window),
  cache(d.prompt_cache),
  d.rate_limits?.five_hour ? `5h ${pct(d.rate_limits.five_hour.used_percentage)}` : "",
  d.rate_limits?.seven_day ? `7d ${pct(d.rate_limits.seven_day.used_percentage)}` : "",
  typeof d.cost?.total_cost_usd === "number" && d.cost.total_cost_usd > 0 ? `$${d.cost.total_cost_usd.toFixed(2)}` : "",
].filter(Boolean);

process.stdout.write(parts.join(" · ") + "\n");

More status lines

​ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ ▐ Opus 4.8 ▌ ▐ high ▌ ▐ …/user/app ▌ ▐ main ▌ ▐ 22% / 200k ━━━━━━━━━━ ▌ ▐ 26% ━━━━━━━━━━ 16:10 ▌ ▐ +128 −34 ▌ ▐ $0.41 ▌ ▐ 10m 12s ▌ │ │ MODEL EFFORT PATH BRANCH CONTEXT USAGE DIFF COST TIME │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ​
Opus 4.8 [high] ~/app main 16:20:55 | ⛁ ██░░░░░░░░ 22% | 5h ●◔○○○ 26% ↻2h7m | 7d ◔○○○○○○ 7% ↻2d1h │ $0.41 ⏱ 10m

Activity Feed

51 copies

Opus 4.8 high ✦ │ ctx 22% │ app (main) │ PR #1287 ● │ $0.41 · 10m +128 -34 Session ● ● ● ● ● ● ● ● ○ ○ ○ 74% left Resets in 2h 6m Weekly ● ● ● ● ● ● ● ● ● ● ○ 93% left Resets in 2d 0h Fable ● ● ● ● ● ● ● ● ● ○ ○ 85% left Resets in 2d 0h ◐ Read:index.ts ✓ Read×1 ✓ Bash×1 ✓ Edit×1 ✓ Grep×1 ◐ code-reviewer Review the change for regressions
◆ Opus 4.8 │ ▪ app │ ⎇ main │ ◷ 14:04 │ ██▄░░░░░░░ 26% (44K/167K) │ 26% ↻2h6m │ 7% ⟳2d0h
Model: Opus 4.8 | Thinking: high | Context: [▰▰▱▱▱▱▱▱▱▱] 45k/200k (22%) | cwd: ~/app | ⎇ main | (+0,-0) Cost: $0.41 | Block: 2hr 6m | Weekly: 7.0% | Session: 10m | In: 916.7 t/s | Out: 29.2 t/s | Cached: 2k | Session: [▰▱▱▱▱] 26.0% Mem: 0.8G/1.0G | (*゚∀゚*) | Session ID: b8e1c0d2-4a6f-4e2a-9c1b-3f5d7a9e2c10
🌿 main │ Opus 4.8/hi │ 🟢 Ctx ▓▓░░░░ 22% │ ⏳ 🟢 ▓▓░░░░ 26% ↻ 2h7m │ $0.41 ⏱ 10m

Related mods

Terminal

❯ Run the tests again ● The repo is clean and the tests pass. ✻ Cooked for 0s · done 10:12 PM ☀ 44k │ 5h 26% │ 7d 7% │ cache 5% [-] ❯ 

Claude Desktop

Token Weather Usage in Claude Desktop

One line above the prompt: context tokens with their weather, a bar per recent prompt, your 5-hour and 7-day limits against the time elapsed, the prompt cache with its time left, the session cost with the last prompt's share in dollars and in points of the 5-hour limit, and the subagents running. Labels in English, French or Russian. After Token Weather (Anthropic, Apache-2.0) and the ideas of usage-meter (HolyGrail) and prompt-cache-control (Daniel San).

Terminal

❯ /deck demo ⎿ deck: Sample plan running above the prompt, with sample routing until real ones arrive. [-] 0: deck ▾ · 5 rows 22:11:41 ⇄ Model route opus = opus jev: haiku · not applied effort ▁▃·· medi = kept ✕ ✓ Orders module Done · 12/12 · 2/2 agents 100% ✕ ● Context 44k / 200k 22% ✕ ◔ Session · 5h 5h · 26% used ↻ 2:04:24 ✕ ◔ Weekly · 7d 7d · 7% used ↻ 2d 0h 57m ✕ ❯  ⏵⏵ auto mode on (shift+tab to cycle) · ← for agents [ Deck 1 ]

Claude Desktop

Deck in Claude Desktop

A cockpit for Claude Code: plan bars and subagent strips, context, usage limits with reset countdowns and burn rates, spend, the model route and a pet. Six bar styles, three collapsed looks. CLI and Desktop.

Terminal

❯ /flightdeck open ⎿ flightdeck: Flightdeck opened. Focus it with ctrl+x tab; 1-6 expand cards, f/s/o open the gate rows. ╭────────────────────────────────────────────────────────────────────────────────────────────────✕─╮ │ Opus 4.8 ○ idle · ctx ▰▱▱▱▱▱ 22% · $0.25 │ │ last turn 0s · 0 agents · 0 edits · 0 errors │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ❯  ⚠ flightdeck: ctx 22%

Claude Desktop

Flightdeck in Claude Desktop

Flightdeck: a live agent dashboard for Claude Code. Main model vitals, an on-call architect, every permission check, subagent cards and swimlanes, a turn receipt and a session log, all from real session events

Terminal

BURN ▁ ▂ *▂▆ ▃ $0.41 = 0.04 burritos [-] 5h 26% in 2h 5m ▅▄█▅▅▆█▆███▅█ opus 4.8 44k in 1k out wk 7% in 2d 0h █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ lifetime $0.41 hide ❯ 

Claude Desktop

Burn Meter in Claude Desktop

Live session cost odometer above the prompt: a burning fuse, real-world comparisons, threshold alerts