gwittebolle/claude-carbon
A Claude Code plugin that estimates session emissions locally from token usage.
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
claude-carbon is a Shell-based Claude Code plugin with a claude-carbon CLI entry point. Its integration uses Claude Code hooks, slash commands, and status-line settings. persist-session.sh runs on Stop and SessionEnd, while backfill.sh imports retained JSONL transcripts. Both process the main session, subagents, and workflow agents, deduplicating assistant records by (message.id, requestId) before saving token counts to local SQLite.
On the hot path, statusline.sh reads the session row in carbon.db instead of rescanning transcripts every turn. The main transcript is read in full during persistence; completed agent totals can be reused if the transcript's file metadata is unchanged. An agent transcript with a partially written line is not cached. Set CLAUDE_CARBON_NO_USAGE_CACHE=1 to disable cache reads and writes.
Key Capabilities & Differentiators
The accounting engine applies per-model emission factors to Anthropic Claude usage, recording input, cache writes, cache reads, and output separately. Cache reads count toward total tokens and use an 8% energy factor in the model. The terminal status line and Claude desktop Code tab show estimated session emissions alongside API list-price equivalents. SQLite preserves recorded history after transcript cleanup, while backfill can recover only logs still on disk.
/carbon-report produces text totals; /carbon-panel compares the current session with the user's historical median and shows period usage and warming stripes. /carbon-card generates shareable cards. /carbon-pr aggregates sessions by project and branch, can attribute qualifying worktree-agent usage to another branch, and creates or updates one sticky comment using the developer's gh authentication.
Trade-offs & Limitations
The strongest use is comparing personal usage over time, not measuring absolute emissions. The CO₂ figures are factor-based estimates rather than metered energy or verified emissions, and the dollar figure is API list-price equivalence, not a subscription charge. Compared with ccusage, the plugin uses the same deduplication approach but adds carbon factors, desktop visualization, and PR reporting. The live display trades freshness for a simpler read path and can lag by one turn.
PR figures describe the developer's recorded Claude Code activity, not the full footprint of a PR. Attribution can follow the branch where a session ends, and sessions recorded under a subdirectory can be left out. Older records without branch metadata can be repaired only while their transcripts survive. The MIT-licensed plugin is a fit for individual local tracking; centralized team reporting is a separate hosted offering. Optional PR publication sends a summary to GitHub and should be treated separately from local accounting.
Hardware & Deployment Guide
Install the plugin through Claude Code's plugin marketplace on macOS, Linux, or Windows, then fully restart and begin a new session. The Shell-based integration needs jq and sqlite3, plus Git Bash on Windows; the package manifest declares Node.js >=18. GitHub PR posting uses gh, and PNG cards need Playwright and Chromium; without that rendering stack, the summary falls back to HTML.
For manual setup, scripts/setup.sh and scripts/configure-settings.sh install and wire the hooks and commands. CLAUDE_CONFIG_DIR can isolate separate Claude environments, including their databases. Accounting runs locally without a hosted service. v1.20.0 introduced first-session status-line registration only when none exists; v1.20.1 moved the command for Homebrew packaging without changing its interface; v1.21.0 defaults to English and the world car factor when no locale is detected.
(message.id, requestId) and stores separate input, cache-write, cache-read, and output counts.carbon.db, trading freshness for a simpler read path and a one-turn lag./carbon-panel compares the session with its historical median; /carbon-card exports PNGs or an HTML summary when browser rendering is unavailable./carbon-pr aggregates local sessions by project and branch, with SubagentStop capturing eligible worktree branches before they disappear.Claude Code developers who want local emissions estimates, usage trends that survive transcript cleanup, and optional PR summaries.
You need audited emissions, actual subscription charges, or a centralized inventory across developers and AI tools.
Quick Start & Installation
curl -fsSL https://raw.githubusercontent.com/gwittebolle/claude-carbon/main/install.sh | CLAUDE_CARBON_DIR=~/my-path/claude-carbon bash
Comparison vs. Top Coding, Skills & MCP Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| claude-carbon ★ | 259 | +3 | Shell | MIT | A Claude Code plugin that estimates session emissions locally from token usage. |
| ECC | 316.1k | +4.2k | JavaScript | MIT | Plugins and CLI workflows for planning, reviewing, and verifying agent-written c |
| caveman | 124.8k | +1.4k | Go | Apache-2.0 | Coding-agent skill and local Go proxy for shorter replies and smaller tool outpu |
| rtk | 88.7k | +684 | Rust | Apache-2.0 | A local Rust CLI wrapper that trims command output before coding agents read it. |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/gwittebolle/claude-carbon.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about claude-carbon
What updates the live total, and will it replace an existing status line?
Does it need a GPU, and what drives local resource use?
Can a company use it locally without subscribing to a hosted service?
When would I choose claude-carbon over ccusage?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy