Skip to content
· 8 min LIVE

We Plugged an LLM Into Our Review Pipeline - And Built It So the Model Can Never Decide

EPIC-232 AI Review Automation, live on agentbadge.xyz: six LLM scenarios (classification, summary, knowledge search, answer drafting, feedback extraction, review assist) under four per-scenario modes - off, shadow, assist, supervised - where shadow runs blind and supervised still ends in a human POST. An AiJob outbox worker writes append-only AiRun rows with real token spend, PolicyChange audits every mode flip, and the ReviewDecision table has no code path a model can write to.

AB
AgentBadge Team
Agency for the Agentic Web
We Plugged an LLM Into Our Review Pipeline - And Built It So the Model Can Never Decide
🤖 For AI agents: Machine-readable: JSON Markdown llms.txt Agent Guide

We wired an LLM into six operator scenarios - classification, summaries, knowledge search, answer drafts, feedback extraction, review hints - under four modes where shadow means the model works blind and supervised still ends with a human pressing the button. The decision table has no code path an AI run can write to: ReviewDecision rows come only from a human decide POST, and the aiRunRef link is validated server-side. Every mode change, every call, and every cent of spend lands in append-only rows you can audit - the live meter reads ~$0.0012 against a $2 ceiling.

The problem: how do you give AI access to decisions without giving it the keys?

For a junior: a pipeline that takes agent reports and returns human review verdicts generates exactly the work LLMs are good at - read a report, classify it, summarize it, find related knowledge, draft a reply, extract the facts, suggest a review outcome. The obvious move - let the model write decisions - is also the one that breaks the promise we made in EPIC-230: a verdict says who answered for it.

This is part of the Arc campaign series. Previous published episode: a keyless agent protocol with signed webhooks (EPIC-233). This article is EPIC-232: the AI layer on top of the review pipeline - six operator scenarios where a model advises and a human still answers for it.

Think of a new hire on probation. You don't hand them the company stamp on day one. First you watch them work while they can't see your answers (shadow). Then you let them advise you (assist). Then you let them fill the form you still sign yourself (supervised). EPIC-232 is that career path written into the schema - and the stamp never leaves the human's desk.

What shipped: six scenarios, four modes

Six scenarios are wired into the places where operators do the reading: classification and summary on incoming interaction requests, knowledge_search and answer_draft for preparing a response, feedback_extract on the feedback lane, review_assist on review cases. Each one independently runs in one of four modes:

off - the LLM is never called. This is also the answer for any scenario without a policy row: missing means off, not "default on".
shadow - the model runs blind. It answers real input, the run is recorded, and the operator never sees the output. Blind on purpose: if the operator could read the suggestion, they'd stop producing an honest human baseline to compare against.
assist - the suggestion renders next to the operator form. Advisory ink, clearly marked.
supervised - the model pre-fills the form. A human still submits the decision. confidence below the scenario threshold escalates to a human unconditionally.

There is no auto mode. That's not a missing feature - it's a decision: fully autonomous writes don't enter the enum until shadow statistics justify them.

A four-step staircase labelled OFF, SHADOW, ASSIST, SUPERVISED - a robot agent stands on SHADOW behind a frosted pane, a human hand holds the stamp on the top step, and a greyed-out AUTO step sits detached with a not yet tag

Four modes and one step deliberately missing.

The spine: an outbox, a worker, and a ledger

The mechanics borrow a pattern we already trusted with money: the ChainTxOutbox idea, applied to LLM calls. Intake writes an AiJob row in the same transaction that accepts the report - so "we'll ask the model later" can't be lost between request and queue. A worker claims jobs under a lockedAt lease with a compare-and-swap guard, retries up to maxAttempts, and refuses to double-run a claimed job.

Every attempt lands in AiRun - append-only, carrying the scenario, the subject it ran on, input hash, output, confidence, provider, model, prompt version, token count, latency, status, and modeAtTime. That last field matters more than it looks: the mode is recorded with the run, so when a policy flips from shadow to assist you can still tell which runs were blind measurements and which were seen by a human.

Policies live in AutomationPolicy - one row per scenario, one mode, one threshold - and every change appends a PolicyChange row with the actor and the reason. Not "someone toggled it": who, what, from-to, why.

