Back to Portfolio

Architecture review and hands-on guide for air-gapped ESG and BRSR compliance analytics

Under the Hood of Carbon Engine & How to Use It

Source Code

Carbon Engine is an open-source (GPLv3), air-gapped desktop platform and local inference daemon built for statutory corporate sustainability reporting (SEBI BRSR, BRSR Core, and GRI). Unlike cloud-based ESG tools that upload sensitive corporate filings to remote APIs, Carbon Engine performs document ingestion, OCR, vector indexing, and LLM extraction entirely on your local machine.


Tech Stack Review

Inspecting the repository (CMakeLists.txt and src/) shows a tightly integrated native C++20 architecture designed for speed, privacy, and zero external runtime dependencies:

1. Core Language & Three-Binary Architecture

The codebase separates background compute, lifecycle supervision, and desktop UI into three coordinated C++20 executables:

  • carbon-engine (src/apps/server): The background ingestion, indexing, and inference daemon listening on http://localhost:8080. Direct standalone launches are blocked by design; it runs under carbon-tray supervision or as a registered Windows Service / systemd service.
  • carbon-tray (src/apps/tray): A lightweight system tray companion that monitors daemon health, manages autostart, and downloads local .gguf models.
  • carbon-engine-client (src/apps/qml-client): A Qt 6.10 (Quick / QML, QuickControls2, WebEngineQuick) desktop workspace with split-view layout, real-time CPU/GPU telemetry, inline editing, and report preview.
  • Inference (llama.cpp): Compiled with GGML_BACKEND_DL and GGML_CPU_ALL_VARIANTS for dynamic multi-architecture CPU dispatch (AVX2/SSE4.2/Alderlake/SkylakeX, etc.), plus optional CUDA 12.x (GGML_CUDA=ON) for NVIDIA GPU acceleration.
  • Models: Uses BGE-Small EN v1.5 (bge-small-en-v1.5-f16.gguf) for embeddings and Gemma 2 2B Instruct (gemma-2-2b-it-q4_k_m.gguf) for context-budgeted structured extraction.
  • Vector Indexing (FAISS v1.9.0): Embedded C++ vector search backed by Intel MKL on Windows (or BLAS/LAPACK on Linux).

3. Document Ingestion, OCR & Reporting Pipeline

  • PDF & OCR (PDFium + Tesseract 5.3.3 + Leptonica 1.83.1): DocumentProcessor extracts native UTF-16LE PDF text via PDFium when character density exceeds the native threshold, and automatically falls back to Tesseract OCR for scanned exhibits (statically linked with zlib, libjpeg-turbo, and libpng).
  • Spreadsheets (ZipReader + QXmlStreamReader): Parses Excel/OOXML workbooks locally without external Python or Office dependencies.
  • Report Templating (Inja v3.4.0): Renders standalone HTML audit deliverables with embedded styling and charts.

4. Storage & HATEOAS REST API

  • Persistence (SQLite WAL): Stores project state, extracted BRSR disclosures, and vector data in <Documents>/Carbon ESG/data/ce-database.sqlite using Write-Ahead Logging for durability.
  • Hypermedia API (Qt HttpServer): Exposes an RFC 8288 / HAL-style REST API on http://localhost:8080 where _links dynamically advertise only valid actions for the current job state (for example, cancel during processing, start_extraction after ingestion completes, and export_report once reviewed).

How to Use Carbon Engine

Step 1: Download or Build the Application

Option A: Pre-built Application (Recommended)
Download the Windows installer (CarbonESG-<version>-Windows-x64.exe) or Linux .deb package from https://carbonesg.online/.

  • Windows: Run the installer (installs to C:\Program Files\Carbon ESG and adds Start Menu shortcuts).
  • Linux: Install the package with:
    sudo dpkg -i carbon-esg_*.deb
    

Option B: Build from Source (Windows MSVC 2022)
Ensure you have Qt 6.10+, CMake 3.28+, Visual Studio 2022 (C++ & .NET desktop workloads), and NASM 2.15+ installed:

git clone https://github.com/carbonservices/carbon-engine.git
cd carbon-engine

cmake -S . -B __Builds/x64/_build -G "Visual Studio 17 2022" -A x64 `
      -DCMAKE_PREFIX_PATH="C:/Qt/6.10.2/msvc2022_64"

cmake --build __Builds/x64/_build --config Release `
      --target carbon-engine --target carbon-engine-client --target carbon-tray

Binaries are written to __Builds/x64/bin/.

Step 2: Start the Tray Companion & Download Local Models

Launch carbon-tray from your Start Menu (or __Builds/x64/bin/carbon-tray.exe).

  1. Right-click the Carbon Engine icon in the system tray to verify daemon status.
  2. If models are not present yet, trigger model download from the tray menu. Models are saved locally under <Documents>/Carbon ESG/models/:
    • bge-small-en-v1.5-f16.gguf
    • gemma-2-2b-it-q4_k_m.gguf
  3. Alternatively, for headless enterprise setups on Windows, register and start carbon-engine as a Windows Service (Run as Administrator):
    carbon-engine.exe --install-service
    carbon-engine.exe --start-service
    
    (On Linux .deb installs, use sudo systemctl start carbon-engine.)

Step 3: Open the Desktop Workspace & Run an Extraction

Launch carbon-engine-client from the tray menu or Start Menu:

  1. Stage Documents: Drag and drop annual reports (.pdf), sustainability exhibits, or Excel workbooks into the left staging dock.
  2. Run Ingestion: Click to ingest. Carbon Engine parses native PDF text, runs Tesseract OCR on scanned pages, preserves tables, and builds local FAISS vector indexes.
  3. Start Statutory Extraction: Once ingestion completes, trigger BRSR extraction. Track live progress, GPU/CPU hardware telemetry, and missing metrics in real time.
  4. Review & Edit Disclosures: Inspect extracted BRSR Principles and Essential Indicators alongside page-level source citations, and edit any cell values inline.
  5. Lock & Export: Accept the reviewed report to freeze its state and export a standalone HTML or PDF audit deliverable.

All user models, logs (<Documents>/Carbon ESG/logs/), and SQLite data stay strictly inside your local Documents/Carbon ESG/ directory, making backups as simple as archiving that folder.