Shipped · Epic #364
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.
The problem
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
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
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.
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.
Part B · Staleness detection
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.
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.
Part C · What-if blast radius
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.
blast PR comment, as a dialog: GET .../cases/[caseId]/blast-radiusThe 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.
| Shipment · line | Δ duty | Entry |
|---|---|---|
| SHP-ACME-2026-002 · 3 steel racks | +$18,400 | Released · PSC |
| SHP-TGT-2026-001 · 1 ball valves | +$12,100 | open |
| SHP-NKE-2026-014 · 2 fittings | +$6,300 | Transmitted · PSC |
| … 19 more lines | ||
Provenance
| 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 design | The 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 adopted | Graft 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
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).