r/ClaudeCode • u/Bavwu • 1d ago
Discussion Coding agents need good architecture, not just good instructions.
After about a year of building a large software platform with CC, one of the biggest lessons I learned was that a good coding agent harness is only half the equation. The codebase architecture matters just as much.
I had spent a lot of time improving agent instructions, workflows, reviews, and testing. The agents were productive, features worked, and progress looked great.
But when I started investigating the codebase as a whole, I found a different story. (And not once did even Fable ever even hint at this being a solution while brainstorming how to make things better)
There were dozens of implementations of things that should have been shared components. Multiple ways to accomplish the same operation. Duplicated systems, inconsistent naming, unclear ownership, and features scattered across whatever files or modules had been convenient at the time.
Individually, the agents had done their jobs. Collectively, they had created a maintenance nightmare.
Local optimization at the expense of global coherence.
The problem compounded. As the architecture became less consistent, agents had a harder time finding the right patterns to follow. They created new implementations, worked around existing systems, and added more complexity.
Better instructions alone didn't solve it. You could give agents all the rules and standards in the world, but if the repository contradicted those rules, the agents often followed the code in front of them or found whatever path made the task work.
What actually needed fixing?
The solution wasn't just improving the agents. It was cleaning up the environment they worked in.
Establish clear domains, boundaries, and ownership so everything had an obvious place to belong.
Consolidate duplicate functionality into shared, canonical implementations.
Standardize how systems communicated instead of allowing every feature to integrate differently.
Untangle dependencies and remove conflicting patterns and obsolete code.
Enforce those boundaries with automated checks, tests, and architectural reviews.
The architecture and the agent harness needed to reinforce each other.
The architecture provided the structure, contracts, and predictable patterns. The harness guided agents to follow them and prevented changes that violated them.
Neither could compensate indefinitely for the absence of the other.
This wasn't a problem unique to AI. Software teams had always accumulated technical debt. But AI agents made it possible to accumulate architectural entropy at unprecedented speed.
The biggest realization for me was that architecture wasn't just a blueprint for building software. It was a control system for maintaining and evolving it.
AI made writing code faster and cheaper. But without architectural discipline, that speed eventually became the very thing that slowed development down.
Has anyone else found that improving their AI coding workflow eventually meant spending more time fixing the structure of the codebase than improving the agents themselves?
•
u/AutoModerator 1d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
6
u/Vargonaught 1d ago
I have been preaching this for months and I'm glad the industry is starting to converge on this idea.
The hilarious thing (for me) is that this is in no way new. DevOps, DevEx, DevProd, CI, Linting and plenty more have all been doing this in spirit for years.
What has happened is that as AI code has proliferated, these practices have become EVEN MORE important. If an agent can't be successful in your repo without you yelling at it, you have a problem and you are the bottle neck.
The best part is this is real engineering with interesting, unique problems! The amount of tooling I've built to steer my agents in my repos correctly with deterministic controls has exploded haha. The reliability, verification, and acceleration gains are worth it
6
u/mblauberg 1d ago
This has always been the case before AI agents…
9
u/Living_Cell7304 1d ago
Why did you use ai to write this? Do you really think everyone is going to read all this? Literal dunning Kruger goofy shit all over this sub
1
u/Desalzes_ 1d ago
I’m not working for a business or anything, just solo stuff and it’s incredibly inefficient and feels dumb every time I do it but I’ve found it works and saves me the hassle of looking for the things you pointed out, I have a session make a summary of a lot of what my project does, feed it to astra or 5.5 in browser not with the harness or local configs I have, rebuild either from the ground up pulling stuff from the old one. Takes less context somehow than fixing the old one and cleaning it up from what I’ve seen. Probably easier for sonnet to find what it needs than opus to make decisions as it combs the entire project
1
u/uduni 1d ago
This is called lack of coherent, searchable documentation
Just put some instructions in AGENTS.md about how to search docs, and build a doc for every feature. Simple
1
u/Blockpair 1d ago
hey op, your post was very long so i havent read it, but i just wanted to say i hope you have a great day ^_^/
2
u/hieuphung97 1d ago
This hits home. Agents always take the path of least resistance. If you leave loose package boundaries, they will happily import internal utilities across four domains just to finish a prompt. Strict compiler checks and boundary linting beat prompt guidelines every single time.
1
u/Turbulent_Swimmer900 1d ago
Just made my code base searchable tonight! I swear Claude is snitching on me...
1
u/Mithryn 1d ago
This is a great discussion and something I've been dealing with. I appreciate the conversation this launched.
1
u/Right-Performance-93 1d ago
i stopped adding rules for this. the check fails the build if a second copy of that function lands, and the prompt never mentions it.
1
u/m-ritter 1d ago
Duplicated implementations of shared components are hard to catch when each agent only sees its own task. A review pass that checks every new change against the components that already exist finds those duplicates before they merge. Writing the agreed boundaries and ownership rules into project memory also lets a fresh session start with them instead of rediscovering them. I'm the developer of QualityLayer, which does exactly this: https://github.com/maxritter/qualitylayer
0
u/adelie42 1d ago
I think there is only so much you can do to protect a user from themselves and make sure they actually do all the work involved in telling Claude what to do for them.