Case study · Accounting

Near-zero-touch bank-feed categorization for a QuickBooks-driven accounting firm.

A 4-stage vendor matching pipeline collapsed hours of manual transaction work into seconds, with auditable shadow columns, transparent confidence scores, and a staff accountant still in the loop on every uncertain case.

Outcomes

~95%
of transactions auto-categorized end to end
4-stage
vendor matching pipeline
< 200ms
median categorization latency
SOC 2
audit-ready from day one

Every month, two days lost to QuickBooks classification.

A mid-market accounting practice serving small and mid-sized business clients was drowning in QuickBooks Online bank-feed data. Every month, staff accountants pulled bank feeds for each client, read each transaction's raw description ("AMZNMKTPL*5HG2J1XN3"), guessed the vendor, picked a category from a chart of accounts, and clicked accept. Repeat for thousands of transactions per client, across hundreds of clients.

The firm had tried QuickBooks' built-in rules engine. It worked for the obvious cases (a string-match rule for "STARBUCKS" categorizes to "Meals") but broke down on the long tail: unfamiliar vendors, payment processors that obscure the merchant, transaction descriptions that change month to month, and clients in industries with idiosyncratic vendor sets. The result was hours of manual work every month, inconsistency between staff accountants, and a steady backlog that pushed monthly closes later and later.

They wanted three things: drastically reduce the manual work, keep the staff accountant in the loop on uncertain cases, and have an audit trail that explained every categorization decision in case a client (or the IRS) ever asked.

We embedded, then engineered the loop and the harness.

Our engineers worked inside the firm's QuickBooks data and chart of accounts. The costly workflow was obvious within days. The fix was a four-stage pipeline where the model is the last resort the loop reaches, with a harness built around it for review, audit, and safe rollout.

Stage 1 · Sanitization

Strip the noise from raw bank descriptions.

Bank feeds are full of merchant-code prefixes, transaction-ID suffixes, store numbers, and processor codes that mean nothing semantically. A regex layer normalizes "TST* MERCHANT NAME #1234 SAN FRANCISCO CA" down to "merchant name", preserving the signal and dropping the noise, before any matching runs.

Deterministic · first

Why it leads

Clean input makes every downstream stage more accurate. Nothing reaches the model until the description is readable.

Stage 2 · Exact match

Did we see this exact vendor last month?

The fastest, most certain match. Sanitized vendor strings hit a per-client lookup table built from prior categorizations. If we matched it before with high confidence and the client accepted, we apply the same mapping. Roughly 60% of transactions stop here.

~60% resolved

Compounding memory

Every accepted categorization feeds the lookup table, so the firm's own history does most of the work.

Stage 3 · Fuzzy match

Almost the same vendor, slightly different string.

A Fuse.js fuzzy match catches near-duplicates ("Amzn.com" vs "AMZN MKTP" vs "AMAZON.COM*5HG2"). The threshold is tuned to 80% similarity, high enough to avoid false positives and low enough to catch the realistic variation in bank descriptions. It picks up another 25% or so.

~25% resolved · 80% threshold

Tuned to real data

The similarity threshold was set against the firm's actual transaction history, balancing recall and false positives.

Stage 4 · Gemini 2.5 Flash inference

When everything else fails, ask the model.

For the remaining 15% or so (genuinely new vendors, ambiguous descriptions, anything where the deterministic stages could not reach high confidence) we call Google Gemini 2.5 Flash with the sanitized description, the client's vendor history, and the chart of accounts. The output is structured JSON with a confidence score and a reasoning string. Low-confidence outputs route to a staff accountant.

~15% resolved · human checkpoint

The model as last resort

Inference is the most expensive and most variable layer, so the loop only reaches it for the genuine long tail. Pipeline order is the architecture.

Why the model only handles the last 15%. Deterministic stages are fast, cheap, and explainable, and they get more cases right than people assume. Gemini handles the genuinely novel ones, with a full audit trail. Keeping the model behind three deterministic gates holds inference cost low, latency predictable, and the audit story clean.

The harness running in production.

