diff --git a/CHANGELOG.md b/CHANGELOG.md index 24e4cbb..3fc9aec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## v0.21.0 — 2026-07-28 — the advisor, wired into your world + +**New: `statusline.sh check` — the advisor as an exit code.** The +statusline never runs when you're away, which is exactly when expiring +capacity needs a voice. Instead of a daemon (still no daemon, ever), +`check` prints the plain-text advisor verdict and exits 0 calm / 1 +opportunity / 2 pressure / 3 unknown-or-stale — you wire it into tmux, +cron, or CI. We provide the judgment; the host provides the plumbing. +Model context for the scoped clauses comes from the last logged +snapshot — the first consumer of v0.20's widened `model` field. + +**New: `statusline.sh session-summary` — one-line session +retrospectives.** Designed as a `SessionEnd` hook (reads the hook JSON +on stdin; falls back to the last logged session for manual runs): + +``` +session 8f3c02aa: 3h12m, 5h +34pts, 7d +4pts, claude-fable-5 +``` + +Window deltas are positive-delta sums (the profile builder's rule), so +a session that straddles a 5h reset still reports what it actually +consumed. 334 tests (322 statusline + 12 installer). + ## v0.20.0 — 2026-07-28 — the waste ledger: see what you paid for and didn't use **New: `statusline.sh report [--days N]` — the waste ledger.** The diff --git a/README.md b/README.md index 1216380..f3f534f 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,47 @@ its reset, so usage from other devices after your last local render is invisible, and a week you never opened a session in never appears at all. The ledger reports what the log observed, nothing more. +## Scripting: `check` and `session-summary` + +The statusline never runs when you're away — exactly when expiring +capacity needs a voice. Instead of shipping a daemon, `check` exposes +the advisor's judgment as an exit code; you provide the plumbing (tmux +segment, cron, CI): + +```bash +~/.claude/statusline.sh check +# stdout: the plain advisor text, or "calm" / "unknown: ..." +# exit 0 calm | 1 opportunity (+) | 2 pressure (!) | 3 unknown/stale +``` + +```bash +# cron: nudge yourself when paid capacity is about to expire unused +*/30 * * * * ~/.claude/statusline.sh check; [ $? -eq 1 ] && notify-send "$(~/.claude/statusline.sh check)" + +# tmux: advisor verdict in the status bar +set -g status-right '#(~/.claude/statusline.sh check)' +``` + +`session-summary` is the same idea for session retrospectives — one +line per session, built from the usage log, designed as a `SessionEnd` +hook (it reads the hook JSON on stdin): + +```jsonc +// settings.json +"hooks": { + "SessionEnd": [{"hooks": [{"type": "command", + "command": "~/.claude/statusline.sh session-summary >> ~/.claude/statusline/session-summaries.log"}]}] +} +``` + +```text +session 8f3c02aa: 3h12m, 5h +34pts, 7d +4pts, claude-fable-5 +``` + +Run it bare and it summarizes the last session in the log. Window +deltas are positive-delta sums, so a session that straddles a 5h reset +still reports what it actually consumed. +
OAuth and API behavior Quota, profile, and extra-usage requests use Claude Code's OAuth credentials @@ -362,7 +403,7 @@ run. Setting only `CLAUDE_CACHE_DIR` keeps the legacy single-dir behavior. npm exec --yes bats -- t/ ``` -327 tests across `t/statusline.bats` (315 statusline + integration) and +334 tests across `t/statusline.bats` (322 statusline + integration) and `t/install.bats` (12 installer). CI runs on push and PR to `main`. ## Project Structure diff --git a/docs/api/state-dir.md b/docs/api/state-dir.md index 58a7536..da468bf 100644 --- a/docs/api/state-dir.md +++ b/docs/api/state-dir.md @@ -7,7 +7,7 @@ is the ONLY writer; everything here is safe to read concurrently. - Contract version: **1** (bump on any breaking layout/field change; this file is the changelog) -- Synced with: statusline.sh v0.20.0 +- Synced with: statusline.sh v0.21.0 - Permissions: the script runs under `umask 077` — files are owner-only. Caches hold account PII (email, uuid, org names). diff --git a/docs/index.html b/docs/index.html index c08c1b5..c6b7ffb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ Claude Code Statusline — quota, context, cost. Live, in one bash file. - +