Agentic Refactoring: An Empirical Study of AI Coding Agents
On the map: LLM agents and tool use → Software engineering coding agents
Abstract (arXiv)
Agentic coding tools, such as OpenAI Codex, Claude Code, and Cursor, are transforming the software engineering landscape. These AI-powered systems function as autonomous teammates capable of planning and executing complex development tasks. Agents have become active participants in refactoring, a cornerstone of sustainable software development aimed at improving internal code quality without altering observable behavior. Despite their increasing adoption, there is a critical lack of empirical understanding regarding how agentic refactoring is utilized in practice, how it compares to human-driven refactoring, and what impact it has on code quality. To address this empirical gap, we present a large-scale study of AI agent-generated refactorings in real-world open-source Java projects, analyzing 15,451 refactoring instances across 12,256 pull requests and 14,988 commits derived from the AIDev dataset. Our empirical analysis shows that refactoring is a common and intentional activity in this development paradigm, with agents explicitly targeting refactoring in 26.1% of commits. Analysis of refactoring types reveals that agentic efforts are dominated by low-level, consistency-oriented edits, such as Change Variable Type (11.8%), Rename Parameter (10.4%), and Rename Variable (8.5%), reflecting a preference for localized improvements over the high-level design changes common in human refactoring. Additionally, the motivations behind agentic refactoring focus overwhelmingly on internal quality concerns, with maintainability (52.5%) and readability (28.1%). Furthermore, quantitative evaluation of code quality metrics shows that agentic refactoring yields small but statistically significant improvements in structural metrics, particularly for medium-level changes, reducing class size and complexity (e.g., Class LOC median Delta = -15.25).
Key facts. Cited by 17 papers in the map (data through 7 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 13 of its 62 references that are in the map. First posted on arXiv 6 Nov 2025.
Builds on
13 of 62 references.
Closest ancestors · 3
Same direction, newest first
- 2025On the Use of Agentic Coding: An Empirical Study of Pull Requests on GitHub18 Sep
- 2025Agentic Software Engineering: Foundational Pillars and a Research Roadmap7 Sep
- 2025Vibe Coding vs. Agentic Coding: Fundamentals and Practical Implications of Agentic AI26 May
Other references · 10
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 150
- 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 87
- 2022Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?cited by 63
- 2024Using AI-Based Coding Assistants in Practice: State of Affairs, Perceptions, and Ways Forwardcited by 44
- 2023Refactoring Programs Using Large Language Models with Few-Shot Examplescited by 27
- 2024Unveiling ChatGPT's Usage in Open Source Projects: A Mining-based Studycited by 16
- 2024How to Refactor this Code? An Exploratory Study on Developer-ChatGPT Refactoring Conversationscited by 11
- 2016Why We Refactor? Confessions of GitHub Contributorscited by 10
- 2025Leveraging LLMs, IDEs, and Semantic Embeddings for Automated Move Method Refactoringcited by 1
Built on by
Citing papers per year: 2025: 1; 2026: 16.
17 papers.
Sort:
By area:
- 2025Agent READMEs: An Empirical Study of Context Files for Agentic Codingcited by 21
- 2026The Story is Not the Science: Execution-Grounded Evaluation of Mechanistic Interpretability Researchcited by 6
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoringcited by 5
- 2026Coding with "Enemy": Can Human Developers Detect AI Agent Sabotage?cited by 4
- 2026Why Agentic-PRs Get Rejected: A Comparative Study of Coding Agentscited by 3
- 2026Do AI Coding Agents Log Like Humans? An Empirical Studycited by 2
- 2026The Devil Is in the Interface: Evaluating How Tool Architecture Shapes Coding Agent Behaviorcited by 2
- 2026"Refactoring Runaway": Understanding and Mitigating Tangled Refactorings in Coding Agents for Issue Resolutioncited by 1
- 2026ParaCodex: A Profiling-Guided Autonomous Coding Agent for Reliable Parallel Code Generation and Translationcited by 0
- 2026Do These Violent Delights Have Violent Ends? Measuring the Post-Merge Fate of Agentic Codecited by 0
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requestscited by 0
5 more
- 2026From Agent Behaviour to Agent-Friendly Documentation: An Empirical Study of How Coding Agents Discover, Read, and Write Technical Documentationcited by 0
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoringcited by 0
- 2026On the Maintenance and Co-evolution of Agent Plugins: An Empirical Study of Claude Code Plugin Marketplacescited by 0
- 2026Super Library Agent: Joint Generation and Maintenance of Multiple Applications Beyond the Single Codebasecited by 0
- 2026Runnable Commit Untangling for Coding Agentscited by 0
- 2026Runnable Commit Untangling for Coding Agents8 Oct 2026
- 2026Super Library Agent: Joint Generation and Maintenance of Multiple Applications Beyond the Single Codebase29 Aug 2026
- 2026On the Maintenance and Co-evolution of Agent Plugins: An Empirical Study of Claude Code Plugin Marketplaces28 Aug 2026
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoring21 Aug 2026
- 2026From Agent Behaviour to Agent-Friendly Documentation: An Empirical Study of How Coding Agents Discover, Read, and Write Technical Documentation20 Aug 2026
- 2026The Devil Is in the Interface: Evaluating How Tool Architecture Shapes Coding Agent Behavior11 Aug 2026
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoring10 Aug 2026
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requests23 Jul 2026
- 2026Do These Violent Delights Have Violent Ends? Measuring the Post-Merge Fate of Agentic Code10 Jul 2026
- 2026Coding with "Enemy": Can Human Developers Detect AI Agent Sabotage?4 Jun 2026
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agents3 Jun 2026
- 2026"Refactoring Runaway": Understanding and Mitigating Tangled Refactorings in Coding Agents for Issue Resolution21 May 2026
5 more
- 2026Do AI Coding Agents Log Like Humans? An Empirical Study10 Apr 2026
- 2026The Story is Not the Science: Execution-Grounded Evaluation of Mechanistic Interpretability Research5 Feb 2026
- 2026Why Agentic-PRs Get Rejected: A Comparative Study of Coding Agents4 Feb 2026
- 2026ParaCodex: A Profiling-Guided Autonomous Coding Agent for Reliable Parallel Code Generation and Translation7 Jan 2026
- 2025Agent READMEs: An Empirical Study of Context Files for Agentic Coding17 Nov 2025
- 2025Agent READMEs: An Empirical Study of Context Files for Agentic Codingcited by 21
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoringcited by 5
- 2026Coding with "Enemy": Can Human Developers Detect AI Agent Sabotage?cited by 4
- 2026Why Agentic-PRs Get Rejected: A Comparative Study of Coding Agentscited by 3
- 2026Do AI Coding Agents Log Like Humans? An Empirical Studycited by 2
- 2026The Devil Is in the Interface: Evaluating How Tool Architecture Shapes Coding Agent Behaviorcited by 2
- 2026"Refactoring Runaway": Understanding and Mitigating Tangled Refactorings in Coding Agents for Issue Resolutioncited by 1
- 2026Do These Violent Delights Have Violent Ends? Measuring the Post-Merge Fate of Agentic Codecited by 0
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requestscited by 0
- 2026From Agent Behaviour to Agent-Friendly Documentation: An Empirical Study of How Coding Agents Discover, Read, and Write Technical Documentationcited by 0
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoringcited by 0
12 most cited of 14 All 14 (JSON)
- 2026Super Library Agent: Joint Generation and Maintenance of Multiple Applications Beyond the Single Codebase29 Aug 2026
- 2026On the Maintenance and Co-evolution of Agent Plugins: An Empirical Study of Claude Code Plugin Marketplaces28 Aug 2026
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoring21 Aug 2026
- 2026From Agent Behaviour to Agent-Friendly Documentation: An Empirical Study of How Coding Agents Discover, Read, and Write Technical Documentation20 Aug 2026
- 2026The Devil Is in the Interface: Evaluating How Tool Architecture Shapes Coding Agent Behavior11 Aug 2026
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoring10 Aug 2026
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requests23 Jul 2026
- 2026Do These Violent Delights Have Violent Ends? Measuring the Post-Merge Fate of Agentic Code10 Jul 2026
- 2026Coding with "Enemy": Can Human Developers Detect AI Agent Sabotage?4 Jun 2026
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agents3 Jun 2026
- 2026"Refactoring Runaway": Understanding and Mitigating Tangled Refactorings in Coding Agents for Issue Resolution21 May 2026
- 2026Do AI Coding Agents Log Like Humans? An Empirical Study10 Apr 2026
12 newest of 14 All 14 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2026How do Agents Refactor: An Empirical Study
- 2026Are We All Using Agents the Same Way? An Empirical Study of Core and Peripheral Developers Use of Coding Agents
- 2025RefAgent: A Multi-agent LLM-based Framework for Automatic Software Refactoring
- 2026CodeTaste: Can LLMs Generate Human-Level Code Refactorings?
- 2024Evaluating Software Development Agents: Patch Patterns, Code Quality, and Issue Complexity in Real-World GitHub Scenarios
- 2026Do AI Agents Really Improve Code Readability?
- 2025MANTRA: Enhancing Automated Method-Level Refactoring with Contextual RAG and Multi-Agent LLM Collaboration
- 2026Harness Engineering for Agentic AI Coding Tools: An Exploratory Study