Cognitive Debt and the Return of Boring Engineering

· 6 min read · Automation

Code now arrives faster than a team can understand it, and Thoughtworks calls the gap cognitive debt. A 4-line example shows 100% coverage hiding 3 untested behaviours, and why the practices that close the gap are old ones.

Cognitive Debt and the Return of Boring Engineering

Software teams now accept code faster than they can understand it. The useful response is not a new tool. It is a handful of old testing and measurement practices that force understanding back into the team, and the oldest of them dates from 1978.

The gap has a name. In February 2026 Margaret-Anne Storey wrote that “Technical debt lives in the code; cognitive debt lives in developers’ minds”. In April, Thoughtworks’ Technology Radar volume 34 warned of “accumulating cognitive debt as AI generates increasingly larger amounts of code and, in so doing, introduces a wider gap between humans and software systems”. This post is for an engineer or tech lead whose team merges agent-written code that passes review, and who suspects nobody could explain half of it during an incident.

Coverage says 100% while three behaviours go untested

The cheapest way to see the gap is to run a mutation tester on a test suite that looks complete. Mutation testing changes your source in small ways, such as > to >=, and reruns the tests. A change that no test notices “survives”, and each survivor is a behaviour the suite does not check.

Here is a 4-line discount rule and two tests of the kind an assistant writes alongside it:

Python
# src/pricing.py
def apply_discount(total: float, tier: str) -> float:
    if tier == "gold" and total > 100:
        return total * 0.9
    return total
Python
# tests/test_pricing.py
from pricing import apply_discount

def test_gold_discount():
    assert apply_discount(200, "gold") == 180

def test_no_discount():
    assert apply_discount(50, "silver") == 50

Both tests pass, and coverage.py reports 100%, branch coverage included. Then run mutmut 3.8.1, the current release, with this configuration:

TOML
# pyproject.toml
[tool.pytest.ini_options]
pythonpath = ["src"]

[tool.mutmut]
source_paths = ["src"]
Bash
$ mutmut run
$ mutmut results
    pricing.x_apply_discount__mutmut_1: survived
    pricing.x_apply_discount__mutmut_5: survived
    pricing.x_apply_discount__mutmut_6: survived

That is the real output of a run on 10 November 2026: 8 mutants, 5 killed, 3 survived. mutmut show gives the change behind each survivor:

MutantChangeWhat no test checks
1and becomes orThat a silver order over 100 pays full price
5> 100 becomes >= 100What happens at exactly 100
6100 becomes 101That 101 gets the discount

Each survivor is a real question about the business rule that the suite never asked. Mutant 1 is the expensive one: if someone swapped and for or, every order over 100 would get the gold discount and every test would stay green. The Stack Overflow 2025 survey found the same shape of problem from the other side. Asked what frustrates them about AI tools, 66% of the developers who answered chose “AI solutions that are almost right, but not quite”, the most common answer.

Two practical notes on mutmut 3. mutmut run no longer takes a --paths-to-mutate flag: the paths go in source_paths in the configuration (the old paths_to_mutate name still works, with a deprecation warning). It also refuses a module whose import name starts with src., so the tests import pricing and pytest is given src on its path.

The fix is to pin current behaviour, not to argue about it

The tests that kill those mutants are characterization tests. Michael Feathers coined the term in Working Effectively with Legacy Code (2004) for tests that record what code currently does, right or wrong, so that a change in behaviour becomes visible. Generated code is legacy code on arrival: it works, and nobody on the team built up the context for why.

Python
import pytest

def test_gold_at_exactly_100_pays_full_price():
    assert apply_discount(100, "gold") == 100

def test_gold_just_over_100_gets_the_discount():
    assert apply_discount(101, "gold") == pytest.approx(90.9)

def test_silver_over_100_pays_full_price():
    assert apply_discount(200, "silver") == 200

With these three added, the same run kills all 8 mutants. Note what the first test does and does not say. It does not claim that an order of exactly 100 should miss the discount. It records that it does, so that changing it becomes a decision someone makes on purpose. Writing tests like these is also a good task to hand an agent, for the reason covered in what to actually hand a coding agent: the behaviour already exists, so there is a right answer to check against.

