r/ChatGPTCoding • • 2d ago

Discussion The biggest problem I've found with AI coding agents: Local optimization vs. global coherence

I've been using AI to develop a fairly large software project for about a year now, starting with Cline and Sonnet, experimenting with various tools, and eventually moving to Claude Code and Codex.

I use(d) a combination of multiple subscriptions with Claude, OpenAI, GLM, Kimi, and DeepSeek, and experimented with dozens of agent harnesses and orchestration workflows.

One recurring problem I've noticed is local optimization at the expense of global coherence.

Agents can make perfectly reasonable decisions for the immediate task while gradually making the overall project worse.

It's easy to get carried away by the optimism. The plans look great, the agents sound confident, and the progress reports show everything getting completed. But as the project grows, small inconsistencies compound into what I'd call architectural entropy.

Here are six recurring problems I've encountered:

  1. Adding instead of replacing

You ask an agent to correct an implementation, and instead of replacing the mistake, it builds around it. It adds compatibility layers, fallbacks, and patches to support something that should never have existed.

What helps: Explicitly require replacing and retiring obsolete implementations, including their references, comments, and documentation. Don't preserve backwards compatibility without a reason.

2. Subagents losing the big picture

An orchestrator develops an excellent plan, then delegates vague, isolated tasks to subagents without passing along enough context. Each agent completes its assignment, but the pieces don't necessarily work together.

What helps: Give subagents the overall objective, relevant architecture, clear interfaces, dependencies, and acceptance criteria. Explicitly assign responsibility for integration.

3. The perpetual 80% problem

An agent breaks a goal into tasks, completes them all, and declares success. Except the actual feature is only 60–80% finished. You ask it to complete the remainder, and another round of tasks gets you 80% of what's left.

It starts feeling like Zeno's paradox. Autonomous loops can make this worse by endlessly discovering new tasks and rabbit holes.

What helps: Define success by observable, end-to-end functionality rather than completed checklists. Verify outcomes against the original objective.

4. Reinventing instead of reusing

An agent doesn't discover an existing implementation, so it creates another. Suddenly you have different colour pickers, navigation systems, validation logic, or state management across the same application.

Each works independently, but the overall system becomes increasingly inconsistent.

What helps: Require searching for existing implementations, establish canonical shared components, and justify introducing new systems.

5. Context contamination

Agents rely on documentation, comments, summaries, and existing code that may be outdated or incorrect.

Worse, an agent can implement something incorrectly, document it, and have future agents treat that documentation as authoritative. Yesterday's mistake becomes tomorrow's specification.

What helps: Maintain clear sources of truth, distinguish proposals from implemented architecture, retire stale documentation, and verify assumptions against actual behaviour.

6. Agents reviewing agents

A second agent can review an implementation, find clean code that follows established patterns, and approve it.

But if both agents are working from the same incorrect assumptions, they can confidently agree on something that fundamentally misses the original objective.

What helps: Give reviewers the original requirements, test actual functionality, and separate code-quality reviews from architectural and outcome verification.

---

The bigger problem: Architectural entropy

These aren't necessarily AI-specific problems. Human development teams experience them too.

But AI agents can make decisions and produce changes at a scale and speed that allows inconsistencies to accumulate before anyone notices.

Each agent optimizes locally: preserve existing functionality, complete the assigned task, solve the immediate problem, follow the available documentation, pass the review.

All reasonable decisions individually.

Yet collectively they can create duplicated systems, unnecessary complexity, contradictory patterns, stale documentation, and features that technically work but don't fit together.

The codebase grows, the task completion rate looks fantastic, but the system itself becomes less coherent.

I've become increasingly interested in workflows that actively counteract this entropy: maintaining architectural consistency, verifying end-to-end outcomes, consolidating duplicate implementations, and removing things that no longer belong.

I'm still a huge advocate for AI coding agents. I wouldn't have built nearly as much without them. But I think the challenge changes as projects grow.

