Skip to content
← Portfoliov2.8.0 on GitHubElectron → SwiftUI

BurnTracker · Case study A 2.2 MB menu‑bar app for rolling AI quotas across six providers.

An open-source macOS menu-bar utility for 5-hour session limits, weekly quotas and spend across Claude, Claude Code, Antigravity, Command Code, Cursor, Grok and Copilot. It began as an Electron widget and moved to SwiftUI.

●No BurnTracker server✓One Keychain prompt per launchUniversal .dmg 1.90 MiB
My commits91
App size2.2MB
Releases9
Services7
My role
Creator and sole developer, paired with Claude Code and Cursor
Team
1 developer, 1 repository
Timeline
About 19 weeks, in five stretches
Stack
Swift 5, SwiftUI, AppKit, Connect-RPC, Keychain
01 — Timeline

91 commits, five stretches.

Pick a week to see what shipped.

Week 6 · 56 commitsAntigravity quota sync and the BurnTracker name, then the rewrite to SwiftUI, vibrancy glass and the 30-day Claude spend trend.
02 — Platform

One store, stateless services, no server.

  • Stays out of the Dock
  • Talks straight to each provider
  • Refreshes on open and in the background
  • Alerts once per window
Provider services · no proxyClaudeService · ClaudeCodeServiceclaude.ai cookie · Keychain OAuthAntigravityService127.0.0.1 Connect-RPC · agy CLICommandCodeServicedollar credits + request windowsCursorService · CopilotServicestate.vscdb · Copilot APIGrokService~/.grok/auth.json OAuthTaskGroupCoordinator · @MainActorAppState.sharedaccounts, pin, alerts, cardOrderRefresh & persistenceFileWatcher + timer · settingsKeychainAccess gateat most 1 prompt per launchClaudeUsageScanner (actor)~/.claude/projects/**/*.jsonlStateActionsMenu bar & popover · SwiftUIMenuBarExtra (.window)one template NSImage + pin %Dashboard & SettingsNSVisualEffectView · DragGestureSession & notificationsisolated WKWebView · alerts
The store: AppState.shared holds all view state on the main actor, with no IPC layer and no third-party Swift packages. It syncs when the popover opens, when ~/.claude files change, and on a 5 to 60 minute timer.
03 — Key decisions

Four calls that shaped the app.

The pivot

From an Electron widget to native SwiftUI

The first version was Electron: a main process, a preload script and a renderer. The rewrite to Swift 5 and SwiftUI kept the exact tracker-settings.json schema, so existing setups loaded with no migration.

Swift 5 · SwiftUI · MenuBarExtra
Electron widget
  • main.js, preload.js and a renderer
  • A Chromium runtime in every bundle
  • An app bundle of about 150–200 MB
Rewritten natively ↓
Swift 5 · SwiftUI
  • A native SwiftUI menu-bar extra
  • No IPC layer, no third-party packages
  • The same tracker-settings.json
  • A 2.2 MB universal app
Normalising usage

Rolling windows, minor-unit credits, loopback RPC

Every provider reports usage in its own units and over its own transport. Each service turns that into the bars on its card, from Claude’s 5-hour window to Command Code’s monthly dollars.

QuotaData · Connect-RPC
quota models
Claudefive_hour and seven_day, snake_case or camelCaseCreditsminor currency units scaled by 10^decimal_placesCommandthe CLI’s plan allowance table, $10 to $300AntigravityCSRF token from ps, lsof scoped to that PIDGemini CLIretired once its endpoint returned 403✓ six live providers on one dashboard
The menu bar

One-image pins, flicker-free reorder, per-model caps

The glyph and the pinned percentage are drawn into one template image, so macOS recolours both in light and dark menu bars. Dragging a card moves only its offset and commits the order on release.

NSImage · DragGesture · weekly_scoped
PieceProblemFix
Status pinMulti-view labels lay out unpredictablyOne template NSImage
ReorderonDrag dismissed the panel; cards blinkedOffset-only DragGesture
Stale pinsA removed account left its pinprunePinIfDangling()
Model capsCaps moved into a limits arrayMatch weekly_scoped by model
One Keychain prompt

