24 June 2025

Code Green - Building Energy Analysis Tools - Blog Series part 5

Written by: Mahdi Ghazimoradi

Throughout our Code Green blog series, we’ve explored the fundamentals of AI, LLMs, and RAG systems. Now it’s time to see these concepts come together in practice through the two energy efficiency analysis tools we’ve developed: an IntelliJ IDEA Plugin and a Web Application.

Both tools serve the same fundamental purpose—helping developers identify and optimize energy consumption in their Java projects—but they target different use cases and audiences. Let’s explore how each tool works and the design decisions behind them.

Project Overview

Our energy efficiency analyzer project consists of two complementary tools:

1. IntelliJ IDEA Plugin - For Individual Developers

A comprehensive plugin that integrates directly into the developer’s IDE, providing on-demand analysis and recommendations within their familiar development environment.

2. Web Application - For Teams and Organizations

A user-friendly web interface that allows teams to upload project archives and receive detailed energy efficiency reports, perfect for code reviews and organizational assessments.

Both tools leverage local AI models through Ollama, ensuring privacy and eliminating dependency on external AI services. This approach gives organizations complete control over their code analysis while maintaining data security.


IntelliJ IDEA Plugin: Developer-Focused Analysis

The IntelliJ plugin is designed for developers who want to integrate energy efficiency analysis directly into their development workflow. Developed using Kotlin, it provides a seamless experience within the IDE.

Core Features

Project Scanning and Analysis When developers click the “Analyze Project” button, the plugin:

  • Scans Java and Kotlin source files in the project
  • Processes dependency configuration files (pom.xml, build.gradle, build.gradle.kts)
  • Analyzes configurable file extensions based on user preferences
  • Focuses on /src/main directories to avoid test code noise

Customizable Configuration The plugin offers extensive customization through its settings panel:

  • Configure Ollama server URL and model selection
  • Set included file extensions for analysis
  • Customize system prompts for specific analysis needs
  • Include or exclude dependency configuration files
  • Add optional context URLs for additional information

Context Enhancement Developers can upload additional documentation to enhance analysis:

  • PDF documents with energy efficiency guidelines
  • Word documents with company-specific standards
  • Text files with project-specific requirements
  • HTML files with relevant web content

Real-time Results Analysis results stream in real-time, allowing developers to:

  • Monitor progress as the AI processes their code
  • See recommendations appear incrementally
  • Stop analysis if needed without losing partial results
  • Copy results to clipboard or save as PDF for sharing

RAG Implementation: Naive RAG Approach

The plugin implements a Naive RAG approach through the ContextService, chosen for its simplicity and developer control:

class ContextService private constructor(
    settings: EnergyAnalysisSettingsState,
    private val embeddingStore: EmbeddingStore<TextSegment>
) {
    fun findRelevantSources(text: String): EmbeddingSearchResult<TextSegment> {
        val embedding = embed(text)
        return embeddingStore.search(
            EmbeddingSearchRequest.builder()
                .queryEmbedding(embedding)
                .build()
        )
    }
}

Why Naive RAG for the Plugin?

  • Developer Control: Allows fine-tuning of retrieval parameters
  • Resource Efficiency: Lightweight approach suitable for IDE environments
  • Transparency: Developers can see and control what context is being used
  • Flexibility: Easy to modify and extend for specific project needs

The RAG system processes uploaded documents by splitting them into chunks, embedding them, and retrieving relevant sections when analyzing code. This ensures that project-specific guidelines and standards are incorporated into the analysis.

User Experience

A typical workflow with the plugin:

  1. Setup: Developer configures Ollama server and preferred models
  2. Context Upload: Optionally uploads company coding standards or energy efficiency guidelines
  3. Analysis: Clicks “Analyze Project” to scan current codebase
  4. Review: Receives streaming recommendations with specific file references and energy impact estimates
  5. Action: Implements suggested optimizations and re-analyzes to measure improvements

Web Application: Team-Oriented Analysis

The web application provides a different approach, designed for teams and organizations that need centralized analysis capabilities. Built with a Java/Quarkus backend and React frontend, it offers a streamlined experience for analyzing uploaded projects.

Architecture Overview

Backend (Java + Quarkus)

  • RESTful API for file upload and analysis
  • Streaming response handling for real-time results
  • Integrated AI model communication
  • Built-in knowledge base with energy efficiency data