It becomes less about "How do I get AI to build this?"

And more about "How do I ensure everything AI builds contributes to the same coherent system?"

I'm curious what others have experienced, especially those running multi-agent workflows on larger, long-lived projects.

What practices have actually helped you prevent architectural entropy, rather than just generating more code, documentation, and reviews?

33 Upvotes

30 comments sorted by

18

u/Any-Blacksmith-2054 1d ago

Everything you mentioned (including architecture entropy) I observe already 15 years in every huge project with so-so developers.

9

u/Bavwu 1d ago

It's funny you mention that, this isn't just an AI issue, it's a Collaboration issue. I used to work in the construction industry and sometimes it's like dejavu.

I think AI just helps people hit fundamental Collaboration painpoints faster.

I don't have a 100 person team, but can feel the same and still need to come up with systems to get things to work together.

Another parallel I see is like company culture, there's "drift" as well, things might initially work right after "alignment meetings", then let it run for days or weeks and things fall back into choas. Seen it in multiple industries, not just in harnesses lol

3

u/Cahnis 1d ago

There is a middle ground. We use agents to help us keep that in check, instead of just tossing quality out of the window.

We had that Iron triangle between scope <> speed <> cost where we had to choose 2 out of the 3, and AI gave us the opportunity to choose a third one, and the business chose speed twice.

2

u/femio 1d ago

The difference is humans are incentivized to shape up or get fired. A model only lives as long as your session anyway, so long term learning and accountability are difficult problems. 

One look at a message like “the AGENTS.md says don’t do X, but Y would fit what I was trained on. Let me just…” in a reasoning trace says it all.

Models will literally reason against you and push back against requirements if they deviate from how they’ve been RLed. Anyone saying “oh this is just like my shitty coworkers” is out of touch. 

Source on above:   https://maxxbench.unlap.ai/research/why-maxxbench/ (And various other papers corroborate, this one just shows excerpts of thinking) 

4

u/PitifulAppearance509 1d ago edited 1d ago

I think you have to sharpen the review agents and provide tooling (e.g. Lints, Scans, and tests) for them to find the things you care about.

One thing I discovered is that explicit state machines creates very good results so I tell the reviewer to check if state transition really go through the state machine. You might want to split different aspects to different specialists reviewers to sharpen their focus. But I haven't done that yet.

I also would avoid feeding too many rules to the implementer Agent because he will lose focus. Instead, use reviewer to guard aspects that are important to you. That way, the things that the implementer needs to build or fix becomes more focused and with each interaction the code gets better and better.

Maybe we have to realize that certain aspects of good coding practices are actually not that big of a deal anway. Especially since a team of humans doesn't do it better and the software worked in the end. Except now, technical debts are handled in a few minutes to hours whereass with humans, they were never addressed because the next features had to be delivered.

I also have moved on to higher models on everything and don't bother with lower models anymore. My Implementers use Opus at medium while reviewers Opus at High.

1

u/Bavwu 1d ago

One thing I have started playing around with is using Jev to create a "smart context assembler". E.g. you have the aspects and long list of rules, but use Jev to pick and choose which to show. Dynamically create an applicable prompt for the reviewer based on what they are reviewing.

Kind of like your specialist idea for better focus, but to have a catalog of things that then get assembled using semantics, keyword/hooks, a decision model (Jev/Clef) to rank/approve when applicable then assembled.

1

u/PitifulAppearance509 1d ago edited 1d ago

I have a feeling that even if you create some kind of smart context assembler, the agentic loop adds more and more context anyway. So your rules might get buried. In your approach, you basically increase the original requirement( that might already be complex) with further dimensions increasing it's complexity even further. Not only does the implementer need to build the original requirement that conforrm to the original akzeptance criteria but now it it has to conform to the acceptance criteria of your rules.

