💡 Inspiration

Software is invisible, but its carbon footprint is real. Every inefficient loop, every idle server, and every unoptimized cloud workload burns electricity and emits CO₂ — yet most developers have no way to measure the carbon impact of their own code. We were inspired by the Green Software Foundation's SCI standard (ISO/IEC 21031) and the idea that developers should be able to audit, refactor, and reduce the carbon emissions of their software just like they lint for bugs or security vulnerabilities. Building this for the Amazon Developer Hackathon 2026 (Alexa+ Track), we also wanted to explore how voice AI and MCP servers could make carbon auditing as easy as asking, "Alexa, is my code green?"


⚙️ What it does

GreenCode Auditor is a local-first software carbon intelligence platform that helps developers and cloud architects measure, reduce, and block carbon-heavy code:

  • ⚡ Real hardware energy measurement — CPU, GPU, DRAM power via Intel/AMD RAPL, NVIDIA NVML, Apple Silicon (IOKit), Linux cgroup v2, and Scaphandre
  • 📊 Carbon tracking per line of code — SCI (Software Carbon Intensity) scores following ISO/IEC 21031
  • 🤖 AI-powered refactor proposals — generates and verifies optimization suggestions using Amazon Bedrock, Google Gemini Pro, and HuggingFace, with deterministic local fallbacks
  • 💰 AWS Graviton4 ARM64 migration recommendations — up to ~45% estimated cloud cost and energy savings
  • 🌍 Live grid intelligence — real-time carbon intensity from 150+ global regions
  • 🔄 CI/CD carbon gate — blocks carbon-heavy PRs before they merge
  • 🗣️ Alexa+-style voice interface — browser simulator backed by a self-hosted MCP server, so you can audit code by voice
  • 📈 Benchmarks — demonstrated 68% energy reduction on algorithmic hotspots

🏗️ How we built it

We built GreenCode as a decoupled, local-first stack:

  • Backend: FastAPI (Python) with real hardware sensor integration (RAPL, NVML, Apple Silicon IOKit, cgroup v2, Scaphandre) and SCI carbon calculations per ISO/IEC 21031
  • Frontend: Vite + React web app with an Alexa+-style MCP simulator at localhost:5173/alexa-demo
  • MCP Server: Self-hosted Model Context Protocol server exposing audit, energy, SCI, and refactor tools to the simulator and any MCP-compatible client
  • AI Layer: Optional multi-provider refactoring (Amazon Bedrock amazon.nova-pro-v1:0, Google Gemini Pro, HuggingFace) with compile/similarity/behavior-probe verification of every LLM proposal
  • Grid Data: Live carbon intensity from 150+ regions (Electricity Maps)
  • CI/CD: SARIF export and PR-blocking integration
  • Testing: 541 tests (412 backend pytest, 89 frontend Vitest, 40 end-to-end)

🚧 Challenges we ran into

  • Alexa voice pipeline silent failures — circular imports between the MCP server and Alexa skill module left NLU dispatch as None; resolved by extracting shared dispatch logic into a third module
  • ASK response format — _build_ask_response hardcoded PlainText instead of SSML, breaking rich voice responses and reprompt handling
  • Wrong webhook endpoint — alexa/addon.json pointed to the MCP Streamable HTTP transport (/mcp) instead of the ASK webhook (/api/alexa/skill), so voice requests hit the wrong handler
  • Cross-platform energy measurement — abstracting RAPL, NVML, Apple Silicon, and cgroup v2 into a unified API that works locally without root where possible
  • AI verification — ensuring LLM-generated refactors are actually behavior-preserving and energy-efficient, not just plausible-sounding

🏆 Accomplishments that we're proud of

  • ✅ Fully functional carbon intelligence platform with real hardware energy measurement
  • ✅ Alexa+-style voice interface via self-hosted MCP server for the Amazon Hackathon 2026
  • ✅ 541 passing tests across backend, frontend, and end-to-end suites
  • ✅ Measured 68% energy reduction on algorithmic hotspots and ~45% AWS cost savings via Graviton4 recommendations
  • ✅ Live grid carbon intelligence across 150+ global regions
  • ✅ ISO/IEC 21031 SCI-standard carbon scoring per line of code
  • ✅ CI/CD integration that blocks carbon-heavy PRs and exports SARIF

📚 What we learned

  • How to measure real software energy consumption at the hardware level (RAPL, NVML, Apple Silicon)
  • The ISO/IEC 21031 SCI standard and how to translate energy into carbon emissions
  • Building and securing a self-hosted MCP server for LLM/AI agent integration
  • The pitfalls of voice-AI development: SSML vs PlainText, reprompt handling, webhook routing, and circular imports
  • Verifying AI-generated code refactors so they are safe, behavior-preserving, and actually greener

🚀 What's next for GreenCode

  • Native Alexa+ skill deployment — publish the voice interface as a real Alexa+ Add-On
  • More language support — expand beyond Python/Java to JavaScript, Go, Rust, and C++
  • Deeper CI/CD integrations — GitHub Actions, GitLab CI, and Azure DevOps native carbon gates
  • Cloud provider expansion — carbon and cost recommendations beyond AWS (Azure, GCP)
  • Mobile app — audit your repositories on the go
  • Team dashboards — organization-wide carbon intensity tracking and reduction goals
  • Automated PR refactoring — AI-generated PRs that reduce carbon, with developer approval

Built With

  • alexa+
  • amazon-bedrock
  • amazon-web-services
  • aws-graviton
  • carbon-footprint
  • ci/cd
  • electricity-maps
  • fastapi
  • google-gemini
  • green-software
  • hackathon
  • hugging-face
  • iso/iec-21031
  • local-first
  • mcp-(model-context-protocol)
  • nvml
  • python
  • rapl
  • react
  • sarif
  • scaphandre
  • sci-(software-carbon-intensity)
  • sustainability
  • typescript
  • vite
Share this project:

Updates

Submission history