Agentic AI
AI Coding Agents Favor Consistency Tweaks Over Deep Refactoring, Study Finds
A large-scale analysis of AI-generated code changes reveals that agent refactoring targets low-level consistency improvements, delivering modest gains in structural quality metrics.
Autonomous AI coding systems like Claude Code and Cursor are reshaping software development, but their refactoring patterns differ notably from how human developers approach code cleanup. A comprehensive empirical study examined over 51,000 refactoring instances across Java open-source projects to understand how these agents work and whether their changes actually improve code quality.
How Agents Refactor Differently#
The research, based on the AIDev dataset spanning 12,256 pull requests, found that AI agents intentionally pursue refactoring in roughly one-quarter of their commits (26.1%). When focusing on cases with explicit refactoring intent, agents concentrate more heavily on granular, consistency-focused edits than humans do—accounting for 27.6% of changes versus 24.4% for human-driven refactoring. The two most common operations are Rename Variable (7.6%) and Change Variable Type (6.8%), both relatively routine modifications compared to larger structural overhauls.
Motivations and Stated Goals#
AI agents frame their refactoring efforts primarily around internal code quality. According to documented commit messages, the overwhelming majority cite either maintainability concerns (52.5%) or readability improvements (28.1%). This focus on surface-level cleanliness aligns with the types of edits the agents actually perform, though the stated intentions are broader than the concrete changes delivered.
Measured Impact on Code Quality#
Despite ambitious goals, the actual quality gains prove modest. The refactorings most frequently performed by agents—variable renaming and type changes—yield limited improvements in traditional metrics. However, structural measures do show small but statistically significant improvements, particularly for medium-sized modifications. These changes reduce class size and complexity markers, suggesting AI agents effectively chip away at structural bloat even if low-level edits alone cannot dramatically transform code health.
Why This Matters#
The findings highlight both the capabilities and constraints of current agentic systems. While AI agents actively engage in refactoring work and generally pursue legitimate quality goals, their operational footprint remains incremental. Organizations adopting these tools should view them as complementary to deeper architectural reviews rather than replacements for comprehensive modernization efforts.

