AI & Document Intelligence
Qubere turns an uploaded PDF into filing-ready facts where every value points back to a page, a bounding box, and the original document (SHA-256-verified on every read) — and puts an assistant in front of the platform that answers only with real, linked records and runs every action through the same permission and audit checks as the UI.
The problem
What a compliance leader says about AI trade tools:
"Extraction tools give me a JSON blob and no way to check it. When it's wrong on a value, I find out at liquidation."
No verification
"Every AI chatbot bolted onto a compliance tool is a liability. If the model classifies a product, who's accountable?"
Accountability
"I want to ask 'which shipments are at risk, what's the dollar exposure' — and I need the number to be right."
Trust the answer
How Qubere addresses it
Field-level provenance
Customs field → extraction field → parser element → page + bounding box → canonical artifact → original. Absence is preserved — a null page means the parser didn't report one, never a default. A bounding box is never synthesised.
Durable processing & quality gate
The upload request validates, stores the immutable original, hashes it, creates one durable run, and returns. A parse becomes the active version only if it passes an objective gate — text coverage, blank-page counts, parser warnings. No invented score.
Multi-document splitting
A 40-page carrier packet is often an invoice, packing list, and BOL stapled together. Header-keyword detection flags this as an advisory suggestion only — it never auto-splits, and every existing field and flow on the original document row is untouched until a person confirms.
Extraction accuracy feedback loop
Every field-review verdict — approve, edit, reject, select an alternate — used to vanish the moment the review status updated. Now each one is recorded against the parser provider/version and confidence signals that produced it, so accuracy is measured from real outcomes, not assumed.
| invoiceTotal | qubere.parser/2 | CONFIRMED_MATCH |
| hsCode | qubere.parser/1 | CORRECTED |
| countryOfOrigin | qubere.parser/2 | REJECTED |
Qubere Magic Marker
A wrong extracted value used to mean deleting it and typing the correction by hand off the page image. Now a reviewer clicks Mark on document, drags a box around the real text on the page, and that text fills the field — the correction comes straight from the source, not from memory or a second read of the PDF.
Group by HS Code
Customs wants one quantity, weight, volume, and value per HS code. Operators used to total that off the extracted line items in a spreadsheet. The shipment's line-items table now has a By Line / Group by HS Code toggle that consolidates every line sharing a code, straight from whatever documents were extracted for the shipment.
| HS code | Lines | Qty | Net / Gross | Volume | Total value |
|---|---|---|---|---|---|
| 8537.10.9170 | 1, 3, 7 | 120 | 84.0/96.0 KG | 0.62 CBM | USD 18,600 |
| 8544.42.9090 | 2, 5 | 300 | 42.0/46.0 KG | 0.30 CBM | USD 9,150 |
| 9403.20.0080 | 4, 6 | 40 | Mixed units — not summed | 0.55 CBM | USD 3,200 (partial) |
Ingest channels
Documents arrive from people, from systems, and from inboxes. Each channel stores the original and hands it to the same parse, classify, and extract pipeline — there is no separate, weaker path for an email attachment or an API upload.
| File | Channel | Status |
|---|---|---|
| invoice_8841.pdf | Portal upload | processing |
| packing_list.pdf | Intake API | processing |
| bol_0451.pdf | Inbound email | processing |
| scan_0012.pdf | Inbound email · unregistered sender | quarantined |
Document types & decision score
Classification runs against a catalog of about 25 customs document types in six categories, each with keywords and a required-for-filing flag. Every extracted field then gets a single 0–100 decision score built from four independent signals, so a reviewer sees why a value is trusted, not just a bare percentage.
Malware screening & quarantine
Documents come from outside the organisation. Every upload gets a verdict — CLEAN, NOT_SCANNED, or QUARANTINE — with the reason recorded in the audit trail, so it is never ambiguous afterward whether a given document was scanned.
| File | Verdict | Reason |
|---|---|---|
| invoice_new.pdf | QUARANTINE | Flagged by scanner |
| scan_0012.pdf | QUARANTINE | Scanner error (fail-closed) |
Documents beyond extraction
Once a document is on file it keeps working: a broker can request a missing one from the customer, choose which documents the customer portal shows, and turn a supplier invoice into a draft vendor bill.
| Document | Visibility | Action |
|---|---|---|
| Commercial invoice | Customer | — |
| Broker worksheet | Internal | — |
| Freight invoice | Internal | Draft vendor bill |
Qubere Learns
A field-review verdict that actually corrects a value (not just approves it) is durably remembered per account + document type + field, the same institutional-memory mechanism already feeding the HTS, origin, valuation, and filing agents. The next extraction for that account retrieves its own correction history and folds it into the prompt.
Trade Data Normalization
The extraction agent is deliberately forbidden from normalizing anything — it captures currency symbols, units, dates, and codes exactly as written so nothing is silently altered before a human can see it. A separate, versioned normalizer registry then reconciles each field to its canonical form as it's promoted onto the shipment record, with a matching validator confirming the result is actually compliant.
Missing-data & document resolution
Required documents are looked up by the shipment's CBP entry type, not a generic checklist, so a Type 01 consumption entry and a Type 86 entry never get the same missing-doc list. Each gap becomes a real, actionable exception — and it clears itself the moment the right document lands.
Document Rules Studio
Every account has its own document quirks — a broker who always wants a specific invoice field flagged, a client whose packing lists never carry a certain code. Rules Studio lets an admin author that logic as a typed, versioned rule instead of a code change, and nothing goes live until it's been dry-run against a real document.
Source-of-truth precedence
An invoice and a packing list can report a different weight for the same shipment. Instead of always freezing on a manual review, an account can publish a precedence policy — "packing list wins on weight" — and the reconciliation engine applies it automatically, every time, for that field.
Field-level explanation
Next to any extracted field is an explain control that reads the same provenance chain a person would have to click through by hand — source document, page, confidence signals, and any precedence or reconciliation decision that touched it — and states it as a short, sourced answer instead of prose.
Correction-learning rule suggestions
The recorded extraction-accuracy events (every approve/edit/reject/select-alternate) are aggregated by field and document type. When a field crosses a real repeat-correction threshold, it surfaces as a suggestion — never an auto-applied change.
Cross-shipment duplicate detection
Every inbound attachment — whether it lands through normal processing or is released out of quarantine — is checked against documents already on file elsewhere in the account. A match surfaces as an advisory notification, without ever blocking storage or parsing.
Relevance-ranked full-text search
A GIN-indexed, weighted full-text vector sits on every document, so a search term ranks the best match first instead of just filtering. Filenames and identifiers weigh higher than incidental text, and the same query still works even against a database that hasn't run the latest migration.
| Document | Rank | Shipment |
|---|---|---|
| commercial_invoice_88.pdf | 0.91 | SHP-000144 |
| acme-manufacturing-rate-card.csv | 0.44 | SHP-000112 |
| packing_list_88.pdf | 0.31 | SHP-000144 |
Canonical file naming
Alongside the untouched original filename, every document now carries a generated, canonical display name — {documentType}_{shipmentNumber}_{YYYYMMDD}{ext} — built the moment the document intelligence agent classifies it. The messy inbound name stays on record; the canonical name is what people actually see.
Ask Qubere · the assistant
~70 tools across shipments, filing readiness, screening, decisions, exceptions, rulings, drawback. Any claim that names a specific record renders as a linked reference. If the model can't back a number with real rows, it doesn't state the number.
| SHP-2026-000007 | 28% ready | $96,120 | critical |
| SHP-2026-000002 | 15% ready | $61,400 | critical |
| SHP-2026-000019 | 52% ready | $42,429 | at risk |
Guardrails & write actions
The registry is filtered to what the caller may use before it's offered to the model; the orchestrator re-checks the tool name before executing. A PLANNER asking "show all shipments" gets the same row-level filter the Shipments page applies — same code path.
Origin safety
A dedicated tool surfaces a product's legal country-of-origin position. The system prompt forces the model to quote it verbatim and forbids falling back to a manufacturing, supplier, ship-from, or export country — even when the tool's own physical-fact fields mention one.
Interactive chat & opt-in verbose audit
An ask_user control tool renders 1–4 labelled options (or a multi-select, or free text) as clickable cards, replacing an earlier regex-on-assistant-text confirm hack. 15 new write tools give the chat web-app parity — each a thin wrapper over the same route the equivalent screen calls, so tenancy, RBAC, validation and audit stay owned by the route, not the model.
Objection handling
| "Which model? Are you sending our data to OpenAI?" | Reasoning is Gemini (3.6 Flash default); Claude is wired as an alternative for the assistant and a few advisory routes. Parsing is Google Document AI. Model choice is per-surface config, and provenance records which model actually ran. No OpenAI. |
| "What if the AI is down?" | Every workflow is fully usable without it. With no model key, the assistant route says so rather than answering from nothing; agent calls fail closed rather than fabricating. |
| "Can it read our whole database?" | No. It calls a fixed tool registry, each running with the caller's real session context. The model never sees SQL, an internal API, the DOM, or a tenant id. |
The close
Evidence you can click. An assistant that can't outrun its own audit log.
Next step: upload one of your commercial invoices on a screen-share. We'll show you the extraction, click into the provenance, and let you try to break the assistant.
Full detail: docs/apps/customs/sales/ai-and-document-intelligence.md