A real-time monitoring tool for Claude Code usage. Track your token consumption, active sessions, and budget with a web dashboard and native macOS menu bar app.
- 5-Hour Rolling Window: Monitor your token budget based on Claude's Max plan limits
- Visual Progress Bar: Color-coded usage indicator (green/yellow/orange/red)
- Lifetime Statistics: Total tokens used across all sessions
- Real-time Tracking: Input, output, and cache token breakdown
- Per-Project Breakdown: See which projects consume the most tokens
- Active Sessions: Track currently running Claude Code sessions
- Agent Detection: Identify active autonomous agents
- Message Counts: Total messages per session and project
- Web Dashboard: Full-featured browser interface with auto-refresh
- macOS Menu Bar App: Quick glance at stats without leaving your workflow
# Clone the repository
git clone https://github.com/Kiwitwitter/claude-monitor.git
cd claude-monitor
# Build release binary
cargo build --release
# Binary location: ./target/release/claude-monitor# Install Tauri CLI if not already installed
cargo install tauri-cli
# Build the app
cd tray-app
cargo tauri build
# Install to Applications
cp -r src-tauri/target/release/bundle/macos/Claude\ Monitor.app /Applications/After building, a DMG file is created at:
tray-app/src-tauri/target/release/bundle/dmg/Claude Monitor_x.x.x_aarch64.dmg
Double-click the DMG and drag "Claude Monitor" to your Applications folder.
When launching for the first time, macOS may show a security warning:
-
"Claude Monitor" cannot be opened because the developer cannot be verified
- Go to System Preferences > Privacy & Security
- Scroll down and click "Open Anyway"
- Or right-click the app and select "Open"
-
Grant necessary permissions if prompted
- The app only reads files from
~/.claude/directory - No network access required (except to open localhost dashboard)
- The app only reads files from
# Start the server (default port: 3456)
./target/release/claude-monitor
# Or with cargo
cargo runOpen http://localhost:3456 in your browser.
Dashboard Features:
- Budget progress bar with percentage and remaining tokens
- Lifetime token statistics
- Active sessions list
- Per-project usage breakdown
- Auto-refresh every 10 seconds
# From terminal
open /Applications/Claude\ Monitor.app
# Or use Spotlight (Cmd + Space)
# Type "Claude Monitor" and press Enter-
Menu Bar Icon: A robot icon appears in your menu bar with the current budget percentage (e.g., "2%")
-
Click the Icon to see:
- 5-hour rolling budget progress bar
- Used/Limit/Remaining tokens
- Active sessions and agents count
- Lifetime token usage (input/output/cache)
- Top 3 projects by usage
- "Open Dashboard" link
- "Quit" option
| Action | Result |
|---|---|
| Click icon | Refresh data and show menu |
| "Open Dashboard" | Opens web dashboard in browser |
| "Quit" | Exit the app |
Menu Bar Features:
- Shows budget usage percentage in the menu bar
- Click icon to refresh and view detailed stats
- 5-hour rolling budget with progress visualization
- Used/remaining tokens
- Lifetime token breakdown (input/output/cache)
- Top projects by usage
- Quick link to open web dashboard
- Auto-refresh every 30 seconds
- Single instance (won't duplicate if opened multiple times)
To start Claude Monitor automatically when you log in:
- Open System Preferences > General > Login Items
- Click + and select Claude Monitor from Applications
- Or drag the app to the Login Items list
| Endpoint | Description |
|---|---|
GET / |
Web dashboard interface |
GET /api/stats |
Token usage statistics (JSON) |
GET /api/sessions |
Active sessions list (JSON) |
GET /api/refresh |
Force data refresh |
GET /partials/budget |
Budget section (HTMX partial) |
GET /partials/stats |
Stats cards (HTMX partial) |
GET /partials/sessions |
Sessions list (HTMX partial) |
{
"total_usage": {
"input_tokens": 60086,
"output_tokens": 65474,
"cache_creation_input_tokens": 1019235,
"cache_read_input_tokens": 26032347
},
"budget": {
"limit": 45000000,
"used": 1122399,
"remaining": 43877601,
"percentage": 2.49,
"window_hours": 5
},
"active_sessions": 1,
"active_agents": 0,
"total_messages": 653
}Claude Monitor reads data from Claude Code's local storage:
~/.claude/
└── projects/
└── {encoded-path}/
├── {session-id}.jsonl # Regular sessions
└── agent-{session-id}.jsonl # Agent sessions
Each JSONL file contains message entries with token usage:
{
"type": "assistant",
"message": {
"usage": {
"input_tokens": 100,
"output_tokens": 50,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 500
}
},
"timestamp": "2024-01-15T10:30:00Z"
}| Component | Technology |
|---|---|
| Web Backend | Rust + Axum |
| Web Frontend | HTMX + CSS |
| Menu Bar App | Tauri 2 |
| File Watching | notify crate |
| Date/Time | chrono |
| Serialization | serde + serde_json |
claude-monitor/
├── src/
│ ├── main.rs # Entry point, CLI, server
│ ├── config.rs # Configuration
│ ├── parser/ # JSONL parsing
│ │ ├── session.rs # Session data & budget
│ │ └── history.rs # History parsing
│ ├── monitor/ # State management
│ │ ├── state.rs # App state & stats
│ │ └── watcher.rs # File system watcher
│ ├── api/
│ │ └── routes.rs # HTTP routes
│ └── web/
│ └── templates.rs # HTML templates
├── tray-app/ # macOS menu bar app
│ └── src-tauri/
│ ├── src/
│ │ ├── main.rs # Tauri app
│ │ └── parser.rs # Shared parsing logic
│ └── icons/ # App icons
└── Cargo.toml
Default settings:
- Web Server Port: 3456
- Auto-refresh (Web): 10 seconds
- Auto-refresh (Menu Bar): 30 seconds
- Active Session Threshold: 5 minutes since last activity
- Rolling Budget Window: 5 hours
- Default Token Limit: 45,000,000 (Max plan)
- Ensure Claude Code has been used and created session files
- Check that
~/.claude/projects/directory exists - Verify file permissions
- This was fixed in recent versions
- Kill all instances:
pkill -f "Claude Monitor" - Relaunch the app
- Another instance may be running
- Kill existing process:
pkill -f claude-monitor - Or use a different port:
cargo run -- --port 3457
Contributions are welcome! Please feel free to submit a Pull Request.
GPL-3.0 License - see LICENSE for details.
- Built for monitoring Claude Code by Anthropic
- Powered by Tauri for the menu bar app
- Uses Axum for the web server