claude-radar
v2.2.0
Published
Monitor and visualize your Claude Code token usage, costs, and ROI across projects
Maintainers
Readme
Claude Radar
Know exactly where your tokens go.
Local-first dashboard for Claude Code — track token usage, costs, ROI, and git cost-per-commit across all your projects. Your data never leaves your machine.
npx claude-radar⚡ Quick Start
npx claude-radar
# Or install globally
npm install -g claude-radar
claude-radar serveOpens the dashboard at http://localhost:3400. First run indexes your ~/.claude/ data (~5s).
✨ Features
Real-time canvas visualization. Each building = a project, height = cost. Stars twinkle on cache hits, sky shifts with spend intensity. Billing gauges, token rate sparkline, and stats bar overlay.
Three hero KPIs (paid vs API value vs ROI), 20+ interactive charts, project/model breakdown tables, activity heatmap. Everything you need at a glance.
Every git commit mapped to its Claude session cost. Cost per commit, per branch, per line of code. Most expensive commits ranked. Nobody else has this.
Gantt timeline, efficiency grades (A-F), duration tracking, cost-per-hour. Click any session for full message replay with token burn timeline.
12 automated detection rules: cost spikes, cache efficiency, 5-hour billing window, model recommendations, usage concentration, inactive projects, and more.
Interactive sliders: what if you shifted model usage? What if cache improved? See projected savings instantly.
GitHub-style 7×24 grid showing when you code with Claude most, by hour and day of week.
Auto-classifies sessions by work type: bug fixing, exploration, greenfield, refactoring, testing, review. Cost breakdown per type.
Tool usage distribution, call patterns, subagent cost tree. See which tools Claude uses most and how subagents contribute to cost.
5 tools for querying usage directly from Claude. "How much have I spent?" "Which project costs most?" Add to settings.json and ask.
claude-radar stats prints usage summary to terminal. Supports --json for scripting. No browser needed.
Tag and annotate important sessions for quick access later.
1-7 to switch tabs, ? for help, R to refresh. Full keyboard navigation.
One-click HTML report with KPIs, project table, model breakdown, git costs, and week-over-week comparison.
Auto-redacts API keys, tokens, JWTs, emails, IPs in message previews. 10 pattern types.
Dark (default), Light, and High Contrast.
**WebSocket watches ~/.**claude/ for changes. Dashboard updates as you code. Optional browser notifications.
JSON, CSV, and HTML report exports. All respect current date filters.
📦 Release Notes
- 🎛️ "What If" Cost Simulator — model switching & cache improvement calculator
- 📅 Activity Heatmap — GitHub-style hour × day grid
- 📈 Prompt Efficiency Scoring — A-F grades per session
- 🏷️ Session Clustering — auto-classify: bug fixing, exploration, greenfield, refactoring
- 💰 Budget Alerts — monthly budget tracking with burn-down gauge
- ⚡ CLI Quick Stats —
claude-radar statsterminal command - 🔖 Session Bookmarks — tag & annotate sessions
- ⌨️ Keyboard Shortcuts — 1-7 tabs, ? help, R refresh
- 🧠 Model Recommendations — "switch to Haiku and save $X"
- 🔧 Subagent Cost Tree — parent → child cost hierarchy
- 📄 Week-over-week Comparison — report generator with delta arrows
- 💡 Tooltip Help — ? icons on every chart explaining what it shows
- 📟 5h Window Gauge — real % from Claude statusline hook
- 🗂️ New JSONL fields — speed, web_search, web_fetch, sidechain indexing
- 📊 Cost per Line — LoC/$ charts on Git Costs tab
- 🌃 Live City Skyline — real-time canvas visualization with buildings per project
- 📟 Billing gauges — billing period + 5-hour window
- 📈 Token rate sparkline — top-left rate history
- 📊 Stats bar overlay — tok/sec, tokens, cost, cache, model, msgs
- 🔄 WebSocket + polling — live data refresh every 5s
/api/liveendpoint for 5h window stats/api/project/:idand/api/projectsendpoints
- 📊 Executive dashboard with 15+ charts
- 🔗 Git-to-cost tracking (cost per commit, branch, line)
- 💬 Session browser with Gantt timeline
- 🧠 AI Insights Engine (10 detection rules)
- 🔧 Tool & subagent analytics
- 🤖 MCP server with 5 tools
- 📄 Report generator
- 🔒 PII redaction (10 patterns)
- 🎨 3 themes (dark, light, contrast)
- 📡 Real-time WebSocket updates
- 🧪 86 tests, 72% coverage
- 🔐 Security: localhost-only, origin checking, parameterized SQL, SRI
💻 Commands
| Command | Description |
|---------|-------------|
| npx claude-radar | Start dashboard (default) |
| claude-radar stats | Print usage summary to terminal |
| claude-radar stats --json | JSON output for scripting |
| claude-radar serve -p 8080 | Custom port |
| claude-radar serve --no-open | Don't auto-open browser |
| claude-radar setup | Configure subscription plan |
| claude-radar mcp | Start MCP server (stdio) |
🤖 MCP Server
Let Claude answer questions about your usage in conversation.
Add to ~/.claude/settings.json:
{
"mcpServers": {
"claude-radar": {
"command": "npx",
"args": ["claude-radar", "mcp"]
}
}
}Then ask: "How much have I spent?" · "Which project costs most?" · "Am I getting good ROI?"
📟 5-Hour Window Tracking
Claude Radar can show your real-time 5-hour billing window usage on the Live page.
Update your statusline in ~/.claude/settings.json to use the Claude Radar hook:
{
"statusLine": {
"type": "command",
"command": "bash /path/to/claude-radar/bin/statusline-hook.sh"
}
}This captures rate_limits.five_hour.used_percentage and resets_at from Claude Code and feeds it to the dashboard gauge.
⚙️ How It Works
Claude Code stores detailed usage data in ~/.claude/. Claude Radar:
- Indexes JSONL files into SQLite (incremental — first run ~5s, subsequent instant)
- Deduplicates by UUID (other tools overcount by ~12%)
- Correlates git commits with session time ranges for cost-per-commit
- Serves via Express with 25+ REST endpoints + WebSocket
- Watches for changes and updates in real-time
🏗️ Architecture
~/.claude/ (read-only) Claude Radar
┌─────────────────────┐ ┌──────────────────────────────┐
│ projects/*.jsonl │──────▶│ SQLite Indexer (incremental) │
│ stats-cache.json │ │ Git Scanner (commit mapping) │
│ history.jsonl │ │ Express Server (25+ APIs) │
└─────────────────────┘ │ WebSocket (live updates) │
│ MCP Server (5 tools, stdio) │
Your git repos └──────────┬───────────────────┘
┌─────────────────────┐ │
│ .git/ (commit logs) │──────▶ Dashboard (localhost:3400)
└─────────────────────┘ 8 tabs · 20+ charts · 3 themes🔐 Security
- Binds to 127.0.0.1 only — not accessible from LAN
- Origin checking on all HTTP and WebSocket connections
- Parameterized SQL · Escaped HTML ·
execFileSync(no shell injection) - Chart.js with SRI hash · PII auto-redacted ·
npm audit: 0 vulnerabilities
📋 Requirements
- Node.js 18+
- Claude Code installed (with data in
~/.claude/) - Git (for commit cost tracking)
License
MIT
