Skip to content

thegauravmahto/CCStats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCStats — Claude Code usage tracker for macOS

Native macOS dashboard + menu-bar app that visualizes your Claude Code usage, tokens, and cost — all offline, all private.

Build Latest release License: MIT macOS 14+ Swift 5.10 SwiftUI

CCStats turns the JSONL session logs Claude Code already writes to ~/.claude/projects/ into a native macOS dashboard — a GitHub-style activity heatmap, daily token totals, per-model spend, per-project breakdown, and a searchable session table. Today's spend lives in the menu bar so it's always one glance away. No telemetry. No cloud. No sign-up. Your transcripts never leave your laptop.

Looking for a CLI alternative? See ccusage. CCStats is its native, GUI cousin.


Highlights

  • 🟧 GitHub-style activity calendar — 12-month heatmap of your daily Claude Code spend, with click-to-drill on any day.
  • 💰 Hero card with prior-period delta — "Last 30 days $1,248.18 · ▼ 12% vs prior period · 47 sessions".
  • 🧮 Per-model + per-project breakdowns that filter to whatever range or day you've selected.
  • 🪙 Cache-hit ratio + savings estimate — see how many dollars caching saved you vs. paying full input rate.
  • 🍎 Menu-bar tile with today's spend, 7-day sparkline, and one-click access to the dashboard.
  • 🔎 All-sessions window (⌘L) with full search, model filter, date filter, min-cost slider, and a sortable Table.
  • 📤 CSV / JSON export of every session.
  • ⚙️ Settings — menu-bar label mode, monthly budget alert, pricing overrides, live update toggle, menu-bar-only mode.
  • 🔄 Live updates — FSEvents watcher reloads automatically as Claude Code writes new JSONL.
  • 🔐 Fully offline — no network calls, no analytics, no telemetry.

Screenshots

Screenshots coming soon. PRs welcome.

Dashboard Activity calendar Menu bar
coming soon coming soon coming soon

Why I built this

I'm an AI Product Manager and a heavy Claude Code user. The one thing that always bothered me was never quite knowing how many tokens I had left, how much I'd spent, or how my usage looked over time. I wanted a clean, GitHub-contributions–style view of my activity — so I built CCStats.

Everything runs locally. Nothing leaves your machine.

Gaurav Mahto · @gaurav_mahto18 · github.com/thegauravmahto


Requirements

  • macOS 14 (Sonoma) or later
  • Claude Code installed (so ~/.claude/projects/ exists)

To build from source:

  • Xcode 15 or later
  • XcodeGenbrew install xcodegen
  • (Optional) Python 3 with Pillow if you want to regenerate the icon assets — pip3 install Pillow

Install

Option A — Download the latest release

  1. Grab CCStats.dmg from the Releases page.
  2. Open the DMG, drag CCStats.app to Applications.
  3. First launch: right-click → OpenOpen (the app isn't notarized yet — see Notarization).

Option B — Build from source

git clone https://github.com/thegauravmahto/CCStats.git
cd CCStats
brew install xcodegen
xcodegen generate
open CCStats.xcodeproj
# ⌘R in Xcode

How it works

Claude Code writes JSONL files under ~/.claude/projects/<project>/<sessionId>.jsonl (and nested subagent files). Each line is a single event — user message, assistant message (with usage token counts and model), tool call, etc.

CCStats:

  1. Recursively walks ~/.claude/projects/ at launch and on every file-system change.
  2. Streams every JSONL line-by-line so multi-MB sessions stay cheap.
  3. Dedupes assistant turns by message.id — Claude Code rewrites the same turn multiple times during resumes / interim cancels; without dedupe, totals are inflated.
  4. Aggregates tokens per session and per model, then prices them via an editable Pricing.swift table.
  5. Renders the dashboard using SwiftUI + a custom heatmap.

Nothing is written, nothing is uploaded. The app needs read access to ~/.claude/projects/ and that's it.


Pricing accuracy

The pricing table in CCStats/Pricing.swift reflects Anthropic's published per-1M-token rates as of the date in the file's header comment. Cache-write costs default to the 5-minute tier (Claude Code's current default cache TTL); 1-hour rates are documented in the same comment if you need to override.

You can also override pricing per-model at runtime via Settings → Pricing (paste JSON like {"claude-opus-4-7": {"input": 5, "output": 25, "cacheWrite": 6.25, "cacheRead": 0.50}}).

Always verify against anthropic.com/pricing before trusting cost numbers for billing.


Keyboard shortcuts

Shortcut Action
⌘R Reload sessions
⌘L Open All Sessions window
⌘F Focus search (in All Sessions)
⌘, Open Settings
(Menu bar) Open Dashboard

Roadmap

  • Notarized + signed releases
  • Window screenshots in this README
  • Per-tool-call breakdown (which tools eat the most tokens)
  • Anomaly detection (highlight unusually expensive sessions)
  • Light-theme polish for the icon (currently optimized for dark dock)
  • iCloud sync of pricing overrides

See open issues for the live list.


Notarization

DMGs attached to releases are not yet notarized with Apple. macOS will warn you on first launch. Bypass safely:

# remove the quarantine attribute
xattr -dr com.apple.quarantine /Applications/CCStats.app

Or right-click CCStats.appOpenOpen in the dialog.

Notarized builds are on the roadmap, gated on an Apple Developer Program membership.


Privacy

CCStats does not:

  • Send your transcripts anywhere
  • Make any network requests
  • Collect telemetry, analytics, or crash reports
  • Modify or delete files in ~/.claude/projects/ (read-only)

The app sandbox is intentionally disabled so the app can directly read ~/.claude/projects/ (a hidden user folder) without prompting for a folder selection. Entitlements are the minimal set required.


Contributing

PRs welcome — see CONTRIBUTING.md. Some good first issues:

  • Update the pricing table when Anthropic ships a new model
  • Add a dashboard / menu bar / About screenshot
  • Anomaly detection on the heatmap
  • Light-theme variant for the app icon

FAQ

Q: Does this work on Linux / Windows? No — it's a native macOS-only app. For cross-platform try ccusage (CLI).

Q: Will this work with the Anthropic API directly, not Claude Code? Not currently. CCStats reads Claude Code session logs, not raw API request history.

Q: Where does it find my data? ~/.claude/projects/<project>/<session>.jsonl and any nested subagents/agent-*.jsonl under that. If the folder is empty, CCStats has nothing to show.

Q: My All-time total dropped after updating — is that a bug? No — the parser was double-counting assistant turns that Claude Code rewrites during resumes/cancels. The new total is the accurate one. Opus pricing was also corrected (Anthropic dropped Opus 4.5/4.6/4.7 from $15/$75 to $5/$25 per 1M tokens).

Q: Is this affiliated with Anthropic? No. CCStats is an independent open-source project.

Q: What about Cursor / Cline / other AI coding tools? Out of scope for now — CCStats is purpose-built for Claude Code's JSONL schema. PRs adding adapters welcome.


Keywords

claude code · claude code usage · claude code stats · claude code analytics · claude code dashboard · claude code cost tracker · claude code menu bar · claude code activity heatmap · anthropic claude · token usage tracker · LLM cost tracking · macOS app · SwiftUI · native mac app · developer tools · ccusage alternative


License

MIT © 2026 Gaurav Mahto.