
Study: messy code trips up AI coding agents too
This paper tests whether how 'clean' code is (clear variable names, tidy structure, no leftover cruft) actually affects how well like Claude or Codex perform when working on it. Researchers gave agents two versions of functionally identical code — a messy one with vague names and tangled structure, and a clean, well-organized one — and had them do tasks like fixing bugs or adding features.
The general pattern found is that agents take more trial-and-error steps to understand messy code and are more likely to make mistakes on it. In short, code that's easier for humans to read tends to be easier for AI agents to work with as well.
Key points
- Tests whether code cleanliness affects how well perform on a task
- Compares a messy version (unclear names, tangled structure) against a clean version of functionally identical code
- Agents tend to take more trial-and-error steps and make more mistakes on messy code
- Suggests good coding practices help AI agent efficiency, not just human readability