Plain Python Bar

One cross-platform Python line: model, user, folder, git branch, a color-coded context bar, input, output and cache token counts, and session cost. Standard library only, no network calls.

0 copies

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

Preview

Clean repo
Opus 4.8 | user | ~/app | main | ██░░░░░░░░ 22% | 37000↑ 1400↓ 2000c | $0.4100
New session
Opus 4.8 | user | ~/app | main | $0.0000
Dirty branch
Sonnet 4.6 | user | ~/app | feat/auth | █████░░░░░ 48% | 89000↑ 1400↓ 2000c | $0.4100
Near-full
Opus 4.8 | user | ~/app | main | █████████░ 91% | 175000↑ 1400↓ 2000c | $4.1200
1M context
Fable 5 | user | ~/app | main | ██████░░░░ 64% | 633000↑ 1400↓ 2000c | $0.4100
Post-compact
Haiku 4.5 | user | ~/app | main | $0.4100
Worktree
Opus 4.8 | user | ~/.wt/feature | worktree-feature | ████░░░░░░ 37% | 67000↑ 1400↓ 2000c | $0.4100
Non-git
Opus 4.8 | user | ~/scratch | ██░░░░░░░░ 22% | 37000↑ 1400↓ 2000c | $0.4100

What it does

One line with the model, your user name, the folder, git branch, a 10-cell context bar, token counts and the session cost in dollars, split by pipes.

Written in
Python
Network access
None
Works in
Terminal

How it works

  1. Reads the model, folder, context window and cost.total_cost_usd from the stdin JSON.
  2. Runs git symbolic-ref for the branch, falling back to the short commit hash.
  3. The bar is green under 50% used, yellow from 50% and red from 80%.
  4. Cost turns yellow at $5 and red at $20. A new session shows no bar or token counts.

Good to know

  • Calls git on every render; outside a repo the branch is left out.
  • Token counts come from context_window.current_usage (input ↑, output ↓, cache reads c), not totals.
  • Shows your login name from $USERNAME or $USER, and prints nothing if stdin isn't valid JSON.

Source

"""
statusline.py — Claude Code custom statusline renderer.

Reads a JSON event payload from stdin (emitted by Claude Code on every turn)
and prints a single ANSI-colored status line to stdout. Renders the model
display name, current user, working directory (with home collapsed to ``~``),
active git branch, a color-coded context window usage bar (green / yellow /
red thresholds), and token counts. Always exits 0 so it can never block
Claude Code — missing fields are silently skipped.

Intended to be referenced from Claude Code's ``statusLine`` setting (see
``statusline-command.sh`` for the wrapper) or installed to
``~/.claude/statusline.py``.

:file: statusline/statusline.py
:module: Claude-Code-Agent-Monitor.statusline
:author: Son Nguyen <hoangson091104@gmail.com>
:maintainer: Son Nguyen (a.k.a. David Nguyen, hoangsonww)
:copyright: (c) 2026 Son Nguyen
:license: MIT
:repository: https://github.com/hoangsonww/Claude-Code-Agent-Monitor
:requires: Python 3.6+
:encoding: utf-8

@author Son Nguyen <hoangson091104@gmail.com>
"""

__file_name__ = "statusline.py"
__module__ = "Claude-Code-Agent-Monitor.statusline"
__author__ = "Son Nguyen"
__email__ = "hoangson091104@gmail.com"
__maintainer__ = "Son Nguyen"
__copyright__ = "Copyright (c) 2026 Son Nguyen"
__license__ = "MIT"
__version__ = "1.0.0"
__status__ = "Production"
__repository__ = "https://github.com/hoangsonww/Claude-Code-Agent-Monitor"

import sys
import json
import os
import subprocess

sys.stdout.reconfigure(encoding='utf-8')

CYAN    = '\033[0;36m'
GREEN   = '\033[0;32m'
YELLOW  = '\033[0;33m'
MAGENTA = '\033[0;35m'
RED     = '\033[0;31m'
DIM     = '\033[2m'
RESET   = '\033[0m'

raw = sys.stdin.read().strip()
if not raw:
    sys.exit(0)

try:
    data = json.loads(raw)
except Exception:
    sys.exit(0)

parts = []

# Model
model = (data.get('model') or {}).get('display_name', '')
if model:
    parts.append(f"{CYAN}{model}{RESET}")

# User
user = os.environ.get('USERNAME') or os.environ.get('USER', '')
if user:
    parts.append(f"{GREEN}{user}{RESET}")

