<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sam Wen</title>
    <description>The latest articles on DEV Community by Sam Wen (@sam_wen_xinfer_ai).</description>
    <link>https://dev.to/sam_wen_xinfer_ai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4012641%2Fcd517cd6-6e41-40aa-93b3-7140daa1324b.png</url>
      <title>DEV Community: Sam Wen</title>
      <link>https://dev.to/sam_wen_xinfer_ai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sam_wen_xinfer_ai"/>
    <language>en</language>
    <item>
      <title>The LLM Narrates, the Core Decides: Anatomy of an AI Checkout</title>
      <dc:creator>Sam Wen</dc:creator>
      <pubDate>Mon, 27 Jul 2026 01:43:31 +0000</pubDate>
      <link>https://dev.to/sam_wen_xinfer_ai/the-llm-narrates-the-core-decides-anatomy-of-an-ai-checkout-419e</link>
      <guid>https://dev.to/sam_wen_xinfer_ai/the-llm-narrates-the-core-decides-anatomy-of-an-ai-checkout-419e</guid>
      <description>&lt;p&gt;&lt;em&gt;How we built a checkout that runs the same protocol in a chat window, a voice session, and a live phone call.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One word, many moves
&lt;/h2&gt;

&lt;p&gt;On the AI storefront platform I work on, a customer can type "checkout" into a chat window — or say it to a voice agent or a phone line — and, a short conversation later, they have an order number. The transcript looks unremarkable: a question about special instructions, maybe a contact form, a quick "Is everything correct?", done.&lt;/p&gt;

&lt;p&gt;Beneath that brief exchange lies the most carefully engineered path in the system. Checkout is where a language model, several tools, an order engine, and a human who may be walking down the street all have to agree on what just happened — and where any disagreement costs real money.&lt;/p&gt;

&lt;p&gt;This post explains our approach: what it is, why the constraints force this particular shape, and how the pieces move together in text and in voice. Then, because a design only means something relative to its alternatives, I'll compare it with the two other ways this is usually built.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part I: The approach
&lt;/h2&gt;

&lt;p&gt;The whole design reduces to one sentence: &lt;strong&gt;the language model conducts the conversation, but a deterministic core makes every decision.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Concretely, checking out involves two tools the model can call:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;shopping_cart&lt;/code&gt;&lt;/strong&gt; — cart operations, with &lt;code&gt;submit&lt;/code&gt; as the consequential one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;collect_user_info&lt;/code&gt;&lt;/strong&gt; — a small sub-protocol for contact details, with four actions: &lt;code&gt;get&lt;/code&gt; (read the current state, rendering nothing), &lt;code&gt;show&lt;/code&gt; (open a form, possibly prefilled), &lt;code&gt;update&lt;/code&gt; (fill in one field), and &lt;code&gt;confirm&lt;/code&gt; (save and close).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the model calls &lt;code&gt;shopping_cart(action="submit")&lt;/code&gt;, the request lands in a single server-side function shared by every channel. That core resolves who is buying, decides whether anything still needs to be asked, and answers with a &lt;strong&gt;typed outcome&lt;/strong&gt; rather than prose. Five of them cover every case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;NEED_CUSTOMER_INFO&lt;/code&gt; — no usable contact information; open the form.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CONFIRM_CUSTOMER_INFO&lt;/code&gt; — contact is on file from before; read it back and get a yes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CART_EMPTY&lt;/code&gt; — there's nothing to check out.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SUBMITTED&lt;/code&gt; — the order exists; here is its number.&lt;/li&gt;
&lt;li&gt;A failure — carrying a reason code the model can relay. The most common is &lt;code&gt;NEED_ORDER_DETAILS&lt;/code&gt;: the order was submitted before the order questions were asked, so the order engine refuses and the model goes back and asks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The customer data that &lt;em&gt;drives a checkout decision&lt;/em&gt; never lives in the model's prompt — the contact used to place the order rides in the tool results, and the core resolves it server-side by provenance, not from anything the prompt says. The prompt otherwise holds only the protocol for reacting to each signal. And every resubmission carries &lt;strong&gt;accumulated flags&lt;/strong&gt;: &lt;code&gt;orderDetailsConfirmed=true&lt;/code&gt; once the order questions were asked, &lt;code&gt;contactConfirmed=true&lt;/code&gt; once the customer approved their on-file details. The flags are how a multi-turn negotiation avoids going in circles — anything already settled travels forward, so no step is ever repeated, and no step can be skipped, because the core simply won't proceed without the flag.&lt;/p&gt;

&lt;p&gt;That "never in the prompt" needs one qualifier. On text and SMS the prompt &lt;em&gt;does&lt;/em&gt; carry a session-context block with the customer's profile, cart, and location for ambient awareness; on voice, where the supplier configs are frozen, even that is absent. Either way the core ignores it: presence of data in the prompt is never permission to spend it.&lt;/p&gt;

&lt;p&gt;That's the approach. The model narrates; the core decides. Everything else in this post is the reasoning behind that split and the machinery that makes it work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part II: Why this shape
&lt;/h2&gt;

&lt;p&gt;Four constraints pushed us here, and I think at least three of them apply to anyone building an agent that transacts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Channels multiply everything you fork.&lt;/strong&gt; The same store sells through web chat, an embeddable widget, a mobile app, in-app voice, real phone calls, and SMS. Early on, each channel had its own glue between the model and the business logic — and the glue drifted. An audit found the kinds of bugs drift produces: an order lookup that skipped its ownership check on one channel but not another, phone-only customers who could buy in text but were refused by voice, and one channel that reported failures as if they had succeeded. None of these were design mistakes; they were &lt;em&gt;synchronization&lt;/em&gt; mistakes. The fix wasn't more review discipline — it was making sure a decision exists in exactly one place, so there is nothing to keep in sync.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The voice prompt is frozen.&lt;/strong&gt; Our voice agents run on third-party conversational AI suppliers, and their system prompts are compiled into configurations that persist on the suppliers' systems. You cannot inject "this customer's name is Pat" into the prompt at call time. This kills the most common trick in LLM app design — personalizing the prompt — and forces a cleaner one: &lt;strong&gt;the prompt stays static and describes only the protocol; anything per customer rides in the tool results.&lt;/strong&gt; A prompt written weeks ago handles today's caller because today's caller's details arrive as data, not as instructions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. A phone call has no screen.&lt;/strong&gt; In text chat, "collect the customer's info" can mean rendering a form. On a phone call, there is no form, no button, nothing to tap. Every step of the protocol, therefore, needs a purely conversational equivalent — which turns out to be a forcing function for good design: if a step can't survive being spoken aloud, it was probably leaning on UI to paper over ambiguity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. The model cannot be trusted with money.&lt;/strong&gt; Not as an insult — as an engineering fact. A language model will occasionally fill in a customer's email address with something it saw earlier in the conversation, announce an order as placed before anything has happened, or retry a timed-out submission, creating the order twice. These aren't edge cases you prompt away; they're the model doing what models do. The decisions that cost money — whose contact to use, whether to place the order, whether this submission already happened — have to live where they can be made deterministically and tested.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part III: How it works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The choreography in text
&lt;/h3&gt;

