Inspiration

Data centers used 415 terawatt-hours of electricity in 2024, and the International Energy Agency projects this could reach 945 terawatt-hours by 2030. Beyond electricity, data centers contribute to greenhouse gas emissions and consume water for cooling and power generation. As AI usage grows, unnecessary requests and oversized model calls add to this environmental footprint without necessarily improving results. In fact, a 2026 study on over 100,000 production queries found that 65% of them were duplicate and wasteful requests. We wanted to help developers identify and eliminate this waste at its source: the code.

What it does

Prune is a GitHub tool that finds and fixes wasteful AI usage before code ships. Prune first scans the codebase for AI calls and flags potential inefficiencies, including oversized models, repeated instructions, duplicate requests, and excessive response limits. Prune then follows how each AI response is used by the surrounding code to identify cases where the application requests more than it needs. Third, it replays original requests against the proposed changes to compare results and verify that the application still behaves as expected. Prune will then present the proposed code changes, test results, and estimated cost, electricity, and water savings in a pull request for developers to review. Unlike tools that only route requests to cheaper models or cache repeated prompts, Prune targets the underlying code and tests whether changes preserve the behavior developers need.

How we built it

We built Prune around a GitHub pull request workflow using Chalk's products. We used sandboxes to provide an isolated environment for running code and tests. Model Gateway handles AI model calls and usage information. Agent evals are used to replay original requests to compare the original and optimized versions, and federal queries combine usage and pricing data with our estimates of electricity and water consumption.

Challenges we ran into

Our biggest challenge was determining and creating a proposed change would still work for the application's specific task. Lower cost sometimes trades off with correct results, so we needed to compare proposed changes against real requests rather than assume they were safe. Estimating environmental impact was also difficult as electricity and water consumption are harder to predict than just token usage, as it depends on factors such as model hardware, data center cooling, energy sources, etc. Our environmental figures are therefore estimates, not direct measurements.

Accomplishments that we're proud of

We built a prototype that connects six checks for common sources of AI waste with request replay/comparisons, proposed code changes, and an estimated savings calculator.

What we learned

We learned that reducing AI's environmental footprint requires more than choosing a cheaper model. How often a model is called, how much context it receives, and how much of its response the application actually uses all affect resource consumption. We also learned that environmental savings need to be estimated carefully and that an optimization is only useful if the application continues to behave as expected.

What's next for Prune

We plan to expand our checks, improve the accuracy of our environmental estimates, and test Prune on more real-world codebases. Over time, we want to build a library of tested optimizations that can be reused across projects and rechecked as models and prices change, helping developers avoid rediscovering the same fixes.

Built With

  • agent
  • ai
  • chalk
  • code-tracing
  • github-app
  • nextjs
  • sandbox
  • sustainability
Share this project:

Updates

Submission history