Skip to content

Add Optimize tab with retry tax, routing waste, and token display modes#349

Merged
iamtoruk merged 4 commits into
mainfrom
feat/menubar-optimize-insights
May 18, 2026
Merged

Add Optimize tab with retry tax, routing waste, and token display modes#349
iamtoruk merged 4 commits into
mainfrom
feat/menubar-optimize-insights

Conversation

@iamtoruk
Copy link
Copy Markdown
Member

Summary

  • Optimize tab: New insight tab showing Retry Tax (money wasted on failed edits) and Routing Waste (counterfactual savings vs cheapest reliable model). All pure math, no LLM.
  • Token display modes: Settings > Metric picker with Cost ($), Tokens (up/down split), Total Tokens. Reflected in menubar strip and hero section.
  • Daily budget alerts: Configurable threshold in Settings. Flame turns yellow when exceeded, warning banner in hero.
  • Project drill-down: Click any project in Stats to expand per-session details with cost, tokens, and model badges. Spring animation with staggered cascade.
  • Period-aware sessions: Non-today periods (7d/30d/month) now parse full range for top sessions and project details instead of only showing today's data.
  • Friendly project names: Directory name instead of full sanitized path; home directory shows as "Home".
  • Audit fixes: Array mutation bug, percentage rounding, ForEach ID collision, near-zero baseline threshold ($0.01 min), editTurns scoping to only models with retries, first-of-month edge case, session cache TTL 60s to 180s.

Test plan

  • Open Settings > General: verify Currency, Metric (3 options), Accent, Daily budget picker
  • Set Metric to "Tokens (up/down)" -- menubar shows up/down arrows, hero shows total tokens
  • Set Metric to "Total Tokens" -- menubar shows single total, hero shows total tokens
  • Set Daily budget to $25 -- flame turns yellow if today's spend exceeds it, orange banner in hero
  • Click Optimize tab on Today and 30 Days -- verify retry tax and routing waste numbers
  • Expand retry tax and routing waste -- per-model breakdowns appear with smooth animation
  • Click project rows in Stats tab -- sessions expand with cost, tokens, model badges
  • Switch between Today/7 Days/30 Days -- top sessions and project details change per period
  • Verify Stats tab still shows all original content (stat grid, tracked spend, costliest session)
  • Verify no menubar lag when viewing 30 Days or 6 Months periods

iamtoruk added 4 commits May 18, 2026 05:49
SwiftUI MenuBarExtra with litellm-snapshot pricing, Claude/Codex/Copilot
parsers, session discovery, auto-refresh timer, and dashboard UI matching
the real menubar design.
Private Mac App Store build, not for the public repo.
…ct drill-down

- New Optimize insight tab with Retry Tax and Routing Waste computations
  (pure math from session data, no LLM required)
- Retry tax: shows money wasted on failed edit retries, per-model breakdown
- Routing waste: counterfactual savings vs cheapest reliable model, per-model
- Token display modes: Cost ($), Tokens (up/down split), Total Tokens
- Daily budget alert: configurable threshold, flame turns yellow when exceeded
- Project drill-down: click project rows to see per-session cost, tokens, models
- Period-aware top sessions: 30-day view now shows 30-day costliest sessions
- Friendly project names: show directory name instead of full path, Home for ~
- Session cache TTL bumped to 180s to prevent re-parsing on non-today periods
- Audit fixes: array mutation, percentage rounding, ForEach ID collision,
  baseline minimum threshold, editTurns scoping, first-of-month edge case
- SessionDetailsList model badges used id: \.name which silently drops
  duplicate model entries. Switched to enumerated offset-based ID.
- Hero budget warning compared against provider-filtered payload instead
  of todayPayload (all providers). Now matches the menubar flame tint.
@iamtoruk iamtoruk merged commit 7cea9ef into main May 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant