Statusline

From mikeprasad/aria-knowledge · View interactive version

Statusline is an AI agent skill from the GitHub repository mikeprasad/aria-knowledge. Install or remove the aria-knowledge status-line meter — a context-window progress bar plus the rolling 5-hour and 7-day plan-usage percentages, shown at the bottom of the Claude Code CLI. Use when the user says '/statusline', 'add a context meter', 'show context usage in the status line', 'show my

How to use this skill

Skill file

/statusline — Context + Usage Meter

Wire up (or remove) a persistent status line at the bottom of the Claude Code CLI showing:

Fable 5 H │ ███░░░░░░░ 31% ctx │ 5h 24% ↺1pm │ 7d 88% ↺Tue 1pm

The 5h/7d segments render only on Pro/Max subscription sessions and only after the first response of a session. On API-key sessions they're absent and the line shows model + context only.

The meter's last segment is the account email (read from ~/.claude.json), placed last so a width-truncated line only ever clips the email, not the usage — and so you can tell which account a terminal belongs to when running more than one.

Installing the meter also lets the session's Claude know these numbers: on each render the meter writes a snapshot, keyed by account, to ~/.claude/aria-statusline-state-<accountUuid>.json, which Claude reads on demand (e.g. before /handoff or compaction — see the SessionStart TASK BUDGET guardrail). Per-account keying means a second logged-in account never clobbers the first's usage (which previously caused the alert to fire on the wrong account). A UserPromptSubmit hook additionally injects a warning when context/5h/7d crosses usage_alert_threshold (80% once aria-knowledge is configured, adjustable in /setup; set off to disable). All of this is dormant until the meter is installed — and the injection specifically is also dormant until /setup has written a config file, because config.sh resolves all of its defaults only when one exists. On-demand reading of the snapshot works either way.

Why a command and not automatic

A Claude Code plugin cannot register a statusLine from its manifest — the main status line is read only from the user's ~/.claude/settings.json. So this skill performs the one-time wiring: it copies the meter script to a stable location and points your settings at it. (subagentStatusLine is the only status-line key a plugin may default, and it's a different surface.)

Runtime note

This is a Claude Code CLI feature — the meter only renders in the terminal CLI. If the Bash tool is unavailable (you're in Cowork or another non-Code runtime), tell the user: "The status-line meter is a Claude Code feature and can't be configured from this runtime." and stop. Otherwise proceed.

Desktop-app caveat: the Claude Code desktop app has Bash but does not render this status line — it does not invoke the statusLine command and shows its own native usage indicator instead. So in a desktop session the wiring installs cleanly but the meter never appears in the desktop UI, and the usage snapshot (aria-statusline-state-<accountUuid>.json) is not refreshed by desktop renders. Still install when asked — the wiring is global, so the meter and snapshot work in the user's CLI sessions on the same machine. If you detect a desktop runtime (e.g. CLAUDE_CODE_ENTRYPOINT=claude-desktop), proceed with the install but mention that the meter shows in CLI sessions, not the desktop UI (where the app's built-in indicator covers it). (See docs/non-goals.md for why a desktop bridge is deferred.)

Argument routing

Parse the argument (default on when none given):


Install / Refresh

Step 1 — Locate the meter script and check dependencies

SRC="${CLAUDE_PLUGIN_ROOT}/scripts/statusline-meter.sh"
DEST="$HOME/.claude/aria-statusline-meter.sh"
SETTINGS="$HOME/.claude/settings.json"
[ -f "$SRC" ] && echo "source ok: $SRC" || echo "MISSING SRC"
command -v jq >/dev/null 2>&1 && echo "jq: present" || echo "jq: MISSING"
echo "HOME=$HOME"

Step 2 — Copy the meter to the stable path

mkdir -p "$HOME/.claude"
cp "${CLAUDE_PLUGIN_ROOT}/scripts/statusline-meter.sh" "$HOME/.claude/aria-statusline-meter.sh"
chmod +x "$HOME/.claude/aria-statusline-meter.sh"
echo "copied to $HOME/.claude/aria-statusline-meter.sh"

Copying (rather than referencing the plugin dir directly) means the meter survives plugin updates and reinstalls. The trade-off: when a plugin update improves the meter, the user re-runs /statusline to refresh this copy — say so in the final summary.

Step 3 — Read existing settings and detect conflicts

