The problem
Coding agents change code until tests pass. Left alone they chase speed or style and can break behaviour while 'optimising'. GreenCode's Constitution gives an agent five inviolable rules, correctness first, and 37 ranked anti-patterns to hunt.
The fix you can use today
- Add an energy skill or rules file to your agent's instructions.
- Make correctness, security and public interfaces non-negotiable in those rules.
- Ask the agent to justify each change and to measure before and after.
GreenCode researchers wrote energy rules for AI coding agents, and the agents saved 25.1% of the energy.
Tools that help
- GreenCode Constitution skill (GreenCode researchers): open-source energy principles and a catalogue of 37 energy anti-patterns that an AI coding agent can follow to find and fix waste like this
- GreenCode Constitution profiler (profile.sh) (GreenCode researchers): a script from the Constitution tooling that measures the energy of a command from processor counters, GPU sensors and an optional smart plug, and writes the result as JSON
- EnergyBench (GreenCode researchers): an MIT-licensed benchmark that scores LLM-generated code for correctness and for the energy it actually uses
How GreenCode helps
GreenCode helps tackle this by publishing the Constitution for anyone to use. An AI agent profiles the code, fixes ranked energy anti-patterns, measures again and keeps only the changes that save energy, leaving changes developers can review. More on this.
Tags
#llm#ai-assistants#refactoring
Sources
All GreenCode Tech Tips