&lt;p&gt;Here is a first-time guest's checkout, annotated with what actually happens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer: checkout

Model:  "Any special notes for your order?"          ← protocol: always ask first
Customer: no, that's it

Model → shopping_cart(submit, orderDetailsConfirmed=true)
Core:   resolve contact → nothing anywhere → NEED_CUSTOMER_INFO

Model → collect_user_info(show)                       ← a contact form renders in chat
Customer: fills in name, email, phone; taps Confirm   ← saved to their profile

Model → shopping_cart(submit, orderDetailsConfirmed=true)
Core:   contact was entered in THIS conversation → proceed
        → order engine → SUBMITTED, order #1042

Model:  "Order #1042 placed — 2 items, $34.50.
         A confirmation email is on its way."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things to notice. The model never asked for the customer's email in free-form chat — a structured surface was available, so the &lt;em&gt;form&lt;/em&gt; collected it, validated it, and normalized it. (On a phone call no such surface exists and asking out loud is all there is — we'll come back to what stays structured even then.) And when the second &lt;code&gt;submit&lt;/code&gt; went through, it still carried &lt;code&gt;orderDetailsConfirmed=true&lt;/code&gt;: settled things stay settled.&lt;/p&gt;

&lt;p&gt;Now the same customer, back next week:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Model → shopping_cart(submit, orderDetailsConfirmed=true)
Core:   contact found ON FILE from a previous visit
        → not yet a trusted repeat buyer
        → CONFIRM_CUSTOMER_INFO {name, email, phone}

Model:  "I have you down as Pat Lee, pat@example.com,
         (555) 010-3985 — should I change anything?"
Customer: Actually, use my work email

Model → collect_user_info(show)                       ← form opens, prefilled
Customer: edits the email, confirms

Model → shopping_cart(submit, orderDetailsConfirmed=true,
                       contactConfirmed=true)
Core:   → SUBMITTED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The on-file values traveled &lt;em&gt;inside the tool result&lt;/em&gt; — the model read them back rather than remembering them. That detail seems small in text. It's the entire ballgame in voice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Voice: same sheet, no hands
&lt;/h3&gt;

&lt;p&gt;Nothing about the protocol changes for voice — that is the point. The signals are identical; the difference is how each side performs its role.&lt;/p&gt;

&lt;p&gt;When the core answers &lt;code&gt;CONFIRM_CUSTOMER_INFO&lt;/code&gt;, the result carries the name, email, and phone number for the agent to &lt;em&gt;speak&lt;/em&gt;. When the customer wants a change, there's no keyboard, so the form fills by voice: the agent calls &lt;code&gt;collect_user_info(update)&lt;/code&gt; with each field as the customer says it, then &lt;code&gt;confirm&lt;/code&gt; to save and close. On our web and app surfaces, the customer actually watches the on-screen form populate as they talk — same form the text flow uses, different hands on it.&lt;/p&gt;

&lt;p&gt;That gives us three regimes of one protocol:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Text&lt;/strong&gt; — the customer types into the form and taps Confirm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Voice with a screen&lt;/strong&gt; — the agent fills the form by &lt;code&gt;update&lt;/code&gt; calls while the customer watches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A phone call&lt;/strong&gt; — no screen exists; &lt;code&gt;show&lt;/code&gt; renders nothing, and the whole exchange is spoken read-back and correction.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The third regime deserves a caveat, because it's where "the model never asks in free text" stops being literally true. On a phone call, collection genuinely is free-form — the agent asks for the email out loud, and the customer says it. What stays structured is the &lt;em&gt;capture&lt;/em&gt;: each spoken answer is immediately pushed through &lt;code&gt;collect_user_info(update)&lt;/code&gt;, one field at a time, then read back for correction. Email gets the closest scrutiny — it's repaired ("john at example dot com" becomes &lt;code&gt;john@example.com&lt;/code&gt;) and validated the moment it's captured, because a mangled address is unrecoverable later; name and phone are captured as spoken and normalized when the order is written. The channel changes how the question is asked; it never changes where the answer lives. The transcript is not the database.&lt;/p&gt;

&lt;p&gt;One choreography sheet, three stagings. And because the voice prompt is static, the supplier-side agent configuration never needs to know who is calling — the caller's identity resolves server-side and rides the tool plumbing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inside the core
&lt;/h3&gt;