Read ~/.claude/settings.json with the Read tool.

Step 4 — Back up and write settings

Before any write, back up the existing file (only if it exists):

[ -f "$HOME/.claude/settings.json" ] && cp "$HOME/.claude/settings.json" "$HOME/.claude/settings.json.aria-bak" && echo "backed up to settings.json.aria-bak"

Then write ~/.claude/settings.json with the statusLine block merged in, preserving all existing keys (read the current JSON, add/replace only the statusLine key, write the whole object back — valid JSON, 2-space indent). The block:

"statusLine": {
  "type": "command",
  "command": "<HOME>/.claude/aria-statusline-meter.sh",
  "refreshInterval": 30
}

Substitute <HOME> with the literal absolute path captured in Step 1 (e.g. /Users/alice/.claude/aria-statusline-meter.sh). If the file didn't exist, the whole file is just { "statusLine": { … } }.

refreshInterval: 30 re-runs the meter every ~30s in addition to the event-driven renders, so the persisted usage snapshot stays current even while the session is idle or just after a resume (when no assistant message has fired a render yet). It re-runs only the meter — a local ~5ms script with no API token cost — and does not change how often the usage alert fires (that's the UserPromptSubmit hook, band-gated on your prompt). On a refresh/repair where settings already has a statusLine pointing at the aria meter, set refreshInterval to 30 if it's absent, but preserve a user's existing smaller (higher-frequency) value.

Validate the written JSON before declaring success:

if command -v jq >/dev/null 2>&1; then
  jq empty "$HOME/.claude/settings.json" && echo "settings.json: valid JSON" || echo "settings.json: INVALID — restoring backup"
fi

If validation fails, restore from settings.json.aria-bak and report the error rather than leaving broken settings in place.

Step 5 — Verify the rendered line

Prove it works by piping a representative payload through the installed copy (don't ask the user to eyeball the CLI — show them the rendered output):

echo '{"model":{"display_name":"Fable 5"},"effort":{"level":"high"},"context_window":{"used_percentage":31},"rate_limits":{"five_hour":{"used_percentage":24,"resets_at":0},"seven_day":{"used_percentage":12}}}' | "$HOME/.claude/aria-statusline-meter.sh"; echo

Step 6 — Confirm

Summarize:

Status-line meter installed.
- Script: ~/.claude/aria-statusline-meter.sh
- Wired in: ~/.claude/settings.json (backup at settings.json.aria-bak)
- Shows: model · context bar · 5h usage · 7d usage (5h/7d on Pro/Max only)

It appears at the bottom of the CLI on the next render (start typing, or open a new session if it doesn't show).
Re-run /statusline after a plugin update to refresh the meter script.
Remove it anytime with /statusline off.

If jq was missing, append the install hint and note the line will show model-only until jq is installed.


Remove

  1. Read ~/.claude/settings.json. If it has no statusLine key, report "No status-line meter is configured." and stop.
  2. If the statusLine.command does not reference aria-statusline-meter.sh, it's not ours — stop and ask before removing: "The configured status line isn't the aria-knowledge meter (<command>). Remove it anyway? (y/n)".
  3. Back up (cp settings.json settings.json.aria-bak), then rewrite settings.json with the statusLine key removed, preserving all other keys. Validate the result is valid JSON (restore backup on failure).
  4. Offer to delete the staged script + snapshots: "Also delete the meter script (~/.claude/aria-statusline-meter.sh) and its per-account usage snapshots (~/.claude/aria-statusline-state-*.json)? (y/n)" — on y, rm -f the script plus the aria-statusline-state-*.json glob (and the legacy aria-statusline-state.json if present), plus any aria-usage-warn-* band-state files in the state directory (the directory named by state_dir= in ARIA CONFIG; skip this part when it reads none).
  5. Confirm: "Status-line meter removed. Backup at ~/.claude/settings.json.aria-bak." (The usage-alert hook stays registered but is now a silent no-op with no snapshot to read.)

Status

  1. Report whether ~/.claude/aria-statusline-meter.sh exists.
  2. Read ~/.claude/settings.json and report whether statusLine is set and what command it points at (and whether that's the aria-knowledge meter).
  3. Report whether jq is installed (command -v jq).
  4. If installed and pointing at our meter, render the sample line (Install Step 5) so the user sees current output.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.