You rolled out Copilot, Cursor, or Claude Code throughout a whole bunch of engineers. Six months in, the productiveness raise is actual however smaller than the slide deck promised — and uneven, with some growth groups flying and others barely transferring.
The AI isn’t underperforming. Your codebase is forcing it to.
The brand new value of carrying unused code
Each codebase carries weight that not earns its maintain — strategies no one calls, libraries no one masses, options that shipped years in the past and quietly stopped mattering. Engineering leaders have all the time identified the price of sustaining and securing useless or unused code is pricey. What’s modified is who pays the invoice.
Till just lately, the tax was paid in human consideration: slower onboarding, longer code critiques, the hesitation earlier than touching an unfamiliar department. Painful, however bounded — a senior engineer learns to navigate across the useless zones, and the crew absorbs the friction. AI coding assistants don’t get that luxurious.
To make a change in any non-trivial space, the assistant has to learn the encircling code, and its context window is finite. Each library, each unused class, each orphaned helper, each dependency the agent pulls in to “perceive the world earlier than altering it” consumes pricey tokens that might have gone to the precise activity.
Unused code appears equivalent to stay code on disk. The AI can’t understand it’s irrelevant till it’s already learn it. By then the associated fee is paid: longer prompts, weaker reasoning, extra hallucinated calls to strategies that not matter, extra rework.
The AI’s efficient intelligence in your codebase is inversely proportional to your useless weight. And that interprets into the consumption of AI token spend that pulls from budgets that needs to be allotted to leveraging AI to innovate new options and purposes
That is technical debt, and it now compounds quicker
It’s price naming this for what it’s: technical debt, within the authentic Ward Cunningham sense — work that was rational to defer on the time, accruing curiosity till anyone pays it down. Each acquisition you take in, each modernization you sequence, each characteristic you ship with out retiring the one it changed provides to the principal.
Engineering groups really feel it: in Azul’s 2026 State of Java Survey & Report, 63% of respondents stated useless and unused code is hurting their crew’s productiveness, and solely 6% reported no affect in any respect. Two issues have modified within the final 24 months.
First, the rate of interest went up: AI assistants now sit in the course of practically each code change, and so they pay the carrying value with token utilization on each immediate. Second, the principal grew quicker than your crew did — in the identical survey, each respondent reported utilizing AI code-generation instruments, and 30% stated greater than half their new code is now written by AI. Extra code, written quicker, with much less of it being deleted on the best way in.
For those who’re an engineering chief making AI funding selections as we speak, the implication is uncomfortable. The identical productiveness device that guarantees to clear your backlog can be increasing the floor space it has to cause over. With out an intentional countermeasure, you’re funding each side of the commerce.
Why the plain reply — “simply run static evaluation” — solely will get you partway
Most engineering organizations have already got static evaluation wired into CI, flagging unreachable branches, unused imports, and useless variables. It’s the correct baseline: if no code path reaches a technique, deleting it’s protected.
However static evaluation is conservative by design. The instruments would fairly miss actual useless code than flag one thing that seems to be stay — a fallacious deletion is catastrophic, a missed one is merely wasteful. And so they can solely cause what they will see within the supply: something known as by reflection, dependency injection, configuration-driven dispatch, characteristic flags, or runtime service lookup seems reachable on paper, even when that path hasn’t fired in manufacturing for 3 years.
The analyzer leaves it alone, accurately, as a result of it has no method to know. So the simple 10–20% of unused code — the stuff with no caller in any respect — will get cleaned up by these static evaluation and IDE instruments you already personal. The opposite 80% — code that compiles, has callers, passes the linter, and by no means really runs — sits within the repository, within the context window, and in your AI invoice.
Runtime proof: ask what ran, not what might run
The class that closes the hole is runtime proof — observing purposes as they execute in manufacturing and cataloging which courses, strategies, and libraries really run. Azul Intelligence Cloud’s Code Stock is probably the most direct expression of this method for Java estates. It really works on any JVM — Azul, Oracle, Eclipse Temurin, Microsoft, Crimson Hat, IBM — so a single dataset covers the entire footprint.
The place static evaluation asks might this code be known as, Code Stock is aware of whether or not it was or not. Over a standard enterprise cycle — lengthy sufficient to seize quarter-end jobs, the annual reporting module, the seasonal promotion path — the image of what your code really does in manufacturing resolves with excessive confidence.
Code that has callers on paper however by no means executes exhibits up as precisely what it’s: useless weight that static instruments can’t see. One Azul buyer described it concisely after an acquisition: hundreds of thousands of strains of unfamiliar code, months of studying forward of them, and as an alternative they used Code Stock to determine massive parts of unused code and archive it. That’s the form of the win — not a marginal refactor, however a defensible resolution to take away code, backed by proof fairly than guesswork.
Pair Code Stock with an automatic refactoring platform like Moderne and OpenRewrite, and the elimination step scales throughout tens of hundreds of thousands of strains as an alternative of turning into its personal multi-quarter venture.
Cleanup is the multiplier in your AI spend
Right here is the half that issues for the funds dialog. Eradicating unused code shouldn’t be a competing line merchandise in opposition to AI tooling. It’s the multiplier that determines what your AI tooling is definitely price. Each line that comes out of the repository pays compounding dividends.
AI brokers learn much less to know any given change, so extra of the context window is offered for the precise drawback. This implies higher options and fewer fabricated calls to strategies that not exist. Human reviewers cease second-guessing whether or not the useless department issues.
Vulnerability triage shrinks: fewer dependencies, fewer CVEs to research, fewer hours spent on the false-positive treadmill that 30% of groups now report consumes greater than half their vulnerability-triage time, a lot of it spent on code paths that by no means run in manufacturing. Exams for retired options will be deleted together with the options themselves.
None of those advantages present up on the AI vendor’s pricing web page, however each one in all them exhibits up within the ratio of AI spend to delivered output. The inverse can be true, and it’s the case price making to your CFO.
For those who scale AI instruments throughout a codebase carrying years of unused code, you’re paying full worth for AI periods that spend a major fraction of their context funds studying materials that ought to have been deleted. That value is invisible on the bill and really actual within the output.
Sequence the work
You don’t have to decide on between cleanup and velocity, and the framing of “pause AI rollout to do refactoring” is the fallacious one. The work runs in parallel, on this order: 1. Instrument manufacturing with runtime proof and let it construct the image of what’s really used. That is passive — engineering groups maintain transport whereas the information accrues. 2. Take away what the proof says is protected to take away. Use static evaluation for the structurally unreachable circumstances and runtime proof for the a lot bigger class it could actually’t see. The place the amount justifies it, automate the elimination with rules-based refactoring fairly than treating it as bespoke developer work. 3. Scale your AI tooling in opposition to a codebase the place each line earns its place within the context window.
The most cost effective line of code to keep up has all the time been the one which isn’t there. Within the AI period, it’s additionally the most affordable line in your assistants to learn, the most affordable to maintain safe, and the most affordable to depart out of each immediate your engineers will run for the remainder of the product’s life. That’s the road merchandise price funding first.

