note · 2026-09-15

AI written code duplicates more and refactors less, what 623 million code changes show

Four years of code changes, 2023 to 2026, and every maintainability signal moved the same direction as AI authorship climbed. Duplicated blocks up 81%, refactoring down to 3.8% of changed lines, changes to code older than a year down 74%. The fix that changed behavior in a client team was a tripwire.

For founders and CTOs of SaaS companies who let coding agents write code that shipsyaab1 min read
AI written code duplicates more and refactors less, what 623 million code changes show

The bill for AI written code does not arrive at merge. It arrives when the code has to be maintained, and GitClear's data on how it accumulates now covers four years.

GitClear analyzed 623 million code changes, human and AI, from 2023 to 2026, with 2022 as its pre AI baseline (report published in 2026). Duplicated blocks, five or more repeated lines, are up 81% since 2023, the highest level on record. Moved code, the signature of refactoring, fell from 21% of changed lines in 2022 to 3.8% in 2026, while copy and paste rose from 9.4% to 15.7%. New code calls existing functions 35% less often. Changes to code older than a year are down 74%. Error masking constructs are up 47%. GitClear's own headline is not that AI writes bad code. It is that the default workflow rewards a closed ticket and quietly taxes reuse, consolidation and the code nobody revisits.

Inside a SaaS client's codebase, one that ships every week and will be maintained for years, we have watched the agent add a new function next to one that already did the job, because finding the old one was not in its instructions. Twice was enough for us to act. The fix was a tripwire on duplicate blocks and a rule in the context file: search before you write.

Peter Steinberger, founder of PSPDFKit, on X: duplicating logic is no longer painful; abstractions still are. That asymmetry is the whole report.

Sources