My Idea decouples the rules from the original requirements a little and place them into seperate implementation iteration and also serves as rule guards. Of course there are good code patterns and rules (e.g. use explicit state machines for state transitions) that are described in Claude.md. But I want to make sure the reviewer needs to at least check for it as well. If I need some kind of smart context assembler it could mean that my rules are already too big.

2

u/ThisGermanEngineer 1d ago

Thanks for sharing your insights! I’m wondering if an independent architecture and strategy agent could be supervising the repo and PRs. That agent will be given an architecture and strategy guideline from a very high level perspective with rules and strategic decisions made. It is important that this agent is independent, not responsible for the implementation, but only for supervision.
What do you think, might that help?

2

u/Bavwu 1d ago

Yes, I think this is definitely part of the solution. I will be playing around with this either more in the planning phase or after during review as you mentioned. One thing I imagine I will have to look out for is with to vauge and they let everything through, to well defined and it gets outdated or might be restrictive.

2

u/jerramw 1d ago

I concur. AI will happily apply the BBOM architecture pattern at speed, and whereas back in the day it took a few years for brittle/fragile to require a rewrite, now you can push a 30 commits a day and reach maximal code entropy in a few months.

I tried putting rules into skills and agent files, but Claude finds new ways to do the wrong thing faster then i could ban them. Also telling Claude not to think about elephants works about as you expect.

I've had better mileage by running two separate loops, outer architecture / scoping that reads/updates architecture.md and code and looks at commit churn and tracks hotfix/ for where bugs live and adds direction to the ticket and then the inner loop that makes the changes.

Once the inner loop passes review (codex) the outer loop validates the change against architecture, not requirments.

So far I'm getting more thoughtful PRs, and often I'm seeing the architecture review find DRY etc issues that already existed that get rolled into the change.

I'll have to wait a few weeks and see what new failure modes Ive unwittingly added.

3

u/Bavwu 1d ago

Lol that's the attitude! It's hard to find a balance of working on the project and working on the system that makes the project. It could be a full time gig just trying to make harnesses work more effectively.

1

u/Far_Reindeer8428 1d ago

we saw this as ten small prs that each made sense and together duplicated three helpers. the fix was a module owner reviewing anything that adds a new file

1

u/Bavwu 1d ago

Yeah, having ownership built in to the process and a review that has good understanding of the desired outcome.

Keeping things current as things evolve is the next challange.

2

u/Ok_Woodpecker_9104 1d ago

the adding instead of replacing one i see a lot too. what helped me most was a second model reviewing the whole branch diff against main before i call it done, not each task. i run codex on it and ask for bugs and missed cases, plus anything the pr description claims that the code doesnt do.

that last question catches the drift. the summary describes what the agent meant to do while the diff shows what it did. old code sitting next to its replacement is easy to spot when both are in one diff.

per task review misses it because each task looks fine on its own.

1

u/Ok_Car_8951 1d ago

you give agent one architecture.md with folder structure and patterns and attach it in every task, otherwise every task it make his own new pattern

1

u/Guy_Zhang 1d ago

Same here on adding instead of replacing. Patches are right while the project is small; past a certain size, each one just pushes the problem somewhere else.

What helped was giving the agent what I'd give a new senior hire: what the product must be, and the architecture — which subsystems exist, what each owns, what it explicitly doesn't. I also fixed the order for trade-offs: useful > simple and stable > robust > cheap, and I stop to redesign when a change needs a workaround or a new special case. Acceptance like yours: unit tests, then clicking through the UI myself, then the UX.

1

u/Right-Performance-93 1d ago

when it adds a second helper i don't ask it to reconcile them. i name the file that stays and tell it to delete the new one in that turn. a merge task is where the third copy shows up.

1

u/KingYF1 1d ago

The "adding instead of replacing" pattern is the one that hurts me most. What finally helped was making replacement a first-class step, not a hope in the prompt.

