Research index
RefacAgent: Autonomous Code Refactoring
Anonymous
Zenodo (CERN European Organization for Nuclear Research)29 May 2025Open access
NobleIDark:/48914/w1/20260525/9B399F9BDOI10.5281/zenodo.15549266
RefacAgent: Autonomous Code Refactoring
Anonymous · Zenodo (CERN European Organization for Nuclear Research) · 2025
NobleIDark:/48914/w1/20260525/9B399F9BDOI10.5281/zenodo.15549266
Free to read at the publisher
You can read the abstract here, or the full text at the publisher.
Abstract
RefacAgent Results Folder results: experiment data for four RQs RQ1: The evaluation results of RefacAgent on 10 Java projects, along with the results of CodePrompt. RQ2: Evaluation results of EM-Assist and RefacAgent with GPT-3.5-Turbo on 10 Java projects RQ3: User servery links and responses RQ4: Ablation study PS: Due to some limitations, the website can't show full content of the results, please download check the README.md and the details. Static Folder static: images and other resources approach-overview: the overview of the approach diagram rag_overview: the overview of building contextual RAG Detail Result of Data Leakage Evaluation Period Type # Refactoring Percentage Compile & Test RM Detection Refactoring Success Success Rate Post-Cutoff Atomic 211 75.63% 176 163 161 76.30% Compound 68 24.37% 66 60 60 88.24% All 279 100% 242 223 221 79.21% Pre-Cutoff Atomic 329 77.59% 305 301 287 87.23% Compound 95 22.41% 89 80 74 77.89% All 424 100% 394 381 361 85.14% Code Folder code: the code for the RefacAgent rag: code for building contextual RAG and retrieving relevant examples. utils: contains functions for operating project, such as switching project commits, reading files, and extracting project structure. data: including specific prompts, the static tools used, and the runtime temporary folder. model: the refactoring entity used in the whole project config.yaml: configuration for RefacAgent requirements.txt: the requirements for the RefacAgent multiple_agent_rag_refactoring_main.py: the main entry of the RefacAgent clone.sh: script to clone the project code to be analyzed Prompts Here we list the prompts for all workflow: /code/data/prompts/ Configuration There are four configurations in config.yaml that need to be set. project_prefix_path: {Path to your project directory, e.g., /Users/xxx/xxx/RefacAgent/code} OPENAI_API_KEY: {Your OpenAI API key} chromadb_host: {ChromaDB host address; use "localhost" if running ChromaDB locally} project_name: {Name of the evaluation project, e.g., "commons-io"} How to run the code set up install the requirements. install the chromadb vector database. the guide link: trychroma once the installation is complete, you need to configure chromadb_host in the config.yaml. it is recommended to use a local Docker installation, as it is more convenient. install the jenv, a tool for switching between different Java versions. the guide link: jenv install Java 8, Java 11, Java 17, and Java 21 using jenv install the build system (Maven and Gradle) run clone.sh to clone the project code to be analyzed configure project_prefix_path, OPENAI_API_KEY, project_name in the config.yaml. run cd ./code && python multiple_agent_rag_refactoring_main.py