convez.ai
PluginUtilidadesIntermediário
JeremieSamson

Green Code

JeremieSamson/green-code

Rastreie e compense a pegada de carbono da IA plantando árvores reais

Ver no GitHub
InicialPluginScore · de 0 a 100

Plugin que rastreia a pegada de carbono do seu uso de Claude Code e planta árvores automaticamente via Tree-Nation para compensar as emissões. Estima consumo energético e CO2 baseado em pesquisa publicada, com suporte a modo automático ou manual de compensação.

Instalação

$npx convez-ai JeremieSamson/green-code

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
7
Forks
1
Acompanhando
0
Saúde
28%
Último commit
há 2 meses
Versão
v1.1.0
Issues abertas
0
Contribuidores
2

Casos de uso

  • Developers conscientes de impacto ambiental que querem neutralizar uso de IA
  • Equipes de tech com metas de sustentabilidade corporativa
  • Pesquisadores estudando eficiência energética de LLMs

Veredito

Plugin bem fundamentado em dados científicos reais (TokenPowerBench, AWS sustainability reports), com integração transparente via Tree-Nation. Adição valiosa para quem leva sustentabilidade a sério, embora dependa de API externa e exija token da Tree-Nation.

README

A tradução para o português deste README ainda está na fila.

green-code

Track your AI carbon footprint and plant trees to compensate.

green-code session start summary

What it does

  • Shows a carbon footprint summary at every Claude Code session start (CO2 emitted, trees planted, debt, progress bar towards next tree)
  • Silently tracks your Claude Code token consumption at each session end
  • Estimates energy use (kWh) and CO2 emissions based on published research
  • Two modes: auto (plant trees automatically at threshold) or manual (track and plant on demand)
  • Plants real trees via Tree-Nation API

Install

/plugin marketplace add JeremieSamson/green-code
/plugin install green-code@green-code-marketplace

On first launch, the plugin asks for your Tree-Nation API token and preferences.

Commands

CommandDescription
/green:statusView your carbon footprint and tree balance
/green:plantPlant trees to offset accumulated CO2
/green:plant 3Plant a specific number of trees
/green:plant 3 "message"Plant trees with a custom dedication message (shown on the certificate)
/green:configView current configuration
/green:config mode autoSwitch to auto-plant mode

How it works

Token tracking

At each session end, the plugin reads ~/.claude/stats-cache.json and computes the delta since the last check.

Energy estimation

Per-model base cost in Wh per output token. Other token types are derived as ratios that match Anthropic's API pricing tiers (which track underlying compute cost):

Model familyWh / output tokenRationale
Opus0.002Dense ~400B-class, TokenPowerBench Llama-405B reference
Sonnet0.0008Mid-size MoE / dense
Haiku0.0003Small fast model
(unknown)0.001Conservative default
Token typeRatio vs outputEffective Wh (Opus)
Output1.000.002
Input (fresh)0.200.0004
Cache creation0.250.0005
Cache read0.020.00004

CO2 conversion

  • Default: 320 gCO2/kWh (cloud-provider weighted US mix with renewable PPAs; AWS sustainability report 2024)
  • PUE 1.15 for datacenter overhead, aligned with AWS 2024 global average
  • 1 tree = 10 kg CO2 (configurable)

Tree-Nation

Trees are planted via the Tree-Nation REST API. You need a Tree-Nation account and API token. Each planting carries a dedication message shown on the public certificate: pass your own (/green:plant 3 "message") or let the plugin fill in a default (Offsetting {co2} kg CO2 - Claude Code AI usage - {date}).

Sources

  • TokenPowerBench, AAAI 2026 -- arxiv.org/abs/2512.03024 (per-model output-token energy at frontier scale)
  • "Energy Considerations of LLM Inference", arXiv 2504.17674 (prefill vs decode energy)
  • Luccioni et al., "Power Hungry Processing", ACM FAccT 2024
  • AWS Sustainability Report 2024 -- aws.amazon.com/sustainability/data-centers/ (PUE 1.15)
  • Anthropic Prompt Caching docs (cache read ~90% reduction vs fresh input)
  • IEA, "Electricity 2024" -- iea.org/reports/electricity-2024

Localization

Shell script output (session start, setup wizard, planting feedback) is auto-translated based on $LANG. Supported locales: fr and en (default). Skills (/green:status, /green:plant, /green:config) remain in English -- they are Markdown prompts loaded by Claude, who will naturally respond in the user's language anyway.

Limitations

  • Energy estimates have ~x2 uncertainty -- no AI provider publishes per-token energy data
  • Claude's exact architecture (dense vs MoE) is not public
  • CO2 depends on datacenter location; US mix is the default assumption
  • stats-cache.json may not update in real-time in all Claude Code versions

Prerequisites

  • jq (JSON processor) -- install: sudo apt install jq / brew install jq
  • bc (calculator) -- usually pre-installed on Linux/macOS
  • curl -- usually pre-installed
  • Tree-Nation account + API token

License

MIT

Ver o original no GitHub

Bom para

Relacionados