Greenbelt banner
mikhail-tokarev mikhail-tokarev

Greenbelt

Development community

Description

Greenbelt is Claude Code hooks that track token usage across Claude Code sessions and plants trees to reduce your CO2 impact

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Greenbelt 🌱

Greenbelt tracks token usage across Claude Code sessions and plants trees whenever your token usage crosses a configurable threshold (1M tokens by default). It uses [Ecologi API](https://ecologi.com/) and runs as a Claude Code hook — no manual steps required after setup.

[Ecologi](https://ecologi.com) is a climate action platform that helps individuals and businesses take measurable, credible action for climate and nature. Fund tree planting from €0.80 (£0.60) per tree. File a feature request if you want to use a different provider.

Get started

Copy and paste the AI prompt:

Clone https://github.com/mikhail-tokarev/greenbelt into the ~/.claude folder and add the hooks as described in README.md

**1. Register the hooks**

Add the following to your Claude Code settings (`~/.claude/settings.json`):

[!IMPORTANT] Replace `/path/to/greenbelt` with the absolute path where you cloned the repo.

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 /path/to/greenbelt/session_hook.py"
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 /path/to/greenbelt/session_hook.py"
          }
        ]
      }
    ]
  }
}

**2. Configure Ecologi**

On the first run, Greenbelt creates `~/.claude/greenbelt.toml` automatically:

provider = "ecologi"
threshold = 1_000_000   # plant trees every 1M tokens

[ecologi]
api_key = ""            # get it from https://app.ecologi.com/impact-api

Fill in your [Ecologi API](https://app.ecologi.com/impact-api) key. Adjust `threshold` to control how often trees are planted.

**That's it.** From this point on, Greenbelt runs silently in the background. At the start of each session it shows how many trees you've planted so far.

Uninstall

  1. Remove the hooks — delete the SessionStart and `SessionEnd