🎬 What this is 0:00
| Property | Detail |
|---|---|
| Show | AI That Works — Vaibhav Gupta and Dex Horthy, with Avery from Boundary as guest |
| Length | 51:07, published 4 December 2026, about 3,400 views |
| Subject | Whether an agent's code can be measured, and whether that measurement can steer it |
| Best moment | The agent asked to make code faster, which then reported that the speed-up was not worth the complexity it had created |
| Most honest line | "None of this is going to prove anything" — the metrics let you go longer between reading the code, not stop reading it |
| Weak spot | Small samples, one language, and the tool is the vendor's own product |
The framing that makes this episode worth an hour: an agent asked to rewrite a codebase is only as good as the feedback it gets, and tests answer "does it work", not "is it any good". Everything else in the conversation is an attempt to manufacture the second signal — deliberately, measurably, and with the agent in the loop instead of a human saying "this sucks, try again".
🏗 The rewrite moment 2:03
| Example | As described in the episode |
|---|---|
| Bun | Complete rewrite from Zig to Rust, shipped in version 1.4 — merging multi-million-line changes and adding an ahead-of-time compiler |
| GitHub Copilot | Its TypeScript runtime ported to Rust |
| Discord | A decade-old Electron app rewritten, according to the hosts |
| Anthropic | API migrated to Rust |
| The premise it validates | A rewrite is safe when you can independently verify the result — a language runtime is the ideal case, because the old and new implementations answer to the same programs |
The distinction the hosts draw is the one most rewrite arguments miss: Bun can be its own oracle — run a Zig Bun and a Rust Bun against the same code and compare outputs — so its rewrite is verifiable in a way most applications are not. That is why "we rewrote it in Rust with agents and it worked" is not a general recipe; it is a statement about a runtime with a conformance surface.
Treat the Rust list as reported rather than established: Bun's rewrite and its timeline are the loudest and best documented of these, and they anchor the argument. The others are mentioned in passing, without links or dates, and I did not independently confirm each one for this article.
♟ Two chess engines, both passing 9:00
| Version A | Version B |
|---|---|
| One class, the board is an array of strings | Multiple data structures, enums, classes, a real type for whose turn it is |
| "Z" could be a chess piece and nothing would complain | Moves that are impossible are unrepresentable |
| Code you could have written in any language | Code that uses the language's own features — what the hosts call mastery |
| Passes all the tests | Passes all the tests |
Both were produced by the same model with the same tests and zero hand-holding — and one of them is stringly typed. That is the entire problem in one slide: the test suite cannot distinguish them, the human can, and the human's judgement arrives as a phrase the agent cannot optimise: "this feels worse". Everything that follows is an attempt to make that phrase computable.
"I'm needed for vibes. The whole point of vibes is that the LLM can't do it. So I was like, okay, how do we turn this into something that's measurable so the LLM can get its own feedback instead of having to call me every time."
📐 The metrics, defined 15:30
| Metric | How it is counted | Lower is |
|---|---|---|
| Cognitive complexity | One point per branching construct, plus one per level of nesting | Better |
| Cyclomatic complexity | The number of independent paths through the function | Better |
| Paths | The combinatorial count of possible execution paths — this is the one that explodes | Better |
| Nesting | Depth of indentation | Better |
| Exits | Number of exits from a function | Directional only — four exits are not always worse than three |
| Function count | How many functions the code is split into | U-shaped — splitting to reduce complexity can raise it by spreading context |
The exit and function-count caveats are the most useful part of the definitions, because they show why this is guidance rather than a scoreboard: refactoring for a lower cognitive score increases function count and total exits, and past a point that makes the code harder to follow, not easier. A metric you can hill-climb into worse code is a metric you have to teach the agent to respect.
The cleanest idea in the episode is borrowed and they say so: giving an agent a functional style — filtering and mapping rather than nested loops with early exits — collapses the path count. That is not a philosophical preference; it is the difference between two paths and eight, and it is why "prefer idiomatic use of the language" is a rule in their skill rather than a matter of taste.
🧰 The tool in the compiler 22:06
| Piece | What it does |
|---|---|
| A code-quality command | Built into the language's own toolchain — one command for a codebase overview, per function, and JSON output for agents |
| A skill with rules | Around twenty to thirty guidelines, including preferring functional style and early returns, and the instruction to check quality as you go |
| An anti-instruction | Telling the agent not to hill-climb the numbers |
| Where it sits | In the toolchain rather than as a plugin ecosystem, which the hosts contrast with the Go ecosystem's pile of separate linters |
The design argument is about discoverability, not features: a metric in the toolchain is something an agent can be told about once and then use; a metric in a third-party plugin is something that has to be found, installed and configured. They also report the behaviour that matters most — an agent mentioning code complexity unprompted in a team channel, because the signal was available to it.
This is a vendor demonstrating a vendor's tool, and the episode is honest about the narrower claim: the same metrics exist for other languages, and several of them came straight out of an external benchmark. What Boundary added is integration and a set of rules encoding their taste — a real contribution, and not a new science of code quality.
📊 What it measured 31:23
| Comparison | Result |
|---|---|
| With the quality tool versus without | About a standard deviation better cognitive complexity — measured by them, on their benchmarks |
| Two task families | A simple blog-style API came close even without the tool; a transit-schedule dataset needed it |
| A port with guidelines versus without | The guided version split one enormous function into several, and used classes and enums instead of strings and integers |
| Cost | The guided run called the quality command seven times and took a couple of minutes longer — "I wouldn't read into the time, it's inconsistent" |
| Sample size | Small, self-reported, and dependent on the model of the day |
"A standard deviation of difference" is the strongest quantitative claim in the episode and it is theirs, not a benchmark's: same task, same model, one variant given a tool that reports its own complexity — meaningfully better code by that measure. The honest caveat is that better on the metric is not the same as better absolutely, which they say explicitly: none of it proves anything.
🚦 The agent that refused 25:56
| What was asked | What came back |
|---|---|
| "Make this faster" | The agent made it faster — then reported that the change was not worth it, because the codebase got worse |
| A summary at the end | Everything else was faster without hurting maintainability, and the metrics elsewhere were unchanged |
| Why it matters | The machine declined an optimisation on engineering grounds, using evidence a human could check |
This is the moment the whole idea pays off, and it is worth being precise about why: the agent was not more cautious or better aligned — it had a measurement that made the trade-off visible to itself. Backpressure here means the system's own signals push back on a change that would have passed every test.
The same mechanism cuts the other way, and the hosts know it: point the metrics at the wrong target and the agent optimises into absurdity — one joke in the episode is asking a model to hill-climb toward the worst possible code, which is a real risk with any measurable objective. Their answer is to treat metrics as advisory rather than as gates.
📜 Two rules for a rewrite 29:28
| Rule | Why it works |
|---|---|
| Do standard one-to-one ports and do not change file architecture | Every deviation is a decision that has to be reviewed; a mechanical port is checkable file by file |
| Skim the code constantly while the refactor runs | You cannot review the diff at the end, but you can watch the shape of it |
| Where these came from | Credited to the Bun author's public posts, which the guest says he read closely before attempting his own port |
The second rule is the one people skip, and it is the one that makes large agent-written changes reviewable: instead of reading the result, you watch the process. Combined with a one-to-one port — which gives you a mechanical expectation of what each file should contain — it turns an impossible review into a stream of small, comparable observations.
⚠️ What the method admits 40:59
| Limitation | Their own words |
|---|---|
| Metrics are not proof | "None of this is going to prove anything" — they are an approximation of taste |
| Do not gate on them | Compared to code coverage: 100% coverage in a real codebase is a warning sign, and 60% can be right. Directional, not absolute |
| You still have to read the code | The question is how long you can go between readings, not whether you can stop |
| Judgement without comparison is unreliable | Shown a single file in isolation, experienced engineers call mediocre code "fine" — the human needs the baseline too |
| Maintainability is invisible until it is expensive | It may genuinely not matter for the first months, and then it costs a rewrite |
The code-coverage analogy is the best argument against metric gating, and it comes from a team that sells metrics: coverage is a proxy for "are we thinking about testing", not a certificate of quality, and every engineer who has seen a 100%-covered codebase riddled with useless assertions knows why. Complexity scores have the same shape — useful as a smell detector, actively harmful as a target.
🏢 Why the labs cannot just fix it 43:55
| The question | The answer offered |
|---|---|
| Why not bake good code practice into the model? | They probably try, with metrics in internal hill-climbing evals — and it still fails to generalise |
| The structural reason | There is no single best way to write a codebase: infinite valid implementations mean no clean optimisation target |
| The asymmetry with prose | Models cannot be taught good writing either — but code has backpressure, tests and metrics, so code can be steered where prose cannot |
| The uncomfortable conclusion | If it takes a senior engineer's judgement to keep an agent's output on track, most people cannot get there yet |
"There's no one way to write it. There's no one best way to write it. There's infinite best ways to write the codebase. So there's no optimization when all roads lead to Rome."
That is the most important sentence in the episode and it explains a great deal of the frustration around agentic coding: models excel where there is a measurable objective and plateau where quality is plural. The fix is not a better model; it is supplying a local definition of good — your metrics, your rules, your review process — and being honest that you are the one who chose it.
✅ Claims checked
| Claim | Verdict | Evidence |
|---|---|---|
| Two implementations of a chess engine, both passing tests, one stringly typed and one not | Demonstrated on screen; produced by a model with no hand-holding | — |
| Cognitive complexity adds one per branching construct plus one per nesting level | Correct as defined | Consistent with the standard formulation of the metric |
| Cyclomatic complexity counts independent paths | Correct | — |
| A code-quality command exists in their compiler with JSON output for agents | Demonstrated live, including repeat invocations by the agent | — |
| About one standard deviation of improvement with the tool | Their own measurement, small sample, self-reported | — |
| Bun rewrote from Zig to Rust and shipped it in 1.4 | Widely reported and consistent with the episode; exact timeline not verified here | — |
| Copilot's TypeScript runtime, Discord's Electron app and Anthropic's API moved to Rust | Mentioned in passing without sources; not independently verified for this article | — |
| The agent independently decided a speed-up was not worth the complexity | Demonstrated by the guest from his own run; not reproducible from the episode | — |
| Metrics were borrowed from an external code-quality benchmark | Stated openly by the hosts, with credit | — |
| "People are saying [a current model] is bad at maintainable code but great if you don't read it" | A remark about developer chatter, not a measurement — treat as anecdote | — |
| Don't gate on metrics; treat them like code coverage | Their explicit recommendation, and it is the right one | — |
Basis note. Built from the full 51:07 episode and checked against the definitions of cognitive and cyclomatic complexity. Everything quantitative here is the participants' own measurement on their own codebase; nothing in the episode constitutes an independent evaluation. The framing of tests as an oracle that makes rewrites safe, and the observation that the human's judgement also needs a baseline to be reliable, are this article's readings of their argument.
🔑 Key takeaways
- Tests answer "does it work", not "is it good" — two passing implementations can differ enormously in maintainability.
- Turn taste into numbers: cognitive complexity, cyclomatic complexity, paths, nesting, exits, function count.
- Give the agent the metric as a tool, not as a gate: about a standard deviation of improvement in their measurement.
- Watch the U-shapes: splitting functions lowers complexity and raises the count, which can make code harder to follow.
- Metrics in the toolchain beat metrics in plugins, because an agent can be told once and then use them.
- The payoff is an agent that declines a speed-up because the complexity cost is visible to it.
- Do one-to-one ports and don't change the file architecture — mechanical rewrites are reviewable, creative ones are not.
- Skim while it works: you cannot review a two-million-line diff at the end, but you can watch the shape.
- Never gate on complexity, for the same reason 100% code coverage is a warning sign.
- You still have to read the code — the metric buys you distance between readings, not exemption.
- Human judgement needs a baseline too: shown one file in isolation, good engineers call mediocre code fine.
- There is no single best codebase, which is why this cannot be trained away — you have to define "good" locally.
🔗 Resources
- The episode — AI That Works, 51:07, 4 December 2026
- Boundary — the company behind the language and the code-quality command demonstrated here
- The episode's own reference to the code-quality benchmark the metrics were borrowed from, and to the data-structure talk that started this line of work
- This site's deep dive on the Katelyn Lesse interview, for Anthropic's Python-to-Rust rewrite of the same kind, at production scale
- This site's deep dive on Grill With UI, for the same instinct applied to design decisions rather than code quality
- This site's deep dive on the three Codex website methods, for verification loops built around a different kind of artefact
Basis note. No sponsor read. The episode closes by pointing at the hosting company's product; nothing from it is promoted here beyond the description above.
⏱ Timestamp index
0:00"It's vibes that it's better"
0:33Bun rewrote everything in Rust
2:03Rewrite your whole codebase, with caveats
3:06All slop starts as bad data structures
5:08The Rust rewrite wave
6:56Does it matter if it is clean?
9:00Two chess engines
13:00Both pass all the tests
15:30Cognitive complexity defined
15:58Cyclomatic complexity and paths
17:43Exits, and why fewer is usually better
19:48Turning vibes into metrics
22:06The command in the toolchain
22:56The Go toolchain comparison
25:56The agent that decided it wasn't worth it
27:34Bun has an independent oracle
29:28Two rules for a rewrite
31:23A standard deviation of difference
32:21Conduit versus the transit dataset
34:57Reading the ugly file
38:09Comparing the two ports
40:31Should these be gates?
40:59The code coverage analogy
43:55Why can't the labs bake this in?
46:59Imagine seeing the bad file alone
49:30No one best way to write a codebase