ChatPaper.aiChatPaper

에이전트 기반 리팩토링: AI 코딩 에이전트에 관한 실증적 연구

Agentic Refactoring: An Empirical Study of AI Coding Agents

November 6, 2025
저자: Kosei Horikawa, Hao Li, Yutaro Kashiwa, Bram Adams, Hajimu Iida, Ahmed E. Hassan
cs.AI

초록

OpenAI Codex, Claude Code, Cursor와 같은 에이전트형 코딩 도구들이 소프트웨어 엔지니어링 환경을 변화시키고 있습니다. 이러한 AI 기반 시스템은 복잡한 개발 작업을 계획하고 실행할 수 있는 자율적인 팀원으로 기능합니다. 에이전트들은 관찰 가능한 동작을 변경하지 않고 내부 코드 품질을 개선하는 것을 목표로 하는 지속 가능한 소프트웨어 개발의 핵심인 리팩토링 과정에서 적극적인 참여자가 되었습니다. 이러한 도구들의 사용이 증가함에도 불구하고, 실제 현장에서 에이전트형 리팩토링이 어떻게 활용되는지, 인간에 의한 리팩토링과 어떻게 비교되는지, 그리고 코드 품질에 어떤 영향을 미치는지에 대한 실증적 이해가 심각하게 부족합니다. 이러한 실증적 공백을 해소하기 위해 우리는 실제 오픈소스 Java 프로젝트에서 AI 에이전트가 생성한 리팩토링에 대한 대규모 연구를 제시하며, AIDev 데이터셋에서 도출된 12,256개의 풀 리퀘스트와 14,988개의 커밋에 걸친 15,451개의 리팩토링 인스턴스를 분석합니다. 우리의 실증적 분석에 따르면, 이 개발 패러다임에서 리팩토링은 흔하며 의도적인 활동으로, 에이전트들은 커밋의 26.1%에서 명시적으로 리팩토링을 대상으로 합니다. 리팩토링 유형 분석은 에이전트의 노력이 '변수 유형 변경(11.8%)', '매개변수 이름 바꾸기(10.4%)', '변수 이름 바꾸기(8.5%)'와 같은 저수준의 일관성 지향 편집이 주를 이룸을 보여주며, 이는 인간의 리팩토링에서 흔한 고수준 설계 변경보다는 지역적 개선을 선호함을 반영합니다. 또한, 에이전트형 리팩토링 배후의 동기는 압도적으로 내부 품질 문제에 집중되어 있으며, 유지보수성(52.5%)과 가독성(28.1%)이 주요 동기입니다. 나아가, 코드 품질 메트릭에 대한 정량적 평가는 에이전트형 리팩토링이 구조적 메트릭에서 통계적으로 유의미하지만 작은 개선을 가져오며, 특히 중간 수준의 변경에서 클래스 크기와 복잡성을 감소시킴을 보여줍니다(예: Class LOC 중앙값 Δ = -15.25).
English
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 Δ = -15.25).
PDF42December 1, 2025