/green-stats:setupfrom green-stats
First-run setup for green-stats — detects the environment (shell, tools, docker/podman), asks the user where and how to collect Claude Code usage, writes the config, and ports the collector to PowerShell if bash is unavailable. Use on first use, or when the user wants to reconfigure green-stats (e.g. enable/disable devcontainer collection).
Ships in green-stats. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The data directory is $GREEN_STATS_HOME, defaulting to ~/.local/share/green-stats (%LOCALAPPDATA%\green-stats on native Windows). The config is config.json there.
Try:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/green-stats.sh" check
docker and/or podman are present, and any missing: tools.Get-Command docker, podman.If a config already exists, this is a reconfigure: read it and use its current values as the defaults for the questions.
Use one AskUserQuestion call with only the questions that apply:
"devcontainers": false.~/.claude from another machine, or a custom CLAUDE_CONFIG_DIR. The default is none.${CLAUDE_PLUGIN_ROOT}/config/default-config.json to the data directory as config.json, unless one exists.devcontainerscontainer_runtimeextra_paths (colon-separated)grid_gco2_per_kwhdefault_daysscript"key": value per line. The script reads it with grep/sed.Settings are always changed through the config, never by editing the script. That covers podman vs docker, extra roots, and container home directories (container_homes).
"script": "bash". Done.${CLAUDE_PLUGIN_ROOT}/scripts/green-stats.sh to <data dir>/green-stats.ps1. Keep the same subcommands, options, config keys and file formats (state/*.jsonl, usage/YYYY-MM.jsonl), so the data stays compatible.message.id|requestId with max per counter, read only from stored byte offsets, process complete lines only, and match only the first "usage":{"input_tokens": object."script": "powershell".pwsh -File <data dir>/green-stats.ps1 check and then report --days 7 to confirm it works.missing: in check output):
<data dir>/green-stats.sh and patch only the affected commands."script" to that path.Run the report once:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/green-stats.sh" report
The first run reads everything, so it takes longer. Later runs only read new data. Show the output, and tell the user they can re-run /green-stats:setup to change settings.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub jaksa76/green-stats --plugin green-stats3 skills in this plugin
/reportReport Claude Code token usage and estimated energy/CO2 for a time window, broken down by model, day or source (host or devcontainer). Collects new transcript data incrementally first. Use when the user asks how many tokens they used, their Claude usage, or the energy or carbon footprint of their Claude usage./update-modelView or update green-stats' energy estimation model — per-token Wh coefficients per model tier, PUE, grid carbon intensity — optionally researching newer published estimates, and assign tiers to models the report lists as unmapped. Use when the user wants to see, tune, refresh or question the energy/CO2 assumptions.