# CWD — strip home prefix
cwd = (data.get('workspace') or {}).get('current_dir') or data.get('cwd', '')
if cwd:
    home = os.path.expanduser('~')  # C:\Users\nguyens6
    if cwd.startswith(home):
        cwd = '~' + cwd[len(home):].replace('\\', '/')
    else:
        cwd = cwd.replace('\\', '/')
    parts.append(f"{YELLOW}{cwd}{RESET}")

# Git branch
git_dir = (data.get('workspace') or {}).get('current_dir') or data.get('cwd', '')
if git_dir:
    try:
        branch = subprocess.check_output(
            ['git', '-C', git_dir, '--no-optional-locks', 'symbolic-ref', '--short', 'HEAD'],
            stderr=subprocess.DEVNULL
        ).decode().strip()
    except Exception:
        try:
            branch = subprocess.check_output(
                ['git', '-C', git_dir, '--no-optional-locks', 'rev-parse', '--short', 'HEAD'],
                stderr=subprocess.DEVNULL
            ).decode().strip()
        except Exception:
            branch = ''
    if branch:
        parts.append(f"{MAGENTA}{branch}{RESET}")

# Context bar
ctx = data.get('context_window') or {}
used_pct = ctx.get('used_percentage')
if used_pct is not None:
    bar_len = 10
    filled = round(bar_len * used_pct / 100)
    bar = '█' * filled + '░' * (bar_len - filled)
    color = RED if used_pct >= 80 else YELLOW if used_pct >= 50 else GREEN
    parts.append(f"{color}{bar} {used_pct}%{RESET}")

# Tokens
usage = ctx.get('current_usage') or {}
in_tok  = usage.get('input_tokens')
out_tok = usage.get('output_tokens')
cache   = usage.get('cache_read_input_tokens')
if in_tok is not None and out_tok is not None:
    tok_parts = [f"{GREEN}{in_tok}↑{RESET}", f"{CYAN}{out_tok}↓{RESET}"]
    if cache:
        tok_parts.append(f"{DIM}{cache}c{RESET}")
    parts.append(' '.join(tok_parts))

# Session cost (USD) — shown on both API and subscription plans
cost = (data.get('cost') or {}).get('total_cost_usd')
if cost is not None:
    try:
        cost_f = float(cost)
        cost_color = RED if cost_f >= 20 else YELLOW if cost_f >= 5 else GREEN
        parts.append(f"{cost_color}${cost_f:.4f}{RESET}")
    except (TypeError, ValueError):
        pass

sep = f"{DIM} | {RESET}"
print(sep.join(parts))

More status lines

Dreambase Panel

223 copies

╭─ CONTEXT ────────────────────────────────────────────╮ │ ████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD │ ├─ STATS ──────────────────────────────────────────────┤ │ ↓ 44.0K ↑ 1.4K │ $0.41 │ ⏱ 10m 12s │ +128/-34 │ ├─ REPO ───────────────────────────────────────────────┤ │ ◆ Opus 4.8 · main · 16:21 │ ╰──────────────────────────────────────────────────────╯
████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD │ ↓ 44.0K ↑ 1.4K │ $0.41 │ ⏱ 10m 12s │ +128/-34 │ ◆ Opus 4.8 · main · 16:22

Noctu

3 copies

◆ Opus 4.8 ▏ ctx ▓▓░░░░░░░░ 22% ▏ high ▏ 10m main ▏ week ▓░░░░░░░░░ 7% ▏ 2d0h ▏ $0.41 ▏ +128/-34
Opus 4.8 [high] ~/app main 16:20:55 | ⛁ ██░░░░░░░░ 22% | 5h ●◔○○○ 26% ↻2h7m | 7d ◔○○○○○○ 7% ↻2d1h │ $0.41 ⏱ 10m
Opus 4.8 │ main │ app │ ▓▓░░░░░░░░ 44k/200k │ $0.41

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

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

╭─────────────────────────────────────────────────────────────────────────────────────────────╮ [-] │ ◆ context 44k of 200k · compacts at 167k 22% │ │ ████████████████████────────────────────────────────────────────────────────░░░░░░░░░░░░░░░ │ │ ■ system prompt 1.9k 1% ■ system tools 28k 14% ■ skills 2k 1% ■ messages 12k 6% │ │ ─ free space 123k ░ autocompact buffer 33k │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ❯ 

Claude Desktop

Context Bar in Claude Desktop

Your context window as a stacked bar above the prompt, a color per category, with token counts and the compaction point. /context-bar shows or hides it.