A merge request scored 2.8 on the CodeScene scale costs 22 to 35% more to review with an AI agent than one scored 9.7 [1]. CodeScene analyzes a repository and summarizes the structure of each file as a score out of ten. Marcus Borg had the same merge requests reviewed by three language models, AI agents that receive the diff and a review instruction, and the gap between the two ends of the scale puts a number on what code structure makes review pay: we call it the Borg gap [1]. Martin Fowler relayed the experiment in his fragments of November 20, 2026 [1].
What the score measures
A low score signals entanglement: nested conditionals, variables changed far from where they are declared. A high score signals a read that follows the thread without going back three times.
On a badly split file, review starts with a map. Where data enters, where it leaves, what transforms it along the way. Three readers will redraw that map three times. On a well split file, the same question is settled by scrolling down the screen.
The Borg gap reads as a structural effect on one condition: that it is counted in tokens consumed by the model. In that case the score puts a price on readability, stable from one reviewer to the next, whether a developer or an AI agent. The experiment does not settle that reading; the 22 to 35% figure remains an order of magnitude [1].
The score speaks about readability, not correctness. A short, well split file can compute the wrong discount. Tests speak about behavior, static analysis speaks about form.
The reasoning holds for any per-file indicator the team already tracks from one Sprint to the next, provided two scales are not mixed in the same curve.
Step 1: measure the files that move
Take a team of six, a Tuesday at 2 p.m. A 780-line merge request has been waiting since the day before. The developer reviewing it opens the changed-files tab, scrolls down once without reading, scrolls back up, looks for the entry point of the flow, then proposes a twenty-minute call to understand the sequence. The meeting room timer goes off for another appointment. Nobody can say what that review cost.
First move: run the analysis on the whole repository and get one score per file. The resulting distribution is worth more than its average. A repository averaging 6 can hide twenty files at 3 that absorb all the review work.
Second move: cross the score with the number of changes over the last six months. A file at 4 changed three times a week costs more than a file at 3 that nobody has opened in two years. The team comes out with a short list, five or six files, the hot spots.
Publishing the repository average in a monthly report points to no file, so to no action. The short list gets discussed in the Sprint Review.
Step 2: connect the score to flow
Accelerate counts code maintainability among the capabilities associated with delivery performance [2]. The score belongs next to cycle time and throughput, in the same conversation.
The tooling is on us: two columns added to the flow board, the score of the most-changed file over the fortnight and the number of human reviews it required. Accelerate establishes a link between maintainability and delivery performance; it prescribes no board [2].
Over three Sprints, the correlation shows by eye. A score going down often comes with longer reviews and back-and-forth comments, those exchanges where two developers end up sending each other the same question about the exact place where the value changes, without agreeing on the variable name.
Comparing the score of two teams says nothing: two repositories share neither history nor language, and ranking turns a flow indicator into internal competition. The team compares itself to itself, over several Sprints.
Step 3: a threshold in the Definition of Done
A useful threshold covers what the team touches. A few lines in the Definition of Done are enough: files already above the agreed score do not go down, a new file starts above it. Existing code stays outside the threshold, otherwise the first merge request blocks everything.
A team of five debates the number for twenty minutes. Two people want 8 right away, one proposes 6, nobody has looked at the scores. The facilitator, the team's Scrum Master, projects the distribution of the ten most-changed files: three are above 7, the other seven sit between 4 and 6. The threshold starts at 6, with a review in three Sprints.
The number is chosen on the team's own data. A threshold set at the level of the repository's best file asks for months; a threshold just above the median of the most-changed files asks for an effort the team can sustain.
Turning the threshold into a goal produces the opposite effect. Someone splits a 200-line function into four functions that call each other in a chain, the score smiles, and reading now means jumping from one to the next.
Step 4: refactor one file at a time
Refactoring changes the internal structure of code without changing its observable behavior [3]. The principles of the Agile Manifesto list technical excellence and good design among what enhances agility [4]. A score that leads to no change produces nothing.
One hot spot per Sprint, in a two-hour slot that ends with a merge the same day. Without tests on the path about to move, the two hours go into writing three for the nominal case, and the refactoring waits for the next Sprint: without a safety net, the slot is useless.
At the end of the slot, two outcomes. Tests pass: merge, even if the score has not moved much, because the move may only be a step. Tests fail: return to the starting state, report the finding in the retrospective, and the file rejoins the hot-spot list with one more piece of information.
Opening a three-week refactoring branch costs more than the original problem: reviewing the branch itself becomes a hot spot.
What AI review changes
Clean code used to be defended as a professional requirement. Borg's experiment gives it a cost line, measured on reviews by language models [1].
The reasonable use: hand the mechanical part to the AI agent, a poorly chosen name, a duplicated block, and keep developers on intent. The agent spots what repeats; it does not know whether the calculation rule is the right one.
Two drifts are waiting. Attributing a file's score to the person who changed it most: everyone then picks files that are already clean. And the dashboard with no recipient, a health curve that names neither file nor Sprint and changes no review.
The question to ask at the next Sprint Planning: which hot spot will you make readable before the end of the Sprint?
Sources
- Martin Fowler, Fragments: November 20, 20 novembre 2026.
- IT Revolution, Accelerate: The Science of Lean Software and DevOps, 2018-03-27.
- Martin Fowler, Refactoring: Improving the Design of Existing Code, 2018-11-20.
- Agile Manifesto, Manifeste agile, 2001-02-13.