Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

GATE

The Last Gate Before Payment.

GATE is a local-first procurement compliance platform. Upload vendor documents — invoices, W-9s, purchase orders, spreadsheets, or full ZIP packages — and get policy-grounded audit results with visual highlights, cross-document integrity checks, and a full decision trace. No cloud APIs. No data leaving your machine.

Built on LightRAG (GraphRAG) and Ollama, GATE is designed for teams that need serious compliance review without sending financial documents to third-party AI services.


Why GATE exists

Procurement and AP teams still lose hours on manual cross-checks: Does the W-9 EIN match the invoice? Does the packing list quantity align with the PO? Is engineering sign-off documented before release?

Generic chatbots hallucinate policy clauses. Vector-only RAG misses relationships across files. GATE takes a different path — it builds an entity graph from your ingested compliance manuals, then audits each submission against that graph with a local LLM.

The result is not just a chat answer. It is a structured review workflow: classified documents, severity-tagged findings, PDF coordinate highlights, package-level conflict detection, and an auditable decision chain you can hand to a vendor or an internal approver.


What you can do

Capability Description
Multi-format intake PDF, Excel (.xlsx/.xls), Word (.docx/.doc), and ZIP vendor packages
Live compliance audit LightRAG + Llama 3.1 — findings grounded in your ingested rules, not hardcoded samples
PDF review UI Color-coded overlays (compliant / warning / critical) with zoom and page navigation
ZIP package integrity Extract, classify, and cross-link documents; detect EIN/PO/qty conflicts across the package
Micro Report Per-document error line chart for multi-file submissions
Decision Trace Step-by-step reasoning chain from classification through final hold/approve
Knowledge base Ingest compliance manuals; GraphRAG builds entities and relations for Q&A
AI Copilot (Aria) Attach findings and ask follow-up questions in context
Human review → email Confirm findings and generate a vendor response draft

Architecture

Upload (PDF / Excel / Word / ZIP)
        │
        ▼
┌───────────────────┐
│  Parse & Classify │  PyMuPDF · native xlsx/docx parsers
└─────────┬─────────┘
          ▼
┌───────────────────┐
│  LightRAG Query   │  Graph + vector dual retrieval
│  (local Ollama)   │  llama3.1 + mxbai-embed-large
└─────────┬─────────┘
          ▼
┌───────────────────┐
│ Structured Audit  │  Policy-grounded findings + coordinates
└─────────┬─────────┘
          ▼
   Review UI · Decision Trace · Micro Report

Air-gapped by design. GATE runs entirely on localhost. Ollama serves the LLM; FastAPI serves the API and static UI. No OpenAI, no Azure, no document egress.


Quick start

Prerequisites

  • macOS or Linux (Windows via WSL works with minor script tweaks)
  • Ollama installed
  • Python 3.10+

Run locally (recommended)

cd lightrag-backend
chmod +x gate.sh gate-supervisor.sh
./gate.sh start

Open http://localhost:8080

gate.sh will:

  1. Start Ollama (if needed) and pull llama3.1 + mxbai-embed-large
  2. Launch the FastAPI backend with an auto-restart supervisor
  3. Open the browser

First-time setup

  1. Sign in and enter your company name during onboarding.
  2. Go to Compliance Manuals and upload your procurement / AP / vendor policies (PDF or text). LightRAG ingests them into the knowledge graph.
  3. Upload vendor documents on the Upload tab.

Note: Audits are only as good as the rules you ingest. With an empty knowledge base, GATE will return minimal or no findings rather than inventing compliance issues.

Other commands

./gate.sh status    # health check
./gate.sh stop      # stop backend + supervisor
./gate.sh restart   # full restart

Docker (optional)

cd lightrag-backend
./start.sh          # requires Docker Desktop + Ollama on host

Backend listens on http://localhost:8000 in Docker mode.


Project layout

.
├── README.md
└── lightrag-backend/
    ├── main.py              # FastAPI app — audit, ingest, chat, graph API
    ├── gate_package.py      # ZIP extraction, cross-doc integrity, micro report
    ├── index.html           # Enterprise web UI
    ├── app.js               # Frontend — workflow, review, copilot
    ├── gate.sh              # One-command local launcher (port 8080)
    ├── gate-supervisor.sh   # Process watchdog
    ├── requirements.txt
    ├── Dockerfile
    └── docker-compose.yml

Runtime data (gate_graph_data/, uploads) is created locally and git-ignored.


Tech stack

Layer Stack
API FastAPI, Uvicorn, httpx
RAG LightRAG — graph + vector retrieval
LLM Ollama — llama3.1
Embeddings Ollama — mxbai-embed-large
PDF PyMuPDF (fitz) — text extraction, rendering, bounding boxes
Office stdlib — .xlsx / .docx parsing
Frontend Vanilla JS, IBM Plex Sans, canvas graph animation

API overview

Endpoint Method Purpose
/api/health GET Backend, Ollama, LightRAG status
/api/analyze-proposal POST Audit single PDF / Excel / Word
/api/analyze-zip POST Audit ZIP package (multi-file)
/api/analyze-status/{id} GET Poll async audit job
/api/ingest POST Ingest compliance manual into GraphRAG
/api/graph GET Knowledge graph for visualization
/api/chat POST GraphRAG Q&A with optional attachment context

Environment variables

Variable Default Description
GATE_WORKING_DIR ./gate_graph_data LightRAG storage path
OLLAMA_HOST http://127.0.0.1:11434 Ollama API endpoint
GATE_LLM_MODEL llama3.1 Chat / audit model
GATE_EMBED_MODEL mxbai-embed-large Embedding model
APP_PORT 8080 Uvicorn port (gate.sh)
GATE_MAX_UPLOAD_MB 100 Upload size limit

Legacy FEDCOMPLY_* env names are still accepted for backward compatibility.


Design principles

  • No fabricated findings. If no rules are ingested or the LLM is offline, GATE returns empty results — it does not ship demo violations or sample Siemens/AEP story data.
  • Policy-grounded only. Every finding must trace to ingested knowledge or explicit document structure checks (e.g., cross-doc EIN regex in ZIP integrity).
  • Local sovereignty. Finance and procurement data never leaves your network.
  • Human in the loop. AI proposes; your team confirms, emails vendors, and approves payment.

License

MIT — see LICENSE.


Acknowledgments

  • LightRAG for dual-level graph-vector retrieval
  • Ollama for local LLM inference

GATE — The Last Gate Before Payment.
Built for procurement teams who cannot afford to guess.

About

Local-first procurement compliance platform — GraphRAG + Ollama. PDF, Excel, Word & ZIP audit with cross-document integrity. The Last Gate Before Payment.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages