Agent Stats is an open-source macOS SwiftUI app for analyzing local AI agent activity from Codex and Claude CLI sessions.
It gives you a live dashboard for:
- Session/thread activity
- Token usage patterns
- Estimated model cost over time
- Active/recent session rollups
- Provider/account limit status surfaced from local CLI/auth state
If you use local agent tooling heavily, it is hard to answer basic questions like:
- Which models are driving spend?
- What are my busiest hours/days?
- How much activity is active right now?
- How do Codex and Claude usage compare over the same period?
Agent Stats aggregates local session metadata into a single desktop view so you can monitor usage without leaving your machine.
- Multi-provider ingestion:
- Codex sessions from
~/.codex - Claude sessions from
~/.claude/projects
- Codex sessions from
- Dashboard views:
- Overview metrics
- Costs and model trends
- Thread-level activity table
- Visualization components:
- Cost-by-model bars
- Daily activity + hourly usage charts
- Activity heatmap
- Local persistence/cache via SwiftData for faster reloads
- Auto-refresh loop (plus manual refresh)
- Model pricing snapshots bundled in app resources
Agent Stats is local-first:
- Reads files from your local
~/.codexand~/.claudedirectories - Uses local SQLite/JSONL parsing for analysis
- Stores cached snapshots locally using SwiftData
No external telemetry pipeline is required for core dashboard functionality.
- macOS 26.2 or later
- Xcode 15+ (or newer)
- Open
Agent Stats.xcodeprojin Xcode. - Select the
Agent Statsscheme. - Build and run on
My Mac.
Or from terminal:
xcodebuild -project "Agent Stats.xcodeproj" \
-scheme "Agent Stats" \
-configuration Debug \
-destination 'platform=macOS' \
buildCurrent architecture is organized by responsibility:
Agent Stats/Domain:- Core domain utilities (token math, model normalization)
Agent Stats/Services:- Application services (cost calculation, live session rollups, snapshot store)
Agent Stats/Infrastructure:- File system, CLI/process, pricing loading, metadata and DB adapters
Agent Stats/Parsers:- Codex/Claude session JSONL parsers
Agent Stats/ViewModels:- Section-level view models for Dashboard / Pricing / Threads
Agent Stats/*.swift:- App composition, root model, and SwiftUI views/components
The app builds snapshots from:
- Session files (
.jsonl) in Codex/Claude local folders - Codex local state database (
state_5.sqlite) when available - Bundled pricing files:
Agent Stats/openai_pricing.jsonAgent Stats/claude_pricing.json
Contributions are welcome.
Suggested workflow:
- Fork the repo
- Create a feature branch
- Make focused changes with clear commit messages
- Validate with local build:
xcodebuild -project "Agent Stats.xcodeproj" -scheme "Agent Stats" -configuration Debug -destination 'platform=macOS' build - Open a pull request with:
- What changed
- Why it changed
- Any behavior/UI impact
- Export analytics as CSV/JSON
- Configurable refresh interval
- Additional provider adapters
- Historical trend comparison presets
- Optional snapshot import/export
This project is licensed under the Apache License 2.0. See LICENSE for details.