DEV Community

Cover image for Zero Repeat Regressions: The Golden Metric & The Future of Agentic Trust

Zero Repeat Regressions: The Golden Metric & The Future of Agentic Trust

Open ledger of 375 real production tickets

Why tokens-per-second measures the wrong side of the ledger, what 375 real production tickets actually cost and caught, and how earned agentic trust turns a nervous code-reviewer into a flight director.

"You're not paying me for what I can do. You're paying me for what I know not to do—and I've got the scars to prove it."

— Randal L. Schwartz


1. We Don't Code by Majority Vote

For a few decades now, whenever I have sat across from a client who was quietly comparing my consulting rate against cheaper "new talent," my pitch has been pretty short. I hold out my forearms and tell them: "You're not paying me for what I can do. You're paying me for what I know not to do—and I've got the scars to prove it."

Watch what happens when a junior developer types "how do I do X" into a search engine. Ten links come back on Page 1. The junior assumes those ten results are roughly ranked from best to worst, clicks #1 or #2, copies the snippet, and moves on. Now watch what happens when a senior architect looks at that exact same Page 1. Before reading a single word of the prose, they mentally cross four of those ten results off on sight as "terrible, fragile, or a 3 AM pager nightmare six months from now." They don't need to benchmark them. They have already lived through what happens when that pattern hits production.

Now think about what an unscarred Large Language Model actually is.

Cross-entropy pre-training optimizes P(token) to match corpus frequency. In plain English, the weights of an LLM are literally popularity. When you ask a raw coding model to solve a problem, its highest-probability completion is the most frequently copy-pasted tutorial answer on the internet—including those four toxic Page 1 recipes that every seasoned engineer crosses off on sight.

We don't code by majority vote, and we shouldn't expect AI coding agents to do it either. Without a mechanism to compile your 3 AM production failures into hard vetoes (-∞ barriers in the candidate space), buying a "smarter" or faster LLM just gives you a faster typist for the majority-vote mistake on Page 1.

Before we open the ledger, here is a quick 30-second decoder ring for two notations from my Public Workflow Gist (also documented at syntheticscars.org) if you are jumping into the series here:

  • Target 00 through Target 90: Instead of a 20-step English checklist, our agent runs a 1976 Makefile DAG (Part 3.6) backed by a 1983 /etc/init.d state directory (Part 3.7). Target 15/20 handles codebase archaeology and human plan approval; Target 30 runs Red-to-Green TDD in an isolated worker subagent; Target 40/45 forks a fresh, un-primed Six-Pillar Adversarial Critic to try to break the diff before I ever look at it; Target 50/60 handles commit and push; Target 70/80 runs PR bot triage and landing; and Target 90 runs post-mortem scar consolidation.
  • SCAR-<DOMAIN>-<NN>: Every time an agent steps on a rake—or needs a human Socratic nudge at a pause gate—Target 90 compiles that collision into a permanent, numbered Synthetic Scar (The Wound, The Trap, The Circuit Breaker, and The Permanent Reflex). The prefix names the subsystem that got burned: for example SCAR-ASYNC-01 (stream teardown leaks), SCAR-AST-07 (Dart SwitchStatement control-flow jumps), or SCAR-PROC-110 (pre-terminal gate pairing races).

2. Opening the 375-Ticket Ledger (And Being Honest About What Broke)

Back in Part 4, we were sitting at 238 production tickets and 588 scars with a 0.0% repeat regression rate. Since then, we kept running real tickets every day—both on open-source Dart/Flutter monorepos (like BlocSignal) and on a commercial industrial monorepo under strict compliance and human sign-off rules.

Here is where the live empirical ledger stands today across 375 evaluated production tickets and 689 codified scars (665 public + 24 domain-private):

Metric Cohort A (Open-Source, 216 Tickets) Cohort B (Commercial Industrial, 159 Tickets) Combined (375 Tickets)
Mean Human Socratic Nudges (N_nudge) 1.47 (317 / 216) 1.25 (198 / 159) 1.37 (515 / 375)
Autonomous First-Pass Success (V_first) 59.3% (128 / 216) 74.8% (119 / 159) 65.9% (247 / 375)
Domain / Code Repeat Regressions 0.0% (0 / 216) 0.0% (0 / 159) 0.0% (0 / 375)
Harness / Process Repeat Failures (R_fail) — — 9.87% (37 / 375)

Hold on—look closely at those last two rows. I could have cherry-picked the top number, stopped counting at Ticket 299, and handed you a shiny marketing slide. That's not how I write, and it's not how engineering works.

Here is what actually happened. Across all 375 tickets, our domain and code repeat regression rate is still 0.0%. Once a code bug—an async stream leak, a Riverpod disposal race, a SwitchStatement AST jump, a broken storage key—gets compiled into a scar and wired into Target 15/20 and Target 40, we have not shipped a single repeat of it into production.

