Speaker Notes

AI-Friendly Code: The Missing Link for Speed with Quality • Adam Tornhill • GOTO Copenhagen 2026

Coding agents dramatically increase developer speed but degrade code health and skyrocket defects unless quality rules and MCP safeguards are enforced.

GOTO Conferences · 44:42 · YouTube ↗

Talk · solo speaker  Advanced · concepts, strategy, and research data

Highlights

5 clips · 15 min of 45 min
    • Controlled studies show a 41% increase in software defects after adopting AI coding tools.
    • Open source projects experienced an initial 200% velocity boost that was fully canceled out within two months due to rising code complexity.
    • AI frequently operates in a self-harm mode, generating code that it cannot safely modify later.
    • Testing coding agents on competitive programming datasets reveals a steep drop in reliability as code health decreases.
    • While a code health score of 9 is considered acceptable for humans, an AI's defect risk jumps by nearly 60% at that level.
    • AI agents require a code health of 9.5 to 10 to keep defect risks properly in check.
    • Packaging code health metrics into an MCP server allows Claude to review and score its own generated code automatically.
    • When health issues are detected, the MCP server provides specific feedback, triggering an automated self-correcting refactoring loop.
    • Developers only review the final, healthy code output, bypassing intermediate messy iterations.
    • Uplifting Street Fighter 3 (300,000 lines of 25-year-old C code) to a perfect 10.0 code health took less than a week using Claude Opus.
    • Manual refactoring of this scale would have taken 12 to 18 months with a specialized senior team.
    • Functional correctness during refactoring was successfully maintained using visual trace replay harnesses and play tests.
    • During large-scale refactoring, the AI automatically compiled a playbook of narrow, codebase-specific patterns and constraints.
    • These narrow receipts successfully bridge local codebase problems to general LLM design and refactoring knowledge.
    • With specific receipts, agentic refactoring becomes a predictable and mechanical process at scale.

Questions this video answers

11 · every answer cites the moment it was said
01 Why do initial AI velocity gains disappear after a couple of months? 2 sources · 5:31

Initial velocity spikes can vanish because coding agents frequently increase code complexity and operate in a self-harm mode. This creates code that the agent cannot safely modify later, resulting in projects ultimately slowing down.

02 How does code health impact task completion speed and defect risk? 2 sources · 9:30

Working in healthy code enables developers to complete tasks up to 10x faster than working in unhealthy code. Additionally, healthy code drastically reduces defect risks by up to 15x, making changes much safer and easier.

03 Are coding agents more sensitive to code quality than human developers? 2 sources · 12:02

Yes, research shows that AI coding agents have a much lower tolerance for poor code health than humans. While a code health of 9 is generally acceptable for humans, an AI's defect risk increases by nearly 60% at that level, requiring a score closer to 10.

04 What kinds of quality problems do coding agents typically introduce? 2 sources · 14:18

Coding agents frequently write code lacking proper modularity by packing too many responsibilities into a single function. They also introduce deep nested logic and poor error handling, such as catch-all clauses that silently swallow exceptions and cause resource leaks.

05 How do MCP servers safeguard AI-generated code? 1 source · 19:30

Packaging the code health metric into an MCP server allows the agent to review its generated code automatically. The AI enters a self-correcting refactoring loop based on MCP feedback, resolving code smells before a human ever reviews it.

06 What is the typical code health score of an average codebase? 1 source · 22:22

While optimal AI-friendly code requires a score of at least 9.5 or 10, the average legacy codebase sits at a meager 5.15. This vast gap means letting unstructured agents loose will inevitably cause spikes in bugs and incidents.

07 How does adding MCP data improve agentic refactoring? 2 sources · 24:34

Without guidance, AI models become extremely conservative and only fix about 20% of code health issues, mostly doing minor renames. When provided with MCP code health metrics, the AI can form a concrete plan to address specific issues and successfully clean up technical debt.

08 How long does it take to uplift a large legacy codebase using agents? 2 sources · 29:43

After spending about two weeks setting up processes and automated test harnesses, the actual agentic uplift of a 300,000-line C codebase took less than a week. This process raised every single file from legacy status to a perfect 10.0 code health score.

