Inspiration

This project started after my internship at an engineering firm. The company spent an incredible amount of time approving vendor documents for massive infrastructure projects—contractor invoices, tax forms, complex Schedule of Values (SOV) matrices, and engineering change orders. The process was entirely manual. Someone had to open the files, compare a spreadsheet against a PDF, check a W-9 against the vendor record, and remember whether a change order was actually approved by the project manager.

It worked until it didn't. A W-9 shows one EIN; the contractor's invoice shows another. A line item in the SOV matrix bills an amount that still sits under "pending approval." None of these mistakes look dramatic on a single file—they only emerge when you lay the whole package side-by-side.

I realized the last check before a $2 million project payment deserves more than a tired pair of eyes and a stack of Excel tabs. That's what GATE is: the last gate before payment. You upload the package, the agent cross-checks the logic, and holds the release until the numbers, tax IDs, and signatures actually agree.

What it does

GATE is a fully localized GraphRAG agent acting as the final pre-payment approval gate for engineering enterprises. It ingests multi-document vendor submission packages and returns a clear payment decision: HOLD, REVIEW, or APPROVE.

When a package is uploaded, the GATE agent immediately generates a visual Micro Report, charting errors across the entire package so reviewers see exactly where the project risks lie. It detects cross-document conflicts—such as a W-9 tax ID conflicting with an invoice, or an unapproved engineering change order attached to a billing cycle.

Each file opens in a visual review panel: the document preview (with exact coordinates highlighted), the compliance findings, and a transparent Decision Trace.

Crucially, the GATE agent never makes the final payment. It is built around a strict Human-in-the-Loop (HITL) philosophy. The AI does the heavy lifting—cross-referencing rules and flagging errors—but a human supervisor must manually check the boxes to confirm the findings and authorize the final release.

How we built it

  • Backend & Privacy: We built a 100% local, air-gapped architecture. Sensitive engineering and financial PDFs never leave the network. We used FastAPI and PyMuPDF for pixel-accurate text extraction and bounding-box rendering.
  • Knowledge Engine: We abandoned vanilla RAG (which fails at cross-document logic) in favor of LightRAG backed by Ollama running Llama 3.1. Administrators upload their engineering compliance manuals, and the agent builds a local entity graph.
  • Frontend: We built a lightning-fast, zero-dependency SPA (HTML/CSS/JS) with purely native SVG visualizations to ensure the deployment remains lightweight.

Challenges we ran into

  • The Ingestion Trade-off: GraphRAG ingestion is inherently slow compared to flat vector indexing. We made a deliberate architectural trade-off: we accept slower, one-time policy ingestion (building the graph) in exchange for an incredibly fast, highly accurate agent capable of cross-document logic at runtime.
  • Coordinate Mapping: Mapping LLM findings back to exact X/Y coordinates on a PDF was finicky, especially for visual elements like missing signatures on a W-9, requiring us to blend PyMuPDF search with hard-coded visual bounding boxes.
  • Live vs. Demo Stability: Processing a full 9-file ZIP via live GraphRAG on local hardware can be unpredictable during a 3-minute pitch. To ensure a stable demonstration, our ZIP package workflow uses a pre-calculated JSON replay, while our single-PDF upload path uses the live, real-time RAG pipeline.

Accomplishments that we're proud of

  • True Cross-Document Integrity: Identifying that a tax ID on Document A conflicts with the ID on Document B, resulting in a single, unified HOLD verdict for the entire project package.
  • The Decision Trace: Engineering firms hate black-box AI. We expose the exact logic chain (Classification -> Policy Match -> Conflict) so project managers can defend their decisions in an audit.
  • Visual Auditing: We don't just output text; we draw a red box around the exact missing signature block on the W-9 PDF preview.
  • Human-Centric AI: Implementing a workflow where the agent flags the errors, but the human user retains total control over the final approval and vendor communication.

What we learned

We learned that flat RAG is just a glorified search engine; it cannot understand that a specific number on an invoice and a W-9 represent a unified business problem. Graph structure is mandatory when the unit of work is a package, not a single page. We also learned that procurement teams at engineering firms don't want a chatbot—they want an autonomous gatekeeper with a defendable audit trail.

What's next for GATE

  • Engineering ERP Connectors: Integrating directly with industry-standard systems (like Procore, SAP) to pull Purchase Orders and Vendor Master Data automatically for a seamless three-way match.
  • Batch Processing: Building a nightly scan mode for AP queues to pre-audit everything sitting in "pending payment."
  • Live Multi-File Auditing: Optimizing our local GraphRAG pipeline to process 10+ file packages live, in under 15 seconds, without relying on preset data.

Built With

Share this project:

Updates