← Sidhant Panda

Turning scanned paperwork into a system of record.

10,000+ documents processed, a 96.8% automated match rate — and why the deterministic layer around the AI, not the AI itself, is the product.

The problem

Waste-management customers — manufacturing sites, mostly — receive disposal invoices as a single scanned PDF: the invoice on top, and behind it a stack of supporting paperwork. Weighing slips, delivery notes, transfer notes, sometimes dozens of pages per bundle. Someone in the back office has to answer the same questions for every invoice: does the billed tonnage match what the weighing slips say? Does every disposal event have weight evidence at all? Is this hazardous-waste code the one we actually contracted for?

Done by hand, that is slow, error-prone, and unauditable. Done naively by AI, it is worse: a plausible-looking wrong answer in a financial workflow is more dangerous than no answer.

The constraints

The architecture

A stateless parsing service takes the raw PDF, triages each page as machine-readable text or scanned image, splits the bundle into its individual documents, and extracts every field — invoice lines, weights, waste codes, parties — into a versioned JSON schema. Structure is enforced twice, by typed models and by a JSON Schema gate, per document rather than per bundle, so one malformed field can never sink a whole upload. A page-coverage check guarantees completeness: if any page went missing from the output, only those pages are re-extracted, and the document is flagged for review instead of being silently truncated.

Downstream, a multi-tenant backend stores the AI output immutably and layers deterministic enrichment and user corrections on top — the original extraction is never edited, which keeps the audit trail free. A reconciliation engine then cross-checks each invoice against its own attachments: billed tonnage against weighing-slip evidence, prices against line arithmetic, waste codes against the customer's ~130-code catalog, with weights normalized through an 18-unit conversion model. Reconciliation is recomputed on every view, so it is always consistent with live edits. A review workspace shows each document beside its extracted data with field-level red/green indicators and one-click fixes; confirmation is blocked server-side until discrepancies are resolved.

The trust layer

Extracting fields from documents is a commodity — every model vendor demos it. What makes the output bookable is a set of deliberately conservative, deterministic decisions wrapped around the AI:

Try it — you're the reviewer

Mock invoice line vs. its evidence. The 10 kg tolerance and the hazard-marker rule are the production ones. The AI checks — but it can't confirm. You can.

Invoice · line 3
Billed weight4,920 kg
Waste code15 01 10*
Order refANR 25-04412
Attached evidence
Weighing slip · net4,915 kg
Transfer note · code15 01 10
Delivery note · refANR 25/4412
Weight: 4,920 billed vs 4,915 weighed
Waste code: 15 01 10* vs 15 01 10
Reference: ANR 25-04412 vs ANR 25/4412

The prompts themselves went through the same discipline: dozens of tracked revisions converged on a layered design where the prompt handles semantics — label-anchored field rules for dense German documents, explicit null-over-guess instructions, an arithmetic self-check that forces line totals to reconcile against the invoice net — while code handles everything prompting can't be trusted with.

Results

The same discipline, applied to chat

The newest layer applies the trust rules to conversation: an auditor-facing chatbot grounded in a versioned export of the tenant's confirmed data — currently in staging. Its system prompt is nine strict rules, not vibes: answer only from the export, run all arithmetic as executed code rather than in the model's head, cite the rows behind every figure, admit data-quality gaps, refuse questions outside the data — and treat data as data. Instruction-like text inside a document can never impersonate a command: reserved structural markers are stripped from every data value before the model sees them.

Ask the auditor

Scripted demo — the rules are the real ones, the numbers are mock. Pick a question.

What I'd do next