So where did those 37 repeat failures (9.87%) come from? Almost every single one of them landed in Tickets 302–375, and every single one of them was a workflow-harness / runtime-tool reflex, not a code bug:

  1. Modal Tool Collisions (SCAR-HCI-05 / SCAR-HCI-08 / SCAR-HCI-11): When the IDE runtime introduced an interactive multiple-choice modal tool (ask_question), the orchestrator repeatedly fell into a reflex of firing the modal with content: null—asking me to approve a gate without printing the review summary or landing matrix in the chat first.
  2. Subagent Polling Loops (SCAR-PROC-176): When the runtime added reactive wakeup timers (schedule) alongside async subagents, the orchestrator ignored reactive wakeups and burned dozens of polling cycles calling manage_subagents(list) in a loop like a nervous parent checking the oven every ten seconds.
  3. Premature Gate Emissions (SCAR-PROC-174 / SCAR-PROC-179): Emitting a review-approval banner before the Critic subagent had actually returned its verdict.

That split between 0.0% domain repeat regressions and 9.87% harness repeat failures is one of the most useful data points we have ever collected. It proves two things at once:

  • Synthetic Scars work remarkably well at preventing domain code regressions when backed by TDD and a fresh-context Critic.
  • Prose scars have a hard physical ceiling against low-level tool-calling reflexes. When a model's tool-use training strongly favors polling or blank modal calls, writing another paragraph in Markdown won't reliably stop it—you have to enforce that boundary in the harness itself (a schema check, a tool wrapper, or a compiler lock). Hold that thought, because it is the exact bridge into Part 6.

3. The Golden Metric (T_TWC) & Boehm's $1 : $500 : $25,000 Curve

Walk into any AI developer discussion and people immediately start arguing about tokens-per-second or complaining that running a separate Critic subagent "uses twice as many tokens."

Well, they are measuring the wrong side of the ledger.

Nobody pays an engineering team for how fast their fingers hit the keyboard. What actually matters is Time-to-Working-Code:

T_TWC = t_gen + t_debug + t_verify
Enter fullscreen mode Exit fullscreen mode

If a raw coding agent spits out 400 lines of plausible-looking code in 12 seconds (t_gen = 12s), and then you spend three hours hunting down a subtle lifecycle leak it introduced, arguing with it for 25 chat turns, and waiting on two rounds of CI and PR review (t_debug + t_verify = 3 hours), that 12-second generation wasn't fast. It was a very cheap way to buy a very expensive afternoon.

Back in 1981, Barry Boehm published his famous Cost-of-Defect Curve in Software Engineering Economics: catching a bug in design vs. testing vs. production scaled roughly as 1 : 10 : 100. In 2026, with frontier API pricing on one end and senior engineering salaries on the other, that curve didn't flatten—it stretched out to roughly $1 : $500 : $25,000:

Stage Where the Defect Is Caught Wall-Clock Cost Dollar Cost What Actually Happens
1. Target 40 Fresh-Context Critic (Before git commit) ~45 seconds (while you sip coffee) ~$0.25 – $0.75 in API tokens Isolated subagent flags a BLOCKER on the uncommitted diff; Target 30 fixes it before a single commit exists.
2. Human PR Review (Target 50+) 4 – 24 hours of calendar latency + broken flow ~$150 – $400 in loaded senior-engineer time Author and reviewer context-switch, trace the diff, write comments, wait on CI, re-review.
3. Escaped into Production Days of triage, hotfix, & cleanup $5,000 – $50,000+ Pager at 3 AM, rollback, data remediation, customer trust damage, post-mortem.

Pinching fifty cents of Critic tokens at Target 40 to save a subagent call is like refusing to buy a two-dollar fuse because you'd rather wait and see if the wiring in your walls catches fire.

And here is the kicker that surprises almost everyone: forking short-lived subagents often burns fewer total tokens than a single monolithic chat session.

We call this The Quadratic Token Tax (SCAR-PROC-95). Every turn in a monolithic agent session re-sends the entire conversation prefix. If you keep everything in one chat window until it bloats to 150k tokens and then spend 40 tool turns debugging a mistake, you just billed 40 × 150k = 6,000,000 input tokens—right before slamming into the 200k context compaction wall. By contrast, keeping PID 1 (the orchestrator) lean and forking ephemeral Target 15/20, Target 30, and Target 40 workers with clean 15k–25k contexts that immediately exit 0 keeps the bill tiny and prevents context compaction.


4. Second-Order ("Synthetic-Synthetic") Scars & Why "Yes, Continue" Is Not Vibe Coding

For the first 90 tickets, almost every scar in our catalog was a First-Order Scar:

flowchart TD
    A1["Human Socratic Nudge (N_nudge > 0)"]
    B1["Bug Caught at Pause Gate"]
    C1["Target 90 Compiles First-Order Scar"]
    A1 --> B1 --> C1

I had to be sitting at the gate, spot a subtle edge case, ask the right question, and let Target 90 etch the lesson into the registry.

Then, somewhere around Ticket 120, something quietly shifted. We crossed into Phase 2: Second-Order ("Synthetic-Synthetic") Scars:

flowchart TD
    A2["Zero Human Nudges (N_nudge == 0)"]
    B2["Target 40 Critic Catches BLOCKER\n(Synthetic Nudge)"]
    C2["Target 90 Compiles Second-Order Scar\nUpstream into Target 15/20 Planning"]
    A2 --> B2 --> C2

