Skip to content

dennisrongo/agent-status

Repository files navigation

πŸ“Š Agent Usage Monitor

A lightweight macOS menubar widget that tracks your Claude Code & GLM CLI usage in real time.

Session / weekly / Opus limits Β· token spend Β· cost estimates Β· per-session history β€” all read from local logs, refreshed on a timer, living quietly in your menu bar.


Tauri Rust React TypeScript Platform Tests


Overview tab

✨ Features

  • What's left, at a glance. Mirrors Claude's /usage view β€” three meters for Session (5h), Week Β· all models, and Week Β· Opus, each with real usage and a live reset countdown.
  • Real token data. Exact per-request token counts parsed straight from Claude Code's session logs β€” input, output, and cache read/write.
  • Cost estimates per model (Opus / Sonnet / Haiku) from standard-tier pricing.
  • 7-day spark chart + all-time model breakdown + recent-session history.
  • Live vendor data (optional). Add a GLM Coding Plan or Anthropic admin API key β€” stored encrypted, machine-bound β€” for real GLM 5h/weekly quota and org-level Anthropic cost.
  • Always current. A Rust timer re-scans and pushes fresh data to the UI β€” auto-refresh interval is configurable in Settings (default 30s), applied live without a restart. No frozen snapshots.
  • Stays out of the way. Menubar-only (LSUIElement), click-to-toggle dropdown, single-instance, launch-at-login.
  • Self-updating. Signed auto-updates via the Tauri updater β€” an in-app "Update & restart" banner appears when a newer build ships.

πŸ–ΌοΈ Screens

Overview
Overview β€” limits, reset timers, week chart, model split
Sessions
Sessions β€” recent sessions with project, model, tokens, cost
Providers
Providers β€” connection status + live vendor usage
Settings
Settings β€” plan tier + encrypted API keys

πŸ—οΈ Architecture

A thin React frontend that only renders, and a rich Rust backend that does all the work.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  React frontend (src/)        β”‚        β”‚  Rust backend (src-tauri/src/)        β”‚
β”‚                               β”‚        β”‚                                       β”‚
β”‚  useUsage / useTauriCommand   │◀──────▢│  commands/   invoke handlers          β”‚
β”‚  Meter Β· WeekChart Β· Settings β”‚ invoke β”‚  scanner/    log aggregation          β”‚
β”‚                               β”‚ + eventβ”‚  vendors/    z.ai + Anthropic clients β”‚
β”‚  renders the snapshot         │◀──────▢│  encryption/ AES-256-GCM key vault    β”‚
β”‚                               β”‚ usage- β”‚  settings/ Β· state/ Β· storage/        β”‚
β”‚                               β”‚ updatedβ”‚  tray.rs     menubar dropdown         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                            β–² timer (cfg) β–² on-demand refresh
                                            β”‚            β”‚
                            ~/.claude/projects/**/*.jsonl Β· ~/.zai/zai-mcp-*.log

The backend scans logs (off-thread via spawn_blocking), optionally fetches live vendor data, merges one UsageSnapshot, and emits usage-updated to the UI.


πŸ“‘ Data sources β€” what's real vs. estimated

Metric Source Real?
Claude token usage (session/week/model) ~/.claude/projects/**/*.jsonl βœ… exact
Claude cost derived from per-model pricing β‰ˆ estimated
Reset countdowns computed from log timestamps βœ… real
"% left" ceilings editable plan tier (Pro / Max 5Γ— / Max 20Γ—) β‰ˆ estimated*
GLM token/cost (local) ~/.zai/*.log β€” lifecycle only ❌ shown as β€”
GLM 5h/weekly quota (with key) z.ai monitor API (/api/monitor/usage/quota/limit) βœ… real
Anthropic cost (with admin key) Anthropic Admin Cost API βœ… real (org-level)
Copilot premium-request quota GitHub copilot_internal/user (your editor / gh token) βœ… real (per-user)

* The Pro/Max subscription "weekly % left" has no public API, so ceilings are estimates you set by picking your plan. The Anthropic admin key reports org-level cost, not the subscription quota.


πŸš€ Quick start

npm install
npm run tauri dev      # develop
npm run tauri build    # bundle an unsigned .app + .dmg (local testing)

Heads-up: if your shell sets NODE_ENV=production, install with NODE_ENV=development npm install --include=dev so the dev toolchain is included.

πŸ“¦ Shipping a signed build

For a .dmg that installs cleanly on any Mac (no Gatekeeper warnings), it must be signed with a Developer ID cert and notarized by Apple:

cp .env.example .env   # fill in your signing identity + notarization creds
./scripts/release-mac.sh

See docs/RELEASE.md for the full runbook (certificates, notarization credentials, verification, universal builds, troubleshooting).


βš™οΈ Configuration

  • Auto-refresh interval β€” choose 10s / 15s / 30s / 1m / 2m / 5m in Settings (default 30s); takes effect on the next cycle.
  • Plan tier β€” pick Pro / Max 5Γ— / Max 20Γ— from the header dropdown; it sets the limit ceilings and persists.
  • API keys (Settings tab) β€” optional z.ai and Anthropic admin (sk-ant-admin…) keys for live vendor data.
  • z.ai endpoint β€” editable; confirm it against your account's billing API.

πŸ”’ Security

API keys are encrypted with AES-256-GCM using an Argon2id-derived key whose password is this machine's UID β€” so a settings.json copied elsewhere can't be decrypted. Keys never leave Rust in plaintext and are never exposed to the frontend (which only sees …KeySet booleans).


πŸ“ Project structure

agent-status/
β”œβ”€β”€ src/                      # React frontend (thin)
β”‚   β”œβ”€β”€ hooks/                # useTauriCommand, useUsage
β”‚   β”œβ”€β”€ components/           # Meter, WeekChart, VendorCard, Settings
β”‚   └── styles/app.css
└── src-tauri/                # Rust backend (rich)
    └── src/
        β”œβ”€β”€ commands/         # invoke handlers (collect = scan + vendor)
        β”œβ”€β”€ scanner/          # log β†’ UsageSnapshot aggregation
        β”œβ”€β”€ vendors/          # z.ai + Anthropic API clients
        β”œβ”€β”€ encryption/       # at-rest key vault
        β”œβ”€β”€ settings/ state/ storage/
        └── tray.rs           # menubar icon + dropdown

πŸ§ͺ Tests

cd src-tauri && cargo test --all     # 12 tests: scanner, encryption, vendor parsers

CI runs the suite on macOS / Windows / Ubuntu (.github/workflows/unit-tests.yml).


πŸ“ Notes / TODO

  • Icon lives at src-tauri/icons/icon.svg β†’ icon.png; re-run npx @tauri-apps/cli icon src-tauri/icons/icon.png after editing to regenerate every size.
  • Bundle identifier is com.dennisrongo.agentstatus β€” change in src-tauri/tauri.conf.json if distributing under a different org.
  • Signing, notarization & auto-updates for distribution β€” see docs/RELEASE.md.
  • Live vendor endpoints are best-effort and unverified offline β€” confirm against your accounts on first run.

About

A lightweight macOS menubar widget that tracks your Claude Code & GLM CLI usage in real time.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors