Seedlabs

RefactorRouter: per-refactoring-type LLM dispatch with test gating and human escalation

A tool that sends coding tasks to the best AI model for that job and asks a human for help with the hard parts.

A middleware that sends each code-refactoring job to the AI model empirically proven best at that specific type of refactoring, auto-applies only changes that pass the project's unit tests, and routes the trickiest, context-sensitive refactorings to human developers.

Computer ScienceSoftware Engineering Research
LLM Evaluation and BenchmarkingCI/CD-integrated automated refactoring for enterprise Java development teams

Concept

RefactorRouter is a dispatch layer (CI plugin plus IDE action) for automated code refactoring. When a refactoring is requested, it (1) classifies the refactoring type, (2) routes it to the LLM with the best demonstrated performance for that type, (3) samples up to 5 candidates and auto-applies the first one that passes the project's unit tests, and (4) escalates refactoring classes where humans measurably outperform LLMs to a reviewer, attaching the LLM's draft as a head start.

The shipped capability table is derived directly from empirical evaluation: code-smell reduction routes to a LLaMA-3-class model; cohesion/coupling/complexity improvements route to a GPT-4o- or DeepSeek-v3-class model; systematic modularity refactorings route to a StarCoder2-class model; context-sensitive changes such as attribute encapsulation escalate to a human. The product is Java-first, matching the studied corpus.

Why now

The new empirical study [0], run on 30 open-source Java projects, provides the first per-model, per-refactoring-type capability table that makes routing evidence-based rather than guesswork: GPT-4o and DeepSeek-v3 exceed 90% pass@5 unit-test success on multi-file refactorings and deliver the greatest cohesion, coupling, and complexity improvements; LLaMA 3 achieves the highest median code-smell reduction (15.1%); StarCoder2 leads on systematic modularity refactorings; and human developers still outperform LLMs on context-sensitive refactorings such as attribute encapsulation. The >90% pass@5 figure makes test-gated auto-apply viable in production for the first time, and the human-superiority finding defines exactly where escalation — not automation — belongs.

Written by GLM · 29 Nov 2026

AI assessment

Backed by 1 paper86

An exceptionally well-supported idea that turns a specific research finding into a high-utility, low-risk tool for enterprise Java maintenance.

Evidence strength
5/5
The idea is directly mapped to the specific performance metrics (pass@5, smell reduction percentages) and model-specific strengths detailed in the cited empirical study.
Market pull
4/5
Enterprise Java teams have high technical debt and strict testing requirements, making a test-gated refactoring tool highly valuable, though the 'beneficiaries' listed are platforms rather than end-users.
Novelty & moat
3/5
While similar to TranslateRisk Map and RevisionRisk in terms of routing and risk assessment, this focuses specifically on refactoring types based on a new empirical capability table, filling a gap in automated code maintenance.
Feasibility
5/5
Building a middleware dispatcher that calls existing APIs and runs a local test suite is straightforward, provided the project has a robust unit test suite.
Wedge clarity
4/5
The focus on Java-first, test-gated refactoring is a sharp entry point that avoids the 'general AI coder' trap.
Simplicity / focus
5/5
The product is a single, focused dispatch layer with a clear logic flow: classify, route, test, and escalate.

Scored by Gemma 4 · 29 Nov 2026. Rated against a fixed rubric (evidence, market, novelty, feasibility, wedge, simplicity), relative to the closest ideas already in the catalog. A prior estimate to compare ideas before real-world signal arrives.

Act on this idea

Ideas only matter if someone runs with them. Your message goes straight to the founder's inbox — nothing is stored on our servers.

Who benefits

  • Modernecompany

    Moderne's OpenRewrite platform already automates large-scale Java refactoring with hand-written recipes; an empirically derived per-type LLM router extends coverage to smell and structural refactorings recipes don't handle, with unit-test gating for safety.

  • JetBrainscompany

    IntelliJ IDEA ships the industry-standard refactoring menus; routing each refactoring type to the demonstrably best model and gating on tests would let JetBrains expose reliable 'AI refactor' actions instead of generic chat suggestions.

  • GitHubcompany

    GitHub Copilot could back refactoring suggestions in pull requests with per-type routing, so each suggestion comes from the model empirically best at that refactoring class, raising suggestion acceptance rates.

  • GitLabcompany

    GitLab Duo combined with GitLab CI can run nightly test-gated refactoring passes routed per type, converting the study's findings into automated, reviewable merge requests.

Research it builds on

  1. An Empirical Study on the Code Refactoring Capability of Large Language Models
    Jonathan Cordeiro, Shayan Noei, Ying Zou · 2026 · 96 citations
    All ideas from this paper →
Leave feedback
feasibility