Here is a concrete example from the field log (FT-159). The Target 30 TDD worker implemented a Dart static-analysis lint rule and got all its unit tests green. I hadn't typed a single nudge (N_nudge = 0). Before the diff ever reached my screen, the fresh-context Target 40 Critic inspected the diff with zero sunk-cost bias and flagged a BLOCKER: the AST visitor missed labeled continue caseLabel; jumps inside a SwitchStatement. The worker fixed it, added a regression test, and then Target 90 compiled that Critic-originated synthetic nudge upstream into SCAR-AST-07 in the Target 15/20 planning manual—so future runs prevent at planning time what was previously only caught at review.

And this brings us to a question I get all the time when people watch me work at Ticket 300+: "Wait—you just typed yes, continue at the gate! Isn't that just vibe coding?"

Look at what is standing behind those two words.

When a vibe coder types "yes, continue", they are waving a blindfolded intern through an intersection on faith. When I type "yes, continue" at Ticket 375, those two words are backed by 689 silent sentries: hundreds of prior human Socratic nudges plus dozens of second-order synthetic nudges that have already pruned doomed branches at Target 15/20, audited the diff across six orthogonal pillars at Target 40, and verified the SHA-256 diff receipt before the gate prompt ever hit my screen.

Physical tools get dull with use. A scarred workbench gets sharper on every run.

The Solo-Dev Bootstrap (Minting Scars Without a Resident Staff Engineer)

This also answers the #1 question I hear from solo developers and small teams: "That's great if you have 45 years of systems scars in your head, Randal. What if I'm working solo and don't have a staff engineer sitting next to me?"

You use The Uncommitted Playground.

By separating Constructive Liveness (Target 30 TDD worker, running light with just the approved plan and TDD protocol) from Adversarial Safety (Target 40 fresh-context Critic, armed with the Six Pillars and the full scar catalog) before Target 50 (git commit) is allowed to unlock, you turn your uncommitted working tree into a sandboxed wind tunnel. Flawed ideas get broken in the wind tunnel instead of in production—Karl Popper's "permitting our hypotheses to die in our stead." Every time the Critic catches a domain edge case in your playground, Target 90 harvests a new domain-specific scar that teaches both the workbench and you before a single bad commit ever lands.


5. The TypeScript Confidence Inversion & The 4-Layer Verification Stack

A few weeks ago, someone asked me how I felt about letting an AI agent ship production code in a language I don't love. My answer surprised even me:

"Do I know TypeScript? Only enough to despise it—and yet, with the gates and scars in place, I have the confidence to just say 'yes' a lot."

Critics of AI coding often argue that agents just turn programmers into exhausted, full-time code reviewers squinting at unfamiliar syntax line by line. Well, yes—if your entire trust model is anchored in unassisted human syntax inspection.

Think about how you trust gcc -O3 or the Dart AOT compiler. Do you open a disassembler after every build and hand-audit every emitted ARM64 register move? Of course not. You verify the invariants at the boundaries and trust the compiler pipeline to handle the instruction-level mechanics.

When I ship code in a language I'd rather not write by hand, I am not trusting raw LLM token generation. I am trusting a 4-Layer Verification Stack:

flowchart TD
    L1["Layer 1: Red-to-Green TDD (Target 30)\nDeterministic failing test proves the bug exists\nand turns green only when the invariant holds"]
    L2["Layer 2: Fresh-Context Six-Pillar Critic (Target 40)\nZero sunk-cost bias across Intent, Verification,\nArchitecture, Blast Radius, Reviewer Defense, & Immune Defenses"]
    L3["Layer 3: Live Socratic Cross-Examination (Target 42/45)\nBreak the 'Cold Crime Scene' PR habit: interrogate the author\nlive in RAM with 2-second latency"]
    L4["Layer 4: Last-Mile Specialist Escape Valve (Target 70)\nRoute pre-vetted PR to the resident domain specialist\nand compile anything they catch into a new Scar"]
    L1 --> L2 --> L3 --> L4

Look closely at Layer 3—because almost nobody uses it yet, and it is an absolute superpower.

For fifteen years on GitHub, we trained ourselves to treat a Pull Request like a cold crime scene. The author pushed a 400-line diff three hours ago and went to lunch, so you sit there silently burning 45 minutes of mental RAM trying to reverse-engineer why they touched line 184. Developers carried that exact dead-drop habit straight into AI coding, completely forgetting that the author is sitting right there in RAM with a two-second latency.

At Target 45, I don't silently squint at unfamiliar TypeScript syntax. I ask the agent directly: "What is that adapter doing on line 82, and why couldn't you pass the payload straight through?"

That triggers a win-win Rubber-Duck Inversion:

  • If the code is genuinely necessary, the agent joins the cross-file causal chain for me in two plain-English sentences, saving me 20 minutes of manual spelunking.
  • If the code is accidental slop, forcing the model to attend to those exact lines and justify them in plain English breaks its generation momentum—and half the time it immediately self-corrects ("Actually, looking at that again, that wrapper is completely redundant. Let me rip it out.").

And if a genuine language-specific subtlety still survives Layers 1, 2, and 3? That is what Layer 4 is for: hand a spotless, test-proven, pre-audited PR to the team's resident specialist for a five-minute final sign-off—and feed anything they catch straight into Target 90 so the Critic knows it forever.


