A Verification-Guided, Context-Efficient Framework for LLM-Based Software Refactoring
Name
Xiao_1.pdf
Size
161.17 KB
Format
Adobe PDF
Checksum (MD5)
b6248ac03ac858a873af09fbc9f50ce8
Author(s) •
Xiao, Jimmy
Mohindra, Sanjeev
Date Issued
August 20, 2026
Abstract
Large Language Models (LLMs) show promise for software refactoring but are hindered by limited context windows and incorrect code generation. We propose a framework enhancing LLM refactoring through context optimization and an automated feedback loop. First, we optimize context using hierarchical subagents and tool-calling access (e.g., shell and REPL environments via MCP servers). This enables models to navigate codebases without ingesting the entire repository. Second, we introduce an iterative feedback loop driven by automated "judges" (build, lint, static analysis, unit testing). When a refactor fails, the system submits structured natural language feedback to the LLM for self-correction, filtering o ut p re-existing technical debt on unchanged lines. Preliminary observations using GitHub Copilot and Aider demonstrate the feasibility of REPL-assisted generation and automated error resolution. We conclude by outlining methodologies for future empirical evaluation.
Subjects
Software Refactoring
LLMs
agentic coding
MIT Department
Lincoln Laboratory
Terms of Use
All rights reserved
Persistent DSpace Link