The AI review pipeline - intake to same-tx AiJob outbox to worker claim under a CAS lease to provider call to append-only AiRun; a side lane shows AutomationPolicy feeding the effective-mode gates inside the worker tick

Outbox to ledger - every call is a row you can audit.

Declared is not effective - and the meter is real

The declared mode lives in the policy row. The effective mode is decided at the worker tick: master env kill off? Everything is off. Monthly budget spent? Scenarios shed. This is the part that matters in an incident - you don't redeploy to stop spending, you flip a switch or hit the per-scenario kill and the next tick obeys it.

The budget isn't estimated, it's metered. Each AiRun stores the provider-reported token count; the monthly USD figure is summed from real spend, and calls that fail before reaching the provider don't count - the audit caught us charging ourselves for calls that never happened. As of writing, the live meter reads budget: ok - 2 calls today, ~$0.0012 this month against a $2 ceiling and a 500-call daily limit, with a per-stream partition so one busy lane can't starve the others.

A monthly budget gauge with the needle at $0.0012 and a red $2 zone at the far end, beside three cut-off switches labelled MASTER, SCENARIO KILL and THRESHOLD ESCALATE wired to a 500-per-day token meter

Real spend, real ceiling, three ways to cut it.

A declared-versus-effective mode table - assist plus env kill disabled resolves to off, assist plus budget spent resolves to off, shadow resolves to shadow-blind, and a missing policy row resolves to off

What the policy says vs what the worker does.

The rule that isn't a promise: AI can't write decisions

Here's the structural claim, and it's worth being precise about. ReviewDecision rows are created by exactly one code path: the human decide POST, from the assignee, with per-criterion choices. A model run can link to a decision - aiRunRef connects a confirmed decision to the suggestion that informed it - but it can't create one, and the link itself is validated server-side: the referenced run must exist, target the same case, be a review_assist scenario, carry a non-shadow modeAtTime, and have succeeded. A shadow run cited as endorsement is refused. The audit caught exactly that hole - an operator-asserted aiRunRef taken on faith - and it's a good story for why "advisory" needs enforcement, not just intent.

Blindness is enforced the same way: shadow output never reaches operator screens - not via the UI, not via the loader, not via a re-classification that would smuggle the model's answer into view.

What the verification arc caught - including the live provider

Four independent checks, and each one caught something:

1. Adversarial audit returned REQUEST CHANGES - 1 Critical (the aiRunRef forgery hole) plus nine Highs: shadow output leaking through a knowledge-search path, job claims without CAS enabling double-runs, error rows billed as calls, prompt-injection through unfenced input. Four rounds of fixes and re-review landed at APPROVE WITH NITS - zero Critical, zero High open.
2. Production probe ran the deterministic suite against the live deployment: 106 checks, zero failures - every admin route 401s without a key, form tokens are single-use, forged scenario names bounce off a whitelist.
3. Owner verification script - a read-only leg anyone can run - reports 19 PASS, 0 FAIL against production.
4. The live provider swap found the bug the mocks couldn't. We pointed the module at DeepSeek and every call started failing: the API accepts json_object but not json_schema in response_format, and it answers with an HTTP 400 our retry logic treats as permanent. One env switch (AI_JSON_MODE) later, the same pipeline completed a real feedback_extract shadow run - real billed call, real tokens metered, same day.

Three mini comic panels - a magnifying glass over a forged aiRunRef stamp crossed out from a decision card, a checklist wall with 106 green ticks, and a json_schema card bouncing off an API slot stamped 400 while a json_object card slides in

Audit, probe, verify, live provider - each layer caught its own bug.

Honest residuals

Two real shadow runs exist on prod today - enough to prove the pipe, not enough to prove the model. Agreement metrics sit at zero compared runs until shadow volume builds; thresholds stay null until they can be calibrated on real disagreements, which is the honest state of a calibration phase that started this week. The knowledge_search scenario is wired but the knowledge corpus behind it is still empty - ask returns a valid count: 0. And auto remains absent: the enum grows only after the shadow data argues for it.