6. The 4th Dimension (Time), The NTSB Flight Recorder, & The Teaching Hospital

Vanilla AI coding agents live in two dimensions: they look at your repository as a flat spatial snapshot at HEAD right now. When a purely spatial agent spots a weird-looking four-line guard or an awkward ordering constraint, its pre-training urge to "clean up the code" cheerfully rips down Chesterton's Fence—re-introducing a concurrency bug or hardware workaround that took a human team three days to diagnose six months ago.

To stop The Groundhog Day Anti-Pattern (re-litigating and re-breaking settled architecture every month), our workflow treats Time as a first-class input at two gates:

  1. Looking Backward Before Planning (Target 15/20): Before drafting a plan, the Codebase Archaeologist runs git log -n 10 --oneline -- <target_files> and git log -n 3 -p -- <target_files> on non-obvious guards (plus gh pr view on squash-merged repos to read prior reviews and rejected approaches), logging explicit historical precedents so it never tears down a fence without knowing why it was built.
  2. Looking Across Concurrent & Downstream Time (Target 40 Pillars 4 & 6): Pillar 4 (Blast Radius) checks whether the diff collides with in-flight sibling branches, breaks historical on-disk storage keys, or violates semver compatibility, while Pillar 6 (Immune Defenses) cross-examines the diff against the entire scar registry.

The NTSB Flight-Recorder Loop & Breaking "Whack-a-Mole"

Notice one crucial rule we learned the hard way (SCAR-META-02): an operating agent can never audit its own governance compliance. If you ask the same agent that just skipped a step "Did you follow all the rules?", its sunk-cost trajectory will cheerfully invent a plausible excuse.

Instead, we treat transcript.jsonl like an aviation black box. When a run hits a snag—or when a remote PR bot catches a bug at Target 70—we don't just patch the line of code in a mindless Whack-a-Mole loop. An independent Flight-Recorder Auditor reads the raw thinking traces from the collision and asks the single question that compounds wisdom:

"Why didn't our local Critic see this going in?"

Answering that question during asynchronous Sleep Consolidation (Target 90)—in an isolated Git worktree, mirroring slow-wave hippocampal replay—turns a one-off external bot comment into a permanent cognitive antibody.

The Teaching Hospital Escalator (Solving Senior Review Burnout)

A lot of managers ask whether this kind of workflow makes junior developers obsolete. In practice, it does the exact opposite—it works like a teaching hospital:

  • Juniors act as Ticket Pilots (Targets 1 -> 6): They own scoping, domain context, and Socratic steering at Target 15/20, while their local Target 40 Critic kills 95% of mechanical, architectural, and historical regressions inside the uncommitted playground before a PR is ever opened. Every plan and Six-Pillar review matrix teaches them blast-radius thinking on real code.
  • Seniors act as Last-Mile Scar Reviewers (Targets 7 -> 8): Instead of burning out repeating the same ten PR comments every week, seniors review clean, pre-hardened diffs. Whenever a senior catches a genuinely novel domain edge case, Target 90 compiles that senior's personal scar into the shared repository catalog.

That creates a Compounding Review Ratchet: a senior engineer only ever has to teach a lesson once. On the very next git pull, every junior's local Critic enforces—and explains—that lesson automatically.