Frontend (React)

  • Clean, intuitive interface for file uploads
  • Real-time streaming display of analysis results
  • Dark/light theme support
  • PDF export and clipboard functionality

Core Features

Simple Upload Process Users can quickly analyze projects by:

  • Uploading ZIP files containing Java projects
  • Automatic extraction and processing of source files
  • No configuration required - works out of the box
  • Support for standard project structures (Maven, Gradle)

Automated Analysis The system automatically:

  • Identifies Java and Kotlin source files
  • Processes build configuration files
  • Applies pre-configured energy efficiency knowledge
  • Generates comprehensive reports with actionable recommendations

Export Options Users can easily share results through:

  • PDF generation for reports and documentation
  • Clipboard copying for quick sharing
  • Formatted display optimized for readability

RAG Implementation: Easy RAG Approach

The web application uses Quarkus’s built-in Easy RAG capabilities for simplicity and automation. Easy RAG automatically processes files from a configured directory and stores them in an embedding store, but accessing this store from other services requires a special configuration.

CDI Bean Configuration To access the Easy RAG embedding store across different services, we created a CDI bean producer:

@ApplicationScoped
public class BeanConfig {

    @Produces
    @ApplicationScoped
    EmbeddingStore<TextSegment> embeddingStore() {
        return CDI.current().select(EmbeddingStore.class).get();
    }
}

This configuration allows us to inject the same embedding store that Easy RAG uses for file ingestion into our analysis service:

@ApplicationScoped
public class EnergyAnalysisService {
    
    @Inject
    EmbeddingModel embeddingModel;
    
    @Inject
    EmbeddingStore<TextSegment> embeddingStore; // Same store used by Easy RAG
    
    private Multi<String> retrieveRelevantInformationAsync(String query) {
        return Multi.createFrom().item(() -> embeddingModel.embed(query).content())
                .flatMap(embedding -> {
                    EmbeddingSearchRequest request = EmbeddingSearchRequest.builder()
                            .queryEmbedding(embedding)
                            .maxResults(3)
                            .minScore(0.7)
                            .build();
                    return Multi.createFrom().item(() -> embeddingStore.search(request));
                });
    }
}

How Easy RAG Works in Our Setup

  1. Automatic Ingestion: Easy RAG scans the configured directory (src/main/resources/data) and automatically embeds all files
  2. Shared Store: The BeanConfig class provides access to the same embedding store across services
  3. Query Processing: When analyzing projects, we can search this pre-populated store for relevant context
  4. Seamless Integration: The analysis service retrieves relevant information without manual embedding management

Why Easy RAG for the Web App?

  • Zero Configuration: Users don’t need to configure anything
  • Automated Processing: System handles all complexity internally
  • Built-in Knowledge: Includes curated energy efficiency data
  • Scalability: Simple to deploy and maintain in production

The Easy RAG implementation automatically incorporates:

  • Built-in Java energy efficiency benchmarks (from java.txt)
  • Latest JDK version performance data
  • Spring Framework optimization guidelines
  • GraalVM native image benefits

The system also fetches additional context from configured web sources, ensuring recommendations stay current with latest best practices.

User Experience

A typical workflow with the web application:

  1. Access: Team member visits the web application
  2. Upload: Drags and drops a project ZIP file
  3. Processing: System automatically extracts and analyzes the code
  4. Results: Real-time streaming of energy efficiency recommendations
  5. Sharing: Exports results as PDF or copies to clipboard for team discussion

Comparison and Use Cases

Aspect IntelliJ Plugin Web Application
Target Users Individual developers Teams and organizations
Integration Deep IDE integration Standalone web interface
Configuration Highly customizable Zero configuration
Context Manual document upload Automated knowledge integration
Processing On-demand analysis Upload-and-analyze workflow
Results IDE-integrated display Web-based reporting
Sharing Copy/PDF from IDE Built-in export options

When to Use Each Tool

Use the IntelliJ Plugin when:

  • Working on individual development tasks
  • Need deep integration with existing workflow
  • Require customized analysis parameters
  • Want to upload project-specific documentation
  • Prefer IDE-native user experience

