Shipped · Epic #364

The assistant re-learns your account every session.
A classification is trusted forever. You cost the change after you commit it.

Three fixes, one idea borrowed from Graft (MIT): a cheap input fingerprint that gates an expensive recompute, plus a deterministic check that fails when a derived answer has drifted from its source of truth — and a visual grammar where the confidence of a fact is drawn, not buried.

A
persistent per-client context graph for the assistant
B
classification & trade-measure staleness detection
C
"what-if" blast radius before you approve

The problem

Three gaps we already have open.

Each maps to a pattern Graft solves for coding agents.

"The chat rebuilds context every turn — resolvedContext: null — and its grounding ledger is regex, applied after the text streams, then thrown away."

A · Grounding is ephemeral

"An approved HTS code is valid forever. Nothing watches the HTSUS revision, the cited ruling, or the 301/232 data it rested on."

B · No staleness signal

"classificationCaseEngine computes the duty delta across every open shipment — but only after the reclassification is attested."

C · Impact known too late

How Qubere addresses it

One mechanism, three surfaces.

  • A fingerprint (sourceId → version/hash) per derived artifact. Graft's fingerprint.ts walks + stats each file in ~3 ms and hashes only what moved. We do the same with DB rows.
  • A deterministic check (no LLM) that re-derives and diffs — drift as named categories with distinct owners: changed → rebuild structure, stale → re-reason.
  • A cache keyed on the builder's own identity — a logic change invalidates every entry, no manual cache-bust (Graft's extractorStamp).
  • A visual grammar: solid line = DB-verified fact; dashed = LLM-inferred; green / amber / grey ring = fresh / stale / pending. "Trust is visible."

A & B are independent. C is most useful after B — B says which classifications to re-review, C says what it costs.

Part A · Assistant knowledge

You can open the graph the assistant reasons from.

A persisted, per-client graph — importer, approved classifications, screened parties, open findings, recent entries — injected into the prompt instead of re-discovered every session. Rebuilt incrementally off the write paths that already exist. The grounding ledger is seeded from the graph's citations at turn start, so a shipment or ruling the graph vouches for is grounded from the first token.

  • Solid edge = a row exists · dashed edge = an LLM summary
  • Green / amber ring = fresh / an input has moved (Part B)
  • Focus a node: amber = "depends on", teal = "depended on by"
How to demo
Ask "which of Target's suppliers isn't screened?" — an aggregate the assistant has no endpoint for today. It answers by walking the graph. Then click ◤ Assistant Knowledge Graph on the client detail page (/app/clients/[id]/assistant-knowledge) and show the same nodes.

Ships off by default (Account.assistantGraphEnabled, plus a kill-switch env var) — enable it for the demo account first. The search box filters nodes within one client's graph; it isn't a cross-client search yet.

Clients/Target Corp/Assistant knowledge
SR
Sarah
47 facts · HTSUS rev 14 · 2 stale · rebuilt 4m ago · builder v12
Target importer Shenzhen X screened ENTRY-TGT score 88 AD/CVD rate n/a 8481.80 3 inputs moved for → ← flags
DB fact LLM summary fresh stale pending

Part B · Staleness detection

"6 approved classifications now have a 301 exposure they didn't at approval."

Every approved determination snapshots a fingerprint of its inputs — HTSUS revision, cited ruling status, 301/232 applicability, AD/CVD cases, a hash of the product facts. A deterministic sweep (no LLM) runs when a new HtsRelease is published, reference data is imported, or a ruling status changes. STALE_INPUTS is a first-class state, distinct from SUPERSEDED.

  • Grouped by root cause — not one alert per SKU
  • Feeds the Classification queue (Stale Inputs filter) and the Today lane
  • Re-review = the existing flow; a same-code outcome writes "reaffirmed under rev 15"
