CodeLedger
Token-level cost intelligence for AI coding tools.

CodeLedger is a Claude Code plugin that tracks where your AI coding tokens go — per-project, per-agent, per-skill — across Claude Code, Codex CLI, Cline, and Gemini CLI. It separates your actual coding work from background plugin overhead, sets budget alerts, and detects spend anomalies. Ask questions conversationally via MCP tools, or browse the local dashboard.
Setup & MCP Tools

Dashboard

Why CodeLedger?
Running Claude Code agents can burn through tokens fast. A single session with 49 parallel subagents can cost $8,000-$15,000. But you have zero visibility into:
- Which project costs the most?
- Which agent burned the most tokens?
- How much is plugin overhead (claude-mem observers, auto-compaction) vs your actual work?
- Are you using Opus for tasks that Sonnet handles just as well?
- Am I going to blow my budget this month?
- How much am I spending across all my AI coding tools?
No existing tool answers these questions. CodeLedger does.
What Makes It Different
| Capability | ccusage | Agentlytics | tokscale | CodeLedger |
|---|
| Per-project tracking | Yes | Yes | No | Yes |
| Per-agent token breakdown | No | No | No | Yes |
| Per-skill attribution | No | No | No | Yes (~estimated) |
| User vs overhead cost split | No | No | No | Yes |
| Session category classification | No | No | No | Yes |
| Cost optimization recommendations | No | No | No | Yes |
| Budget alerts & anomaly detection | No | No | No | Yes |
| Multi-tool cost tracking | No | Yes (16+) | Yes (16+) | Yes (4 tools) |
| Conversational querying via MCP | No | No | No | Yes |
| Local web dashboard | No | Yes | No | Yes |
| Runs as Claude Code plugin | No | No | No | Yes |
Quick Start
Install from npm
npm install -g codeledger
Run Claude Code with the plugin
macOS / Linux:
claude --plugin-dir $(npm root -g)/codeledger
Windows (PowerShell):
claude --plugin-dir "$(npm root -g)\codeledger"
Windows (CMD):
for /f "delims=" %i in ('npm root -g') do claude --plugin-dir "%i\codeledger"
This loads everything — 9 MCP tools, 4 hooks (real-time tracking), and slash commands.
Anthropic Plugin Marketplace: CodeLedger has been submitted to the official Claude Code plugin directory and is pending approval. Once approved, installation will be simply:
/plugin install codeledger
Until then, use the npm install method above.
Start the dashboard
npx codeledger dashboard
Opens a local dashboard at http://localhost:4321 with charts, tables, and drill-downs.
Install from source (development)
git clone https://github.com/bhvbhushan/codeledger.git
cd codeledger && npm install && npm run build
claude --plugin-dir .
Features
9 MCP Tools (conversational querying)
Ask Claude directly — no dashboards needed:
usage_summary — "How much have I spent today?" (includes spend velocity + budget status)
project_usage — "Which project costs the most?"
model_stats — "What's my model distribution?"
agent_usage — "Which agents burned the most tokens?"
skill_usage — "How much does brainstorming cost vs code review?" (~estimated)
cost_optimize — "How can I reduce my costs?" (6 evidence-based rules including anomaly detection)
budget_set — "Set my monthly budget to $200"
budget_status — "Am I on track for my budget?" (utilization + projected overshoot)
cross_tool_cost — "How much am I spending across all my AI tools?"
User vs Overhead Classification
CodeLedger automatically separates your actual coding work from background noise:
This Week — $142.62
Your coding agents: $122.76 (86%)
Background overhead: $19.87 (14%)
Plugin observers (acompact-*)
System agents (aprompt_suggestion-*)
Zero configuration. Works by detecting agent ID prefixes — a structural signal present in all Claude Code versions.
Session Categories (auto-classified)
Every session is classified by what kind of work it does, based on tool usage patterns: