r/ClaudeCode • • 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:

  1. 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.
  2. 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.

18 Upvotes

29 comments sorted by

•

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

  • Make the plan cite evidence. Every step names the files, functions and interfaces it touches, and has a short "assumptions" list. A plan that says "extend the billing service" without pointing at the code it read is the one that falls apart in implementation.
  • Ask for the riskiest assumption explicitly, then spike it before approving the plan: a 20 minute throwaway branch that proves the data model or integration actually works. Most "architecturally flawed" plans are one wrong assumption deep.
  • If you add Codex as an adversary, scope it narrowly so it doesn't slow you down: only the data model, public interfaces, migrations and anything irreversible. Give it a fixed checklist and a single pass. Reviewing the whole plan line by line is where the process cost comes from.

Plan drift

  • Turn the decisions that matter into checks, not documents. Import boundaries (dependency-cruiser, eslint 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.
  • Keep the plan as a file in the repo with checkboxes the session updates as it goes, and start each implementation session fresh with that file plus only the ADRs relevant to the task. Drift grows with session length, especially after the context gets compacted and the early instructions are summarised away.
  • When it does drift, ask it to update the plan first ("we're deviating from step 3, here's why") before changing code. That makes drift a visible decision instead of something you discover in review.

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.

1

u/jvertrees 13d ago

This is actually pretty good advice.

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:

  • One task per session, sized to finish before the context gets long. Drift grows with session length more than with anything else.
  • Give each implementation session only the decisions relevant to its task, with the reason ("handlers never query the DB directly, always through the repository layer, because X"), not the whole ADR folder. The reason is what lets the model apply the rule to cases it doesn't literally cover.
  • Verify against the plan, not just against tests. After implementation, a fresh session (or Codex, since it already reviews for you) gets the plan plus the diff and answers one question: does this diff do what the plan said, and does it break any listed decision? Drifted code passes tests all the time.
  • Turn the decisions you keep correcting into mechanical checks: lint rules, import boundaries, a CI grep. If you've corrected the same drift three times, it shouldn't be a prompt anymore.

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:

  1. Make "this task needs to change a decision" a stop, not a judgment call. Most of our drift wasn't the agent forgetting an ADR. It was the agent deciding mid-task that the ADR didn't apply here. A standing rule that it stops and says which decision it wants to change, and why, turned silent drift into a question we answer in a minute.
  2. Close against the plan, not against the tests. Each plan has numbered acceptance criteria, and whoever closes the task has to show evidence per criterion: a test name, a command and its output, a file and line. We compared this with a plain "done when CI is green" on the same tasks, and the difference showed up exactly where the existing tests didn't cover the change. Green CI let the gap through; evidence per criterion caught it.

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

  1. Read first. The architect opens by reading a small set of canonical documents in a set order: the current state of the project, the architecture, the roadmap, and a ledger of everything that has been deferred.
  2. Write the spec. The architect drafts the block's specification, then reviews its own draft twice, the second time stepping back and reading it cold.
  3. Owner approves. Nothing reaches the builder until the owner has approved the spec. Product questions are put to him in plain language, usually as multiple choice.
  4. Hand off. The architect writes a handoff for each build session: the context, the critical points, the quality bar, and the format the report must come back in. The owner pastes it into a Claude Code session.
  5. Check the premise. Before the first edit, a fresh agent checks the handoff against the real code, so that a wrong assumption is caught before it is built on.
  6. Build. The builder works on the block's own branch, commits there when the tests pass, and pushes at the end of every session, so the next handoff is always written against the real code.
  7. Feel-check. The builder runs the mechanical checks itself. The owner then uses the software and reports what he sees in screenshots and one-line notes. He judges by feel, never by reading code. This step typically catches six or more real defects per block.
  8. Proofread. The architect checks the builder's report against the actual code before anything is accepted.
  9. Merge on the owner's word. The main line moves only when he says so.
  10. Close the block. A documentation-only commit updates all the canonical documents together, so they never drift apart, and the kickoff for the next block is written.

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 nested CLAUDE.md files 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 anymore

so the decisions that must not drift belong in the root CLAUDE.md or an unscoped rule that points at the adrs, not only in the adrs

1

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/lgmarian 12d ago

It seems to me that they are saving their plans, since they mention ADRs, though it isn't stated. At any rate, rereading the post made something jump out at me, that I can provide some advice about.

OP, don't shy away from reviewing plans with another model, or at least a fresh session. I do this regularly, having the review pass create a new plan, or a list of concerns to bring back to the original planner to create a new plan. There's usually something to improve in the original plan.

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.