codeburn icon indicating copy to clipboard operation
codeburn copied to clipboard

Feature request: toggle panel headline between cost and tokens

Open MARUCIE opened this issue 6 months ago • 1 comments

Problem

The menubar popover's headline number is currency-only. In the screenshot below the user sees $442.72 (Today) and $226.51 / $164.24 / … in the Activity rows, but cannot flip the same panel to show token totals as the primary metric without leaving the popover and running codeburn today --format=json | jq on the CLI.

For users on Claude Max / ChatGPT Pro flat-rate plans, the cost number is largely informational — what they actually want to monitor at-a-glance is token consumption (rate-limit headroom), not dollars.

Evidence (v0.9.7 on macOS 14+)

Verified by inspecting the installed bundle and CLI:

  • codeburn currency [code] switches currency (USD/EUR/GBP/CNY etc. via api.frankfurter.app), NOT cost↔tokens. Strings present in CodeBurnMenubar binary: SupportedCurrency, setCurrencyCode:, _currency, currencySymbol, savingsUSD.
  • defaults read org.agentseal.codeburn-menubar exposes only 4 keys, all housekeeping (UpdateChecker.lastCheckDate, UpdateChecker.latestVersion, codeburn.loginItemRegistered, codeburn.starBannerDismissed). No displayMode / headlineMetric / showTokens key.
  • CLI has no config subcommand and no --unit flag on today / report. codeburn --help top-level commands: report status today month export menubar currency model-alias plan optimize compare yield.
  • Binary does contain an InsightMode symbol, suggesting the data layer can already produce both views — only the user-facing toggle is missing.

So the data is already computed (inputTokens / cacheReadTokens / cacheWriteTokens / effectiveTokens fields are in the JSON payload) — the gap is purely UI exposure in the popover.

Tokens are partially visible already, but inconsistently

  • Inside the Trend tab the chart Y-axis IS tokens (Last 19 days 267.7M tokens, Avg/day 14.1M tok, Peak 52.1M tok, Yesterday 12.7M tok).
  • But the popover headline (Today $442.72), the Activity rows (Coding $226.51), and the menubar status-icon number are all currency-only.

This split forces the user to mentally translate between two metrics on the same panel.

Proposal

Add a single toggle that flips headline + Activity rows + menubar status icon between Cost and Tokens. Three placement options, in order of preference:

  1. Tab next to Trend / Forecast / Pulse / Stats → e.g. Cost | Tokens segmented control at panel top. Same affordance as the existing tab strip, zero new visual vocabulary.
  2. Right of the $ USD button in the footer → e.g. $ USD becomes $ USD ⇄ Tokens cycler. Keeps unit-related controls grouped, but conflates "currency" with "metric" semantically.
  3. CLI-only first → codeburn config set menubar.headline tokens (persist to ~/.config/codeburn/config.json), menubar reads on next refresh. Lowest UI risk, fastest to ship.

Either way the underlying InsightMode enum probably already supports it — this is a UI-surface change, not a data-layer change.

Related

  • #291 "configurable period for menubar status icon (today / week / month)" — orthogonal axis (time period), same general theme of letting the user pick what the menubar headline represents.
  • #267 menubar popover alignment — same surface.

Environment

  • CodeBurn v0.9.7 (CLI + Menubar app)
  • macOS 14+, M3 Max

MARUCIE avatar May 11 '26 15:05 MARUCIE

Implemented in PR #307: https://github.com/getagentseal/codeburn/pull/307

This adds a persisted Cost/Tokens toggle in the menubar popover. The selected metric now drives:

  • the hero headline
  • Activity row values and bars
  • the always-visible menubar status item number

Token mode uses total token traffic for the selected period/activity: input + output + cache read + cache write. The menubar JSON payload now includes current-period cache token totals and per-activity token totals, with defensive Swift decode fallback for older payloads. The daily cache is bumped to v6 so historical Activity token totals are recomputed instead of carrying forward old rollups that did not store per-category tokens.

Validation:

  • npm run build
  • swift build
  • npx vitest run (47 files / 662 tests)
  • git diff --check
  • Argus local reviewer: PASS
  • Claude Opus 4.7 effort max: PASS
  • Gemini 3.1 Pro Preview: PASS

GitHub checks are passing on the PR.

ozymandiashh avatar May 11 '26 16:05 ozymandiashh