Hacki
All BUIDLs

About the project

What Coteja does

Coteja automates the first-pass reconciliation of a letter of credit, commercial invoice, packing list and bill of lading. It detects inconsistencies in quantities, currencies, totals, parties, shipment dates and missing documents, then produces an evidence packet a human can audit.

How it works

  1. QVAC OCR reads scans and photographs locally using OCR_LATIN.
  2. An input guard detects and redacts prompt injection like document text before extraction.
  3. Qwen3 4B Instruct Q4_K_M extracts structured fields entirely on-device.
  4. Zod validates the output, and every extracted quote must resolve to its referenced OCR block.
  5. Six deterministic TypeScript controls—not the language model—compare the documents.
  6. An evidence lock checks every discrepancy for citations, provenance, confidence and an exact calculation.
  7. Missing, ungrounded or low-confidence evidence is routed to human review rather than guessed.

The resulting verdict is PASS, DISCREPANCY or NEEDS HUMAN REVIEW, accompanied by source quotes, page references, available bounding boxes, OCR confidence, provenance and measured timings.

Why QVAC

Trade documents contain financial and commercial information that companies may not be able to send to a third-party model API. Coteja uses QVAC as its actual OCR and inference layer: no cloud model, no API key and no document data leaving the machine.

Reliability evidence

We ran four seeded dossiers three times each. All 12 runs matched their expected verdict, with 100% verdict consistency and no missed seeded discrepancy rule.

The test set includes clean documents, deliberately rotated/noisy/low-light JPEG images, an adversarial document containing an injected approval command, and genuine phone-camera captures of synthetic documents.

Honest scope

The documents are synthetic and the benchmark is reproducible, not a production-accuracy claim. Coteja currently implements six structural controls rather than complete UCP 600 legal review. Full-dossier latency ranged from approximately five to fourteen minutes on an Apple M3 with 8 GB RAM. Final responsibility remains with a human operator.