&lt;p&gt;The decisions the core keeps for itself are where most of the design lives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trust is gated by provenance, not presence.&lt;/strong&gt; When the core resolves contact information, it doesn't just ask &lt;em&gt;Do I have it?&lt;/em&gt; — it asks &lt;em&gt;Where did it come from?&lt;/em&gt; An explicit argument means the model was told this turn. A conversation session means the customer entered it minutes ago, in this very chat — don't insult them by re-asking. A record on file means it's from a previous visit — read it back and confirm before spending it. Same three fields, three different levels of consent. The presence of data is not permission to use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Earned trust has a number.&lt;/strong&gt; Re-confirming contact on every order would punish regulars with friction. So there's an explicit bar, and it takes three things at once: the customer's three most recent orders all carry the same contact details, that triple matches the contact currently on file, and all three fields — name, email, &lt;em&gt;and&lt;/em&gt; phone — are present. Everything is compared after normalization, because &lt;code&gt;PAT@x.com&lt;/code&gt; and &lt;code&gt;(555) 010-3985&lt;/code&gt; have to match &lt;code&gt;pat@x.com&lt;/code&gt; and &lt;code&gt;5550103985&lt;/code&gt;. Miss any of it — one of those three orders differing, a phone that was never collected — and we ask. The threshold isn't clever; the point is that it's &lt;em&gt;explicit&lt;/em&gt;, and a unit test can hold it in place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Evidence gets consumed.&lt;/strong&gt; One subtlety earned its scars: that "entered this conversation" session is an &lt;em&gt;evidence token&lt;/em&gt; — it vouches that the customer just told us who they are. We shipped a version where the token outlived the order it vouched for, and a second order in the same conversation sailed through with no contact interaction at all, riding the first order's evidence. The fix: a successful order &lt;em&gt;spends&lt;/em&gt; the token (a failed one keeps it, so retries don't re-ask). Note that spending it never sends the customer back to a blank form — by then their details are on file, so the next order in the same chat gets the one-line read-back, not re-entry. Ten lines and two tests — and it was findable in one debugging session precisely because there was exactly one place to look.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An order is claimed, not just created.&lt;/strong&gt; Submission begins with an atomic claim on the cart, so a timed-out request that gets retried replays the same order instead of creating a twin. The model can be as retry-happy as it likes; the core is idempotent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part IV: Two alternatives, for comparison
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Alternative 1: the workflow wizard
&lt;/h3&gt;

&lt;p&gt;The traditional answer: a fixed state machine — cart → details → contact → confirm → pay — with the LLM reduced to narrating each step. It's deterministic and safe, and it's how most checkout flows were built for twenty years.&lt;/p&gt;

&lt;p&gt;It dies on contact with conversation. A customer who asks "wait, does that come in a larger size?" mid-checkout is off-script; the wizard has no state for it. "Use my work email instead" is an edit the flow didn't anticipate. And the wizard is coupled to its medium — a form-based state machine has no natural phone-call rendering, so each channel grows its own variant, and you're back to N copies drifting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Alternative 2: the free-form agent
&lt;/h3&gt;

&lt;p&gt;The fashionable answer: give the model the tools and the conversation, and let it decide. Prompt it with guidelines — "always confirm contact details before ordering" — and trust it.&lt;/p&gt;

&lt;p&gt;The conversation is genuinely wonderful. The decisions are not. The model fills in an email it saw two hundred messages ago. It announces "your order is placed!" one tool-call too early. It confirms contact details on Tuesday and forgets to on Thursday, because &lt;em&gt;guidelines in a prompt are sampled, not executed&lt;/em&gt;. There's no idempotency, because retries are a concept the model doesn't reliably hold. And you can't write a unit test for behavior that lives in sampling temperature — every prompt tweak becomes a release risk for your revenue path.&lt;/p&gt;

&lt;h3&gt;
  
  
  Side by side
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Workflow wizard&lt;/th&gt;
&lt;th&gt;Free-form agent&lt;/th&gt;
&lt;th&gt;Protocol over a core (ours)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Conversation quality&lt;/td&gt;
&lt;td&gt;Scripted, brittle&lt;/td&gt;
&lt;td&gt;Natural&lt;/td&gt;
&lt;td&gt;Natural&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Decision safety&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Sampled — varies&lt;/td&gt;
&lt;td&gt;High (decisions are never sampled)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Channel portability&lt;/td&gt;
&lt;td&gt;One wizard per channel&lt;/td&gt;
&lt;td&gt;High, but each channel drifts&lt;/td&gt;
&lt;td&gt;One core, thin adapters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Testability&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Poor&lt;/td&gt;
&lt;td&gt;High — decisions live in one heavily unit-tested core&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Our approach aims to preserve the wizard's decisions and the agent's conversation. The price is real: someone has to &lt;em&gt;design the protocol&lt;/em&gt; — enumerate the outcomes, define the flags, decide what rides in results versus prompts. That design work is exactly what the other two approaches let you skip, and exactly why they fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part V: What generalizes
&lt;/h2&gt;

&lt;p&gt;If you're building an agent that transacts — orders, bookings, payments, anything with consequences — the shape of the argument travels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Put decisions in code and conversation in the model.&lt;/strong&gt; The boundary between them is the most important interface in your system; make it explicit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Typed outcomes are that interface.&lt;/strong&gt; The model should react to signals, not parse prose or improvise state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep prompts static; let data ride the tool results.&lt;/strong&gt; You may be forced into this by frozen voice configs, as we were — but it's worth doing anyway. It's what makes one protocol portable across channels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate trust on provenance and recency.&lt;/strong&gt; &lt;em&gt;That you have&lt;/em&gt; a customer's details and &lt;em&gt;that you may use them&lt;/em&gt; are different facts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give trust thresholds explicit numbers&lt;/strong&gt;, so tests can pin them down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single-use evidence must be consumed.&lt;/strong&gt; Anything that vouches for "the customer just did X" needs to be spent when it's used.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make the decision layer testable.&lt;/strong&gt; Push each rule into one place and unit-test it there. The sharpest rules — the trust threshold, the order-details check — fall out as pure functions you can test in isolation, even where the core around them still does its own database and cache I/O. Our conversational layer changes weekly; the decision layer, pinned by its tests, doesn't flinch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The quiet payoff shows up later. The same choreography sheet runs a chat widget and a live phone line, unchanged. And when a real bug appeared in the trust logic, the fix was ten lines — not because we're careful, but because there was one place to be careless in.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://xinfer.ai/home/md/the-llm-narrates-the-core-decides" rel="noopener noreferrer"&gt;xinfer.ai&lt;/a&gt; — where there is also a 2-minute audio spotlight and a full narration of this essay.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm Sam Wen, founder of &lt;a href="https://xinfer.ai" rel="noopener noreferrer"&gt;XInfer.AI&lt;/a&gt;. We build AI agents that transact — chat, voice, phone, and SMS — with one deterministic core underneath all of it.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>architecture</category>
      <category>ecommerce</category>
    </item>
    <item>
      <title>The Model Writes, the Judge Measures: Anatomy of an LLM Judge</title>
      <dc:creator>Sam Wen</dc:creator>
      <pubDate>Mon, 27 Jul 2026 01:18:04 +0000</pubDate>
      <link>https://dev.to/sam_wen_xinfer_ai/the-model-writes-the-judge-measures-anatomy-of-an-llm-judge-2k95</link>
      <guid>https://dev.to/sam_wen_xinfer_ai/the-model-writes-the-judge-measures-anatomy-of-an-llm-judge-2k95</guid>
      <description>&lt;p&gt;Here is the kind of sentence that should keep a team up at night:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"At this clarity grade, you won't see a thing with the naked eye."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Our assistant produced it while explaining a diamond. The grade it cites is real — SI1, printed on&lt;br&gt;
the stone's lab report. The promise attached to it is invented. A clarity grade is assigned under&lt;br&gt;
10× magnification; it does not resolve what a naked eye will see. Two SI1 stones can look entirely&lt;br&gt;
different — one clean at arm's length, the other with a visible speck right in the middle.&lt;br&gt;
The model took a true fact and manufactured its consequence, because that is what a helpful&lt;br&gt;
sentence sounds like.&lt;/p&gt;

&lt;p&gt;Notice what the sentence is not. It is not a banned word. It is not a hallucinated stone. It&lt;br&gt;
contains no wrong number. It breaks no rule you could have written down in advance. It is simply&lt;br&gt;
fluent — and fluency is the problem. Fluent and true are different variables, and a language model&lt;br&gt;
optimizes the first one.&lt;/p&gt;

&lt;p&gt;We build AI assistants for exactly this kind of product. The one in this essay explains diamonds:&lt;br&gt;
a short, two-voice spoken conversation about one stone — a host asks the questions a shopper&lt;br&gt;
would ask, a gemologist answers — generated from that stone's evidence. A diamond is the&lt;br&gt;
definition of a high-consideration purchase: thousands of dollars, bought rarely, chosen under&lt;br&gt;
uncertainty. And it has a property that makes it an unforgiving test bed for generative AI —&lt;br&gt;
nearly every claim about a diamond can be checked against its certificate from GIA or IGI, the&lt;br&gt;
independent laboratories that grade the world's diamonds. Overselling is not just tacky here. It&lt;br&gt;
is checkable.&lt;/p&gt;

&lt;p&gt;In an &lt;a href="https://xinfer.ai/home/md/the-llm-narrates-the-core-decides" rel="noopener noreferrer"&gt;earlier essay&lt;/a&gt; we argued that the language model should conduct the conversation while a&lt;br&gt;
deterministic core makes every decision. This essay is the same worldview applied to quality. The&lt;br&gt;
model writes. It does not get to grade.&lt;/p&gt;

&lt;p&gt;At one generation you can catch a sentence like the one above by reading it. Across a catalogue of&lt;br&gt;
stones you cannot. So before we made the writer better, we built an instrument: an independent LLM&lt;br&gt;
judge that reads every generated claim against the evidence and returns a verdict we can count.&lt;br&gt;
This essay is about how that judge is built, how we keep the judge itself honest, and what changed&lt;br&gt;
once we had it — which is that the arguments stopped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part I — Three gates, and who owns which rule
&lt;/h2&gt;

&lt;p&gt;The assistant explains one diamond at a time, from that diamond's evidence: the lab certificate,&lt;br&gt;
the price, the retailer's published analysis of the stone. One rule governs everything: &lt;strong&gt;every&lt;br&gt;
claim about this stone must trace to supplied evidence.&lt;/strong&gt; If the evidence cannot answer — &lt;em&gt;is it&lt;br&gt;
eye-clean, meaning no marks visible to the naked eye?&lt;/em&gt; — the assistant says so, out loud: the&lt;br&gt;
honest answer is a maybe, and it will not promise more. Then it points the shopper to a human gemologist.&lt;/p&gt;

&lt;p&gt;Enforcing that rule is not one mechanism. It is three, layered, and they differ in kind.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The first gate prevents.&lt;/strong&gt; It runs in code, inside the pipeline. When the assistant generates a&lt;br&gt;
follow-up question about a stone, the question must name the evidence path it would be answered&lt;br&gt;
from. A question that names no available path is rejected — by code, not by prompt hope. This is&lt;br&gt;
what stops the system from asking "how does this price compare to the market?" about a stone&lt;br&gt;
whose data has no comparable set. The model never gets the chance to improvise an answer, because&lt;br&gt;
the question never survives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The second gate catches.&lt;/strong&gt; A deterministic validator runs over every finished script: a&lt;br&gt;
hard-fail lexicon of the words the assistant must never say — &lt;em&gt;amazing&lt;/em&gt;, &lt;em&gt;must-have&lt;/em&gt;,&lt;br&gt;
&lt;em&gt;investment&lt;/em&gt;, the manufactured urgency, the "trust me." Word-boundary regexes, a few dozen tests,&lt;br&gt;
no judgment involved. If a banned phrase appears, the script fails. Cheap, fast, and absolute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The third gate judges.&lt;/strong&gt; What remains after prevention and regex is the dangerous class: the&lt;br&gt;
plausible-but-unsupported claim. "You won't see a thing with the naked eye" passes both gates. No&lt;br&gt;
rule names it in advance, because it is not a phrase — it is a relationship between a sentence and&lt;br&gt;
a lab report. Checking it requires reading both. That is a job for a reader, and at scale the&lt;br&gt;
reader has to be a model.&lt;/p&gt;

&lt;p&gt;One detail here taught us more than we expected: &lt;strong&gt;the boundary between the gates is itself a&lt;br&gt;
design decision.&lt;/strong&gt; When we extended the banned-word list from the domain experts' style guide, the&lt;br&gt;
unambiguous terms went into the regex gate. But the context-dependent ones deliberately did not —&lt;br&gt;
and the best example is &lt;em&gt;flawless&lt;/em&gt;. In most products, "flawless" is empty praise. In diamonds it&lt;br&gt;
is literally a grade: FL, the top of the GIA clarity scale. "It is not flawless" is a factual&lt;br&gt;
statement about an SI1 stone, not a compliment withheld. Likewise "guaranteed": a real test&lt;br&gt;
fixture proved that "that would need a guarantee the report doesn't give" is the assistant at its&lt;br&gt;
most honest. A blunt regex would fail exactly those sentences. Those words went to the judge&lt;br&gt;
instead, which can read the sense and not just the string. Which gate owns which rule is not a&lt;br&gt;
default. It is a decision, and we made it with test evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part II — Anatomy of a verdict
&lt;/h2&gt;

&lt;p&gt;"Use an LLM judge" usually means: ask a model to rate the output from one to ten. A score like&lt;br&gt;
that is an opinion with a number attached. You cannot appeal it, you cannot audit it, and you&lt;br&gt;
cannot tell whether a 7 means two small problems or one large one. It is not an instrument; it is&lt;br&gt;
a mood.&lt;/p&gt;

&lt;p&gt;Our judge is built differently, and every difference exists because a naive version failed first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It returns a triage, not a score.&lt;/strong&gt; For every sentence that asserts something beyond restating&lt;br&gt;
the input data, the judge answers typed questions: Is this a claim about &lt;em&gt;this stone&lt;/em&gt;, or about&lt;br&gt;
diamonds in general? If it is about this stone — does the evidence establish it? If it is general&lt;br&gt;
— is it accurate gemology? "Lab-grown and natural diamonds are chemically identical" is category&lt;br&gt;
teaching: permitted, and wanted — the judge's instructions say teaching is never a violation.&lt;br&gt;
"This stone will look white to the eye" is an item claim, and it had better trace to something. A &lt;strong&gt;real&lt;/strong&gt;&lt;br&gt;
violation is only the intersection: about this stone, &lt;em&gt;and&lt;/em&gt; unsupported.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A claim also has an owner.&lt;/strong&gt; Supported is not the only axis. GIA graded the stone; the retailer&lt;br&gt;
analyzed it; the assistant speaks for the house. If it says "we grade this VS1," every word is&lt;br&gt;
factually true and the sentence is still a violation — it credits the lab's work to the house.&lt;br&gt;
The judge flags misattribution as its own class, separate from unsupported claims, because&lt;br&gt;
provenance errors are how a trustworthy voice quietly claims authority it does not have.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It must report the claims it cleared.&lt;/strong&gt; The judge is required to list the general statements and&lt;br&gt;
the supported claims too, with the classification visible — and it is forbidden from letting them&lt;br&gt;
inflate the violation count. This sounds like bureaucracy. It is the whole point. A verdict that&lt;br&gt;
only lists problems is a number you have to trust. A verdict that shows every ruling — each quote&lt;br&gt;
verbatim, each one naming the evidence path it was checked against — is an audit trail you can&lt;br&gt;
re-check. When the judge is wrong, you can see exactly where.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Orthogonal signals stay orthogonal.&lt;/strong&gt; The judge also measures tone: does the assistant sound&lt;br&gt;
like a trusted expert across the counter or a closer working a commission? Does the conversation&lt;br&gt;
sound like two people responding to a stone, or a script? But tone is a separate, subordinate&lt;br&gt;
channel, and the judge's instructions are blunt: warmth never excuses an unsupported claim. A&lt;br&gt;
formatting check rides in a third channel and changes nothing in the honesty count. There is no&lt;br&gt;
blended score, deliberately. A blended score is where warmth hides dishonesty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The writer and the judge read the same constitution.&lt;/strong&gt; Every rule about what a lab report does&lt;br&gt;
and does not support lives in one content-standard document. That document is spliced into the&lt;br&gt;
writer's prompt and into the judge's prompt. The spec is a single artifact: the writer implements&lt;br&gt;
it, the judge enforces it, and editing one sentence changes both sides of the contract at once.&lt;br&gt;
There is no version of the rules that only the judge believes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It never grades its own output.&lt;/strong&gt; The writers run on Claude Sonnet 5. The judge's seat has been&lt;br&gt;
held by two models — first GPT-5.5, a different lab entirely, and today Claude Opus 4.8, a&lt;br&gt;
different model from the writers — and we verified the discipline held across the change. A model&lt;br&gt;
asked to grade its own writing has a conflict of interest baked into its weights. Independence&lt;br&gt;
has to be constructed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It never touches production.&lt;/strong&gt; The judge is a development instrument, not a runtime guardrail.&lt;br&gt;
It grades output during the dev cycle to find where the writer's prompts leak; it adds zero&lt;br&gt;
latency and zero cost to serving. Grading one diamond costs about thirty cents — four passes,&lt;br&gt;
each re-reading the full evidence — which is trivially cheap in development and pointlessly&lt;br&gt;
expensive in production, where the deterministic gates already stand. A judge is not a content&lt;br&gt;
filter. It is how you find out what to fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part III — Calibrate the instrument
&lt;/h2&gt;

&lt;p&gt;The uncomfortable part: the judge is also a language model. It is an unreliable narrator hired to&lt;br&gt;
audit an unreliable narrator. This is less absurd than it sounds — auditors are people too — but&lt;br&gt;
only if the workflow plans for it. Ours does, in three ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The judge can be wrong, and the loop says so.&lt;/strong&gt; Our written dev cycle is: the judge finds a&lt;br&gt;
violation → we fix the writer's prompt, &lt;em&gt;or we fix the judge if the judge is wrong&lt;/em&gt; → we log it →&lt;br&gt;
we re-run. The same humility applies to the deterministic gates. We ban the word &lt;em&gt;flaw&lt;/em&gt; — the&lt;br&gt;
marks inside a stone are characteristics, never flaws. Then the assistant, explaining a modest luster&lt;br&gt;
rating, said it was &lt;em&gt;"not a flaw; just part of why the rating sits at four instead of five or&lt;br&gt;
six"&lt;/em&gt; — and the regex failed the most honest sentence in the script. So the ban was narrowed:&lt;br&gt;
the corrective "not a flaw" now passes, while "no flaws in this stone" — a perfection claim —&lt;br&gt;
still fails. The exemption got its own tests. False positives are not noise; they are&lt;br&gt;
calibration data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The verdict is schema-checked, and malformed verdicts retry.&lt;/strong&gt; In real runs the judge would&lt;br&gt;
intermittently drop a required field, or return a field with the wrong type. We do not average&lt;br&gt;
around that; the harness detects the malformed verdict and retries it, and every consumer of the&lt;br&gt;
verdict is guarded against a bad shape. An instrument with unhandled failure modes doesn't stop&lt;br&gt;
measuring — it starts lying quietly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One sample is noise.&lt;/strong&gt; The same stone, judged twice, does not score the same. We watched one&lt;br&gt;
diamond score fifteen violations on one run and six to eight on reruns. If we had compared two&lt;br&gt;
models using single samples, we could have concluded anything at all. The discipline is boring:&lt;br&gt;
average at least two runs before believing any comparison, and never let a single verdict decide&lt;br&gt;
anything important.&lt;/p&gt;

&lt;p&gt;An instrument you never calibrate is just another opinion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part IV — Three arguments we never had to have
&lt;/h2&gt;

&lt;p&gt;Here is what actually changed when the judge existed. Three decisions that AI teams normally&lt;br&gt;
settle by taste, seniority, or vendor reputation got settled by reading the same number before and&lt;br&gt;
after.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which model.&lt;/strong&gt; We ran two writer tiers over the same stones, with the same prompts and the same&lt;br&gt;
judge. Claude Haiku 4.5 — the small, fast tier — averaged about ten real violations per diamond.&lt;br&gt;
Claude Sonnet 5 averaged 0.8. A twelve-fold honesty gap, on identical inputs. And the direction of&lt;br&gt;
the tradeoff surprised us: Sonnet also scored &lt;em&gt;higher&lt;/em&gt; on specificity, so the honesty did not cost&lt;br&gt;
richness. Every arithmetic blunder in the corpus came from the small model — including the run&lt;br&gt;
where it declared one stone "59 carats more" than another. The real gap between those stones was&lt;br&gt;
0.13 carats — and fifty-nine &lt;em&gt;dollars&lt;/em&gt;. The model had turned a price difference into a weight.&lt;br&gt;
Fifty-nine carats is not an engagement ring; it is a museum piece. A model that cannot keep&lt;br&gt;
dollars and carats apart is not a bargain at any latency.&lt;/p&gt;

&lt;p&gt;The judge also caught something no benchmark would have: the fast tier existed only to shave&lt;br&gt;
seconds off time-to-first-word, yet it had quietly generated every record in our persisted&lt;br&gt;
"quality" collection. The latency shortcut had poisoned the quality artifact. No unit test flagged&lt;br&gt;
it, because every unit test passed. The judge flagged it, because the judge reads output.&lt;/p&gt;

&lt;p&gt;The ending is the good part. The fast model's one advantage evaporated when we fixed a parser to&lt;br&gt;
accept the larger model's output format — and measured end to end, the strong model at low&lt;br&gt;
reasoning effort was fast enough to serve. Reputation said "the small model is fine for this." The&lt;br&gt;
instrument said otherwise, and the instrument had receipts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Whether RAG.&lt;/strong&gt; Everyone's default architecture for grounding is retrieval. We shipped something&lt;br&gt;
smaller: a deterministic key-join. The gemological knowledge — vetted definitions, approved&lt;br&gt;
analogies, the boundaries of what a report can and cannot tell you — is keyed by characteristic,&lt;br&gt;
and each stone's generation receives only the blocks matching what &lt;em&gt;its&lt;/em&gt; report actually lists: a&lt;br&gt;
cloud, a feather, a needle — the trade's names for the tiny marks inside a stone. An exact&lt;br&gt;
lookup, not a search. So when the assistant explains a&lt;br&gt;
cloud, it uses the vetted definition — a cluster of microscopic pinpoints — and keeps the vetted&lt;br&gt;
boundary: the report cannot tell you whether it causes visible haze in &lt;em&gt;this&lt;/em&gt; stone. The&lt;br&gt;
knowledge base is content-hashed into the cache key, so editing one entry regenerates exactly the&lt;br&gt;
output that depended on it.&lt;/p&gt;

&lt;p&gt;Did we lose anything by skipping the vector database? That is normally a religious question. For&lt;br&gt;
us it was an empirical one: the judge held the grounded output at zero real violations per stone.&lt;br&gt;
Retrieval remained unnecessary for a bounded, one-stone-at-a-time task — not as an article of&lt;br&gt;
faith, but as a measured result we can revisit the day the task stops being bounded.&lt;/p&gt;

&lt;p&gt;There was a quiet confirmation along the way. A gemological standard written independently by the&lt;br&gt;
domain's own experts — people who had never read our prompts — was later diffed against our&lt;br&gt;
system. It landed on the same rules: the same evidence discipline, the same refusal to infer&lt;br&gt;
eye-cleanness from a clarity grade, the same banned reassurances. Two instruments, built apart,&lt;br&gt;
giving the same reading. That is what being right feels like from the inside: unremarkable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Did the edit help.&lt;/strong&gt; The prompts are the product, so we treat them like one. Every prompt edit&lt;br&gt;
carries a changelog entry with four fields: the &lt;strong&gt;case&lt;/strong&gt; (the concrete finding that forced it —&lt;br&gt;
almost always a judge finding), the &lt;strong&gt;reason&lt;/strong&gt; (the principle it serves), the &lt;strong&gt;change&lt;/strong&gt; (what&lt;br&gt;
actually moved), and the &lt;strong&gt;verification&lt;/strong&gt; (a judged real run, with numbers). A typical case: the&lt;br&gt;
judge caught the assistant volunteering &lt;em&gt;why&lt;/em&gt; a stone had earned its value rating — a cause the&lt;br&gt;
evidence never states — so the rule against manufactured explanations was widened, and the&lt;br&gt;
verification showed the pattern gone across redraws with the honesty counts unchanged. About&lt;br&gt;
sixty entries accumulated in the first week. No silent edits, ever. And because the prompt version&lt;br&gt;
is folded into the cache key, no cached episode can ever have come from an unknown prompt: edit&lt;br&gt;
the prompt, and everything it touched regenerates by design.&lt;/p&gt;

&lt;p&gt;This is test-driven development for a non-deterministic system. The judge's verdict is the failing&lt;br&gt;
test you drive to green. And the tests that matter run against the real API, on real output —&lt;br&gt;
because in this project, every finding above came from a real run, and the mocked tests passed the&lt;br&gt;
whole time. Over four hundred automated tests guard what can be asserted deterministically; not&lt;br&gt;
one of them counts as evidence that the writing got better. Only the instrument says that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part V — What generalizes
&lt;/h2&gt;

&lt;p&gt;Diamonds are the setting, not the point. This pattern transfers to any team shipping generative&lt;br&gt;
output where being wrong is expensive. The short version:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build the instrument before polishing the product.&lt;/strong&gt; You cannot improve what you argue about.
A judge you trust converts taste into experiments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer the gates, and decide which gate owns which rule.&lt;/strong&gt; Prevent in code what can be
prevented. Hard-fail on regex what is unambiguous. Send to the judge only what requires
reading. The boundary is a design decision — make it with test evidence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demand a triage, not a score.&lt;/strong&gt; Typed questions, verbatim quotes, named evidence, cleared
claims reported alongside violations. If you cannot re-check a verdict, you do not have an
instrument; you have a mood.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep channels orthogonal.&lt;/strong&gt; Honesty, provenance, tone, formatting — measured separately,
never blended. A single number is where problems hide behind virtues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Construct independence.&lt;/strong&gt; A different model, ideally a different lab, reading from the same
written standard as the writer. Never let a model grade its own homework.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calibrate, and distrust single samples.&lt;/strong&gt; Fix the judge when the judge is wrong, guard
against malformed verdicts, average runs. Variance is real and it will lie to you.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep the judge out of production.&lt;/strong&gt; It is a development instrument. The gates that serve
customers should be deterministic, cheap, and boring.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The payoff is cultural as much as technical. Model selection stopped being a debate about vendor&lt;br&gt;
reputation. Architecture stopped being a debate about fashion. Prompt engineering stopped being a&lt;br&gt;
vibe. We stopped arguing about which model was smarter and started reading the same number twice.&lt;/p&gt;

&lt;p&gt;One honest caveat, because our instrument would flag us if we skipped it: the judge measures&lt;br&gt;
whether the assistant is honest about a diamond. It cannot measure whether a shopper wants to&lt;br&gt;
listen. That is a different experiment, with a different instrument — and no model gets to grade&lt;br&gt;
it for us.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://xinfer.ai/home/md/the-model-writes-the-judge-measures" rel="noopener noreferrer"&gt;xinfer.ai&lt;/a&gt; — where there is also a 2-minute audio spotlight and a full narration of this essay.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm Sam Wen, founder of &lt;a href="https://xinfer.ai" rel="noopener noreferrer"&gt;XInfer.AI&lt;/a&gt;. We build AI agents that transact — chat, voice, phone, and SMS — with one deterministic core underneath all of it.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>testing</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>The Factory Builds, the Evidence Admits: Anatomy of an Agent Certification</title>
      <dc:creator>Sam Wen</dc:creator>
      <pubDate>Mon, 27 Jul 2026 01:16:04 +0000</pubDate>
      <link>https://dev.to/sam_wen_xinfer_ai/the-factory-builds-the-evidence-admits-anatomy-of-an-agent-certification-48pe</link>
      <guid>https://dev.to/sam_wen_xinfer_ai/the-factory-builds-the-evidence-admits-anatomy-of-an-agent-certification-48pe</guid>
      <description>&lt;p&gt;Sooner or later, someone across the table asks the question. A client's security team. An auditor. An acquirer's diligence engineer. A regulator. Or you, at two in the morning:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Why is this agent allowed to do that?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not &lt;em&gt;does it work&lt;/em&gt; — demos answer that, and demos are cheap. Not &lt;em&gt;how good is it&lt;/em&gt; — benchmarks answer that, about someone else's test set. The question is why it is &lt;strong&gt;allowed&lt;/strong&gt;: what, concretely, stands behind the decision to let a language model operate near your customers and your money, and would that reasoning survive being read back to you a year later.&lt;/p&gt;

&lt;p&gt;We build AI agents that transact — chat, voice, phone, SMS, one deterministic core underneath all of it. In an &lt;a href="https://xinfer.ai/home/md/the-llm-narrates-the-core-decides" rel="noopener noreferrer"&gt;earlier essay&lt;/a&gt; we argued that the language model should conduct the conversation while that core makes every decision. In a &lt;a href="https://xinfer.ai/home/md/the-model-writes-the-judge-measures" rel="noopener noreferrer"&gt;second&lt;/a&gt;, that the model which writes must never be the model that grades. This essay is the third act, and it asks what the first two were building toward: when an agent is done, what actually admits it to production?&lt;/p&gt;

&lt;p&gt;Our answer is unglamorous. Not a launch review, not a leaderboard, not a sign-off meeting. &lt;strong&gt;A file.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A note on what kind of essay this is, because the subject demands it. The first two essays reported what we had built and measured; every claim had a receipt. This one goes further than the receipts. The system it describes is real and in production — but parts of what follows are &lt;strong&gt;extrapolation from the work we have done&lt;/strong&gt;: conclusions the built system points to, worked out on paper, not yet running. I will mark the line as we cross it. An essay about certification that blurred the line between measured and extrapolated would fail its own bar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part I — The question a demo can't answer
&lt;/h2&gt;

&lt;p&gt;Strip the ceremony away and "this agent may run in production" asserts four things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Its authority is bounded.&lt;/strong&gt; There is a known, finite list of decisions it can cause, and everything off that list is impossible — not discouraged, impossible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Its inputs are trusted by origin.&lt;/strong&gt; Every piece of data it acts on has a provenance, and provenance — not mere presence — determines what may be done with it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Its words are measured.&lt;/strong&gt; Whatever the model still says freely has been evaluated against evidence, by something that is not the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All of it replays.&lt;/strong&gt; Anyone, later, can reconstruct exactly what was approved, against what evidence, and check the reasoning themselves.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Notice what's missing from that list: &lt;em&gt;the builder's confidence.&lt;/em&gt; "We built it and it works" is the builder grading their own homework — the precise conflict of interest the second essay spent five parts constructing independence against, now at the scale of a whole agent instead of a single sentence. A model must not grade its own writing; a team cannot certify its own agent. Not because teams are dishonest, but because the incentives point one way and the weights, so to speak, are baked.&lt;/p&gt;

&lt;p&gt;The first essay separated the decider from the narrator inside one request. The second separated the evaluator from the writer inside one build. Certification is the same cut, one level up: it separates &lt;strong&gt;the party that builds from the thing that admits&lt;/strong&gt;. And the admitting party, in our view, should not be a committee. It should be the evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part II — The evidence file
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;What follows is built and measured — this is the file we can produce for our own agent today.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authority is a list, not a mood.&lt;/strong&gt; When our model submits an order, the request lands in one server-side function, and that function answers with one of five typed outcomes — order placed, contact needed, contact to confirm, cart empty, or a failure with a reason code. That list &lt;em&gt;is&lt;/em&gt; the agent's authority over money. Nothing else can happen, because there is nothing else the core returns. This is the first thing that belongs in an evidence file, and the cheapest to check: the enumerated decisions. If you cannot write the list down, your agent does not have bounded authority; it has tendencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Seriousness is not the criterion for what goes in code. Determinism is.&lt;/strong&gt; The temptation is to move everything "important" into the deterministic core. That's the wrong test. What moves into code is what has a &lt;em&gt;code-time-knowable correct answer&lt;/em&gt; — thresholds, lookups, idempotency, required disclosures. Force a genuine judgment call into code and you either reduce it to a crude proxy or smuggle a model in through the back door, destroying the very property that made the core trustworthy. The right move, when a judgment is needed, is the one the second essay described: the model emits a &lt;strong&gt;typed verdict&lt;/strong&gt;, and the core decides the &lt;em&gt;action&lt;/em&gt;. Judgment measured by a model; consequence owned by code. The same split, applied recursively.&lt;/p&gt;

&lt;p&gt;There is a corollary we now treat as a rule: &lt;strong&gt;an agent may make a decision only where the decision rule already exists in deployable form&lt;/strong&gt; — a written policy, an existing validated system, a governed model. Where the rule exists nowhere — where the call is genuinely discretionary — the agent does not get to manufacture it, and neither does your prompt. The agent does the &lt;em&gt;perception&lt;/em&gt;: it reads the messy input, extracts the structure, drafts the summary. A person, or captured logic, decides. This sounds restrictive; in practice it's liberating, because an enormous amount of valuable work was never automated not because the logic was missing but because the &lt;em&gt;inputs&lt;/em&gt; arrived unstructured. The rules were always written down. They were gated on reading. Reading is exactly what these models are for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Provenance, and evidence that is spent.&lt;/strong&gt; The first essay covered this machinery in detail, so a summary: our core trusts data by where it came from — supplied this turn, established this session, on file from before — and each origin authorizes something different. Session evidence is a single-use token, consumed by the order it vouches for, so a second order can't ride the first one's proof. Submissions claim the cart atomically, so a model that retries a timeout replays the same order instead of minting a twin. Every one of those sentences is a unit test somewhere; that's what makes them evidence rather than architecture slides.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The gate is not a dashboard.&lt;/strong&gt; Our judge — a different model from the writer, reading the same written standard — returns typed verdicts, quotes each claim verbatim, names the evidence path it checked against, and reports the claims it &lt;em&gt;cleared&lt;/em&gt; alongside the ones it flagged. But the detail that matters for certification is what happens downstream of a verdict: &lt;strong&gt;grounding failures block the merge; quality is tracked as a trend.&lt;/strong&gt; One is a gate, the other is a gauge, and confusing them is how eval programs die. A check that cannot fail the build is not a control. It's a dashboard with opinions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Everything replays.&lt;/strong&gt; Every judged run persists what it saw: the prompt, the evidence supplied, the verdict, the model and version. Prompt versions and knowledge content are hashed into cache keys, so no cached output can ever have come from an unknown prompt — edit the standard and everything that depended on it regenerates by design. Every prompt change carries a changelog entry: the case that forced it, the reason, the change, the judged verification. The second essay said that a verdict you cannot re-check is not an instrument but a mood. One level up, the same law: &lt;strong&gt;a certification you cannot replay is not a decision. It's an opinion.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part III — The map, and the open column
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;This part is an audit, not a system — real work, done on paper, against standards we didn't write.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Confidence in your own architecture is worth little; the essays above are, after all, the builder talking. So recently we did the adversarial thing: we took the two patterns — core-decides, judge-measures — and put them in front of &lt;strong&gt;twenty-five requirements drawn from NIST's AI Risk Management Framework and the EU AI Act's high-risk articles.&lt;/strong&gt; Frameworks written by people who have never read our prompts and owe us nothing.&lt;/p&gt;

&lt;p&gt;The map came back in three colors: &lt;strong&gt;ten requirements covered, ten partial, and the rest open.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Covered&lt;/em&gt; clustered exactly where you'd predict, which is itself a useful check. Accuracy and truthfulness — the judge's whole existence. Robustness and reliability — idempotency, cross-channel consistency, retry-safety. Logging and traceability — typed outcomes are auditable &lt;em&gt;by construction&lt;/em&gt;; you don't add logging to a decision that is already a value. Independent measurement — a calibrated evaluator that is not the writer. In NIST's vocabulary, the judge is a &lt;strong&gt;Measure&lt;/strong&gt; function and the core is a &lt;strong&gt;Manage&lt;/strong&gt; function, and the two patterns turn out to be those two boxes, implemented.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Partial&lt;/em&gt; is where architecture helps but doesn't finish: data governance, transparency, human oversight. The core makes oversight &lt;em&gt;possible&lt;/em&gt; — a transparent, logged, explainable decision that a person can review is strictly better than a model output to rubber-stamp — but possible is not the same as done. Disclosure to the end user sits here too, and it's an instructive case. Every agent we ship introduces itself as an AI in its opening line — &lt;em&gt;"I'm Kai, your AI assistant. How can I help you today?"&lt;/em&gt; — across chat, voice, and phone alike. But that sentence lives in a configurable greeting, not an enforced gate: a merchant could edit it away. Handled by default is not the same as guaranteed by construction, and a map that blurred those two would be flattering itself.&lt;/p&gt;

&lt;p&gt;Then the open column, and here is the finding that reframed the exercise for us. The open items were: accountability and ownership. Governance of third-party and vendor models. Bias and fairness examination. Privacy and PII handling. Runtime monitoring and incident response.&lt;/p&gt;

&lt;p&gt;Read that list twice. &lt;strong&gt;Every open item is organizational.&lt;/strong&gt; Not one of them is a gate you can design. No typed outcome produces an accountable owner; no judge verdict staffs an incident channel at 3 a.m.; no cache key reviews a vendor. The architecture ran out precisely where the org chart begins — which is not a failure of the architecture. It is the discovery of where certification stops being an engineering problem. An audit that came back all green would have told us nothing except that we'd audited ourselves gently.&lt;/p&gt;

&lt;p&gt;One more honest finding from the same exercise, because it surprised us: &lt;strong&gt;"high-stakes claim" and "high-risk system" are different axes.&lt;/strong&gt; Under the EU AI Act, a commerce agent is limited-risk — its legal obligation is disclosure, not truthfulness. The Act tiers by domain, not by how expensive a false sentence is. Our guardrail work is justified commercially — by what a false promise costs a merchant — not because a statute demands it. Teams over-claim compliance pressure in both directions; the map keeps you honest about which force is actually pushing.&lt;/p&gt;

&lt;p&gt;And the audit exposed a seam we had not named before. The judge works in &lt;em&gt;development&lt;/em&gt; — it grades output to find where the writer's prompts leak, then stays out of production, where the deterministic gates stand watch. Which means: at runtime, nothing independently verifies the narration. The words the model speaks to a live customer pass regex and locked facts, and nothing else. For our risk profile today, that's a reasoned trade. But naming the seam tells you exactly what the next mechanism has to be — and that is where the receipts end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part IV — Extrapolations
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;The line is here. Everything below is extrapolation from the work above — worked out on paper, argued from the built system, not yet running. Our own judge would flag us if we let you read it any other way.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First extrapolation: gate the consequence, not the utterance.&lt;/strong&gt; You cannot batch-check a sentence after a customer has heard it — a slow check on spoken words is monitoring, not a guardrail. But you can gate the &lt;em&gt;consequence&lt;/em&gt;. Capture the irreversible step immediately and idempotently — the order lands, marked pending review. Then run the full-strength judge in the window between capture and fulfillment, where it has no latency budget at all: the entire transcript against the entire evidence file, all the time it wants. Deterministic code reads the verdict and releases, holds, or corrects — before anything ships, charges, or becomes real.&lt;/p&gt;

&lt;p&gt;Payments people will recognize this instantly: it is authorize-then-capture with a fraud hold, applied to conversation. Fast cheap prevention at the utterance; slow accurate judgment at the commit; the irreversible step gated in between. The pattern has one precondition — a reversible window must exist. Instant digital delivery has none; pure advice has nothing downstream to gate; both fall back to strong inline prevention. Our core is idempotent and claims orders atomically today; the hold-window with an asynchronous judge deciding release is design. It is, we think, the single most underused idea in agent safety — mostly because the people who know the payments pattern and the people building agents have not been the same people.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second extrapolation: the admissions office.&lt;/strong&gt; Scale the argument of Part I up from one agent to a catalog of them — the "agent factory" every large organization is now standing up — and the logic forces a structure. If a certification is a file, and the builder cannot self-attest it, then somewhere there is a party whose job is to &lt;em&gt;read the file and say no&lt;/em&gt;. Separate from the builders. Owning the bar, not the backlog.&lt;/p&gt;

&lt;p&gt;That party's product is not agents. It is the bar — and the credibility of the bar is measured by exactly one number: &lt;strong&gt;the rejection rate. A catalog with no rejection rate is not a control. It is a spreadsheet with better branding.&lt;/strong&gt; Every organization that stands up an agent program announces a catalog; almost none can tell you what their bar has refused. Twelve months later there are four hundred entries, zero rejections, and no claim anyone outside the team believes.&lt;/p&gt;

&lt;p&gt;The same file does one more job: it is how reuse gets enforced rather than encouraged. Once an agent's pattern is certified, the file is the reference — and the second team that needs the same capability doesn't get a second certification for a copy; they get pointed at the first one. The catalog becomes the place where duplicate work goes to be refused. We run this logic at merchant scale — one certified checkout protocol, reused across every channel rather than re-certified per channel. At enterprise scale we have not run it, and this essay won't pretend otherwise. The shape is extrapolation. The forces it answers — builders grading themselves, catalogs that only ever grow — are not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part V — What generalizes
&lt;/h2&gt;

&lt;p&gt;The three essays in this series are one idea wearing three sizes. At every layer, &lt;strong&gt;one party proposes, and a different party — with different incentives, reading the same written standard — decides:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Proposes&lt;/th&gt;
&lt;th&gt;Decides&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One request&lt;/td&gt;
&lt;td&gt;The model offers words&lt;/td&gt;
&lt;td&gt;The core owns the action&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One build&lt;/td&gt;
&lt;td&gt;The model writes&lt;/td&gt;
&lt;td&gt;The judge measures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One organization&lt;/td&gt;
&lt;td&gt;The team builds&lt;/td&gt;
&lt;td&gt;The evidence admits&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you are deciding what "certified" should mean for agents — yours, or a catalog of them — here is the shape of the argument, portable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Certification is a file, not a ceremony.&lt;/strong&gt; Enumerated authority, provenance rules, measured words, replayable runs. If you cannot replay the decision, you have an opinion with a date on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check authority first — it's the cheapest gate.&lt;/strong&gt; The list of decisions an agent can cause is knowable before a single behavioral test runs. No list, no bounded authority.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Determinism, not seriousness, decides what lives in code.&lt;/strong&gt; And where judgment is genuinely needed: the model emits a typed verdict, code owns the action.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An agent decides only where the rule is captured.&lt;/strong&gt; Everywhere else it reads, extracts, and drafts — perception — while captured logic or a person decides. Most of the value is in the reading anyway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit against a standard you didn't write.&lt;/strong&gt; Your own rubric will be kind to you. The open column — what your architecture &lt;em&gt;cannot&lt;/em&gt; certify — is the most valuable output, because it is a precise list of what the organization must supply instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate the consequence, not the utterance.&lt;/strong&gt; Where a reversible window exists, capture fast, judge slow, and let code release the hold. Where it doesn't, prevention is all there is — know which case you're in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Separate the builder from the bar.&lt;/strong&gt; And publish the rejection rate. It is the only number that proves the bar exists.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One honest caveat, in the house style: the file certifies the agent. It cannot certify the organization around it — no artifact we know how to construct measures whether an accountable owner will actually show up when the incident channel fires. That column stays open, and pretending a gate design closes it would be exactly the kind of fluent, unsupported claim this whole series exists to catch.&lt;/p&gt;

&lt;p&gt;The extrapolations above are unbuilt, and we've said so. That is not a hedge; it is a roadmap with witnesses. When the hold-window ships, it will get its own essay — receipts first.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://xinfer.ai/home/md/the-factory-builds-the-evidence-admits" rel="noopener noreferrer"&gt;xinfer.ai&lt;/a&gt; — where there is also a 2-minute audio spotlight and a full narration of this essay.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm Sam Wen, founder of &lt;a href="https://xinfer.ai" rel="noopener noreferrer"&gt;XInfer.AI&lt;/a&gt;. We build AI agents that transact — chat, voice, phone, and SMS — with one deterministic core underneath all of it.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>architecture</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
