Working with AI agents day to day, a worrying trend has emerged: teams, including experienced engineers, have quietly stopped pushing to rewrite or restructure the most complex parts of their systems. It's not about the quality of the code the agents write, but about a decision that used to happen almost reflexively and now rarely does - the decision to stop and say this has become unmanageable, we need to refactor it before we go any further.
Historically, human context limits have shaped how we build software. A computer can hold far more in 'working memory' than a human can. We can't reason about a complex system when it branches in dozens of directions, each branch with its own implications, all interconnected. So, we split systems into modules small enough to understand in isolation, and then spent effort connecting those modules together with interfaces we could also understand.
The refactoring reflex, triggered by a human getting lost in the code, has been one of the most important forces keeping long-lived systems maintainable. However, AI agents are not bound by human context limits in the same way. An agent can read the tangled function, trace every caller, and make sense of the mess that would have stopped a human cold. It can add the next branch correctly, and the one after that, working confidently inside code that no human on the team fully understands anymore.
The problem is that AI agents never get lost, so the signal to refactor never fires. The agent has no reflex that says 'this has become unmanageable, we should stop and refactor.' It just keeps adding branches to the pile, unless it's specifically instructed to step back and question the structure. This can lead to a system where no developer on the team can fully reason about key parts of the code, reviews become rubber stamps, and the team increasingly trusts the agent precisely because they no longer understand the code themselves.
Keeping the source organized isn't just a favor we do for humans; it benefits humans, improves the agents' accuracy, and lowers the token cost of every change we'll ever make to that code again. The refactoring reflex we're at risk of losing was never only about human comfort - it turns out to be good economics too. To mitigate this risk, we need to bring back the checkpoint deliberately, since it no longer happens on its own, by asking questions like 'Do I still understand this part of the system, or have I been letting the agent understand it for me?' and 'If a human had to debug this without the agent, could they follow it?'
We can also push some of this into the harness - instructing our agents to flag when a module has grown beyond a reasonable size or branching complexity, to propose refactorings rather than only extending, and to call out when a change is getting hard to reason about. The ultimate responsibility stays with us, because we're the ones who need to be able to understand our systems, and we're the ones who lose that ability if we're not paying attention.
Este artigo foi escrito com a assistência de IA.
News Factory APP - notícias agênticas para impulsionar seu SEO e AEO.