How to demo
Seed a ClassificationInputFingerprint at STALE_INPUTS touching heading 8541.40. Open Comply → Classification, apply the Stale Inputs filter and show the badge on the affected cases.

The sweep engine and drift categories are real (classification-staleness package); the Classification queue reads and badges STALE_INPUTS today, and the sweep now runs automatically when a new HTS release is published (alongside FTA-revalidation and duty-staleness sweeps). Not verified as live: a trigger off every ruling-status change, and the grouped Today-lane card shown here — the lane component exists but isn't wired to real drift data yet.

Today
SR
Sarah
HTSUS revision 15 — heading 8541.40 changed
diode modules · General duty 0% → 2.6% · +$3,100 est. exposure
40 SKUs ▸
Ruling NY N301234 revoked
cited in the rationale for 2 approved codes
2 SKUs ▸
Section 301 four-year-review list published
6 codes gain a List 3 exposure not evaluated at approval
6 SKUs ▸
Product fact changed — TGT-4471 material
"steel" → "brass" · classification rationale relied on the body metal
1 SKU ▸
every flag → AuditLog · every re-affirmation → AuditLog

Part C · What-if blast radius

See the $41,250 and the 3 PSCs before you click Approve.

A pure assembleClassificationBlastRadius() takes a proposed code change (or an external measure change) and returns the affected shipments, lines and filings — signed duty delta per line, PSC count, new PGA flags, worst first. Reuses the full dutyEngine stack, not just a General ad-valorem lookup.

  • Real endpoint + modal — this is Graft's blast PR comment, as a dialog: GET .../cases/[caseId]/blast-radius
  • The Approve button restates the consequence: "creates 3 PSC tasks"
  • Also runs book-wide on a schedule → a RegulatoryImpactReport when USTR / CBP data moves
How to demo
Call the blast-radius endpoint for a reclassification case and walk the response live: multi-shipment blast, the two Released entries flagged for PSC.

The impact preview (shipments, lines, duty delta, PSC tasks, new PGA flags) now loads inline in the Classification case detail from the blast-radius endpoint. Duty delta covers General duty only today; 301/232/AD-CVD show as DATA_UNAVAILABLE.

Classification/CASE-4471
SR
Sarah
14
shipments
22
lines
+$41,250
duty delta
3
PSCs required
2
new PGA flags
Shipment · lineΔ dutyEntry
SHP-ACME-2026-002 · 3  steel racks+$18,400Released · PSC
SHP-TGT-2026-001 · 1  ball valves+$12,100open
SHP-NKE-2026-014 · 2  fittings+$6,300Transmitted · PSC
… 19 more lines

Provenance

What we take from Graft — and what we don't.

Ported code (MIT, credited)fingerprint.ts (drift probe), extract-cache.ts (builder-identity cache key), check.ts (drift categories + CI gate), blast.ts + traverse.ts (impact set, direction-aware walk). Each keeps a header crediting trailhq/Graft.
Adapted designThe edge grammar (solid vs dashed = confidence), focus mode (amber "depends on" / teal "depended on by"), the freshness statusline. Drawn in Qubere tokens, not Graft's indigo.
Not adoptedGraft itself as a dependency — it indexes source code for coding agents, orthogonal to our product. It may be worth a solo dev-tooling trial on our monorepo; that is a separate call.

The close

The assistant shows its sources. The classification tells you when it's stale. The reclassification shows its cost first.

One fingerprint-plus-check mechanism, three surfaces, each with a deterministic gate so a schema change can't silently rot the derived layer.

Status: shipped in #364 (merged, off by default per account). Design doc: docs/plans/features/GRAFT-INSPIRED-GROUNDING-AND-STALENESS.md.

Screens are real product UI except the Today-lane card, which is not yet wired to live drift data, and the blast-radius card, which is illustrative here (the in-app version is an inline impact panel in the case detail). Known follow-ups: Today-lane data wiring, fuller duty-stack coverage, LLM stale-node summaries (template text today).