# Here’s where AI coding agents are delivering reliable code refactoring | LinearB Blog

> New research analyzing 15,000+ AI refactorings reveals agents excel at routine cleanup but struggle with architectural changes. Learn where AI delivers value and where human expertise remains essential.

_This is a markdown rendering of a live HTML page on linearb.io, generated for AI/LLM consumption — it is not a markdown-only site. To get the full HTML page instead, request this URL with an explicit `Accept: text/html` header (no wildcard, no markdown preference)._


```json
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Home",
      "item": "https://linearb.io/"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Blog",
      "item": "https://linearb.io/blog"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "Here’s where AI coding agents are delivering reliable code refactoring",
      "item": "https://linearb.io/blog/ai-coding-agents-code-refactoring"
    }
  ]
}
```

[Home](https://linearb.io/)

/

[Blog](https://linearb.io/blog)

/

Here’s where AI coding agents are delivering reliable code refactoring

# Here’s where AI coding agents are delivering reliable code refactoring

![Photo of Ben Lloyd Pearson](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/blp_headshot_1_ee25d527aa?_a=BAVMn6ID0)

By [Ben Lloyd Pearson](https://linearb.io/blog/ai-coding-agents-code-refactoring#ben-lloyd-pearson)

|

November 24, 2025

![Blog_Reliable_Code_Refactoring_2400x1256_7f99a0f2c2](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Blog_Reliable_Code_Refactoring_2400x1256_7f99a0f2c2?_a=BAVMn6ID0)

Every engineering leader investing in AI coding tools faces a pivotal question: Can these agents truly improve code quality and developer productivity, or are they just expensive autocomplete with a refactoring feature? The stakes are high, as organizations [embed AI deeply into development workflows](https://linearb.io/blog/how-agentic-ai-will-disrupt-your-software-delivery-lifecycle), with expectations ranging from automated technical debt reduction to wholesale codebase modernization.

New research from Nara Institute of Science and Technology and Queen's University [delivers a comprehensive answer](https://arxiv.org/pdf/2511.04824). By analyzing 15,451 refactoring operations performed by leading AI coding agents across real-world open-source projects, the study reveals a nuanced reality: today's agents are exceptional at routine code maintenance but fundamentally limited when it comes to architectural transformation.

[![image.png](https://assets.linearb.io/image/upload/v1764009294/image_22c2a7757f.png)](https://arxiv.org/pdf/2511.04824)

For VPs and Directors of Engineering, these findings provide a strategic blueprint. AI agents can deliver immediate productivity gains by automating tedious cleanup work, but expecting them to function as software architects will lead to disappointment and wasted investment.

## **AI coding agents drive widespread adoption but lack architectural depth**

AI coding agents like OpenAI Codex, Claude Code, Cursor, and Devin are no longer experimental curiosities; they are now established tools. They're active contributors in production codebases, autonomously planning and executing development tasks with minimal human intervention. Unlike traditional prompt-based tools where developers guide every step, these agents operate as collaborative teammates, proposing changes, running tests, and submitting pull requests.

The research examined 12,256 pull requests and 14,998 commits from 1,613 Java repositories to understand how agents participate in [refactoring](https://linearb.io/platform/engineering-metrics/features#refactor-rate-what-is-refactor-rate). The scale of adoption is striking, as developers merged 86.9% of agent-generated pull requests, demonstrating substantial acceptance of AI-generated code in real-world projects.

But acceptance does not equal architectural sophistication. The study reveals that 26.1% of agent commits explicitly target refactoring, a significant portion of their activity, yet the nature of these refactorings tells a more constrained story.

## **AI agents transform code hygiene with routine maintenance**

The data shows agents are highly proficient at low-level, consistency-oriented refactoring. 35.8% of agent refactorings are low-level operations, compared to just 24.4% for human developers. These operations include:

* Change Variable Type (11.8%): Updating variable declarations for type consistency
* Rename Parameter (10.4%): Standardizing parameter names across methods
* Rename Variable (8.5%): Improving local variable naming conventions

These three operations alone account for 30.7% of all agent refactoring instances. Agents also perform medium-level refactorings, such as extracting methods or changing parameter types, at rates similar to humans (21.2% for agents vs. 20.7% for humans).

The motivations behind these refactorings are overwhelmingly focused on internal quality. 52.5% of agent refactorings target maintainability, far exceeding the 11.7% rate for human developers. An additional 28.1% focus on readability, closely matching human priorities. Together, these two motivations account for over 80% of all agent refactoring activity.

For engineering leaders, this represents a clear value proposition: agents can systematically handle the unglamorous but essential work of code hygiene, such as renaming for clarity, enforcing type consistency, and maintaining coding standards. These tasks consume developer time but don't require deep domain knowledge or architectural insight.

When agents perform medium-level refactorings with maintainability intent, the quality improvements are measurable. The research found that agents achieve a median reduction of 15.25 lines in Class Lines of Code and a median reduction of 2.07 in Weighted Methods per Class, which are concrete indicators of simplified code structure.

## **AI agents still struggle to deliver architectural refactoring**

The limitations become apparent when examining high-level, architectural refactorings. Only 43.0% of agent refactorings are high-level operations, compared to 54.9% for human developers. This gap reveals a fundamental constraint, as agents struggle with refactorings that require system-wide understanding or strategic design decisions.

Human developers frequently perform major API changes like Rename Method (4.4%) and Add Parameter (4.3%), which ripple through codebases and require careful consideration of downstream impacts. Agents, by contrast, prioritize more localized changes like Rename Attribute (6.0%) and Change Method Access Modifier (3.8%).

Even more telling, agents rarely address design-level concerns that experienced developers prioritize. Only 1.1% of agent refactorings target code duplication, and just 4.6% focus on modularity and reuse, compared to 13.7% and 12.9% respectively for human developers.

The impact on code smells is similarly limited. Despite the focus on maintainability, agents show no significant reduction in design or implementation smell counts. The median change in both categories is 0.00, meaning that while agents can improve structural metrics like code size and complexity, they consistently fail to eliminate the deeper quality issues that experienced developers target.

## **Tangled commits increase review complexity and hidden costs**

A critical finding that engineering leaders must consider is that 53.9% of agent refactorings occur in "tangled commits," which are changes bundled with feature work or bug fixes rather than isolated refactoring efforts. This pattern increases code review complexity, as reviewers must validate both the primary task and the incidental refactorings to ensure behavior preservation.

This tangling suggests agents often refactor opportunistically while implementing other changes, rather than executing focused quality improvement initiatives. For teams scaling AI adoption, this creates a hidden review burden that can [offset productivity gains](https://linearb.io/blog/developer-productivity) if not properly managed.

## **Engineering leaders must align AI agent use with strategic outcomes**

These findings have direct implications for how organizations should deploy AI coding agents:

**Delegate routine cleanup strategically**. Agents deliver the highest ROI when assigned to low-level maintenance: variable renaming, type consistency enforcement, and code formatting. These tasks consume significant developer time but don't require architectural judgment. By systematically delegating this work to agents, engineering leaders can free senior developers to focus on complex design problems and business logic.

**Enforce commit hygiene policies**. To mitigate the review burden of tangled commits, require agents to submit refactoring changes separately from features and bug fixes. This practice, already a best practice for human developers, becomes even more critical when agents are contributing at scale. Separate refactoring PRs are faster to review, easier to validate, and build reviewer trust in AI contributions.

**Reserve architectural work for human expertise**. High-level refactorings, such as extracting classes, restructuring inheritance hierarchies, and managing dependencies, require domain knowledge and strategic intent that current agents lack. Attempting to delegate these tasks to AI will result in superficial changes that fail to address underlying design issues. Keep experienced engineers in the driver's seat for architectural decisions.

**Monitor quality outcomes rigorously**. While agents can improve structural metrics, they don't consistently reduce [code smells](https://linearb.io/blog/what-is-a-code-smell) or prevent technical debt accumulation. Engineering leaders should implement regular quality audits that track both immediate metrics (LOC, complexity) and long-term indicators (defect density, maintenance effort) to ensure AI-driven refactoring delivers sustained value rather than cosmetic improvements.

## Improve developer productivity with LinearB

Find us on

[](https://www.linkedin.com/company/linearb)
[](https://devinterrupted.substack.com/)

![blp_headshot_1_ee25d527aa](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/blp_headshot_1_ee25d527aa?_a=BAVMn6ID0)

## Ben Lloyd Pearson

Ben hosts Dev Interrupted, a podcast and newsletter for engineering leaders, and is Director of DevEx Strategy at LinearB. Ben has spent the last decade working in platform engineering and developer advocacy to help teams improve workflows, foster internal and external communities, and deliver better developer experiences.

### Connect with

[](https://www.linkedin.com/in/benlloydpearson)
[](https://substack.com/@benlloydpearson)

## Your next read

[![Cover image for AI agents are killing the pull request and reinventing CI/CD](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Blog_Post_Name_2400x1256_5_496cdfde2d?_a=BAVMn6ID0)](https://linearb.io/blog/circleci-rob-zuber-ai-agents-pull-request-cicd-sdlc)

AI

[AI agents are killing the pull request and reinventing CI/CD](https://linearb.io/blog/circleci-rob-zuber-ai-agents-pull-request-cicd-sdlc)

CircleCI CTO Rob Zuber explains why AI adoption is killing the pull request and forcing engineering teams to completely reimagine the software development...

[![Cover image for Rippling's employee graph turns HR data into an agentic AI platform](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Blog_Post_Name_2400x1256_be5ec4183f?_a=BAVMn6ID0)](https://linearb.io/blog/rippling-albert-strasheim-employee-graph-agentic-ai)

AI

[Rippling's employee graph turns HR data into an agentic AI platform](https://linearb.io/blog/rippling-albert-strasheim-employee-graph-agentic-ai)

Rippling CTO Albert Strasheim explains why the employee graph serves as the essential context layer for enterprise agentic AI. Discover how unifying HR, IT,...

[![Cover image for Deterministic guardrails must evolve to control probabilistic AI systems](https://assets.linearb.io/image/upload/c_limit,w_2560/f_auto/q_auto/v1/Blog_Post_Name_2400x1256_5_f5375661ec?_a=BAVMn6ID0)](https://linearb.io/blog/launchdarkly-cameron-etezadi-deterministic-guardrails-probabilistic-ai-darkfactory)

AI

[Deterministic guardrails must evolve to control probabilistic AI systems](https://linearb.io/blog/launchdarkly-cameron-etezadi-deterministic-guardrails-probabilistic-ai-darkfactory)

LaunchDarkly CTO Cameron Etezadi explains why traditional engineering pipelines are breaking down in a probabilistic, AI-driven world. Discover how to safely...

## Structured data

_Machine-readable metadata (JSON-LD) embedded in the page for search/AI context — not content rendered on the page itself._

```json
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "LinearB",
  "url": "https://linearb.io/",
  "logo": "https://assets.linearb.io/image/upload/v1715628027/logo-mark-lg.svg",
  "description": "LinearB is the engineering productivity platform that helps engineering leaders prove AI is improving throughput without sacrificing delivery confidence, flow efficiency, or developer experience.",
  "sameAs": [
    "https://www.linkedin.com/company/linearb"
  ],
  "award": [
    {
      "@type": "Award",
      "name": "LinearB is a Leader in the 2026 Gartner® Magic Quadrant™ for Developer Productivity Insight Platforms",
      "dateAwarded": "2026",
      "awardedBy": {
        "@type": "Organization",
        "name": "Gartner®"
      }
    },
    {
      "@type": "Award",
      "name": "Great Place to Work Certification",
      "dateAwarded": "2025-2027",
      "awardedBy": {
        "@type": "Organization",
        "name": "Great Place to Work"
      }
    },
    {
      "@type": "Award",
      "name": "America's Best Startup Employers 2025",
      "dateAwarded": "2025",
      "awardedBy": {
        "@type": "Organization",
        "name": "Forbes Magazine"
      }
    }
  ],
  "hasCertification": [
    {
      "@type": "Certification",
      "name": "SOC 1 Type 2"
    },
    {
      "@type": "Certification",
      "name": "SOC 2 Type 2"
    },
    {
      "@type": "Certification",
      "name": "GDPR Compliance certification"
    },
    {
      "@type": "Certification",
      "name": "ISO 27001"
    }
  ]
}
```

```json
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "Here’s where AI coding agents are delivering reliable code refactoring",
  "url": "https://linearb.io/blog/ai-coding-agents-code-refactoring",
  "author": {
    "@type": "Person",
    "name": "Ben Lloyd Pearson"
  },
  "datePublished": "2025-11-24T08:00:00.000Z",
  "dateModified": "2025-11-24T08:00:00.000Z",
  "image": "https://assets.linearb.io/image/upload/v1764009232/Blog_Reliable_Code_Refactoring_2400x1256_7f99a0f2c2.png",
  "publisher": {
    "@type": "Organization",
    "name": "LinearB",
    "logo": "https://assets.linearb.io/image/upload/v1777485755/linearb-logo-2026.png"
  },
  "description": "New research analyzing 15,000+ AI refactorings reveals agents excel at routine cleanup but struggle with architectural changes. Learn where AI delivers value and where human expertise remains essential."
}
```

## More on linearb.io

### Top navigation

- [Book a Demo](https://linearb.io/book-a-demo)
- [AI Code Reviews — Catch security risks, bugs, and spec mismatches](https://linearb.io/platform/ai-code-reviews)
- [AI & Productivity Insights — See how AI tools affect cycle time and delivery speed](https://linearb.io/platform/ai-developer-productivity-insights)
- [Measure AI Impact — Track AI adoption and tie it to delivery outcomes](https://linearb.io/use-case/measure-ai-impact)
- [MCP Server — Chat with your data to spot patterns and boost output](https://linearb.io/platform/mcp-server)
- [Resource Allocation — Cost initiatives and shape your investment strategy](https://linearb.io/platform/resource-allocation)
- [Cost Capitalization — Capitalize engineering costs with audit-ready reports](https://linearb.io/platform/cost-capitalization)
- [Dev Team Management — Set targets and tie throughput to business outcomes](https://linearb.io/platform/goals-and-reporting)
- [DevOps Workflow Automation — Policy-based PR routing, approvals, and tests](https://linearb.io/platform/ai-workflow-governance)
- [AI Powered Support — Unify AI and human code delivery in one clear view](https://linearb.io/use-case/ai-powered-support)
- [Optimization — Surface friction with feedback and MCP insights](https://linearb.io/platform/developer-experience)
- [Reporting — Spot what's working and what needs attention](https://linearb.io/use-case/measuring-developer-experience)
- [Surveys — Turn developer feedback into actionable signals](https://linearb.io/platform/developer-surveys)
- [Platform overview](https://linearb.io/platform/overview)
- [Watch now](https://linearb.io/event/engineering-productivity-gap)
- [Customers](https://linearb.io/customers)
- [Pricing](https://linearb.io/pricing)
- [Why choose LinearB — Explore your data. Measure performance. Act to improve it.](https://linearb.io/why-linearb)
- [APEX framework — The operating model for AI-era engineering teams](https://linearb.io/resources/apex-framework)
- [Anti-FAQ — The questions other vendors won't answer](https://linearb.io/why-linearb/anti-faq)
- [Security — Enterprise-grade compliance and zero code access](https://linearb.io/security)
- [Build vs. buy — The hidden cost of building it yourself](https://linearb.io/resources/build-vs-buy)
- [Dev Interrupted Podcast — Conversations with engineering leaders](https://linearb.io/dev-interrupted/podcasts)
- [Reports & Guides — Deep dives on productivity and delivery](https://linearb.io/resources)
- [Webinars — Expert sessions on productivity and AI](https://linearb.io/resources?category=workshops)
- [Metrics Benchmarks — See how your engineering org stacks up](https://linearb.io/resources/software-engineering-benchmarks-report)
- [Blog — Product updates and practical insights](https://linearb.io/blog)
- [Help Center — Documentation, setup, and support](https://linearb.helpdocs.io)
- [API Docs](https://docs.linearb.io/api-overview)
- [Status](https://www.linearbstatus.com/)
- [Integrations](https://linearb.io/integrations)
- [LinearB Library](https://linearb.io/library)
- [Engineering metrics](https://linearb.io/library/engineering-metrics)
- [Platform engineering](https://linearb.io/library/platform-engineering)
- [Engineering glossary](https://linearb.io/library/engineering-glossary)
- [Developer productivity](https://linearb.io/library/developer-productivity)
- [AI in software development](https://linearb.io/library/ai-in-software-development)
- [Engineering management](https://linearb.io/library/engineering-management)
- [Developer experience](https://linearb.io/library/developer-experience)
- [DevOps](https://linearb.io/library/devops)
- [Engineering operations and the context layer](https://linearb.io/library/engineering-operations)
- [Engineering efficiency](https://linearb.io/library/engineering-efficiency)
- [Software delivery](https://linearb.io/library/software-delivery)
- [Research and data](https://linearb.io/library/engineering-benchmarks-and-research)
- [LinearB is a Leader in the 2026 Gartner® Magic Quadrant™ for Developer Productivity Insight Platforms](https://linearb.io/resources/gartner-magic-quadrant-dpi-platforms-2026)
- [Sign in](https://app.linearb.io/login)
- [Enterprise](https://linearb.io/solutions/enterprise)
- [Contact](https://linearb.io/contact-us)
- [About us](https://linearb.io/about-us)
- [Careers](https://linearb.io/careers)
- [Service agreement](https://linearb.io/services-agreement)
- [Privacy policy](https://linearb.io/privacy-policy)
- [DPA](https://linearb.io/data-processing-agreement)
- [Security FAQ](https://linearb.io/security-faq)
- [Substack](https://devinterrupted.substack.com/)

### Footer

_Additional links from the site footer, not repeated from the top navigation above._

- [GitHub](https://github.com/linear-b)
- [LinkedIn](https://www.linkedin.com/company/linearb)
- [Twitter](https://twitter.com/LinearB_Inc)