AI Overview rework — domain model and build plan
Status: planned (Aug 2026). Decided in a grilling session with Kevin; supersedes the original post-confirm design that was discussed in the same session (see Decision log).What the AI Overview is (final shape)
A pre-selection strategy coach for the operator. Generated on demand, after underwriting completes and before product selection, from a card on the/contact
Overview tab placed directly above the Product Decisions panel. Its job is
cross-product strategy sequencing the engine does not do — e.g. “remove the inquiries
not tied to open accounts first, then use the term-loan proceeds to pay down these
three cards, which lifts utilization under 30% and materially improves the 0% card
outcome” — ending with an explicit handoff: select these products in Product
Decisions and begin the funding workflow.
Benchmark profile: high score, heavy encumbrance (many inquiries, large paydowns).
Golden test case: contact RY9HEzVryPbYyMNbpmQW, location isqlsHX3ljyFgKYAxPTQ
(Toan Nguyen) — great score/pre-approval, 10 inquiries in 12 months, $20k+ paydowns.
Trigger and billing contract
- Manual generate button, available to every location. No settings. The button is
the consent for the charge; the tooltip states the price. No operator toggle, no
admin kill-switch, no schema change. The admin
aiOverviewEnabledflag stays retired-in-place (it gates nothing today and continues to gate nothing). - Credit pull charges
creditPullPrice(2 default) at click time, on cache miss only. These are and remain fully separate charges (tests/billing.test.tslocks this in). There is no combined $7 charge. - Cache hits are free; the $2 buys the overview for that file’s data-state
permanently. Deliberate Regenerate clicks are each billed. Admin/internal locations
(
creditPullPrice === 0) generate free. - Never auto-generated. Not at underwriting time, not on auto (webhook) pulls. Auto-generation would charge without operator intent and would resurrect the need for a per-location opt-in setting. If demand appears later, an opt-in “auto-generate on manual pulls” location setting is an additive follow-up.
- If the charge succeeds but the LLM fails, the charge is not auto-refunded (existing behavior); the card shows a non-blocking error with a retry.
Roles and responsibilities at every step
Output contract (PR 2)
Dual-section output, stored onunderwritingResults.aiOverview (widened with optional
fields for backward compatibility with cached rows; cache namespace bumped so
old-format caches regenerate naturally — same pattern as borderline-v1):
- Operator section: the strategy narrative — sequenced plan with per-account dollar amounts, which inquiries are plausibly removable, how term-loan proceeds interact with card-stacking outcomes, and the product-selection recommendation. Steps split by owner (client lane / operator lane).
- Client-safe summary: relayable verbatim or via the funding plan email later. Says “CRM”, never GHL; never mentions 7 Figures (existing sanitizer extended).
paydownRecommendations dollar amounts,
the inquiry list with open-account association (may need a small deterministic
matching helper so the AI cites facts rather than guessing), decline/status codes,
and the estimated ranges per track. The engine remains the source of truth: the model
may only cite dollar amounts and thresholds present in its input.
The computeDataHash inputs must grow in lockstep with the prompt inputs, or stale
overviews will survive data changes.
Borderline files (requiresManualReview) keep their separate skeptical prompt.
Build phases (one branch + PR each, cut from origin/main)
- PR 1 — cleanup: delete the dead
$5 + $2wallet pre-check in the new-lead webhook andlib/webhooks/auto-credit-pull-core.ts(it checks 5); update billing tests; land this doc. - PR 2 — strategy-coach prompt: new system prompt + enriched inputs + dual
output schema + cache-namespace bump + Toan Nguyen golden fixture (read-only data
pull into a test fixture). Consider a model bump from
openai/gpt-4o-miniand a higher token ceiling for the longer plan. Verifiable without UI: iterate against the golden fixture and the existing/api/ai-overview/generateroute directly. Lands before the UI so the card is designed once, against the final output contract, instead of being built for the old shape and reworked. - PR 3 — placement + generate flow: AI Overview card on the
/contactOverview tab above Product Decisions, with ungenerated (explains value + price), generating, error-with-retry, generated, and Outdated states. Renders the dual output contract from PR 2; reuses the existing/api/ai-overview/generatecharge path unchanged. Note:AiOverviewSectioncurrently renders only on surfaces that never receivecontactId/locationId(why the feature is invisible today); the contact page usesCreditReportsView, which never included it.
Decision log (grilling session, Aug 6 2026)
- Post-confirm trigger with “Confirm and generate AI Overview” button — superseded: the overview’s job moved from execution plan to pre-selection strategy coach after the Toan Nguyen example showed the highest-value output is sequencing advice that informs product selection.
- Operator toggle in Settings + admin kill-switch — superseded: with a manual button, the click is the consent; no settings are needed.
- “AI Overview settings” letting operators choose generation timing — rejected: two prompts/caches/placements for one feature; pick one moment.
- Auto-generate at underwriting time — rejected: charges without operator intent, effectively the $7-per-pull model; also bills dead/duplicate/webhook files.
- Confirm always succeeds independently of AI billing — retained (now trivially true since Confirm no longer touches AI).
- Dual output (operator + client-safe) — retained.
- Stale-on-data-change with paid regenerate, never auto-charge — retained.
- No AI Overview on auto pulls — retained.