Before any edit, the agent has to list the files it expects to touch and mark each change as replace, remove, or add. If it wants to add a new helper next to an existing one, it has to say why the old one can't be changed. I reject the plan if that list looks like a compatibility layer.

I also stopped doing architecture review in the same session that wrote the code. A fresh session, with the branch diff against main and a short note of the original goal, is much better at spotting wrappers around dead code. The writing session is already locally optimized; it will defend its own patches.

For the 80% problem, I don't accept a checklist as done. Done is a command I can run, or a UI path I can click, written down before the work starts. If that command still needs a follow-up prompt, the task wasn't finished.

Subagents only get a task once the interface is written: function signatures, error shape, and which module owns the data. "Implement the parser" is how you get two slightly different parsers.

1

u/rdpl_ 1d ago

tldr long ted talk about common sense

1

u/wegster 1d ago

So I don't know if it's 'good' news, but yeah, have experienced pretty much all of them over time.

I have less 'forgiveness' or something I guess, as I've been in tech forever, was an SWE and architect, then moved to Product and Director roles, but also worked in DS then AI/ML for going on a decade (not all LLMs, hopefully obvious), yet - here we are.

One of the most 'memorable' was I'd used Bolt as an occasional 'let's see if it can code non-trash yet,' and I finally got around to saying 'ok, might be more than a toy now, so let's see.' Holy god - the number of NEW status files for the same content it tried to create in very few turns = total shitshow. Yeah, talk about 'where's the source of truth?' Resolved via putting some strict repo-level rules in place, but wasn't the most fun ever.

I wound up building my own framework, although I leverage what I can. I went through using tools like Continue in vscode, which was dead but I guess now someone's bought it, but still no new activity, cline, and a few different harnesses, which help in some ways, but I guess I take a repo-up additive approach, and still fight with some of the 'drift,' occasionally to screaming levels, but most of the times, things are working reasonably well.

Repo-level agents sets the tone and ground rules, including e.g. precedence of other (sub)Agents files, pointing to architecture, authoritative plan and state files, etc. Part of the guidance is no introduction of new tech stacks and to always focus on minimal change needed to accomplish the task.

I've been using the whole Plan -> spec -> build -> review -> merge loop before it had the names and visibility it's seen recently, but it's perpetually evolving.

I use mostly base Pi without plugins, do NOT bother with 'swarms' or for the most part even subs, unless I'm using my codex or Claude sub vs local.

Separate reviewer as most do. Definition of done includes core doc updates including last state, if plan, roadmap or architecture, ops have changed, etc. and this generally works pretty well. Skill in place for sane git hygiene to avoid runaway abandoned git branches and worktrees. worktrees in general, even though I personally hate them, anywhere concurrent work may be happening, branches if I'm mixed into the code or intentionally incrementing, manually reviewing etc.

I'm in the middle of testing pre-compaction triggers with task writes, which still bumps the token usage, and while I have a shitload of model comparison benchmarks, I still need to quantify does it help measurably on longer execution runs or not.

Similarly to your post, I definitely think while the adversarial reviewer is generally better than single agent, at a bit of cost of tokens/time, it doesn't have enough context so it's effectively grading a single sliding small window of changes in context of the overall project. This is good in context of obvious security , scalability, negative testing types of things, but pretty awful if your build agent just invented the 27th way to do a single thing while the reviewer only has the scope/view/context on the one just done. The obvious bit is to feed in the plan, original task, and a code map, call map, or LSP, with stringent but extended review criteria, e.g. ensure it is not duplicating near-identical functional implementations with a new implementation, etc. etc. What I haven't done - is test it end to end enough to see of the token tradeoffs are 'better,' as most of the issues are stacked tolerance-like, in they're non-obvious for a while, until something comes up that makes you want to scream as you uncovered a special little pile of dog shit unasked-for tech debt.

