RepoClean: How Coding Agents Handle Repository-Level Dead Code Cleanup

RepoClean benchmark debuts for repository-level dead code cleanup; the strongest model solves only 23%.
RepoClean is the first benchmark evaluating LLM agents' ability to safely remove outdated code in real open-source repositories, with 200 tasks across 34 popular Python repositories. It extracts already-deleted code from repository history and reintroduces it into newer versions while preserving the resulting failing tests, requiring agents to restore original behavior without adding features. The best model, GPT-6 Astra, solves only 23%, showing cross-file dependency reasoning and historical code identification remain significant weaknesses. Agents also remove far less outdated code when cleanup is not explicitly requested, highlighting the importance of explicit instructions in deployment.
Large language model (LLM) agents have demonstrated strong capabilities in repository-level programming tasks, but redundant or outdated code that accumulates during software evolution has rarely been systematically evaluated. Recently, a benchmark called RepoClean has filled this gap, specifically measuring agents' ability to safely remove deprecated code in real open-source repositories.

Why Does Repository-Level Code Cleanup Deserve Separate Evaluation?
As software iterates, repositories accumulate a large number of functions, classes, or modules that are no longer called. This outdated code not only drives up maintenance costs but can also introduce hidden functional issues. Agents need to identify and remove it without breaking existing functionality, which requires a deep understanding of repository interfaces and cross-file dependencies.
However, existing code generation or repair benchmarks rarely treat "cleanup" as an independent task. RepoClean was proposed precisely to isolate this capability and avoid other programming task scores masking weaknesses in cleanup scenarios.
Repository-level tasks refer to task settings that use the entire code repository as context, rather than a single file or function snippet. Unlike traditional code completion or function-level repair, repository-level tasks require models to trace symbol definitions, import relationships, and call chains across dozens or even hundreds of files. Typical examples include repository-level code generation (such as RepoBench and DevBench) and issue fixing (such as SWE-bench). The core difficulty of such tasks is that the context length far exceeds a single input window, so models must rely on retrieval, static analysis, or iterative file browsing to locate relevant information. Therefore, repository-level benchmarks typically provide tool interfaces (such as search, file reading, and test execution) rather than directly feeding in all source code, evaluating the agent's exploration and reasoning strategies rather than just code generation quality.
How RepoClean Was Built
RepoClean contains 200 cleanup tasks covering 34 popular open-source Python repositories. Its construction process is quite ingenious: it automatically extracts code that has already been deleted from real repository history and reintroduces it into newer versions. This reintroduced code coexists with the current implementation and preserves test cases that originally passed but now fail due to the code reappearing.
This means agents must use repository interfaces and cross-file dependencies to determine which historical code should be removed and which existing implementations must be retained, thereby restoring original functionality rather than developing new features. This design makes the tasks closer to real maintenance scenarios rather than simple code deletion exercises.
Dead code / outdated code refers to functions, classes, modules, or variables that still exist in the repository but are no longer referenced by any active call path. It differs slightly from "unused code": the former emphasizes historical remnants replaced through feature evolution, while the latter leans more toward isolated implementations that were never integrated. Determining dead code is essentially a reachability analysis problem, requiring the construction of a call graph starting from entry points (such as public APIs, tests, and scripts) and handling dynamic calls, reflection, plugin registration, and other cases that static analysis struggles to cover. As a result, purely tool-based detection often comes with false positives. The risk of cleaning up dead code is that symbols referenced by external users or dynamically at runtime may be deleted, constituting a breaking change that typically requires semantic versioning and a deprecation cycle.
Agent Performance: Best Model Solves Only 23%
The paper evaluated seven models, and the results show that even the best-performing GPT-6 Astra solved only 23% of the tasks. This data indicates that repository-level outdated code cleanup still poses a significant challenge for current agents.
Further analysis revealed a key phenomenon: when cleanup was not explicitly requested, the amount of outdated code removed by agents decreased substantially. In other words, agents tend to "do less to avoid mistakes" and will not proactively clean up in the absence of explicit instructions. This suggests that in real deployments, clear task descriptions are crucial for triggering cleanup behavior.
"Solve rate" in such benchmarks is typically judged by test passing: after the agent completes its modifications, the relevant tests that originally failed due to the reappearance of historical code must pass again, while other existing tests in the repository must not regress—that is, "fix without breaking" is required. This dual condition distinguishes the task from simple deletion operations—blindly deleting all suspicious code often passes the target tests but breaks other functionality. The 23% solve rate therefore reflects the model's ability to balance precision (deleting the right code) and conservatism (not deleting by mistake), rather than mere code editing accuracy. Such metrics are also commonly used in issue-fixing benchmarks like SWE-bench, facilitating cross-comparison of gaps across different capability dimensions.
Implications for Autonomous Software Maintenance
The value of RepoClean lies not only in rankings but also in providing a foundation for systematic study of cleanup challenges. It exposes agents' shortcomings in cross-file dependency reasoning and historical code identification. In the future, improving agents' awareness of repository evolution history may help push them one step closer to autonomous software maintenance.
For developers, this research also reminds us that when relying on agents for code maintenance, clear cleanup instructions and sufficient test coverage remain the safety baseline.
One-line Summary
RepoClean is the first benchmark for repository-level outdated code cleanup, and the strongest model solves only 23%.
Paragraph Summary
RepoClean is the first benchmark specifically evaluating LLM agents' ability to safely remove outdated code in real open-source repositories, comprising 200 tasks across 34 popular Python repositories. It is constructed by extracting already-deleted code from repository history and reintroducing it into newer versions, while preserving the tests that fail as a result, requiring agents to restore original behavior without developing new features. Evaluation of seven models shows that the best-performing GPT-6 Astra solves only 23% of tasks, indicating that cross-file dependency reasoning and historical code identification remain significant weaknesses. The study also finds that when cleanup is not explicitly requested, agents proactively remove substantially less outdated code, highlighting the importance of explicit instructions in real deployments.
Related articles

Astrophysicist Pokes Fun at Supermoons: The Difference Between a 16-Inch and a 15-Inch Pizza
Astrophysicist Neil deGrasse Tyson criticizes the terms supermoon and micromoon, using a 16-inch vs. 15-inch pizza analogy to show the visual difference is negligible, and calls out exaggerated labels in science communication.

Bypassing the iOS Safari 60fps Limit: Building a Native-Like Web App Experience
A deep dive into bypassing iOS Safari's 60fps limit through compositor animations, frame rate decoupling, and interaction detail optimization to give web apps a near-native feel on iPhone.

Allstate's Multi-Day Technical Outage Before Thanksgiving
Insurance giant Allstate suffered a multi-day technical outage before the Thanksgiving travel peak. This article analyzes the impact of the timing, implications for insurtech, and the importance of system stability for financial institutions.