feat: Add energy/carbon tracking and timezone fix #164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive environmental impact tracking for LLM usage and fixes timezone handling in event capture hooks.
Features Added
🌍 Energy & Carbon Footprint Tracking
PAI_ENV_METRICS=1in settings.json📊 Status Line Updates
💎 Tokens | 💰 Cost | ⚡ Energy | 🌍 Carbon📈 Observability Dashboard Updates
🕐 Timezone Fix
capture-all-events.tsnow uses local timezonetimestamp_psttotimestamp_localthroughoutTechnical Details
New Files
.claude/lib/energy-calculations.sh- Calculation library with model-specific constants.claude/Custom_Features.md- Comprehensive feature documentationModified Files
.claude/statusline-command.sh- Added energy/carbon display logic.claude/hooks/capture-all-events.ts- Local timezone support.claude/skills/Observability/apps/client/src/components/widgets/TokenUsageWidget.vue- 2x2 grid.claude/skills/Observability/apps/client/src/components/LivePulseChart.vue- Header metricsCalculation Methodology
Model Energy Estimates (per token):
Constants:
Configuration Example
{ "env": { "PAI_ENV_METRICS": "1", "PAI_CARBON_INTENSITY": "240" } }Regional Carbon Intensity Values:
Research Sources
MIT Study: Power, Latency and Cost of LLM Inference Systems
Google 2025: AI Footprint Update
Hugging Face: CO₂ Emissions Analysis
Environmental Impact Context
Example: 1M tokens daily (mixed models)
Testing
PAI_ENV_METRICS=1Documentation
Complete documentation available in
.claude/Custom_Features.mdincluding:🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com