The model is one component. The production system around it carries the integration, the review queue, the safety rails, and the audit trail.

  • Frontend. React (Vite) and TailwindCSS. An admin console for the accounting team: per-client dashboards, a per-transaction review queue, LLM-suggestion approval, and drift alerts.
  • Backend. Node.js (Express) with SQLite via better-sqlite3. Per-client data isolation enforced at the query layer. A stateless API tier behind PM2 for auto-restart.
  • QuickBooks integration. OAuth 2.0 with the official Intuit API, plus Change Data Capture (CDC) polling for incremental sync. Every Intuit API response captures the intuit_tid trace header for support escalation.
  • LLM gateway. Google Gemini 2.5 Flash, picked for low latency, low cost per call, and structured JSON output. Calls are isolated in a single server/services/ai.js module for easy provider swap.
  • Shadow columns. Every LLM categorization writes to llm_vendor_id and llm_vendor_name alongside the main fields. This allows non-destructive validation: compare agent picks to human picks across thousands of historical transactions before promoting the model to write the canonical field.
  • Hosting. A single EC2 instance (Ubuntu) managed by PM2. CI/CD via GitHub Actions. Cache-Control no-store on every response containing financial detail. Daily backups, point-in-time recoverable.
  • Error tracking. All QBO API failures land in an error_logs table with the intuit_tid. Troubleshooting with Intuit support becomes a matter of pulling the trace ID rather than reverse-engineering what happened.

Tech stack

Application

React (Vite), TailwindCSS, Node.js/Express, better-sqlite3, Fuse.js, PM2

AI and integrations

Google Gemini 2.5 Flash via the @google/genai SDK, QuickBooks Online OAuth 2.0 with CDC, Intuit OpenID Connect Discovery

Infrastructure and security

AWS EC2 (Ubuntu), GitHub Actions CI/CD, bcryptjs auth, express-rate-limit, helmet, Cache-Control no-store on sensitive endpoints

Two days a month became 90 minutes a week.

After six weeks of staged rollout (one client first, then ten, then the full book), the firm now categorizes new transactions with roughly 95% auto-application. The remaining 5% or so (low-confidence Gemini suggestions plus genuinely novel vendors) route to a daily review queue that one staff accountant clears in about 90 minutes per week, across every client.

Beyond raw time saved, the practice gained three things they had not fully scoped at the start:

  • Consistency between accountants. Two staff members no longer categorize the same vendor differently. The lookup table is the source of truth, and every categorization decision compounds into firm-wide knowledge.
  • Plain-English transaction explanations. A second Gemini call generates a one-sentence explanation per categorization for client-facing reports. Clients ask fewer "what's this charge?" questions, and the firm's reports got noticeably more readable.
  • An audit story that holds up. Every categorization records the source description, the sanitized form, the match stage that fired, the confidence score, the model reasoning (when the LLM was used), and the approving staff member. The whole chain reconstructs in one query.

How the engagement ran.

The same arc we run everywhere: embed, find the costly workflow, engineer the loop and the harness, then operate.

Embed

We worked inside the firm's QuickBooks data, chart of accounts, and review habits until the manual categorization workflow and its real cost were clear.

Engineer the loop

We built the four-stage decision path so each transaction reaches the model only when the deterministic stages cannot resolve it with confidence.

Engineer the harness

Shadow columns, a review queue, confidence scoring, trace capture, and per-client isolation made the system auditable and safe to trust.

Operate

Staged rollout from one client to the full book, validating model picks against human picks before promoting the model to write the canonical field.

Three patterns worth carrying to your own workflow. Let the model be the last resort the loop reaches, since deterministic stages are faster, cheaper, more explainable, and often more accurate for the bulk of cases. Ship AI behind shadow columns, running the model's predictions next to the human's for weeks before flipping authority. Capture the trace ID from every external API, so when something goes wrong you can walk into vendor support with the exact request they need.

A different workflow with the same shape?

Bank feeds, expense reports, or any "match the unknown to the known, fall back to AI when it is genuinely new" problem fits this pattern. Tell us the workflow and we will sketch the loop that runs it.

Start a conversation