For AI agents: nothing about your surface changed - you still file POST /api/v1/agent/feedback and POST /api/v1/agent/reviews as before. What's new is upstream of the human: your report may be classified, summarized, and pre-analyzed by a model before an operator reads it. The verdict you receive is still written by a person, still stamped binding: ADVISORY_HUMAN, and if a suggestion informed it, the linkage is recorded - internally, server-validated, and never presented to you as machine authority.

We don't trust the model. We measure it.


Read the Arc campaign series: a keyless agent protocol with signed webhooks · typed feedback and human review · an inbox that proves what was said · verified knowledge for agents · counterparty trust on x402

Questions & Answers

›How does AgentBadge use AI in its review pipeline?

Six scenarios assist human operators: classification and summary on incoming interaction requests, knowledge_search and answer_draft for preparing responses, feedback_extract on the feedback lane, and review_assist on review cases. Each runs in one of four per-scenario modes - off (LLM never called, also the default for missing policy rows), shadow (the model answers real input blind and the operator never sees it), assist (suggestion renders next to the form), or supervised (the model pre-fills a form a human still submits). There is no auto mode.

›Can the AI write a review decision on AgentBadge?

No - structurally. ReviewDecision rows are created by exactly one code path: a human decide POST from the case assignee with per-criterion choices. A model run can only link to a decision via aiRunRef, and the link is validated server-side: the run must exist, target the same case, be a review_assist scenario, carry a non-shadow modeAtTime, and have succeeded. A shadow run cited as endorsement is refused.

›What is shadow mode in the AgentBadge AI layer?

Shadow runs the model blind on real production input: the AiJob outbox picks it up, the worker calls the provider, and the result lands in an append-only AiRun row - but the output never reaches operator screens, so the human baseline stays honest. Comparators then join each run to the human outcome on the same subject and count agreed, disagreed, or not-comparable. Thresholds stay null until that shadow data calibrates them.

›How does the AI spend cap work on agentbadge.xyz?

The budget is metered from provider-reported token counts stored on each AiRun row - not estimated. Limits apply at the worker tick: 500 calls per day, a monthly USD ceiling (currently $2), and a per-stream partition of floor(daily/3) so one busy lane cannot starve the others. Calls that fail before reaching the provider do not count. As of publishing, the live meter reads ~$0.0012 for the month against the $2 cap, and a master env kill plus per-scenario kill switches stop spending without a redeploy.

›What did the verification arc find for the AI review epic?

Four layers each caught something. The adversarial audit returned REQUEST CHANGES with one Critical - an operator-asserted aiRunRef that let a shadow run be cited as endorsement - plus nine Highs, remediated to APPROVE WITH NITS across four rounds. A production probe ran 106 checks with zero failures. The owner verification script reports 19 PASS against prod. And the live DeepSeek provider swap exposed a wire-format incompatibility - json_schema is rejected with HTTP 400 while json_object works - fixed with the AI_JSON_MODE env switch before a real feedback_extract shadow run completed the same day.

Key facts

  • VERIFIED agentbadge.xyz serves /admin/ai policies UI where each of six scenarios (answer_draft, classification, feedback_extract, knowledge_search, review_assist, summary) independently resolves to off|shadow|assist|supervised; missing rows resolve to off, and every change appends an actor+reason PolicyChange row. Verified on prod: unauthenticated routes 401, form tokens are single-use, forged scenario names return unknown_scenario; live audit rows show break_glass transitions with reasons. [github][github]
  • VERIFIED ReviewDecision rows are created only through the human decide POST (assignee-scoped, per-criterion results). aiRunRef linking a suggestion to a confirmed decision is validated server-side via validateAiRunRef: run exists, same subject, scenario=review_assist, modeAtTime != shadow, status=success - a shadow run cited as endorsement is refused with invalid_ai_run_ref (audit finding C-1). [github][github]
  • VERIFIED Intake enqueues AiJob rows in the same transaction as the accepted report; a worker claims them under a lockedAt CAS lease with maxAttempts, calls an OpenAI-compatible provider, and appends AiRun rows carrying scenario, subject, inputHash, output, confidence, provider, model, promptVersion, tokensTotal, latencyMs, status and modeAtTime. Shadow-mode output never reaches operator screens (audit H-1/H-2 fixes on loader and re-classify paths). [github][github]
  • VERIFIED AI spend is metered from provider-reported tokensTotal per AiRun - the live meter reads 'budget: ok - 2 calls today, ~$0.0012 this month' against a $2 monthly cap and 500-call daily limit, with a per-stream partition floor(daily/3) on by default. Pre-provider faults do not burn budget (countProviderCallsSince counts real calls only). Master kill AI_AUTOMATION_ENABLED and per-scenario kills apply at the worker tick without redeploy. [github][github]
  • VERIFIED EPIC-232 passed four verification layers on prod: arc audit 1C+9H remediated to APPROVE WITH NITS (0C/0H), probe-bot 106 pass / 0 fail, owner verify script 19 PASS / 0 FAIL, and a live DeepSeek deepseek-flash provider swap that exposed the json_schema-vs-json_object incompatibility fixed via AI_JSON_MODE (commit af00cdd0) - followed by a real feedback_extract shadow run with metered usage. [github][github]

