Proactive Code Refactoring with Agentic Workflows

How Far Are We?

Master Thesis (2026)
Author(s)

V. Horneţ (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Contributor(s)

M. Izadi – Mentor (TU Delft - Electrical Engineering, Mathematics and Computer Science)

J. Yang – Graduation committee member (TU Delft - Electrical Engineering, Mathematics and Computer Science)

B. Özkan – Graduation committee member (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Faculty
Electrical Engineering, Mathematics and Computer Science
More Info
expand_more
Publication Year
2026
Language
English
Graduation Date
14-07-2026
Awarding Institution
Delft University of Technology
Programme
Computer Science, Data Science and Artificial Intelligence Technology
Faculty
Electrical Engineering, Mathematics and Computer Science
Downloads counter
19
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

As software systems evolve, refactoring becomes essential for preserving maintainability, yet identifying suitable refactoring opportunities remains difficult. Existing automated refactoring tools often depend on static rules or explicit developer requests, limiting their ability to account for broader code and process context. This thesis investigates how automated refactoring support can move towards a proactive, developer-facing workflow by combining metric-based prediction with large language model reasoning.

The proposed pipeline uses stacked prediction models to detect candidate Java refactoring opportunities and then applies large language model-based components to assess, select, and generate patches for plausible operations. The workflow was implemented in an IntelliJ IDEA plugin. The system was evaluated on 2,000 real-world Java examples created after the training cutoff of the evaluated models, using Qwen2.5-Coder models of 7B, 14B, and 32B parameters. In addition, 12 developers evaluated the plugin in a 2x2 crossover study.

The results show that large language models can improve metric-based refactoring prediction mainly as selective filters, reducing false positives and supporting reviewable suggestions. However, this filtering introduces a precision-recall trade-off, and candidate reranking still remains an open problem. The 14B model produced the strongest candidate lists for developer review, while the 32B model was more selective and the 7B model was faster but less stable.

This thesis shows that large language models can improve automated refactoring support when used in a human-in-the-loop IDE workflow. The strongest use case being reviewable, developer-controlled assistance. Future work should address broader refactoring coverage, multi-label prediction, better datasets, and edit-history-based techniques for faster in-IDE suggestions.

Files

warning

File under embargo until 01-01-2027