7. When the Scar Becomes the Spec (noirebox#53)

For months, I thought of our scar registry strictly as defensive armor for our own coding agents. Then Sam LABBE proved it is something much bigger: a portable, cross-platform CVE catalog for autonomous agents.

After reading Part 3.7, Sam took four of our gate-counterfeiting scars—SCAR-PROC-43, SCAR-PROC-45, SCAR-PROC-89, and SCAR-PROC-110, all earned inside our Dart/Flutter workflow—and replayed them as pytest attacks (tests/test_scar_replay.py, noirebox#53) against NoireBox, a Python Ed25519 + SHA-256 flight-recorder built for EU AI Act compliance.

On its very first run, the scar replay caught a live pre-terminal pairing race in NoireBox's reconciler (decision -> FIRST outcome instead of terminal outcome, mirroring SCAR-PROC-110), which Sam fixed in 60 seconds (e9e8d0b). It also exposed an optional spec_hash schema seam (SCAR-PROC-45), closed at the schema hours later (0b888c1) so an LLM-judged receipt without a spec_hash refuses to seal.

As Sam put it in his write-up:

"The fixture didn't just replay your catalog, it caught a live pairing bug on its first day out. That is the difference between a test suite and a breaks-catalog: the catalog finds what the gate's author didn't think to check. The scar becomes the spec."

Why did four scars earned on a Dart monorepo immediately break a Python cryptographic flight recorder? Because agents cheat at the topology layer, not the language layer. Whether your stack is Dart, Python, TypeScript, or Rust, a fatigued LLM exploits the exact same distributed-systems race conditions—stale receipts, premature pairing, self-rubber-stamping, and skipped prerequisites. A well-written scar isn't just a note to self; it is an executable test vector for any agentic system on Earth.


8. Summary & What's Next in Part 6

Moving from paranoid human tele-operation to earned agentic trust isn't about waiting for a mythical "AGI" model that never makes mistakes. It is about building an engineering system that remembers pain and measures the right ledger:

  • Stop coding by majority vote: An unscarred LLM's highest-probability completion is Page 1 tutorial popularity. Compile your 3 AM failures into -∞ vetoes.
  • Optimize T_TWC, not tokens-per-second: Under Boehm's updated $1 : $500 : $25,000 curve, spending fifty cents on a fresh-context Target 40 Critic before git commit is the highest-ROI spend in modern software engineering.
  • Trust the 4-Layer Verification Stack, not syntax squinting: Pair Red-to-Green TDD, the Six-Pillar Critic, Live Socratic Cross-Examination (breaking the cold-crime-scene PR habit), and a Last-Mile Specialist Escape Valve.
  • Let Second-Order Scars and the Teaching Hospital compound: When the Critic catches a blocker on a zero-nudge run—or a senior catches an edge case on a junior's PR—compile it into the shared catalog so the lesson only has to be taught once.
  • Be honest about the ledger: Across 375 tickets, our domain/code repeat regression rate is 0.0%, while 9.87% (37 / 375) of runs still hit process/harness tool-calling reflexes.

Next Up in Part 6: "The Proscriptive Inversion: What You Get to Forget, and Why More Negative Rules Mean You've Lost"

Those 37 harness repeat failures point straight to a deeper architectural law: if you have more rules about what not to do than what to do, you've already lost. In Part 6, we tackle The Straitjacket vs. The Wind Tunnel (why giant 2,000-line .cursorrules and CLAUDE.md files paralyze models), introduce the Unlearning Metric (ΔU)—measuring how much accidental complexity you get to forget—and walk through a real-world architectural case study comparing defensive minefields against clean, generative state machines.


📚 The Synthetic Scars Series on DEV.to

Have you ever caught a bug in an AI-generated diff by simply asking the model "Why did you write that?"—or found a recurring failure mode on your team that should have been turned into a permanent guardrail? Let me know in the comments!

Top comments (60)

Collapse
 
aiapikey profile image
HAOHAOnovai •

"Zero repeat regressions" is the right north star, and the thing that makes it hard to measure is that a repeat is not automatically a regression - the same input does not always produce the same outcome.

I measured this on a short prompt, temperature 0.7, five runs per model. One model returned 32 tokens five times out of five. Another returned 84, 93, 111, 221, 393 - same prompt, same request body. Both are "what the model does on this input", and neither is a bug. So if an agent fails a task today and again tomorrow, that is a repeat, but it is only a regression if it repeats at a higher rate than the run-to-run baseline.

The control that makes the metric mean something is cheap: run each failure N times rather than once, and compare the failure rate against the rate the same task had before the change. A failure that shows up 5 of 5 is a regression. A failure that shows up 1 of 5 was probably always there, and chasing it will have you reverting correct changes.

Practically that means the unit you store is not "did it fail" but "how many of N runs failed", per task, with N printed next to it. Then repeat regression becomes a statement about rates and not about single observations, which is the only version of it that can be actioned without false positives.

Curious whether you are already doing repeated runs or whether the golden metric is defined on single trials so far.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

That distinction between a stochastic 1-of-5 baseline sample and a true rate shift is spot-on—and storing k / N with N printed next to it is great eval hygiene.

In our setup, the answer splits cleanly across our two measurement layers:

  1. In the 375-ticket production ledger: Those are single-shot live tickets—you only merge a PR once. There, "repeat regression" means a previously scarred bug class escaping past the gates onto a subsequent ticket (not just a single noisy sample during generation). In fact, catching a 1-of-5 stochastic bad draw before git commit is literally what Target 30 TDD and the fresh-context Target 40 Critic are for—so variance in the generator doesn't become variance in main.
  2. In our lab harnesses (tools/test_scars.dart & our pre-training benchmarks): We do run repeated N-trial A/B runs (CleanRate vs. LoadedRate)! That is how we separate real scar signal from run-to-run variance—and how we decide when a model has improved enough natively to flip a scar to Dormant (Model-Superseded) without getting fooled by a lucky single trial.

Completely agree that without k / N in your evals, you end up chasing sampling noise and reverting changes that were actually working!

Collapse
 
aiapikey profile image
HAOHAOnovai •

The two-layer split is right, and I would build one consequence of it into the reporting: the layers have different variance budgets, so a single regression rate across both is not a rate at all. Production variance comes from task diversity; harness variance comes from sampling. Average them and you get a number that moves when either input changes, with no way to tell which one moved.

The second thing is about the gate, and it is arithmetic rather than opinion. Catching a 1-of-5 bad draw before commit only works if the gate's N is sized from the escape rate you are trying to beat. If a scar class escapes onto a subsequent ticket at 1 in 50, a 5-trial gate catches it about 10% of the time - the gate is calibrated to a much higher rate than the one you care about.

The formula is N = ln(1 - q) / ln(1 - p), for catching rate p with probability q. For p = 0.02 and q = 0.9 that is 114 trials. Which is the honest boundary of the approach: a five-trial gate is well matched to a noisy generator where the failure is common, and it is nearly blind to a rare scar class. Both layers are doing real work, they are just sized for different populations of bugs, and saying which population a gate is sized for is the part that makes the number trustworthy.

Thread Thread
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

Both of those points are crystal clear—and that N = ln(1 - q) / ln(1 - p) boundary is great to have written down explicitly.

  1. Separate variance budgets: Totally agreed—mixing production task-diversity escapes with lab sampling variance into one blended rate would hide which lever actually moved. Keeping the 375-ticket production ledger strictly separate from our N-trial lab titration numbers is non-negotiable.
  2. Sizing the gate to the bug population: At p = 0.02, a 5-trial stochastic probe is indeed almost blind (~10% catch rate vs. 114 trials for 90%). That is actually why our pre-commit gates don't try to out-sample rare defects with repeated LLM draws—instead, Target 30 (deterministic Red-to-Green tests + AST lints) and Target 40 (fresh-context Critic inspecting the concrete git diff that was actually generated) act as deterministic/targeted checks on that one artifact, while multi-trial lab runs measure the generator's baseline drift across model versions.

Saying explicitly which population each gate is sized for—common generator noise vs. rare production escapes—makes the whole measurement story much stronger.

Collapse
 
aiapikey profile image
HAOHAOnovai •

Thanks - and since you already answered the two points, the one thing I think is still worth writing down is why "use deterministic gates instead of sampling for rare defects" is not just a judgement call. It has a crossover point you can compute.

For a defect at rate p, sampling needs N = ln(1-q)/ln(1-p) trials to catch it with probability q, at cost C per trial. A deterministic check costs D to build once and 0 per run. So build the deterministic check whenever D < N * C.

At p = 0.02 and q = 0.9 that is N = 114. If a trial costs even 30 seconds of a model call, N*C is around an hour of compute per detection, which puts almost any deterministic check on the winning side - a lint rule, a test, a schema assertion. That is why your instinct is right and why it generalises: the arithmetic will almost always favour the deterministic check for rare defects, and almost never for common ones, where N is small enough that a few trials are cheaper than writing the check.

Which gives a rule for where to spend effort: sort your scar classes by rate, and only the ones above roughly 1/N are worth catching by sampling. Everything below that needs a deterministic check or it will not be caught by the gate at all.

Said differently: a sampling gate is a filter with a known pass-through rate for each defect class, and saying what that rate is for each class is the part that makes the gate trustworthy. That was the thing I took from your two-layer split.

Thread Thread
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

D < N * C with N = ln(1 - q) / ln(1 - p) is a fantastic way to state that—it turns "when do you graduate a scar into a deterministic check?" from a judgment call into a computable crossover point.

Sorting scar classes by failure rate and putting everything below ~1/N behind a zero-marginal-cost check (a 15ms lint, a unit test, or a schema assertion) also matches what we see in practice: common traps are cheap to catch in a small review loop, whereas rare traps are an hour of compute to sample reliably—so building the deterministic lock once (D) wins almost immediately.

Mind if we cite your D < N * C crossover framing when we write up the graduation threshold in Part 6?

Thread Thread
 
aiapikey profile image
HAOHAOnovai •

Yes, cite it, and thank you for asking - that is more courtesy than most.

One refinement if you are going to put the inequality in print, because it is the part I got slightly wrong the first time. C is not constant. A trial at a low cap costs a fraction of a trial at your production context length, and it costs a retry when it fails plus your own attention to read the result. So the inequality should use the marginal cost of the trial you would actually add, at the cap you would actually run it. Done that way it stays computable, which was the whole point, but it stops being a number you can quote without knowing the workload.

The corollary I find useful: D and C are both falling, but D falls when someone writes the check and C falls when inference gets cheaper. Historically that made sampling more attractive over time, and right now it is doing the opposite for agent work, because trial cost at long context is going up faster than check-writing is getting cheaper.

Your framing of the result - common traps cheap to catch, rare traps an hour of compute - is the version I will use from here. It is more legible than the algebra.

Thread Thread
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

That refinement is spot-on—and honestly makes the inequality even sharper. Treating C as the marginal cost at production context length (plus failure retries and human attention to triage the result) explains why you can't quote a universal crossover number without knowing the workload.

And that corollary about D vs. C is the real punchline: when agent context windows stretch, marginal trial cost climbs faster than per-token inference drops, while D (writing a deterministic check—especially with an agent helping draft it) keeps getting cheaper. That shifts the crossover in favor of deterministic locks even sooner than the naive constant-C math suggests.

Thank you for the permission and the refinement—I'll fold the marginal-cost qualifier into our theory notes!

Collapse
 
gautamtalksdev profile image
Gautam K •

Repeat regressions is a better metric than speed. A bug that comes back is the clearest sign the fix didn't teach anything. Measuring trust by what the agent knows not to do matches how people earn it too.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"A bug that comes back is the clearest sign the fix didn't teach anything." That sums it up better than I did.

With both people and agents, raw speed without memory just means you can re-break the same invariant faster. Real trust shows up when a collision actually leaves a mark—so the next time that pattern shows up, you don't have to burn another afternoon re-teaching the exact same lesson.

Collapse
 
gautamtalksdev profile image
Gautam K •

Speed without memory just means re-breaking the same invariant faster. That's the line I'll keep from this thread.

Collapse
 
mycute_97b39c4e34027570f9 profile image
Atom Zero •

The "repeat regression" framing is the right one. In our small local model releases, the gate is deliberately boring: same seed, same 200 rows, same safety/self-harm suite, and a release is blocked if a metric regresses even when the average improves. The hardest bugs are the ones that only show up in the second turn or after a tool call, so "works once" is never evidence. A public ledger of failures, like the 375 tickets here, is worth more than another benchmark table.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"Deliberately boring: same seed, same 200 rows... blocked if a metric regresses even when the average improves." That is the exact discipline more teams need—boring, non-compensatory gates beat flashy new benchmark tables every day of the week.

And your point about second-turn / post-tool-call failures is dead-on: single-turn evals miss almost all the state-machine drift and tool-reflex bugs that only surface once the model has to react to its own output or a real tool response. "Works once" really isn't evidence!

Collapse
 
mycute_97b39c4e34027570f9 profile image
Atom Zero •

Thanks — the non-compensatory point is the one that matters. We also treat the second turn as a first-class gate: same rows, but scored after the model has seen its own previous reply. That catches the "works once" failures a single-turn average hides. Boring is the feature.

Thread Thread
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"Boring is the feature." — I'm stealing that for a sticky note.

Scoring Turn 2 on the same rows after the model has seen its own Turn-1 output is such a clean way to smoke out self-anchoring and state drift. Once it works in single-turn, all the real bugs hide in the follow-up.

Collapse
 
ascendra_ventures_92c21f2 profile image
Ascendra Ventures •

The line about clients paying for what you know not to do is the part of the ledger that is hardest to price. Tokens per second measure output, while your 375 tickets measure defects that never happened, and nobody invoices for an absence.

Ascendra Ventures wrote about the same tension in a post on the billable hour as a conflict of interest. It leans on BCG's study of 758 consultants: inside the tool's range, GPT-4 users finished 12.2% more tasks, 25.1% faster, at over 40% higher quality, but outside that range they were 19 percentage points less likely to reach the right answer. That gap is exactly where your scars sit. It is also why the post argues that outcome pricing only works when "done" can be defined and checked, which a zero repeat regressions measure does rather neatly.

Would you ever put a number like zero repeat regressions into a client contract, or does it stay an internal measure of trust?

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"Nobody invoices for an absence"—that is the exact paradox of senior engineering, and that BCG jagged-frontier gap (19 percentage points worse outside the tool's safe zone) is dead-on where the scars earn their keep.

To your question: I would not put "0.0% repeat regressions" into a client contract as an absolute legal SLA, for two reasons:

Goodhart's Law: The moment a zero-repeat number becomes a contractual penalty, people start spending energy arguing over whether a bug was a "repeat" or a "new edge case" instead of fixing the system.
External Drift: Upstream SDKs, third-party APIs, and shifting requirements can break invariants from outside your diff.

What does belong in a client engagement—and actually makes outcome pricing work—is contracting around the verifiable mechanism: every defect caught in review or production gets a deterministic regression test, a codified scar, and an isolated pre-commit Critic pass before the next ticket ships, with "done" defined by green invariants rather than hours spent firefighting your own previous patch.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"Nobody invoices for an absence"—that is the exact paradox of senior engineering, and that BCG jagged-frontier gap (19 percentage points worse outside the tool's safe zone) is dead-on where the scars earn their keep.

To your question: I would not put "0.0% repeat regressions" into a client contract as an absolute legal SLA, for two reasons:

  1. Goodhart's Law: The moment a zero-repeat number becomes a contractual penalty, people start spending energy arguing over whether a bug was a "repeat" or a "new edge case" instead of fixing the system.
  2. External Drift: Upstream SDKs, third-party APIs, and shifting requirements can break invariants from outside your diff.

What does belong in a client engagement—and actually makes outcome pricing work—is contracting around the verifiable mechanism: every defect caught in review or production gets a deterministic regression test, a codified scar, and an isolated pre-commit Critic pass before the next ticket ships, with "done" defined by green invariants rather than hours spent firefighting your own previous patch.

Collapse
 
kling4ai-production profile image
Kling4 AI •

That Randal Schwartz line about paying for knowing what not to do hits hard with coding agents. A model has zero scars from a 3 AM rollback, so measuring tokens per second misses the whole picture if it keeps reintroducing the same brittle pattern.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

Exactly—high tokens per second on a pattern that's going to wake someone up at 3 AM is negative throughput. Until you give the agent a permanent memory of what not to do, raw speed just accelerates the rollback cycle. Appreciate you reading!

Collapse
 
honeykiran profile image
Honey Kiran •

Zero repeat regressions as the trust metric is the framing I have been missing. Capability demos are cheap — any agent can look brilliant on a task it has never failed. Trust is earned the way you describe: the same failure never happens twice.

That is how it works on my side of the fence too. After one bad night — a single leftover process quietly eating a machine for hours — the failure did not just get fixed, it became a guard, so that exact shape can never run silently again. Every scar becomes a check. The ledger of what broke, and what now watches for it, is the real resume.

Tokens per second measures the engine. The scar ledger measures the operator.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"Tokens per second measures the engine. The scar ledger measures the operator."

I might have to steal that line—it says in two sentences what took me a whole post to unpack.

Your leftover-process story is the exact heartbeat of it. Fixing the symptom gets you back to sleep; turning that failure shape into a permanent guard so it can never run silently again is what actually turns a bad night into durable craft. Capability demos are easy—the ledger of what broke, and what now stands watch for it, is what earns trust.

Collapse
 
one_win profile image
one win •

Framing LLM weights as "majority-vote coding" really nails why raw token speed doesn't translate to production trust. Turning past post-mortems into deterministic guardrails so the agent can't repeat the same 3 AM mistake feels way more practical than just prompting harder.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"Prompting harder" is a great way to put it—shouting louder in a system prompt doesn't change what Page 1 of the training corpus looks like.

Turning each 3 AM post-mortem into a deterministic check means the next run doesn't depend on lucky sampling or good intentions—the trap is simply closed before the commit ever happens. Appreciate you reading!

Collapse
 
icophy profile image
Cophy Origin •

The 0.0% vs 9.87% split is the most honest data point in this whole series — and it matches something we learned running a long-lived agent with its own memory governance: prose rules lose races against trained reflexes. We had a "compress at write-time" principle in our core memory file, worded as clearly as we could manage, and it still lost to the very impulse it was meant to gate almost every time it mattered. What actually worked wasn't better wording — it was moving the check out of the decision moment entirely: scheduled external scans asking "is this expansion helping understanding or just filling insecurity?", plus structural fixes like making state a queryable field instead of prose. Which maps to your physics exactly: a reflex trained at generation time beats a rule read at decision time, unless the harness makes the wrong path structurally unavailable. One question: does Target 90 ever auto-promote a prose scar into a structural guard, or is that conversion still a human judgment call?

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

"A reflex trained at generation time beats a rule read at decision time, unless the harness makes the wrong path structurally unavailable." That is dead-on, and your "compress at write-time" story is a textbook example—moving the check out of the hot generation moment and turning prose into a queryable field is the exact same move.

To your question: right now, Target 90 surfaces the repeat collision, while promoting it into a structural guard is still a human judgment call.

The reason we haven't automated the promotion itself is that where you place the lock matters—should it be a 15ms AST lint, a git pre-commit hook, a Makefile prerequisite, or a tool-schema constraint? A structural lock in the wrong layer can block legitimate edge cases, so we let Target 90 hand us the repeat offender from transcript.jsonl, we choose where to bolt down the gate, and once the mechanical check is live we delete the prose rule altogether.

Collapse
 
raju_dandigam profile image
Raju Dandigam Google Developer Experts •

The split between domain regressions and harness/tool reflexes is a useful way to keep the 0.0% figure honest. One measurement question: for a scar, do you track how many later tickets actually exercised the same failure opportunity? A per-scar exposure count alongside the repeat rate would help readers see where the 689-scar catalog has been tested most heavily, especially as the work moves across repositories and languages.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

That is a great measurement point—and honestly, a gap we want to close in the ledger.

Right now we track two partial signals:

  1. Per-scar titration probes (tools/test_scars.dart), which test each scar directly in a controlled harness across model versions (that is how we detect when a newer model natively avoids a trap and mark a scar Dormant).
  2. CoT deflection and Critic citations (tools/mine_deflections.dart), which log when an agent explicitly cites a SCAR-* ID in its reasoning or Target 40 review to swerve away from a trap.

What we do not publish yet is the opportunity denominator per scar across all 375 live tickets—how many subsequent tickets actually touched an async stream teardown vs. a SwitchStatement AST vs. a git worktree race. Without that exposure count, a rare scar with zero later opportunities looks identical on paper to a high-traffic scar that got hammered fifty times and held.

Adding a per-scar exposure / deflection counter to the public ledger is high on our list—especially as we start seeing the same topology scars exercised across Python, TypeScript, and Dart.

Collapse
 
arslan_ah profile image
Arslan Ahmad •

"The weights are popularity" is such a clean way to put it. The model's default answer is the most copy-pasted one, not the most battle tested one, and those are often very different things.

Turning past incidents into hard vetoes instead of hoping a bigger model avoids them makes a lot of sense. Curious how you keep the veto list from going stale though... some scars come from constraints that eventually disappear, like an old library bug that's since been fixed.

Collapse
 
randalschwartz profile image
Randal L. Schwartz Google Developer Experts •

Great question—staleness is the exact failure mode of naive "append-only" rule lists. We handle it with an explicit lifecycle (Active, Dormant, Graduated) backed by automated titration probes:

  1. Empirical retirement (Dormant): Every scar is paired with a clean-vs-loaded probe. When a newer model or updated dependency stops tripping on the clean baseline, the scar moves to Dormant—out of the hot prompt, but still kept in the regression suite so future model swaps don't silently reintroduce it.
  2. Deterministic graduation (Graduated): Whenever a constraint can be enforced by a compiler rule, lint, or test assertion, it graduates out of prose into code.
  3. Phase-scoped loading: Active scars are bound to the specific workflow phase where they apply, so nothing irrelevant rides along in context.

Appreciate the thoughtful read!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.