The Factory runs on BITs
Jeremy McEntire
VP of Engineering12 min read
A benchmark published this spring gave a frontier coding agent a payroll task in COBOL. The agent computed a health deduction of $275. The correct figure was $125. Twenty-four of the twenty-nine tests passed anyway. The agent reported success and stopped.1
That is not a model failure in the way we usually mean it. The model did not run out of intelligence. It ran out of information, and — this is the part that should bother you — it had no way to know it had run out. Across every failure in that benchmark, the agent believed it had solved the task ninety-seven percent of the time.
I want to argue that this is not a bug to be patched by the next release. It is a measurement problem, and Claude Shannon described its shape in 1948.2
The cheapest thing you can ask an AI to do is invent
Give an agent a blank directory and a description of a service, and it does well. Give it a twelve-year-old codebase and ask it to change one predicate, and it does badly. Everyone has noticed this. Almost nobody has said why, other than gesturing at "context."
Here is why.
Specifying a correct change costs bits. The number of bits is the log of the space of changes you'd otherwise have to search. When you build something new, that space is enormous but forgiving: many mutually inconsistent answers are all acceptable, because nothing downstream has committed to any of them yet. The model doesn't need many bits from you, because its priors already supply the rest. Code is unusually predictable — Hindle and colleagues showed in 2012 that source code has lower cross-entropy than natural language, that it is more repetitive, more habitual, more guessable.3 A model asked to invent will invent the most probable thing. On a blank page, the most probable thing is usually fine.
I should be careful with the word greenfield, because it invites a strawman. New work is not unconstrained. It has requirements, budgets, regulatory obligations, external interfaces, and platform rules, and those can be brutal. What it lacks is inherited implementation constraint — commitments already made, by people who may be gone, that something downstream now depends on.
That's the real axis, and it's continuous rather than binary. Constraint inheritance is why a one-line change to an authentication predicate can cost more than a new service. The predicate participates in call paths nobody has drawn, invariants nobody wrote down, systems that are already buggy in ways consumers have come to rely on, and tests that will fail without telling you whether they failed because the behavior legitimately changed or because you broke something. Each of those is bits. They are not optional bits. They are the difference between the change and a plausible-looking artifact that computes $275.
The quantity that matters isn't the entropy of the change. It's the conditional entropy: how much uncertainty remains about which changes are acceptable, given what the agent can actually see. Conditional Kolmogorov complexity — the length of the shortest program producing the change when the codebase is furnished as auxiliary input — is the tighter formal cousin.
Both are honest as framing. Neither is a metric. Kolmogorov complexity is uncomputable, and there is no protocol for estimating the conditional entropy of a real repository. If you take one thing from this section, take the mechanism, not a number.
The bits are not in the code
This is the load-bearing claim, and it is forty years old.
In 1985, Peter Naur argued that a program is a secondary artifact.4 The primary artifact is the theory held by the people who built it — and familiarity with the program text and its documentation is not sufficient to acquire that theory. He concluded that a program dies when the team holding it disperses, and that revival is generally not possible. He recommended rewriting.
That is the whole argument, stated before any of us were doing this. The codebase records what the system does. It does not distinguish what it does on purpose from what it does by accident, because that distinction was never encoded. (Rice's theorem sets a formal ceiling nearby — nontrivial semantic properties of arbitrary programs are undecidable5 — but it's a boundary condition, not the argument. Naur is making a stronger and more specific claim about where the theory actually lives.)
Which means the reflex — dump the repo into a million-token window — is a category error. It adds tokens. It does not add bits. The information you need was never in the channel.
Four consequences that cost money
The gap is measured, and it isn't small. The cleanest number I've found comes from an evaluation that held language and model fixed and varied only whether the task was synthetic or real. On synthetic function-level benchmarks, frontier models scored 84 to 89 percent. On real class-level tasks inside actual repositories, the same models scored 25 to 34 percent.6
| Task | Lowest model (%) | Highest model (%) |
|---|---|---|
| Synthetic function-level | 84 | 89 |
| Real class-level in a repository | 25 | 34 |
The same study measured the obvious remedies. Complete docstrings closed one to three points. Retrieval augmentation closed four to seven. The hole is roughly fifty-five points wide. Neither instrument is remotely the size of it. Anyone proposing to fix a brownfield factory by writing more documentation has not looked at the numbers.
More context is not more information. In one 2026 study, prior execution trajectories averaged about 24,700 words. Correctly selected summaries of the same material averaged about 205. The summaries produced a 34% resolution rate. The full trajectories produced 27% — worse than supplying nothing at all, which scored 26%. Incorrectly selected summaries actively hurt.7 Every frontier model tested degrades as input length grows, well below the stated window limit.8 Context is a channel, not a warehouse, and channels have capacity.
| What the agent was given | Resolution rate (%) |
|---|---|
| Nothing | 26 |
| Full trajectories | 27 |
| Selected summaries | 34 |
Redundancy is not information. This is the finding from my own systems I'd most want you to take. I ran three agents in consensus over the same story — three independent reviewers, same input. They caught interface and contract errors reliably. They caught zero conceptual errors. Every conceptual failure — a substrate-versus-spec confusion, polishing a generator that should have been deleted, a compliance boundary inverted — went through all three untouched, because all three shared the same wrong frame. Shannon would have predicted this. Correlated channels do not add capacity. Three copies of the same prior is one prior. What broke the pattern was adversarial separation: independent lenses prompted to refute rather than confirm, and a blind oracle where the implementer and the test author never see each other's work. That configuration caught a replay hole, and refuted three of four findings consensus had previously marked confirmed.
Your instrument can't see the missing bits either. When Google compared standard retrieval against a structure-aware variant on enterprise code migration, the structural approach cut API hallucination from 56% to 16% and nearly doubled dependency resolution quality. Both approaches scored an identical 91% on CodeBLEU.9
| Measure | Standard retrieval (%) | Structure-aware retrieval (%) |
|---|---|---|
| API hallucination | 56 | 16 |
| CodeBLEU | 91 | 91 |
Read that again. Same task, same language, two methods — one producing structurally broken code — and the lexical metric could not tell them apart. The agent couldn't tell it was wrong, and neither could the thing we were using to check. Missing bits don't register as errors. They register as nothing.
This is why I think observability is doing more work than model choice. Where a system emits a machine-readable signal that the agent is wrong, the agent iterates and converges. Where it fails silently — a wrong packed-decimal field that compiles clean and prints something shaped like money — it declares victory. I want to be careful here, because the benchmark evidence for this is confounded: agents do better on Java than COBOL, but that could be training distribution, tooling maturity, or runtime feedback, and I can't separate them. The CodeBLEU result is the cleaner version of the same point, and it's the one I'd bet on.
What actually grows
Not lines of code. Relationships.
A system of N elements has up to N² reachability relations. Design Structure Matrix work gives this a name — propagation cost, the density of the transitive visibility matrix, roughly the proportion of the architecture a randomly chosen change might touch.10 Measured at 25% across a real telecom portfolio of 103 applications.11
That N² is a ceiling on the relationship surface, not an observed growth law. I want to be explicit about that, because the quadratic is doing rhetorical work it hasn't earned empirically. Real dependency graphs are sparse. Whether the relevant surface actually grows super-linearly in your system is a question about your coupling, not a theorem.
Which is exactly why the counter-move works. Parnas described it in 1972: hide the decisions likely to change behind interfaces.12 A good interface doesn't eliminate dependency — it collapses many implementation-level dependencies into a smaller contract surface. In agentic terms, it reduces the requisite knowledge set for a change. Information hiding is context compression for machines you haven't hired yet, and architectural decoupling is now capex on your future agent's channel capacity.
Where the argument is weak, stated before someone else states it
The formal apparatus is a bound and a mechanism, not a measurement. I said this above and I'll say it once more because it's the objection I'd raise.
Naturalness cuts both ways. If code is highly predictable, a strong model's priors already encode a great deal of ordinary structure — which is the steelman my counterparts offer. My answer is that priors supply typical structure, and inherited-constraint difficulty lives entirely in the atypical commitments that make this system this system rather than the mean of its training distribution.
And the strongest counterargument isn't about models at all. It's that you should regenerate rather than patch — rewrite the module from a specification instead of surgically modifying it. That genuinely inverts the cost curve, if a durable specification exists. Mostly it doesn't. Most teams have tickets, Slack threads, and a senior engineer's memory. Regeneration relocates the bits from the patch to the spec. It doesn't reduce them, and manufacturing the spec is the same information-recovery problem wearing a better hat.
The operating rule
Sort work by information state, not by model capability.
Bounded change, good test coverage, machine-visible failure: run the factory, gate on held-out tests, never on the agent's self-report. Broad change, good coverage: agentic implementation with explicit parity gates. Untested, undocumented, drifted: do not point a factory at it. Not yet. The measured outcome of doing so is negative — experienced developers on codebases they maintain were 19% slower with AI assistance while believing they were 20% faster, a thirty-nine-point error in self-assessment that should terrify anyone making adoption decisions from survey data.13
There is a shape to the fix, and it's two problems rather than one. First, compile the organization's corpus — code, history, tests, traces, decisions — into a durable model of what the system is and what it has committed to. Second, given a task, project the relevant slice of that model into the agent's working set. Task-conditional salience belongs entirely to the second stage, and conflating the two is why "index the repo" keeps disappointing people. That architecture deserves its own essay, and it will get one.
The prerequisite work is unglamorous and nobody has budgeted it: characterization tests with a human labeling which behaviors are intentional, types as cheap machine-checkable invariants, executable specifications, and enough instrumentation that being wrong produces a signal. That is the bill. You can pay it or you can keep generating $275.
What I'm going to measure next
Everything above is synthesis. The pieces are old — Shannon, Naur, Brooks, Lehman, Parnas, Ashby141516 — and the benchmarks are new, but I haven't found anyone joining them into a claim about the bit cost of a change. That means it's either novel or wrong, and the way to find out is to measure it.
The first experiment: hold the model and the task fixed, vary the artifact classes in context — bare code, plus types, plus characterization tests, plus decision records, plus commit history, plus runtime traces — and report success gain per thousand tokens added. That is a utility measurement, not an information measurement, and I'll label it as such. It's also the number every engineering leader trying to make a legacy system agent-ready actually needs, and none of us has it.
The sharper version uses open weights and measures the negative log-likelihood of the accepted patch under each context condition. That one is in bits, literally, and it's the only version that earns the word.
It has a known flaw: many patches are correct, so the likelihood of one particular patch conflates wrong with differently right. Differencing across conditions on the same patch absorbs most of that. Not all of it. I'll say so in the results.
If the framing is right, adding types should move the needle more per token than adding prose. If it's wrong, that experiment will say so, and I'd rather find out from a number than from an argument.
Jeremy McEntire is a VP of Engineering and fractional CTO who holds patents in infrastructure and performance optimization and writes on organizational failure and the limits of method (The Cage and the Mirror, Beyond Code). His own codebase is entirely agent-built on a contract-first stack he wrote; the field results here come from running it. Papers and research at perardua.dev.
References
- Legacy-Bench: Can AI Agents Maintain the World's Most Critical Software? (Tchourakov, Singhal & Reyes, Factory, 2026)
- A Mathematical Theory of Communication (Shannon, 1948)
- On the Naturalness of Software (Hindle, Barr, Su, Gabel & Devanbu, 2012)
- Programming as Theory Building (Naur, 1985)
- Classes of Recursively Enumerable Sets and Their Decision Problems (Rice, 1953)
- Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation (Rahman, Khatoonabadi & Shihab, 2025)
- SWE Context Bench: A Benchmark for Context Learning in Coding (Zhu, Wu et al., 2026)
- Context Rot: How Increasing Input Tokens Impacts LLM Performance (Hong, Troynikov & Huber, Chroma, 2025)
- Beyond Vector Similarity: Hierarchical Context-Aware Graph RAG vs Standard RAG in Enterprise Code Migration (Bhaumik et al., Google, 2026)
- Exploring the Structure of Complex Software Designs: An Empirical Study of Open Source and Proprietary Code (MacCormack, Rusnak & Baldwin, 2006)
- Visualizing and Measuring Enterprise Application Architecture: An Exploratory Telecom Case (Lagerström, Baldwin, MacCormack & Aier, 2014)
- On the Criteria To Be Used in Decomposing Systems into Modules (Parnas, 1972)
- Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity (Becker, Rush, Barnes & Rein, 2025)
- The Mythical Man-Month: Essays on Software Engineering (Brooks, 1975)
- Programs, Life Cycles, and Laws of Software Evolution (Lehman, 1980)
- An Introduction to Cybernetics (Ashby, 1956)