claude-statusline: Instructions file for Claude Code

CLAUDE.md

claude-statusline CLAUDE.md is an instructions file for Claude Code from howar31/claude-statusline. It costs 1,641 tokens per session, scanned B, original, MIT.

A repository guide for a Claude Code statusline: a Bash script that reads session data and displays an eight-line colored status view, plus a hook that tracks compactions.

In plain words
What is it for?
Use it when modifying the statusline renderer or its compaction-monitor hook while preserving defaults and optional-field behavior.
Why use it?
It explains the input format, display rules, and safeguards needed when Claude Code adds or omits status fields.

Instructions file for Claude Code

Written for Claude Code: PreCompact hook event. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is howar31/claude-statusline's own configuration. It tells Claude Code how to work on claude-statusline itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-statusline configures →

Reuse

Borrowing it

Nothing to install: this file belongs to howar31/claude-statusline. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/howar31/claude-statusline/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/howar31/claude-statusline

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for claude-statusline CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/howar31/claude-statusline/claude-md.svg)](https://agentmods.dev/instructions/howar31/claude-statusline/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/howar31/claude-statusline/claude-md"><img src="https://agentmods.dev/badge/instructions/howar31/claude-statusline/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,641 This file is loaded in full into every session.
When invoked 1,641 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01641 $0.01641
Opus 5 $0.00821 $0.00821
Sonnet 5 $0.00328 $0.00328
Haiku 4.5 $0.00164 $0.00164

Measured 7d ago against content hash dcce315189e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade B, and why

claude-statusline CLAUDE.md scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

Scripts are meant to be symlinked into `~/.claude/` and referenced from `~/.claude/settings.json` (see `SPEC.md` for the exact JSON stanza). Edits here take effect on the next statusline refresh — no reload needed, becau
CLAUDE.md · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What this repo is

A custom statusline for Claude Code: a one-shot Bash script that reads session JSON from stdin and renders an eight-line colored status display. No build, no package manager, no test suite.

Architecture

See SPEC.md for the authoritative spec — output layout, color formulas, JSON input contract, IPC invariants, install wiring.

Two scripts:

  • statusline.sh — the renderer
  • hooks/compact-monitor.sh — a PreCompact hook that bumps a counter the renderer consumes via /tmp/claude-compacts-<sanitized_session_id>.json

Conventions to preserve

  • Every jq lookup in statusline.sh must have a // default. Claude Code may add or rename schema fields; the script must degrade gracefully.
  • Optional payload fields render gated. Fields that may be absent (pr.*, worktree.*, thinking.enabled, context_window.context_window_size, cost.total_api_duration_ms, version) are shown only when present / non-zero, so a line never emits a stray separator or placeholder. Keep new field additions gated the same way. See SPEC.md → Gated fields.
  • Effort comes from stdin .effort.level, with no silent fallback. It is one of low/medium/high/xhigh/max (Claude Code normalizes ultracodexhigh upstream, so it never arrives literally). A missing field (models without effort support, e.g. Haiku 4.5) renders as a dim ; a present-but-unrecognized value renders as a loud bright-red unknown so schema drift stays visible. Don't reintroduce a quiet default. See SPEC.md → Effort level.
  • Cross-platform date: use the BSD-or-GNU fallback date -r "$EPOCH" "+%H:%M" 2>/dev/null || date -d "@$EPOCH" "+%H:%M" 2>/dev/null. Keep it when adding new time displays.
  • Bars are built by glyph concatenation, not tr. tr ' ' '█' maps bytes, so GNU coreutils corrupts the 3-byte bar glyphs into invalid UTF-8 (only BSD tr rendered them) — the bars looked fine on macOS but were broken on Linux. Build runs with the repeat_glyph helper in statusline.sh (and the inline loop in docs/swatches.sh); mirror that for any new bar.
  • Session id sanitization (tr -dc 'a-zA-Z0-9' | cut -c1-24) is the IPC key shared by statusline.sh, hooks/compact-monitor.sh, and hooks/account-monitor.sh. Change one, change all three.
  • The account label must be derived from the session's own credential, never from ~/.claude.json. .oauthAccount there is a single machine-global slot shared by every Claude Code surface and is only rewritten by a full profile fetch gated behind a 24h TTL, so it can name a different account than the one actually spending quota (it did, for two days, before 2026-08-24). hooks/account-monitor.sh resolves the credential the session authenticates with and publishes the owner; the renderer reads only that. If resolution fails the label is a loud yellow ? — never fall back to a name that might be wrong. See SPEC.md → Account attribution.
  • The context bar must not be wrapped in DIM — it uses 24-bit truecolor and DIM collapses the gradient. (The 5h / 7d limit bars are also truecolor but are intentionally wrapped in DIM for a softer look — that's a deliberate aesthetic choice, not a precedent to copy.)
  • Bar widths: context 30 chars, 5h/7d 20 chars. If you change one, update its pct * N / 100 calculation too.
  • Line width budget ≤ 60 columns. Keep every rendered line within ~60 visible columns (excluding ANSI codes and the line-8 ⚠ <drift> suffix appended by claude-backup). The shared label column is dynamic (it widens to the account displayName), so a long account name — or long repo/branch/PR/worktree on line 1 — can blow the budget. If a design change would push any line past 60, confirm the design with the user before shipping rather than silently overflowing. See SPEC.md → Width budget.
  • docs/swatches.sh mirrors the colors. It regenerates the three README graphics and duplicates statusline.sh's palette + gradient formulas (it is not sourced by the renderer — that stays a single drop-in file). Change a color constant or gradient formula in statusline.sh → update docs/swatches.sh too, then re-render and re-screenshot the affected docs/*.png.
  • docs/preview.sh regenerates the README text previews. It rewrites the two blocks between the <!-- preview:baseline --> / <!-- preview:full --> markers in README.md by running the real statusline.sh against fixed sandboxed payloads (pinned clock via TZ=UTC + a date shim, scratch git repos for branch/diff, fake HOME for the drift flag, seeded /tmp account + compact files). Unlike swatches.sh it does not duplicate renderer logic — it invokes statusline.sh, so it can only drift in its sample inputs, never in output formatting. It is deterministic (a no-op change yields no diff) and byte-reproducible across BSD/GNU (verified in a Linux container). After any change to statusline.sh's output, re-run it (./docs/preview.sh) and commit; no manual paste/screenshot needed (that's only swatches, because those are images). ./docs/preview.sh --check regenerates into a temp file and diffs without mutating README (exit 1 on drift); CI runs exactly this via .github/workflows/preview-check.yml, so a stale preview fails the build.

Read the full file on GitHub · 46 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 46 lines · 1,641 tokens per session scan B dcce315189e4

Subscribe to this mod's changes

claude-statusline CLAUDE.md is an instructions file published in the GitHub repository howar31/claude-statusline (2 stars, last pushed 8d ago), licensed MIT. It adds 1,641 tokens to every session, about $0.0082 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens