Accelerating Engineering with Gemini & Codex
A transparent look at how Dinesh Mahajan used Gemini CLI and AI coding assistants to build a multi-layer ETL pipeline in record time - from architecture design to terminal-based validation.
Project Context: Parsing Complex Energy Tariffs
At pchomes inc (an EPC company in the residential solar space), we developed an ROI analysis tool that compares a homeowner's current electricity bill with 500+ other available utility plans. A parser is a specialized software program designed to scan these unstructured documents, identify key text patterns, and extract numerical data into structured database fields. This case study focuses on Octopus Energy - renowned for innovative, dynamic, and time-of-use tariffs.
The parsing engine was developed through a high-velocity collaboration between a human architect and an AI agent operating directly in the terminal via the Gemini CLI.
"The terminal is no longer just for commands; it's a conversational space where architecture is discussed, code is written, and bugs are fixed in real-time by a human-AI duo."
The Dual-AI Strategy
To achieve 100% completion of the workflow, we utilized two distinct AI capabilities in a unified, high-velocity loop:
Gemini CLI: The "Hands" of Execution
The Gemini CLI served as the operational layer. It autonomously navigated the directory structure, read the existing source code to learn the project's patterns, and executed terminal commands (dotnet build, dotnet test). It performed the heavy lifting of code integration without a single manual edit by the human researcher.
Claude.ai & Codex: The "Brain" of Logic
The underlying Claude.ai and Codex-class models acted as the intelligence layer. This "brain" was responsible for complex business logic synthesis: translating raw requirements into precise C# Entity Models and surgical Regular Expressions. It calculated seasonal date ranges and captured multi-tier electricity rates directly from PDF text.
Choosing the Right Tool: The Triple-AI Strategy
To maximize velocity, we treat AI tools as specialized departments within a single engineering firm:
| Role | AI Tool | Specific Use Case |
|---|---|---|
| The Architect | Claude.ai | High-level architectural design, complex logical synthesis, and "why" decisions. |
| The Builder | Codex | Idiomatic C# generation, surgical Regex engineering, and EF Core mapping. |
| The Executor | Gemini CLI | Autonomous terminal orchestration, codebase navigation, code injection, and validation. |
Rule of thumb: Claude designs the strategy, Codex builds the logic, and Gemini CLI applies and validates it in the terminal.
The Workflow: Step-by-Step
Codebase Discovery
Dinesh Mahajan initiated the session by providing project context. Using glob and read_file tools, the AI agent scanned the project structure to understand existing patterns and schemas without manual documentation.
Architectural Strategy & Documentation
Instead of writing code immediately, Claude.ai was used to discuss strategy and draft high-level documentation. This phase established the "two-layer approach" to keep PDF logic separate from ETL orchestration.
Incremental Implementation
Implementation was done in small, verifiable chunks. The AI used write_file to create one class at a time. After each file, Dinesh Mahajan inspected the code and ran dotnet build to ensure no errors were introduced.
Integration & Verification
The AI wired up new services into existing controllers - performing dependency injection, creating API endpoints automatically, then verifying by running the project in the background and checking health endpoints.
Collaborative Roles: Human + AI
Dinesh Mahajan + Claude.ai: Synthesizing the "What"
Dinesh's Role: Provided business context, shared technical brief, established architectural direction. Claude.ai's Role: Processed intent to generate C# models, design report structures, and provide refined technical explanations for the methodology.
Dinesh Mahajan + Gemini CLI: Executing the "How"
Dinesh's Role: Acted as Project Director, issuing high-level execution directives and validating terminal output. Gemini CLI's Role: Autonomous developer - navigated codebase, applied surgical edits via replace, ran dotnet build, and executed test suites.
Case Study: The Octopus Energy Parsing Engine
The "Octopus Parsing" task created a scalable system to ingest Octopus Energy electricity plan PDFs and convert them into structured database records.
Two-Layer Architecture
- USRoofs.Energy.PDF: The "Brain." Handles raw text extraction, deterministic type classification, and specific parsing logic for each plan type (A through F).
- USRoofs.Energy.ETL: The "Orchestrator." Manages manifests (JSON/CSV/Text), handles local or remote file resolution, and drives the multi-threaded processing loop using
OctoEtlProcessor.
The Octopus Parsing Tools
| Component | Role in the Pipeline |
|---|---|
| OctoEtlProcessor | Orchestrates the entire flow: manifest reading, file fetching, classification, parsing, and result aggregation. |
| PdfTemplateClassifier | Determines if a PDF is Type A, C, D, E, or F based on layout and keyword signatures. |
| TypeCFlexParser | Specialized logic for complex "Octopus Flex" plans, extracting seasonal time-of-use rate matrices. |
| PDFUtils (Gemini) | AI-driven structured data extraction from PDF text using Google's Gemini models. |
| Entity Framework Core | Handles persistence to Postgres database with precise column mapping. |
| xUnit / Moq | Testing framework to verify parser accuracy against known "Golden Samples." |
The result is a production-ready data pipeline that transforms a folder of PDFs into a rich, queryable dataset, powering the BessAndSolar energy analysis platform.
Tools Used: Gemini CLI, Google Gemini 1.5 Pro, .NET 8 SDK, Bash. © AI Energy Plans (pchomes, inc.).