Ficus
A local carbon ledger for Claude Code. It reads your session transcripts,
estimates the electricity, water and CO2e behind them, keeps the total in your
statusline, and records the offsets and donations you buy against it.
Everything runs on your machine. No network calls, no telemetry, no installer.

Documentation → — install, where the
data comes from, how every figure is calculated, and the research behind each
organisation it links to.
Live demo dashboard →
(fabricated data: fake sessions, fake purchases, fake receipt)
Install
You need bash, jq and sqlite3. Nothing else, and there is nothing to add
to a package manager.
git clone https://github.com/signalblur/ficus.git
cd ficus
bash scripts/setup.sh
setup.sh checks those three dependencies, creates
~/.claude/carbon-ledger/carbon.db, writes factors.env, backfills whatever
transcripts are still on disk, and prints a hook block. Paste it into
~/.claude/settings.json and reload Claude Code:
{
"hooks": {
"Stop": [{ "matcher": "", "hooks": [{ "type": "command", "command": "<repo>/scripts/persist-session.sh" }] }],
"SessionStart": [{ "matcher": "", "hooks": [{ "type": "command", "command": "<repo>/scripts/safety-rescan.sh" }] }]
}
}
For /carbon, /carbon-offset and /carbon-review, symlink the three skills:
ln -s "$PWD/skills/carbon/SKILL.md" ~/.claude/commands/carbon.md
ln -s "$PWD/skills/carbon-offset/SKILL.md" ~/.claude/commands/carbon-offset.md
ln -s "$PWD/skills/carbon-review/SKILL.md" ~/.claude/commands/carbon-review.md
Each skill resolves the repo through $CARBON_LEDGER_DIR, so export that in
your shell profile pointing at your clone.
The statusline segment is opt-in and merges into your own
~/.claude/statusline.sh. docs/statusline-segment.md
walks through it; statusline-snippet.sh at the repo root is the reference
implementation.
State lives in ~/.claude/carbon-ledger/ (database, receipts, exports,
dashboards). CARBON_LEDGER_DB overrides the database path and everything else
is derived from it, which is how the tests run against throwaway sandboxes.
Where the numbers come from
No vendor publishes per-query energy for a hosted model. Every figure in this
tool is an estimate carrying roughly ±50% uncertainty. Trends and relative
comparisons hold up; absolute values are indicative, and none of it is fit for
regulatory reporting.
No script hardcodes a constant. They all live in data/*.json next to a
_source field, and these are the ones that matter:
| Constant | Value | Source recorded in data/factors.json |
|---|
| CO2e per million tokens | 39 in / 826 out (Sonnet), scaled for the rest | Jegham et al. 2025, arXiv:2505.09598. Opus is 2x Sonnet, Haiku 0.5x, Fable 2x Opus. |
| Grid carbon intensity | 0.287 gCO2e/Wh | AWS location-based intensity, same paper |
| PUE | 1.14 | AWS fleet, same paper |
| Water | 0.18 L/kWh on-site + 5.11 L/kWh off-site | AWS 2023 sustainability figure; WRI generation-water intensity via Li et al. |
| Embodied carbon | 44.1 gCO2e/kWh | 8xH100 server LCA (BoaviztAPI + Lees-Perasso), 3-year life at TDP |
| Cache-read energy | 0.08 of an input token | Engineering estimate, not a measurement. The widest single lever here, because cache reads are most of the tokens. |
Energy is not a second model. energy_wh = co2_grams / 0.287 is an identity:
the CO2 factors are facility energy times grid intensity, so dividing recovers
the energy exactly. Water and embodied carbon derive from that same energy.
There is one estimate in the ledger, not four.
Full derivations, every constant with its date, and the uncertainty bands are in
METHODOLOGY.md.
What the footprint actually lands on
Three things this tool counts, and one published measurement for each.
Electricity. US data centres used 176 TWh in 2023, 4.4% of all US
electricity, up from 76 TWh (1.9%) in 2018, and are projected at 325 to 580
TWh (6.7% to 12.0%) by 2028. Berkeley Lab, 2024 United States Data Center
Energy Usage Report (LBNL-2001637,
December 2024). Globally the IEA puts data centres at around 415 TWh in 2024,
about 1.5% of world electricity, roughly doubling to 950 TWh by 2030
(Key Questions on Energy and AI,
April 2026).