09 How do codebase-specific refactoring receipts bridge local problems to general design patterns? 2 sources · 31:29

As the AI refactors, it documents successful transformations along with specific constraints into a playbook. These narrow, codebase-specific receipts adapt to local problems while connecting them to broader design patterns encoded in the LLM.

10 What is the financial impact of code health on token consumption? 1 source · 36:17

Working with healthy code significantly reduces API token costs when building features with AI. On average, implementing features in healthy code requires 40% to 45% fewer tokens compared to unhealthy code.

11 Why do architectural god classes lead to agentic merge conflicts? 2 sources · 42:06

God classes compulsively collect responsibilities and span thousands of lines, forcing agents working on distinct features to modify the exact same files. This accidental complexity acts as a traffic jam and directly causes enterprise-scale merge conflicts.

Section-by-section summary

9 parts

AI coding speeds up work but risks quality

While AI coding provides a 2x to 3x speedup and helps unblock simple tasks like GitHub actions, it also introduces a significant rise in defects and accidental code complexity that can stall projects within months.

AI code quality and the illusion of instant software

Studies on open-source projects show that initial velocity gains from AI are often canceled out over time due to accumulating complexity. Building the first prototype is easy, but 95% of software costs occur during maintenance where code quality matters most.

Code health is an objective metric for quality

Code health measures readability and structure on a 10-point scale, heavily correlating with both human task completion speed and defect risk. Healthy code allows developers to work up to 10x faster and reduces bugs drastically.

Coding agents are extremely sensitive to code health

Research on competitive programming datasets demonstrates that AI agents break tests much more frequently on unhealthy code. While a score of 9 satisfies humans, agents require a code health of 9.5 or higher to operate reliably.

Safeguarding AI generation with MCP feedback loops

Developers can integrate code health rules into an MCP server that evaluates AI-generated code instantly. The agent automatically enters a self-correcting refactoring loop until the code meets high quality standards before human review.

Legacy codebases are a bottleneck for enterprise AI adoption

With the average codebase scoring around 5.15 on code health, legacy technical debt prevents coding agents from operating safely. Enterprises must uplift their codebases to fully leverage agentic coding capabilities.

Uplifting large legacy codebases agentically in days

Using Claude Opus guided by code health MCP data, a team successfully refactored a 300,000-line C codebase from legacy status to a perfect 10.0 code health in just a few days. Functional correctness was preserved via screenshot trace hashes and play testing.

Codebase-specific refactoring playbooks and token savings

During large-scale refactoring, AI generates specific patterns and receipts that map local problems to general design knowledge. Furthermore, healthy code reduces token consumption by 40 to 45%, making agentic workflows significantly cheaper.

Architectural god classes cause agentic merge conflicts

High author density and recurring merge conflicts in AI workflows are socio-technical symptoms of monolithic god classes. Modularizing and refactoring at the architectural level is the next frontier for scaling agentic engineering.

0:00 / 44:42
k play/pause · f fullscreen · m mute
n next · p previous clip · t highlights/full
< > slower/faster · / search what was said
  • Behavioral code analysis2× · first 1:03

    An analysis technique used to track stable software fundamentals and identify coordination clashes.

  • Code health16× · first 6:30

    An objective numeric metric measuring code complexity and quality on a scale from 1 to 10.

  • MCP server5× · first 19:32

    A server implementation packaging code health rules to provide real-time feedback loops for coding agents.

  • Illusion of instant software2× · first 16:39

    The false impression that building a prototype easily is the hardest part, ignoring long-term maintenance costs.

  • AI whiplash2× · first 18:14

    A reporting trend showing that increased coding speed often leads to higher bug counts and production incidents.

  • Refactoring playbook2× · first 28:16

    A document built up by an AI during refactoring that details successful receipts and constraints.

  • Action parameter4× · first 31:47

    An AI-innovated refactoring pattern used to deduplicate similar coordinate transformations using function pointers.

  • God class2× · first 42:01

    A massive module that compulsively collects responsibilities and forces multiple developers or agents into merge conflicts.