Skip to content
E

EcoLint

#codecarbon

Created on 12th July 2026

โ€ข

E

EcoLint

#codecarbon

The problem EcoLint solves

EcoLint ๐Ÿƒ

AI-Powered FinOps Optimizer, Security Scanner, & VS Code Extension

EcoLint is a comprehensive suite of tools designed to drastically reduce the computational footprint of your code. By acting as an advanced FinOps engine, it intelligently analyzes your source code to optimize performance (speed, RAM, CPU cycles), calculate carbon and cost savings, and apply automated cybersecurity patches.

The EcoLint project is divided into two primary interfaces:

  1. The VS Code Extension (/ecolint & /backend)
  2. The Terminal CLI Tool (/ecolint-cli)

๐Ÿ’ป 1. EcoLint for VS Code

The EcoLint VS Code extension brings our AI-powered code analysis, benchmarking, and optimization directly into your IDE. It communicates with a dedicated backend language server to provide real-time suggestions and automated refactoring.

โœจ Extension Features

  • Analyze (ecolint.analyze): Analyzes the current code for performance bottlenecks and structural issues.
  • Benchmark (ecolint.benchmark): Runs simulated performance benchmarks on the active file.
  • Optimize (ecolint.optimize): Automatically optimizes the selected code inline.
  • Generate Pull Request (ecolint.generatePullRequest): Generates a summary PR containing the analysis results and optimization justifications.
  • Interactive UI: Integrates directly into the VS Code Activity Bar with dedicated views for Analysis Results, Benchmarks, and Optimizations.

๐Ÿ› ๏ธ Extension Setup

The VS Code extension requires the backend server to be running:

  1. Start the Backend:
    cd EcoLint/backend
    npm install
    npm run start # (or equivalent dev script)
    
  2. Install the Extension:
    cd EcoLint/ecolint
    npm install
    # Press F5 in VS Code to launch the Extension Development Host
    

(Note: Ensure ecolint.apiEndpoint in your VS Code settings points to your running backend).


๐Ÿš€ 2. EcoLint CLI

The EcoLint CLI is a lightweight, terminal-based alternative for fast, pipeline-friendly optimizations.

โœจ CLI Features

  • ๐Ÿง  Multi-Mode AI Optimization:
    • Maximum Performance: Strips formatting and readability to compress variables and maximize raw computational speed. (C/C++ Aware: Replaces heavy includes with lightweight forward declarations).
    • Balanced Production: Achieves high performance while adhering strictly to clean architectural principles.
    • Educational Mode: Provides a JSON-formatted technical breakdown explaining the complexity shifts (e.g., $O(N^2) \rightarrow O(N)$).
  • ๐Ÿ”’ Intelligent Security Scanner (SOLID Design): Scans entire files for severe vulnerabilities (SQL Injections, XSS) and offers 1-click automated security patches.
  • ๐Ÿ“Š Eco Metrics Telemetry: Simulates the real-world impact of your code optimizations (Latency, RAM, Carbon Reduction, Cost Savings).
  • ๐Ÿ’ฌ Dynamic Custom Directives: Override the engine with natural language rules (e.g., "Do not remove comments").

๐Ÿ› ๏ธ CLI Setup & Usage

  1. Installation:
    cd EcoLint/ecolint-cli
    npm install
    
  2. Configuration: Add your AI provider API Key to ecolint-cli/.env:
    NVIDIA_API_KEY=your_api_key_here
    
  3. Usage:
    npm run build
    
    # Optimize and secure a specific file
    npm start -- --file ../test.c
    
    # Optimize a specific line range
    npm start -- --file ../test.c --lines 10-25
    

๐Ÿ“š Documentation

For more in-depth architectural details, API documentation, and contribution guidelines, please refer to the /docs directory.

๐Ÿงช Testing the Pipeline

You can test the core AI engine using the provided test files at the root of the repository:

  • vulnerable_test.py: Contains O(N^2) loops and glaring security flaws (Hardcoded Secrets & SQL Injection). Tests both the FinOps optimizer and the Security Scanner.
  • test.c: Contains standard C code. Tests the C/C++ specific include optimizations.

Challenges we ran into

Here are the major technical problems and roadblocks we encountered (and successfully solved!) while building the EcoLint project:

  1. The AST web-tree-sitter Module Crash
    The Problem: When we first tried to implement Abstract Syntax Tree (AST) parsing to deeply analyze code structure, we hit a hard crash: SyntaxError: The requested module 'web-tree-sitter' does not provide an export named 'default'.
    The Solution: This happened because our project uses modern ESM (ECMAScript Modules, type: "module"), but the library was built for older CommonJS environments. Since it blocked the build, we pivoted, ripped out the AST logic, and shifted our focus entirely to LLM-based parsing and optimization instead.
  2. The AI Ignoring the "Don't Remove Comments" Rule
    The Problem: You passed a custom directive saying "don't remove comments", but the AI kept deleting them anyway.
    The Solution: The underlying Maximum Performance system prompt was so aggressive ("Ignore code readability, documentation... at all costs") that it overpowered your custom instruction. We solved this by wrapping your custom instructions in a CRITICAL USER DIRECTIVE block, explicitly telling the AI that your instructions strictly override its default system behavior.
  3. DeepSeek Minifying and Squashing Code
    The Problem: When you switched to the DeepSeek AI model and ran it on test.c, it output the code as a giant, unreadable block of text squashed onto a single line.
    The Solution: The AI took our instruction to "optimize for token constraints at all costs" far too literally and deleted all spaces and line breaks to save tokens. I updated the system prompt to explicitly command it: "CRITICAL: You must preserve standard code formatting, indentation, and line breaks. Do not minify or squash the code."
  4. Git Submodule & Push Failures
    The Problem: When you tried to push the code to GitHub, Git threw warnings about an "embedded git repository" and later failed with fatal: 'ecolint_cli' does not appear to be a git repository.
    The Solution: Because ecolint-cli had its own hidden .git folder inside it, Git treated it as a detached submodule, meaning it wasn't actually saving your files to the main EcoLint repo. We solved this by deleting the inner .git folder, clearing the cache, and re-adding it so the main repository could properly track all your code.
  5. Architectural Bloat (SOLID Principles)
    The Problem: When you asked to add a full-file Security Vulnerability Scanner on top of the FinOps optimizer, the main AI engine and orchestration file were at risk of becoming a massive, unmaintainable "spaghetti" script.
    The Solution: We applied SOLID principles (specifically the Single Responsibility Principle) by entirely separating the cybersecurity logic into a brand new securityController.ts. This kept the optimization engine fast and clean, while allowing the security scanner to run as an independent layer just before saving the file.

Technologies used

Discussion

Builders also viewed

See more projects on Devfolio