Logins already on the Mac, one prompt per launch

Claude Code, Cursor, Grok and Copilot connect through the logins already on the Mac, so nobody copies browser cookies. Keychain reads queue up behind at most one password sheet per launch, and background sync stays silent.

Keychain · /usr/bin/security · CommonCrypto
ClaudeCodeServiceKeychainAccess/usr/bin/securityAnthropic OAuthread · 1 sheet maxfind-generic-passwordaccess + refresh tokenrefresh within 5 min of expiryrotated token pairre-read, then hex via security -i stdinThe CLI stays signed in; the token never enters ps
04 — Results

About 150–200 MB, down to 2.2 MB.

The Electron prototype carried a whole Chromium runtime. Flip the switch to see what the SwiftUI rewrite changed.

Universal app bundle2.2 MB
RuntimeSwiftUISwift 5, no third-party packages
Background sync5–60 minPlus on open and when ~/.claude changes
SettingsSame schemaLoaded with no migration
Versionv2.8.0Nine releases on GitHub, from v2.2.0
Where it stands
1.90 MiBUniversal .dmg
9Releases
6Live providers
macOS 15+Apple Silicon and Intel

Bundle sizes as recorded in the rewrite’s pull request, for a universal (arm64 + x86_64) Release build. The .dmg is the v2.8.0 release asset on GitHub.

05 — Screens

The whole app, in one popover.

Accounts, provider quotas, failed logins, an empty state and settings, as the popover shows them.

06 — Behind the build

One developer, two AI pairs.

61 / 91commits carry an AI co-author trailer: 57 Claude Code and 5 Cursor, with both on one release commit. CLAUDE.md and a release skill hold the rules the sessions follow.
With Claude Code or Cursor (61)Solo (30)
I directed and verified

The move from Electron to a native menu-bar app, the one-image status pin, Keychain access through /usr/bin/security with one prompt per launch, and retiring the broken Gemini CLI card.

Claude Code and Cursor drafted

The SwiftUI views and vibrancy wrappers, the drag reorder, the usage-log scanner and 30-day chart, Command Code’s credits, Cursor’s decryption, and the Grok and Copilot services.

A file watcher that survives atomic writes

A dispatch source watches ~/.claude/history.jsonl and stats-cache.json with a 500 ms debounce. When a CLI renames or deletes the file, the watcher closes the stale descriptor and re-opens the new inode.

Thirty days of spend, parsed on the Mac

An actor parses ~/.claude/projects/**/*.jsonl off the main thread, drops duplicate records and caches each file by size and modification time. It estimates spend from embedded Opus, Sonnet and Haiku rates.

Token rotation that never signs the CLI out

Anthropic rotates refresh tokens on use, so an actor collapses overlapping fetches and re-reads the credential store before writing back. Calling /usr/bin/security, already on the item’s access list, avoids a re-prompt after every update.

Cursor’s login, decrypted

The app reads Cursor’s state.vscdb and decrypts Electron’s safe-storage payload with CommonCrypto, PBKDF2-SHA1 and AES-128-CBC, keyed by the Cursor Safe Storage secret in the Keychain.

A session window per account

Opening a Claude account puts its sessionKey into a non-persistent WKWebView data store and loads claude.ai/new. An earlier auto-paste script went, because synthetic DOM input proved unreliable.

Installing on macOS 15

Builds are ad-hoc signed without a paid Developer ID, and macOS 15 removed the Control-click → Open bypass. The README and release notes show how to clear the quarantine flag once with xattr.

Swift 5SwiftUIAppKitConnect-RPCCommonCryptoKeychainWKWebViewClaude CodeCursor

Non-merge commits on the develop branch. Claude Code and Cursor commits were made in my sessions and count as mine. Commit counts measure activity, not effort.

Lets work together

Need a successful project?

I’m available for freelance work.

Hire/Contact Me Now