BrightSource
BrightSource
About: BrightSource

Accelerating a critical business transaction by automating technical documentation for millions of lines of C++ legacy code using AWS Bedrock and Advanced RAG.

How BrightSource Energy Used GenAI to Unlock Value in Legacy Code

Accelerating a critical business transaction by automating technical documentation for millions of lines of C++ legacy code using AWS Bedrock and Advanced RAG.

 

About BrightSource Energy

BrightSource Energy enables the global transition towards a sustainable and resilient energy ecosystem with a disruptive Energy Management System (EMS). Their flagship OASES™ platform is a flexible and powerful solution that revolutionizes asset management, improving energy efficiency, reliability, and profitability. BrightSource combines breakthrough solar technologies with advanced storage and optimization capabilities to manage renewable energy resources worldwide.

The Challenge: The “Black Box” of Legacy Code

BrightSource was approaching a critical strategic milestone: leasing a core portion of their software assets to a third-party company. However, a significant obstacle threatened to derail the deal.

The asset in question was built on a massive, legacy C++ codebase. Over years of development, the original authors had moved on, leaving behind a “knowledge vacuum.” The code was functional but virtually undocumented.

  • The Knowledge Gap: Current developers faced a bottleneck trying to explain the code to the technical writing team.
  • The Resource Drain: A team of 6 technical writers was struggling to make sense of the complex class structures and inheritance hierarchies manually.
  • The Risk: Without comprehensive, accurate documentation, the third-party client could not verify the asset’s value, putting the lease agreement at risk.

BrightSource needed a solution that could not just “read” code, but understand its structure, map its logic, and explain it clearly—fast.

The Solution: A “Code Cartographer” Agent

BrightSource partnered with Sela to build a GenAI-powered agent capable of autonomous technical documentation. The solution moved beyond simple code completion; it acted as an intelligent “Code Cartographer,” mapping the entire repository.

Key Capabilities

  1. Deep Code Mapping (Graph + Vector): Because C++ relies heavily on complex relationships (inheritance, polymorphism), simple text search wasn’t enough. The team utilized a Hybrid Retrieval approach:
    • pgvector on AWS RDS: To handle semantic understanding of the code logic (Vector Search).
    • Neo4j (Graph Database): To map the structural relationships between classes, headers, and dependencies.
  2. The Brain (AWS Bedrock): The core analysis was powered by the Claude 4.5 family (Opus, Sonnet, and Haiku) via AWS Bedrock.
    • Haiku handled rapid scanning and simple commenting.
    • Sonnet managed the structuring of documentation.
    • Opus was leveraged for the most complex architectural questions requiring deep reasoning.
  3. Interactive Interface: A Q&A interface allowed the technical writer to “interview” the code (e.g., “How does the SolarFieldOptimizer class interact with the GridStorage module?”).

Architecture Highlights

  • Compute: The agent was containerized and deployed on Amazon ECS Fargate for serverless, scalable compute that could handle the heavy processing load during the initial mapping phase.
  • Workflow: The agent pulled raw code directly from Git, processed it in the ECS environment, generated the necessary comments/docs, and committed them back to the repository.

The Results

The deployment of the GenAI agent fundamentally transformed BrightSource’s documentation process and saved the deal.

  • 83% Efficiency Gain in Technical Writing: The technical writing team was reduced from 6 writers to just 1. The role shifted from “manual drafter” to “reviewer/editor,” focusing on validating the AI’s output rather than writing from scratch.
  • Eliminated Developer Bottlenecks: Engineering staff were freed from the burden of explaining legacy code, allowing them to focus on active development.
  • Successful Deal Closure: The third-party company accepted the code handover, satisfied with the depth and accuracy of the newly generated documentation.

Lessons Learned

Structure is as Important as Semantics. When dealing with legacy languages like C++, using a Vector Database alone is often insufficient because it captures meaning but loses structure“We learned that to truly document legacy code, you cannot just read the text; you must map the connections. Integrating a Graph Database (Neo4j) alongside our Vector DB was the turning point that allowed the AI to understand not just what a function ‘does,’ but how it fits into the larger machine.”