r/ClaudeCode • u/GreenCurious9895 • 13d ago
Help/Question Struggling with planning & architecture quality
We've been using Claude Code heavily for several months across a team of almost 10 accounts (Opus 5.5 Max for nearly everything. Occasional Fable 5.2). As our codebase has grown, we're finding that Claude is good at small-to-medium tasks but struggles with complex feature planning, architecture decisions, and sticking to agreed-upon plans.
We have a fairly structured setup: monorepo, Git, CI, ADRs, documentation, and dedicated planning/orchestration sessions coordinating task-specific sessions. We also use Codex as an adversarial code reviewer, which has worked really well.
Our two biggest challenges:
- Planning quality: Claude produces plans with high confidence, but once implementation starts, we often discover they're incomplete, poorly thought out, or architecturally flawed. We're considering adversarial planning (Claude creates the plan, Codex independently challenges it), but don't want to create so much process that development grinds to a halt.
- Plan drift: Even when we establish good architectural decisions, conventions, and implementation plans, Claude tends to drift away from them over time, requiring constant course correction.
For those managing larger, more complex Claude Code projects:
- What has been most important to your architecture and planning quality?
- How do you enforce architectural decisions and keep Claude from drifting?
- Has anyone had success with multi-model/adversarial planning without sacrificing too much velocity?
Advice is very much appreciated.
•
u/AutoModerator 13d 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.
7
u/CCodeSI 13d ago
Both problems usually have the same root: the plan is written from what the model assumes about the codebase, and the drift happens because the decisions only live in prose. What has helped teams we've seen at this size:
Planning quality
Plan drift
no-restricted-imports, ArchUnit, whatever fits your stack), banned patterns as lint rules, contract tests on module interfaces. An agent ignores paragraph 4 of an ADR; it doesn't ignore a red CI run.The general pattern: anything you'd be upset to see violated should be enforced by a tool, and the prose should only cover what can't be checked.
2
u/heroyi 13d ago
This is not a unique issue and many companies suffer from this. Many have tried various solutions and have varying results.
I haven't tried it but I know some that have created hooks where every x turns it reinjects the Claude.md or whatever rules you want it to adhere by to reduce drifting.
Your main problem, and this is what companies struggle with on large codebase, is creating a robust document system that will inject only what Claude needs effectively to do the tasks while maintaining context of the codebase. Essentially a code wiki. There are many tools that have attempted to solve this but none really scale well or have various holes.
I guess the first step is to document the issues, real issues, you have experienced that are related to the problems you are asking it here and tell Claude to explain why it keeps fucking up, give it your hypothesis or concerns on why you think it is fucking and ask it to formulate a plan for your review.
Either way this won't be easy. And people will say things like go use obsidian or whatever llm dag based tooling for a code wiki but they all fall apart at a certain point
2
u/momentone_ 13d ago
the confidently wrong plan mostly happens when it's one big plan upfront.
What worked better for me: plan
- only the first slice that touches real code,
- ship it
- then replan with what you learned.
the plan after slice 1 is way better because it's built on code that actually exists now, not on what claude guessed
1
u/NishantJha612 13d ago
I think the best way to handle it is to start the goal and plan clean after every few days / hours / weeks depending on the frequency that suits your setup. What this means is, ask the agent to give you remaining features + inventory of what's built. Then clean up everything - docs, plan, agent, and give it the remaining features + inventory list and start back up as if its a new project. It may need some fine tuning and some work from your side, but it'll help keep things clean and focused.
1
u/ServesYouRice 13d ago
You should use both long term and short term memory. And both Codex and Gemini as Claude while being the best is still not flawless and these 2 can catch many issues Claude overlooks.
I have some big projects and making a big docs folder with the full map of features at the beginning and "sprint" plans for each phase as I go works well for me. I also built myself a multimodel orchestrator that tracks issues and produces plans based on Anthropics prompting guidelines which I run from time to time to make sure no dead code, dead ends and other things pile up
The only thing I struggle with at this point is when Opus goes into fixing all the edge cases it encounters but wcyd
1
u/AppealSame4367 13d ago
I started using Deepseek 4.1 as implementer because of this. It's made for this, because it sticks to rules much better than any OAI or Ant model. Also it has the ability to plan and get a very deep understanding of a code base on its own.
I caught Claude, especially Opus, planting subtle mistakes and changing code it didn't have to all over code bases over the course of the last year and therefore have stopped using it for implementation in already complex code bases when I switched to DS 4.1
Now that Gemini Carbon and Neon are out, I think they are better planners than Opus, although I haven't tested them enough and I suspect they could be Opus checkpoints (Google owns parts of Anthropic). Also, Google might turn them down and enshitify them soon, as is custom with Gemini models.
1
u/redrabbit1977 13d ago
Just a note: I find chatgpt to be easily the best content-writer and the most logical UI planner...Claude often creates weird content slop so I use chat as an adversarial writer/reviewer...
1
u/wangadong 13d ago
the plans that held up for me started with a written definition of done, not the steps. if the planning session cannot state what finished looks like in checkable terms, the drift starts there, not in the code.
1
u/torvalds75 13d ago
Both of these got a lot better for us once we stopped treating the plan as a document and started treating it as a contract that gets checked.
Planning quality. Confident-but-wrong plans usually come from Claude planning against what it assumes the code looks like. Two things helped. First, planning is its own session and has to read before it writes: every step names the files and interfaces it touches and lists its assumptions explicitly. Second, before a plan is accepted it has to answer "what would make this plan wrong?" and "what did you consider and reject?". If it can't name a rejected alternative, it didn't really plan, it picked the first idea. Your Codex-as-challenger idea fits right here and stays cheap if you scope it: Codex reviews only the assumptions and the rejected alternatives, not the whole plan. That's a five minute pass, not a process.
Plan drift. Drift happens when the decision lives in a doc the implementing session read once, 80 turns ago. What worked better:
The combination that kept our velocity: adversarial review at the two cheap points (assumptions before coding, plan vs diff after), and nothing in between.
1
u/tariqosmani 13d ago
Rules in a prompt drift, checks in code don't. So move every architectural decision you can into something that fails the build.
Import boundary rules, a dependency checker, lint rules for naming, and a few architecture tests that assert "this module may not call that one". The agent can ignore a paragraph in CLAUDE.md, but it can't ignore a red CI run. Then tell it to run those checks before it says it's done.
For plans, make the plan a file in the repo with a checklist, where each step lists the files it touches and how you'll know it worked. Tell the agent to re-read it before each step and tick items off. At the end, ask it to diff the work against the plan and list every place it deviated.
On the adversarial setup, keep it to one round, with a fixed checklist for the reviewer: missing cases, wrong assumptions, what breaks existing code. Skip it for small tasks. That keeps velocity.
Do the planning sessions write to a file, or does the plan only live in the chat?
1
u/japbujan 13d ago
Others covered turning rules into checks well. Two things that helped us on top of that:
On adversarial planning: we keep it cheap by having the reviewer check the plan only against the existing decisions and the criteria, not redesign it. That catches the plans that quietly contradict an ADR, which in our case was most of the bad ones.
1
u/m-ritter 13d ago
The plan drift part is where I would start. If the plan has a section where the agent lists every decision it made on its own, you can overrule one before any code exists, and a section on what is out of scope gives your Codex review something concrete to check against. After the build, a reviewer that did not write the change can then compare the result to each agreed point with evidence.
I built QualityLayer around that loop: https://github.com/maxritter/qualitylayer
1
u/InternationalTie4310 13d ago
Not sure whether this will help you or not, but here's how I manage a 100k+ Loc Rust code base as a solo dev. I'm basically building a large piece of software with a very small team: one person who owns the product, and two AI roles that do the engineering. The product owner i.e me does not write code. What makes this work is not any single tool but a fixed rhythm that every piece of work passes through, with a clear answer at each step to the question "who decides this?"
Three roles
The owner decides what the product is. He makes every call about how it should look, feel and behave, and his word is what lets work move onto the main line.
The architect is a Claude chat. It owns how the code base is built: it reads the current state of the project, writes the specification for each piece of work, resolves implementation choices, and checks the builder's output. It is also expected to be a critic, and to say so when the owner is wrong or when there is a better way.
The builder is Claude Code. It receives a written handoff, writes the code, runs the tests, and reports back.
The split matters. The architect never writes production code, and the builder never decides scope. Neither of them makes product decisions.
Blocks and eras
Work is cut into blocks, each a self-contained unit with its own specification, grouped into larger phases we call eras. The order of blocks within an era is planned and signed off before the era begins. Every block starts in a fresh chat, opened with a short kickoff document written at the end of the previous one. Long chats get slow and expensive, so the project's memory lives in documents, not in conversation history.
The rhythm of a block
Keeping it affordable
Rigour costs tokens, so the process is graded by risk. Crucial blocks get the strongest models and the full set of checks. Simpler ones run lighter. Verification work, such as the premise check, the post-commit review and the second read of a spec, goes to cheaper models, because checking is easier than creating. Small jobs are bundled into one longer build session instead of several short ones, and one-off fixes are logged in the deferred ledger and collected into a later polish phase instead of interrupting the current block.
Why it works
Three habits carry most of the weight. Everything is written down, so any fresh session can pick up exactly where the last one stopped. Nothing is trusted unchecked: specs are re-read, premises are tested against the code, and reports are verified. And the human stays at the points where judgement matters, which are approving the spec, feeling the result, and saying "commit", while staying out of everything else.
The workflow is not frozen. It has been revised several times as the project grew, each time to go faster without lowering the standard.
1
u/redtear1115 13d ago
Long plans always look fine when I skim them, and I only catch the gaps once the code starts moving. Half the time it's just reading fatigue on my end. Breaking the work down so the plan stays short enough to actually read helped me more than adding another review layer. If you try having Codex challenge Claude's plan, how do you keep the back and forth from turning into another long doc to go through?
1
u/DataDr0p 13d ago
Teilt eure Module auf und setzt in jeden Unterordner Skill und Agents. Ich habe eine Code Factory von 190 Dateien und Ja es muss bei jeder Aufgabe Prio sein, dass er zuerst immer einmal liest und durch die Überschriften zu jeder Aufgabe sich das richtige aus der Code Factory zieht! Er wird nie alles lesen und sich nie an alles halten! Menschen machen das auch nicht! Irgendwann hat man ein Gespür dafür ob das was man orchestriert hat funktioniert und das Wichtigste von allem! KI ist eine Copy Maschine! Am besten habt ihr vorher Projekte gehabt wo er sich an dem Stil orientieren kann! Ich will hier niemanden motivieren das zu tun aber die beste Methode ist sich GitHub Repo zu holen! KI wurde darauf trainiert in GitHub zu klauen, also ist es leicht die Methode selber zu verwenden!
1
u/RealFullMetal 13d ago
on the drift part, it helps to know what survives compaction. project-root
CLAUDE.md, unscoped rules and the plan from plan mode are re-injected from disk, so you don't need a hook to re-add those after a compaction. path-scoped rules and nestedCLAUDE.mdfiles get summarized away until claude touches their files again, and only the five most recently modified files it read come back, so an adr it read early usually isn't in context anymoreso the decisions that must not drift belong in the root
CLAUDE.mdor an unscoped rule that points at the adrs, not only in the adrs1
u/kthuiaa 13d ago
plan drift usually starts when the plan only lives in the chat. i think it helps to have the planning session write it to a file with a short must-keep decisions list, and have each task session check its diff against that list before it finishes.
1
u/Right-Performance-93 13d ago
i don't let the second model read the plan. it gets the diff and the original ask, and one question: name one thing the user still can't do. if it can see claude's writeup it just agrees.
1
u/Alexander_Golev 13d ago
On large codebases, it can be helpful to run Fable with high reasoning on an open question like, "Tell me, is everything clear to you about this codebase? List confusions, contradictions, and ambiguities you stumble upon". We call it a "wtf check" internally. Large codebases accumulate such debt and need periodic sweeping.
1
u/RE-call 13d ago
Make Claude preregister the result. Before a task runs its tests or a measurement, Claude writes down what it expects and commits it. A flawed plan then shows up at the first task where the result doesn't match, instead of halfway through implementation. Without that, Claude is so good at explaining things that it will find a suitable answer no matter what the results are. A simple hook enforces it for me: it blocks the measurement command while the prediction is uncommitted. It costs a few lines per task, far less than a second planning round.
Narrow every task as much as possible. Simple tasks, a bug review after each one, and the agent always tests and confirms before calling it done. Each task gets only the context and tools it needs, including the ADRs that apply to it, plus a clear statement of what I expect from it. Most drift I saw came from sessions carrying too much context, not too little.
1
u/smermetfr 12d ago
drift is usually a storage problem, not a model one. the plan lives in the context window, compaction eats it, and the agent rebuilds from whatever it still remembers. write the decisions into the repo as a file every session reads first, then have it restate them before it starts.
1
u/carstenkoch 13d ago
Hey, we run a similar setup on an open-source database (RFCs where you have ADRs, a PM agent that plans, coder and reviewer sessions, a merger), and drift was our biggest problem too. What helped most was turning decisions into checks that fail. A decision that exists only as prose is one the agent will drift from sooner or later.
Three from this week: the code snippets on our landing page are type-checked against the SDK, so the page can't describe an API that no longer exists; every RFC records later decisions in a fixed form, and the gate fails when one doesn't; and the decision log keeps only decisions that still bind work, so the agent never reads a superseded one next to the current one.
For planning, I review the RFCs and diagrams of the architecture, and most PRs merge without me. Reviewing every PR made me the bottleneck; reviewing the plan catches the flaws while they're still cheap. I haven't tried a second model challenging the plan. Has anyone measured whether it finds different flaws than a person reading it?
0
u/ankush2282 13d ago
I am in the same boat while building a enterprise grade security solution from last 9 months and when I reached closure to the MVP i start finding bugs, integration issues even after having such a hardened dev environment with almost 6-7k tests per merge including security, compliance, quality etc yet it produce half built features and left it for follow up even after clear instructions to finish end to end. I installed claude-mem for context but still same. Now I moved back to sonnet 5.5 as default and kept opus only for planner, architecture decisions, review because even if you keep opus output is same. Hallucination is now at next lvl I am becoming manager of a fresher whom I need to groom everyday. Every session i need to start with abuse to burst out my frustration 🤣. It seems the bigger the codebase more complex is to maintain the quality and context.