🧱 Your Agent Won't Quit Over Your Technical Debt. It Copies It.
📅 Thursday, Nov 19, 2026
⏰ 9:00 AM
Your agent won’t quit over your technical debt; it copies the debt into the next change, because the nearest example in the repository is the one it follows. Before you give agents more autonomy in an established codebase, turn what your developers have been working around into checks the pipeline enforces, and give the agent a rule for when it has to stop.
When a developer keeps telling you that a codebase is hard to change, hard to test, and full of exceptions, that frustration deserves attention. The team may be keeping the app running on knowledge and judgment the development process has never captured. Someone knows which service should never be copied. Someone remembers why a particular database update needs an extra check. And someone notices that a ticket described as a small change actually crosses three business boundaries.
They work around the problem, raise it in a meeting, argue for time to fix it, or eventually find another job.
An agent won’t resign because it’s tired of your architecture.
That’s convenient. You can keep handing it work, and nobody has to look at the conditions it’s working under. A long run of finished tasks tells you very little about whether the code is getting healthier.
The nearest example becomes the standard
Say your team has several endpoints that copy the same business logic. The authorization checks vary from one endpoint to the next, nothing tests tenant isolation in a way that would catch a leak, and the plan to consolidate them has been on the board for months. You ask an agent to add one more endpoint and follow the existing conventions.
It finds the nearest example, copies its structure, and adapts the logic. The app builds. A test confirms that the new endpoint returns the right result for an authorized user, and the change looks like everything around it.
The missing tenant check has now acquired another implementation.
Run the same workflow next week and that endpoint is the nearest example for the next ticket. Every accepted change becomes context for the one after it, so a shortcut slowly turns into what looks like the standard. That loop is what worries me. In Conway’s Law Meets the Corpus Effect I wrote about a model’s training filling in the decisions an organization leaves open; here the corpus is your own repository, and the agent rereads it at the start of every task.
Your team already runs a software factory, people included. I argued in The Software Factory Was Already Here that you fix a station before you automate it. A station that only works because someone remembers the tenant check isn’t fixed; it’s staffed.
Agents copy what’s in front of them
Researchers at ETH Zurich measured the copying directly. In Coding Agents Propagate Vulnerabilities in Code Bases , posted on November 8, Chenhao Sun and colleagues held each coding task fixed and changed only how secure the surrounding code was. They ran 96 tasks that add a backend app beside existing ones, plus 20 pairs of tasks in real C/C++ projects. Every agent they tested (GLM 5.3, Claude Opus 5, and GPT-5.6 Sol, with Claude Opus 5.5 and GPT-6 Astra added on the C/C++ pairs) wrote less secure code when the code around it was insecure. The backend effect was small, 3.4% on average against a repository with no neighbors at all; in the C/C++ pairs, the average gap between secure and insecure context reached 35.4%.
The prompt results are the ones I’d tape to the monitor. In the same study , telling the agent to follow the existing code style made it copy more of the vulnerable pattern, and that’s the instruction in my endpoint example. Telling it to be careful about security cut the copying but didn’t stop it. Asked to explain a vulnerable choice, agents credited another place in the code 76.5% of the time; asked to review that same code, they found the flaw they’d introduced 69.9% of the time. So the agent could often see the problem, and it followed the example anyway.
DORA sees the same shape across whole organizations. Its 2025 report calls AI “an amplifier” of an organization’s existing strengths and weaknesses. In a March 2026 write-up , DORA notes that higher AI adoption goes with both more delivery throughput and more delivery instability, and it’s blunt about a team stuck with fragile infrastructure: “AI will simply help them generate technical debt faster.”
Some of that debt sticks. Liu and colleagues collected 302.6k AI-authored commits from 6,299 public GitHub repositories, ran static analysis before and after each commit, and followed every issue those commits introduced to the latest revision. Most of the issues were code smells (89.3%), and 22.7% were still there.
There’s a counterweight. In a preregistered experiment with 151 participants , 95% of them professional developers, Markus Borg and colleagues had developers add a feature to a Java web app, some with an AI assistant and some without, then randomly assigned new developers to evolve that code without AI. They found no significant difference in completion time or code quality.
Two caveats, and then I’ll stop hedging. Liu’s team didn’t compare against human-only commits (they explain that a reliable baseline is hard to build when AI use often leaves no trace), so their numbers say the debt persists, not that agents write more of it than people do. Borg’s team tested one feature in one Java app, which can’t speak for a factory that’s been merging agent changes for six months. That leaves a narrower claim, and it’s the one I’m making: where the controls are weak, the agent has more shortcuts to copy and less to stop it.
Turn the workarounds into checks
None of this requires a careless agent. The code supplies the examples, the ticket supplies a narrow goal, and the pipeline decides what counts as done. I’d put these controls around the code an agent is about to change:
| What your developers work around | Control to put in place |
|---|---|
| Important behavior has little test coverage | Add tests for critical behavior, failure paths, and authorization boundaries. Decide which current behaviors to keep and which are defects. |
| Architectural boundaries live in people’s heads | Write down the intended dependencies and enforce them with architecture or dependency tests. |
| Repository examples include accepted shortcuts | Name the examples to follow, and list the known exceptions that must not be copied into new work. |
| Type and static-analysis checks get bypassed | Define the checks every new change must pass, and give each exception an owner. |
| “Done” means the feature works | Require regression, security, architecture, and review results before merge. |
| The agent can’t report blocked work | Define when it must stop, what it must hand back, and which person owns the next decision. |
The language won’t do this for you. TypeScript infers types
where nobody wrote an annotation, so a missing annotation isn’t a missing type; a codebase full of any and suppressed errors is a different story. strict
turns on the stronger checks, and noImplicitAny
flags the spots where the compiler would have fallen back to any (an any someone typed on purpose still passes). A Java app can compile cleanly with tangled modules, duplicated business rules, and thin tests. What I’d look at is the set of guarantees the project actually enforces.
For Java, ArchUnit
can fail the build when a package depends on one it shouldn’t, and its freeze feature
records the violations you already have so only new ones fail. That’s how a rule goes into a messy codebase on day one. The frozen violations sit in plain text files. Set freeze.store.default.allowStoreUpdate=false in CI so a test run can’t rewrite them, and review hand edits like code, because a change that edits the baseline can redefine its own acceptance criteria.
Start with one bounded area. Record the problems it has today, protect the behavior you can’t afford to break, and enforce the standard for new changes. Agents help here too (tracing dependencies, drafting tests a person reviews, doing focused refactoring) as long as these checks hold them.
No result, no merge
The factory has to tell missing evidence from a pass. An empty test suite can’t show that a change preserves behavior. A mandatory architecture check that fails has to block the merge, not leave a warning in a log nobody reads. A check that never ran is the failure I wrote about in Your Agent Read the Skill. Did the Check Run? , and it gets the same answer here: the merge waits.
Tests and pipeline settings get the same review as the baseline, since editing either one can change what a green result means. Agent self-review is fine while the agent iterates. Before merge, I want an independent review step, plus a person’s judgment where the risk calls for it, and every accepted exception has a named owner (a person, not a role on a wiki page).
Test the stop before you widen the permissions
An agent can flag a problem, push back on an instruction, or stop when it can’t go on. The factory has to make those part of its operating rules, and I want to see them work before the agent gets wider permissions. A jig refuses the piece that doesn’t seat properly; these tests check that the factory’s refusal works.
So I’d test them the way I’d test any other control. Give the agent a repository with a misleading example, a missing test, an ambiguous boundary, or a failing mandatory check. Then watch whether it spots the problem, asks for the decision it needs, and stops where the rule says to stop. A benchmark that only scores whether the feature works won’t tell you.
Once it’s running, track the checks that actually ran, the changes that got blocked, the exceptions someone accepted, the rework, the defects that escaped, and how long recovery took. Widen autonomy where those numbers say you can.
Your best developer might quit over that tenant check. The agent won’t, so the build has to be the one that says no.