Mostly, have had things working 'pretty well' at like the 85% mark. Some things I know could/should be 'better,' but occasionally the 15% part comes to bite me in the ass, like the test explosion after I'd tried to get more testing in as blockers - of course when 50 tests would suffice, it grew to hundreds, some of which were, well - stupid and wrong, or such edge cases that I'm unsure there were even valid code paths to get 'there' to those conditions.

I suspect more can be done with hooks, and just starting to look at those beyond the compaction hook.

All ears to see how this thread develops.

1

u/aioli3 17h ago

#6 got me for a while. My reviewer agent kept approving stuff because it read the implementer's summary and believed it. Now it only gets the ticket and the diff, and it catches way more.

For the entropy part, something that helped was a separate agent that runs on a schedule and looks for mess. Stale docs, two versions of the same thing, dead code. It doesn't fix anything, it just files cleanup tickets. Really helps catch & prevent drift.

Also started deleting old docs instead of keeping them around "for reference". Agents kept treating them as current.

1

u/hieuphung97 16h ago

Point 1 is the killer. Agents hate deleting code. They treat deprecated helpers like sacred artifacts and wrap them in three layers of fallback adapters. Forcing a hard rule like 'delete the old implementation or fail CI' cut half our entropy overnight.

1

u/xqianliu 15h ago

I'd move effort off the reviewer and onto the code side.

One harness, 23 tasks, 183 runs total. 38 of those runs passed review and still failed hidden tests: 22 broke working behavior, 9 broke a changelog convention, 7 missed cases the issue never showed. 38 runs out of 183, not 38 different bugs.

Asking the reviewer to check for regressions didn't help. What worked: the code side generates tests for each class of input, writes the count into the delivery notes, and review checks the number against the diff. The counts come from the agent's own notes, not a test framework.

That's the agents-reviewing-agents point. Two agents sharing the same assumptions approve the same mistake. A number written in the notes is hard for either to skip.

For the perpetual 80%: success means meeting the ticket's criteria, checked by a fresh session on the final diff.

1

u/rodrigolduarte 15h ago

The "subagents losing the big picture" one matches what we see. What helped most wasn't a better prompt, it was moving global coherence out of the agents that write code. The engineers stay local on purpose: one card, one branch. One manager agent sees every PR against staging and the rest of its batch (git merge-tree before merge), runs the full suite once on the tree that would land, and is the only one that merges. The leftovers are rules that live in one engineer's head, so we write them where the next one will read them. Do you keep a written list of what should be replaced or removed?

1

u/London-Boat 12h ago

a lot of that drift comes from each session re-deciding things that were already decided, because the decision only lived in some old chat. writing the big ones down as short decision notes in the repo (what was chosen, why, what not to do) and having review check new code against them catches more than a smarter reviewer does. i've been building something for this, a local mcp where agents log decisions and findings and the next session or a different tool reads them before touching the code. happy to share if it's useful. which of the six hits you hardest?

1

u/leweir 3h ago

For "adding instead of replacing", make deletion part of acceptance, not just the instruction: a separate review pass on the diff whose only job is to flag new fallbacks, compat shims and duplicate helpers, and fail the task if the old path still exists. Keep a short architecture note with decisions and things that should not exist, have agents read it before planning and update it after. Net line count per task is crude but a decent early warning for entropy creeping in.

1

u/LASER-RASTERIZER 1d ago

Instead of using ai to push shit out faster you should use it for depth, not breadth.

Don’t ship more features in less complete state, in less time, ship the same features but more properly attended to, at the same rate.

Any time architectural slop starts to occur stop everything and refactor it out of the conversation

You have to do a lot more smaller refactors with ai

Pushing features out incomplete faster is the stupidest way to use ai

We have a machine that can easily tackle tech debt for us the moment we identify it, while it’s still small and easy to manage

And instead of making that part of every sprint cycle we are perverting it to ship out more code that is less vetted than ever before basically spraying tech debt everywhere instead of pouring it in the trash as it trickles in.

It’s insanity.

Go deeper, not faster.