Use the Web Application when:

  • Conducting team code reviews
  • Need to analyze projects without IDE setup
  • Want to share results with non-technical stakeholders
  • Require standardized analysis across organization
  • Prefer simple, browser-based access

Real-World Impact

Both tools provide actionable recommendations that help developers:

Identify Energy Inefficiencies

  • Outdated Java versions with higher energy consumption
  • Inefficient framework choices for specific use cases
  • Suboptimal collection usage patterns
  • Missing caching opportunities
  • Oversized dependency configurations

Quantify Improvements

  • Specific energy savings percentages
  • Performance impact estimates
  • Resource utilization improvements
  • Cost reduction calculations

Implement Changes

  • Step-by-step upgrade instructions
  • Alternative technology suggestions
  • Code optimization examples
  • Best practice recommendations

Lessons Learned

Architecture Decisions

Tool Separation Benefits

  • Each tool serves its specific audience optimally
  • Different RAG approaches suit different use cases
  • Maintenance complexity is manageable per tool
  • User experience is tailored to context

Local AI Integration

  • Privacy and security requirements met
  • No external dependencies for sensitive code
  • Consistent performance across environments
  • Cost-effective for organizations

Technical Insights

RAG Implementation Choices

  • Simple approaches often provide better user experience
  • Configuration complexity should match user expectations
  • Built-in knowledge reduces setup burden
  • Context quality matters more than quantity

User Experience Design

  • IDE users expect granular control
  • Web users prefer automated simplicity
  • Real-time feedback improves engagement
  • Export options are essential for team workflows

Conclusion

The development of these energy efficiency analysis tools demonstrates how AI can be practically integrated into developer workflows. By building both an IDE plugin and web application, we’ve created solutions that meet developers where they are—whether working individually in their IDE or collaborating as teams through web interfaces.

The key insight from this project is that successful AI tools require careful consideration of user context and needs. The same underlying capability (energy efficiency analysis) benefits from different implementations and interfaces depending on how and where it’s used.

Both tools prove that energy-conscious development doesn’t require sacrificing productivity or convenience. Instead, they make energy efficiency a natural part of the development process, helping create more sustainable software one project at a time.

This concludes our Code Green blog series, where we’ve journeyed from understanding AI fundamentals to building practical tools for sustainable software development. We hope these insights and tools inspire more developers to consider the environmental impact of their code and contribute to a more sustainable future for software development.


Open Source and Community

Both tools are available as open source projects on GitLab. We encourage developers, researchers, and organizations to explore, use, and contribute to these tools:

IntelliJ IDEA Plugin

Web Application

Contributing and Feedback

We believe that sustainable software development requires community collaboration. Whether you’re a developer interested in energy-efficient coding, a researcher studying software sustainability, or an organization looking to reduce your digital carbon footprint, we’d love to hear from you.

Ways to Get Involved:

  • Try the tools with your own projects and share your experiences
  • Contribute code improvements, bug fixes, or new features
  • Suggest additional energy efficiency patterns and optimizations
  • Share your energy consumption measurements and results
  • Help us extend support to other programming languages and frameworks

Share Your Ideas:

  • Have suggestions for improving the analysis accuracy?
  • Know of additional energy efficiency patterns we should detect?
  • Ideas for integrating with other development tools?
  • Thoughts on measuring and tracking energy improvements over time?

Your feedback and contributions will help make these tools more effective and expand their impact across the software development community. Together, we can make sustainable coding practices more accessible and widespread.


The Project “Code Green - Sustainable Software Development” is supported by the SIDN Fonds. Read more about SIDN Fonds and Project Code Green at www.sidnfonds.nl/projecten/project-code-groen


Mahdi Ghazimoradi

Mahdi is an experienced Software Engineer specializing in scalable microservices, legacy system modernization, and real-time data analysis. He excels at optimizing workflows, accelerating integrations, and delivering impactful projects across various domains. Proficient in Java, Kotlin, Spring Boot, SQL and NoSQL databases, and messaging systems, Mahdi focuses on enhancing system performance, improving test coverage, and building maintainable, efficient applications. His work significantly boosts scalability, reusability, and readability. Outside of work, he enjoys tackling challenging technical projects to stay sharp and explore new technologies. When he’s not coding, you’ll find him cycling, exploring innovative ideas, watching movies, or listening to music and podcasts.