Ankit Sinha

Field note / 01

Plain-code reconciliation before the LLM

If a deterministic join can close 96% of a settlement batch in ten milliseconds, sending the whole ledger through an LLM is neither faster nor safer.

Nov 2026 · 3 min read · from Keel

Keep inference proportional to ambiguity #

In payment operations, almost every row in a settlement export is boring: exact order reference, expected net amount, matching currency. Only a narrow edge produces headaches—fee deductions applied without notice, duplicate rows across cutoffs, partial refunds, or two orders with the same amount on the same afternoon.

Putting a model in front of every row couples latency, token spend, and failure surface to total store volume. Running plain code first turns the problem inside out: deterministic matchers close clear pairs immediately and emit typed exceptions for everything left behind.

settlement batch (N rows)
  └─ deterministic pass ──▶ clean matches closed in SQL
         └─ leftovers (K ≪ N) ──▶ agent loop + policy citations

The model proposes; keys decide #

Once an exception reaches the agent, the temptation is to let tool calls mutate balances directly. That breaks under retries, prompt variance, and flaky upstream payment providers.

Letting plain code draw the boundary leaves the LLM with what it is actually good at: reading messy policy text and explaining why an exception matches.