PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
October 16, 2025PeerJ Computer Science4 citationsOpen Access

RefactorGPT: a ChatGPT-based multi-agent framework for automated code refactoring

View Full Paper
MKMuhammed Abdulhamid Karabıyık

Key Points

  • RefactorGPT improves code modularity and readability, achieving up to 100% execution correctness through autonomous error recovery.
  • The framework showcases consistent effectiveness across a curated dataset, utilizing nine classical refactoring techniques in various complexities.
  • By iteratively leveraging ChatGPT, RefactorGPT enables precise refactoring with functional guarantees, differentiating it from conventional tools.
  • The study provides a reusable blueprint for integrating large language models into developer workflows, promoting collaboration in code evolution.

Abstract

The rise of large language models has redefined what is computationally possible in code generation, yet their potential in systematic software refactoring remains largely untapped. This article introduces RefactorGPT, a ChatGPT-augmented sequential multi-agent framework that transforms refactoring from a monolithic, opaque process into a modular, explainable, and scalable workflow. The system orchestrates four specialized agents, Analyzer, Refactor, Refine, and Fixer, to sequentially analyse source code, apply structural refactoring, enhance code quality, and recover from potential generation errors. Unlike conventional rule-based tools or one-shot large language model (LLM) prompts, RefactorGPT leverages ChatGPT iteratively across clearly defined responsibilities, enabling controlled refactoring with functional guarantees. To evaluate the framework’s effectiveness, we constructed a curated dataset encompassing nine classical refactoring techniques across three complexity levels. RefactorGPT demonstrated consistent improvements in code modularity, readability, and structural decomposition, while maintaining computational efficiency. Notably, the system achieved full execution correctness through autonomous error recovery, showcasing robustness in practical scenarios. This study contributes a reusable blueprint for LLM-integrated refactoring systems and presents a novel application of ChatGPT not merely as a code generator, but as a cooperative agent in intelligent software refactoring. The findings reveal a path forward for embedding language models into real-world developer workflows, not as assistants, but as collaborators in code evolution.

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

Muhammed Abdulhamid Karabıyık (2025) studied this question.

synapsesocial.com/papers/68f04927e559138a1a06dacbhttps://doi.org/10.7717/peerj-cs.3257
Ask AI
Helpful
Bookmark
Share
View Full Paper