Skip to content

GreenSage

GreenSage is a VS Code extension that analyzes your code and suggests energy-efficient improvements based on Green Software Foundation guidelines, helping developers reduce energy use, optimize performance, and write sustainable code.

Core trick

A VS Code extension sends the highlighted code to OpenAI and shows an energy-efficient rewrite with reasoning in a side panel.

Tags

Description

GreenSage – A VS Code Extension for Sustainable Code Suggestions GreenSage is an intelligent Visual Studio Code extension designed to help developers write environmentally sustainable and energy-efficient code. Built on the principles of the Green Software Foundation, GreenSage integrates with the OpenAI API to analyze selected portions of code and provide intelligent suggestions for improvement. Developers can simply highlight any code snippet and click a dedicated button in the editor toolbar to receive suggestions in a side panel. These suggestions include the original code, a more sustainable version, and a detailed reason for the change. Users can also choose to automatically replace the selected code with the optimized version. GreenSage empowers developers to write better, greener software while learning sustainable practices along the way — making it both an educational and practical tool in modern development workflows.
AvinashDwivedi/GreenSage★ 01 forksTypeScriptMITCreated Aug 21, 2025 · last push Aug 28, 2025

README excerpt

# 🌱 GreenSage – VS Code Extension for Sustainable Coding

GreenSage is a **Visual Studio Code extension** that helps developers write **energy-efficient, carbon-aware, and sustainable code** by following the principles of the [Green Software Foundation](https://greensoftware.foundation/).  

It analyzes selected portions of your code and suggests improvements that reduce **energy consumption, carbon emissions, and hardware waste**, while still maintaining correctness and performance.  

---

## ✨ Features

- 🔍 **Selective Code Analysis** – Highlight code in your editor and click *Analyze Selected Code* to receive green suggestions.  
- ⚡ **Intelligent Improvements** – Suggestions are generated using AI, guided by the **Green Software Foundation’s Software Carbon Intensity (SCI)** framework.  
- 🎨 **Theme Aware UI** – The results panel matches your VS Code theme (dark/light).  
- ♻️ **Replace with One Click** – Apply suggested code changes directly in your file with a **Replace in Editor** button.  
- 📊 **GSF-Aligned Guidance** – Recommendations follow **energy efficiency**, **carbon awareness**, and **hardware efficiency** principles.  

---

## 📦 Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/your-username/greensage.git
   cd greensage
   ```

2. Install dependencies:
   ```bash
   npm install
   ```

3. Compile the extension:
   ```bash
   npm run compile
   ```

4. Open the project in **VS Code**:
   ```bash
   code .
   ```

5. Press `F5

Team