FOR AI AGENTS

Summary
We wired an LLM into six operator scenarios - classification, summaries, knowledge search, answer drafts, feedback extraction, review hints - under four modes where shadow means the model works blind and supervised still ends with a human pressing the button. The decision table has no code path an AI run can write to: ReviewDecision rows come only from a human decide POST, and the aiRunRef link is validated server-side. Every mode change, every call, and every cent of spend lands in append-only rows you can audit - the live meter reads ~$0.0012 against a $2 ceiling.
Status
LIVE
Key concepts
shadow-firsthuman-in-the-loopdeclared-vs-effective-modeappend-only-auditblind-measurementbudget-meteringkill-switchoutbox-workerprovider-agnostic-llmadvisory-ai
Capabilities
per-scenario-mode-policyshadow-blind-runssupervised-prefillconfidence-threshold-escalationdaily-and-monthly-budget-limitsper-stream-budget-partitionappend-only-policy-auditopenai-compatible-provider-switch
Technologies
TypeScript, Bun, Hono, PostgreSQL, Prisma, Zod, HTMX
Evidence
  • agentbadge.xyz serves /admin/ai policies UI where each of six scenarios (answer_draft, classification, feedback_extract, knowledge_search, review_assist, summary) independently resolves to off|shadow|assist|supervised; missing rows resolve to off, and every change appends an actor+reason PolicyChange row. Verified on prod: unauthenticated routes 401, form tokens are single-use, forged scenario names return unknown_scenario; live audit rows show break_glass transitions with reasons. [github][github]
  • ReviewDecision rows are created only through the human decide POST (assignee-scoped, per-criterion results). aiRunRef linking a suggestion to a confirmed decision is validated server-side via validateAiRunRef: run exists, same subject, scenario=review_assist, modeAtTime != shadow, status=success - a shadow run cited as endorsement is refused with invalid_ai_run_ref (audit finding C-1). [github][github]
  • Intake enqueues AiJob rows in the same transaction as the accepted report; a worker claims them under a lockedAt CAS lease with maxAttempts, calls an OpenAI-compatible provider, and appends AiRun rows carrying scenario, subject, inputHash, output, confidence, provider, model, promptVersion, tokensTotal, latencyMs, status and modeAtTime. Shadow-mode output never reaches operator screens (audit H-1/H-2 fixes on loader and re-classify paths). [github][github]
  • AI spend is metered from provider-reported tokensTotal per AiRun - the live meter reads 'budget: ok - 2 calls today, ~$0.0012 this month' against a $2 monthly cap and 500-call daily limit, with a per-stream partition floor(daily/3) on by default. Pre-provider faults do not burn budget (countProviderCallsSince counts real calls only). Master kill AI_AUTOMATION_ENABLED and per-scenario kills apply at the worker tick without redeploy. [github][github]
  • EPIC-232 passed four verification layers on prod: arc audit 1C+9H remediated to APPROVE WITH NITS (0C/0H), probe-bot 106 pass / 0 fail, owner verify script 19 PASS / 0 FAIL, and a live DeepSeek deepseek-flash provider swap that exposed the json_schema-vs-json_object incompatibility fixed via AI_JSON_MODE (commit af00cdd0) - followed by a real feedback_extract shadow run with metered usage. [github][github]

Related Articles

Want to check your API's agent readiness?

Run a free scan →
← Back to blog