Neither the Radar’s volume 34 announcement nor its mutation testing entry mentions characterization tests; pairing them with mutation testing is my recommendation. The Radar does back the first half. In April 2026 it placed mutation testing in Trial and called it “the most honest signal for evaluating the real fault-detection capability of a test suite”. In November 2026 it moved it to Adopt, noting that AI-generated tests make “traditional code coverage metrics easier to inflate with superficial tests that lack meaningful validation”.

Mutation runs are slow by construction, because the suite runs once per mutant. Point them at the modules where a wrong answer costs money, such as pricing, billing and permissions, and run them nightly rather than on every commit.

Outcome metrics still mean something when output does not

Thoughtworks’ volume 34 lists DORA metrics among the “well-established techniques” that “the speed of AI is driving a return to”, alongside zero trust architecture and testability. The reason is simple. Lines of code and merged pull requests now measure how fast a model types. If a team’s output triples and its review capacity does not, the review queue triples and throughput does not.

DORA’s measures look at whether changes reach users and hold up. There are five of them now, not the four many teams still quote. In 2023 DORA replaced “time to restore service” with failed deployment recovery time, which counts only failures caused by a change. In 2024 it added deployment rework rate, the share of deployments that are unplanned fixes for production incidents. The full set is change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate.

If cognitive debt is building up on a team, I would expect it to show in recovery time and rework rate before anywhere else. The team keeps shipping at the same pace, but each fix takes longer, because the person paged does not understand the code they are fixing.

An agent gets permissions, not trust

The same Radar is direct about agents with access to a codebase: “Zero trust architectures, sandboxed execution, and defense in depth are now non-negotiable table stakes.” A colleague with repository access has a manager, a contract and a reputation to lose. An agent has a prompt. So it gets credentials scoped to the task in front of it and no more, and it runs where a mistake cannot reach production. The harness around the agent is the subject of the next post in this series.

Thoughtworks frames the two halves of this as controls. Feedforward controls, “like Agent Skills and spec-driven development”, shape the work before it happens. Feedback controls, “like mutation testing”, catch what got through and “trigger self-correction before human review”. Of the two, the feedforward half matters more for cognitive debt. A spec written before the code records what someone decided; documentation written afterwards records what someone reconstructed.

Start with one mutation run on the code that handles money

  1. Run a mutation tester once on your single most business-critical module: mutmut for Python, Stryker for JavaScript and C#, PIT for Java, cargo-mutants for Rust. Count the survivors.
  2. Read each survivor and write the characterization test it asks for. Do not chase a score; a survivor that changes nothing a user could notice can stay.
  3. Start recording failed deployment recovery time and deployment rework rate. Both come from data you already have in your deploy log and incident tracker.
  4. Scope agent credentials to the task, and write the spec before the next feature, in the repository, as its documentation.

None of this is new. Mutation testing was first published in 1978, characterization tests in 2004, and DORA’s research predates the current wave of coding agents. The pressure from AI did not create a need for new practice. It removed the slack that let teams skip the practices they already knew, and the 3 survivors in a 4-line function with 100% coverage are what that slack was hiding.

Frequently Asked Questions

What is cognitive debt?
The gap between the software a team owns and the software it understands. Margaret-Anne Storey put it as "Technical debt lives in the code; cognitive debt lives in developers' minds" in February 2026, and Thoughtworks Technology Radar volume 34 (April 2026) warned of it accumulating "as AI generates increasingly larger amounts of code". The code can be clean and still be debt, if nobody on the team can explain it.
What is mutation testing and why is it back?
Mutation testing makes small deliberate changes to your source code, such as flipping a comparison, and checks whether any test fails. A change no test notices shows a behaviour the suite does not check, which coverage cannot show. Thoughtworks moved it to Adopt on its Technology Radar in November 2026, because generated tests make coverage easy to inflate.
What are characterization tests?
Tests that record what code currently does rather than what it should do, so that any change in behaviour becomes visible. Michael Feathers coined the term in Working Effectively with Legacy Code (2004). They are the standard way to take ownership of code nobody on the team wrote by hand.
Do DORA metrics still make sense with AI-assisted development?
Yes, because they measure outcomes rather than output. DORA has used five since 2024: change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate. None of them cares who or what wrote the code.
cognitive debt thoughtworks technology radar mutation testing characterization tests dora metrics zero trust architecture engineering fundamentals ai technical debt code comprehension testing strategy

Enjoyed this article?

Get notified when I publish new articles on automation, ecommerce, and data engineering.

Get in touch

Related Articles