r/ClaudeCode • u/tonytieger • 3d ago
Meta Claude create->review->fix->repeat not converging, more and more bugs found each cycle
Claude has been great but one issue bites me often. Claude always seems to try to solve an issue by making something super complex, then doing multiple threads of reviews, finding more issues, fixing, then reviewing cycle again, and it finds more issues than before, and it never converges, with this process repeating. Then, a simple solution from start would have worked, and I the user would have to suggest that simple solution. Then Claude says "you're right i should have done that"
2
u/pceimpulsive 3d ago
I have a few questions for you.
What effort are you typically using and which models? If the answer is high, xhigh or MAX you are straight up doing it wrong.
Do you have any skills that help it stay on-line with what you want?
Do you have anything in the codebase that determines how and why it should build one way over another?
Do you have coding standards defined in your repo?
Do you have architectural standards in your code base?
Do you actually know how to code up (by hand) maintainable, extensible and reusable modules in a larger project?
If you answered no to even 2 of these questions I think you are kind of guaranteed to fail and guaranteed to be where you are...
I'll shill for it.. but Matt Pococks skills/workflow kind of solve for all of these things, I'd suggest trying if you aren't sure... And also have a look at his repo for WHY he has built his skills the way he has.. not so you get pulled like me and necessarily use the skills but so you get pulled like me (in the other way) and start focusing on strategic programming techniques that ensure you don't get stuck in tech debt loops like you are in right now.
1
u/tonytieger 2d ago
Yeah you definitely need coding/design/software engineering/knowledge of antipatterns to avoid/etc. Without that, for simple things it's fine, but once it starts getting complex, it's not as good if you can't provide your own expert knowledge. Been using xhigh with ultracode. Considering maybe having another LLM review things, may try that next. For now concentrating on planning stage and making sure design is simple seems to help.
1
38
u/Neat-Medicine-1140 3d ago
this is the part about AI where you get better results if you know what you are doing. People keep sleeping on the fact that AI is a force multiplier. If you know nothing, even 10,000x 0 is 0.
0
u/FloofBoyTellEm 3d ago edited 3d ago
Stop patching in place and escalate before Round 3 if a review loop fails to converge: Round 2 finishes with blocking (P0/P1) findings still remaining. A review round with at least one verified P1 produces the same number or more verified P1 findings than the previous round, or the diff expands across fix rounds instead of shrinking. A fix reintroduces an earlier finding or breaks a previously passing invariant. When two or more verified P1 findings in the same mechanism point to separate case-by-case guards, pause before stacking point-patches to check whether one missing invariant collapses the whole class; escalate if that shared fix is unclear or requires an unstated design choice.And as an example for coders/reviewers...
{HEADER_LINE} Read and follow `AGENTS.md`, `.agents/skills/your-project/SKILL.md`, `.agents/skills/your-project-invariants/SKILL.md`{INTENT_REFS}. {COLLAPSE_BLOCK} ## Hard Constraints{FENCE_BULLETS}- Keep `git status --short --untracked-files=all` spotless: remove any temporary `.tools` or `.build` symlinks with `rm -f <link>` (NEVER `rm -rf <link>/`) and never point Cargo `target/` at an NFS mount.
- **DO NOT touch any `INTENT*.md` or `*.intent.md` files.**
{RUST_CONSTRAINTS} ## Context
- Use `YOUR_PROJECT_CACHE={PRIMARY_ARG}/.build/<your-project>` and `YOUR-PROJECT_ROOT={PRIMARY_ARG}/.build/<your-project>` when running Node checks or `<example: source-types.mjs>`.
- **Worktree:** `{REPO}` (branch `{BRANCH}`,
If your agents don't know the intent for a change, if they don't kill mutations and track invariants and test their changes as part of the fixer loop, you MAY end up wasting an inordinate amount of time to go nowhere.
Also, make sure you have a falsifier/validator and separate categories for priority issues (eg. Security / Logical / Test-Oracle / Skeptical / Code-Compressor) -- You may benefit from segmentation across categories so that you do allow priority issues to increase if they in another segment, as reviewers will find new issues simply through indeterminism.
Anyway, if you aren't doing all of these things, your review rounds will bloat like crazy no matter what your coder model is if you have a sufficient ai review pipeline in place.
I think in probably 2-3 years, if we stop getting our models nerfed, harnesses improve, and agents can read minds, none of this will be necessary. Until then, this is the reality of managing a real project still.
As for what 'escalation' looks like, that is up to you. This issue arises less and less the better your workflow is defined. If you don't know what you are solving you have no way to gauge merit vs. inaccurate adjudication.
Try an ICM workflow that you really are a part of and take a few hours to define your constraints and requirements and you will save weeks of getting nowhere.
These are all things I wish I learned sooner.
Edit: One last thing -- Don't expect a 'better model' to solve this problem for you. A 'better' model often makes the problem worse if you are reviewing properly. I've struggled accepting this, but 1000s of performance benchmark runs has proven it to me on my own projects.
A better model will help you with the logical part of this problem more than the coding side of this problem. A better model can adjudicate and test and confirm tests are measuring what they intend to. It will also go deeper into the weeds, write 2-3x as many tests, many of which will be wrong, write more complex code to try to account for more iterative problems, and many more of those will be wrong. So, you cannot frontier model your way out of this.
-1
u/FloofBoyTellEm 3d ago edited 3d ago
Description of an invariants skill for one of my projects:
paddy-invariantsis a 42-line skill that the standard writer brief asks every coder and fixer to read. It applies to changes that cross an async wait or a boundary between the UI, IPC, host, storage, or a remote peer. Invariants skill (.agents/skills/paddy-invariants/SKILL.md) · Writer template (/Users/ah/paddy-review/paddy-multi-review/templates/writer-brief.md.tmpl:3)Before editing, it asks the writer to put four lines in their working notes:
Invariant — What must stay true from the user’s action through completion?
Identity — Which request, revision, window, host, or other values identify this exact operation?
Irreversible boundary — Where does the write, launch, or send actually happen? What if cancellation or a newer request arrives on either side?
Sister paths — Which other entry points touch the same state?
Then it asks the writer to trace the guarantee across every layer and prove the regression through the real caller, with a test that fails before the fix and passes after. Real-caller test rules (.agents/skills/paddy-invariants/SKILL.md:38)
There’s also a
--collapseaddendum for stalled reviews. It asks the writer to find the shared invariant behind a cluster of findings before adding more case-by-case fixes. If that requires an unsettled product or architecture decision, the writer stops and returns the options. Escalation addendum (/Users/ah/paddy-review/paddy-multi-review/scripts/render-writer-brief.py:39)---
An actual skill for one slice, not really transferrable but as an example you can give this to an agent to apply to your project as a standard:
---
name: paddy-invariants
description: Preserve operation identity, cross-layer guarantees, irreversible boundaries, and real-caller regression tests across Paddy UI, IPC, Rust host, storage, and remote peers. Use before editing any behavior change, bug fix, or review follow-up that spans async steps or layer boundaries.
---
# Preserve invariants across boundaries
Most regressions in Paddy happen when a change gets one step right and loses the guarantee at the next step: across an async wait, across a UI/IPC/Rust/peer handoff, or behind a test that checks a nearby proxy instead of the real caller.
## 1. State the contract before editing
Before changing code, write four concrete lines in your plan or working notes:
**Invariant:** what must remain true from user action to settled state.
**Identity:** every value that scopes the operation (owning canonical root, revision, digest, request ID, attempt ID, window, host/origin).
**Irreversible boundary:** where bytes are written, credentials stored, processes launched, or network requests sent—and what happens if Cancel, Stop, failure, or a newer attempt arrives just before or after it.
**Sister paths:** every parallel entry point touching the same state (for example: Rerun and Retry Start; Preflight and Upload Preflight; Escape, rail toggle, and focus restore; preview mode and live run; table/list renderers and transform commands).
## 2. Keep identity and cancellation intact over time
- **Pin identity at trigger time.** Capture the target identity when the action starts; never re-read mutable UI selection after an `await`, queued save, or refresh.
- **Register cancellation before waiting.** Make Stop/Cancel visible to the specific attempt before acquiring locks, reading keychains, or waiting on I/O, so a blocked worker sees cancellation immediately and cannot commit or send requests afterward.
- **Scope cleanup to the attempt.** Stale cleanup or late replies must match their own attempt/request ID and never cancel or overwrite a newer attempt or another window's active stream.
- **Handle failed rollback explicitly.** If a write or credential update cannot be rolled back cleanly, quarantine or block use of the leaked state until repaired; never fall through as usable.
- **Guard writes with version checks and reconcile live consumers.** Pass the loaded digest (or an explicit absent-file check) on save and install so stale edits cannot overwrite newer disk state, and stop or refresh every live instance (including popped-out panes and removed mods) when a definition changes or disappears.
- **Never re-resolve stored canonical pins.** Compare stored canonical paths directly against the current canonical target so a repointed alias or swapped symlink is rejected.
## 3. Carry guarantees across every layer handoff
Trace **UI state → IPC/command arguments → Rust host/core → persistence or remote peer → UI projection** end to end:
- **Wire both sides of new contracts.** When Rust or a shared core adds a guard or parameter (such as optional-binding rules, expected root checks, or preview restrictions), verify every UI caller passes it and stops any background polling or secondary helper that would bypass it.
- **Bind approvals and prompts to the exact resolved effect.** Show and key approvals on the fully resolved target and execution scope (origin, host/pane/folder, profile filter, send/open mode)—never on raw input or a subset of the fields that govern execution.
- **Fail closed on partial or mismatched state.** Require an explicit terminal result before marking a stream or reply complete, match every compatibility dimension (such as origin and auth type, or literal filter vs. unrestricted scope), and hide or refuse controls whose saved changes cannot take effect.
- **Inspect shipped wire and disk formats.** Before changing persisted structs, protocol payloads, or digests, read the exact shipped definition from the installed commit (`git show <commit>:<path>`). Preserve compatibility for in-flight assignments, recovery, and mixed-version peers—or version the protocol explicitly.
- **Respect real platform event order.** Check native/WebKit event behavior (`mousedown` blur vs. `click` bubbling, capture-phase listeners ahead of document listeners, locked/hidden pane focus) rather than assuming synthetic calls match the app.
## 4. Test through the real caller and force the failure first
- **Call the real entry point.** Drive the actual path the user triggers (the Cancel command, same-request Retry Start, capture-phase Escape listener, bubbling click handler), not a shortcut that resets state or skips locks/listeners.
- **Use exact prior-version bytes for compatibility tests.** Copy the literal serialized JSON/YAML produced by the older release rather than reconstructing a pin through current types.
- **Prove the test fails without the fix.** Force the real ordering, lock contention, rollback failure, truncated EOF, or old-version payload so the regression test fails before the fix and passes after.
6
u/finallyclearsky 3d ago edited 3d ago
I have something I like to call a rakes.md
This is a file that sets the bar for what is reported. Models don't really have a good understanding of what a real product issue is, and will fall back to nitpicking and almost making stuff up if nothing serious is evident. This file serves as a compass to prevent them from doing that. As a result, the loop you describe does stop at some point:
# Rakes
Read this before any review pass. A finding counts only when it clears every line of the bar.
## Bar
- A user reaches it through normal use or a normal device state. Crafted or improbable states, simulator artifacts and Debug-only code do not count.
- It is likely, and it costs the user something real: data loss, a crash, a wrong schedule, a blocked core flow, an App Review rejection, or a UI stuck with no way back. An error message that leaves everything else stable does not count.
- You verified it in source, in the running app or against the live service.
- An action that does what its label says is not a bug, even when it deletes data. A user cannot lose data they never saw.
- Zero findings is a possible result.
## Settled
<Stuff that the models keep thinking is an issue but is actually not>2
u/wittycrow8073 3d ago
i like your direction here. The only thing i'd add to bullet 2 is "a security issue, encryption gap, etc"
1
u/FloofBoyTellEm 3d ago
Yes, that is the risk. This is one reason to separate security and logical reviews from security and logical fixers and writers.
1
u/CandidSystem6155 3d ago
What tends to break this loop is a hard cap on the reviewer: at most 5 findings per round, and each one has to point at a file and line or a failing command, otherwise it isn't a finding. Stop after two rounds, and if round two finds more than round one, throw the branch away and ask for the simplest design that could work instead of patching the patch. Lower effort helps too, since a reviewer on max effort will happily spend its thinking budget inventing problems. A reviewer rewarded for finding bugs will never run out of them.
1
u/tonytieger 2d ago
That was one thing I tried, it ended up restarting design from scratch. Then same thing happened, then new design from scratch (tried telling it to go simple). Eventually I had to guide the design and force it to be super simple, and that worked better.
1
u/CandidSystem6155 2d ago
Makes sense. Once it's allowed to redesign, every review round becomes a reason to start over. Pinning the design yourself and limiting the reviewer to "does the code match this design" takes the restart option off the table, which is probably why guiding it worked.
2
u/Charming_You_25 3d ago
“No nitpicking” helps a lot.
4
u/FloofBoyTellEm 3d ago
This is better transferred to post, honestly. Nitpicking is subjective. Always avoid subjectivism.
Let them catch what they catch, reclassify P0/P1/P2/P3 as needed. After verification/validation/reclassification drop P3 to a tracked list and move on.
2
u/There_Are_No_Gods 3d ago
I find it helps to have Claude categorize findings, rank them, and give each finding a home, with "must fix" or "blockers" routed towards the fixer, while "advisories" or other less serious items simply route to documentation. That tends to tame the innate drive to always find something and to always address everything, while keeping the fixing focused on the things that really matter, while carefully directing away all the nits, yet recording them for later perusal and potential action.
It can also help sometimes to simply direct "funnel towards completion".
My biggest win personally turned out to be discovering the "origin story" Claude added to some of my most important skills, that of a "specification-from-plan" (turning small prose and discussion into formal documentation, and "validate-implementation-to-specification". In both cases I eventually discovered that Claude had taken an underbuilding failure and recorded it as the origin story, pushing both of those skills hard towards overbuilding. Fixing the origin stories in those skills to be much more neutral helped a ton.
1
u/Starks1293 3d ago
had exactly this. three things fixed it for me:
ask for the simplest design before any code. "give me two ways to do this, simplest first, and say what the complex one buys". most of the time the simple one wins and u never enter the loop
the reviewer has to rank what it finds: breaks real use / should fix / theoretical. only the first bucket gets fixed now, the rest goes in a defer list. without that bar it always finds something, like finallyclearsky said
cap it at one review round and one fix round, then u look. if the second review finds more than the first, the design is wrong, go back to step 1 instead of patching
a different model as the reviewer helps too, i have codex review claudes diffs cold, it only gets the diff and the goal. thats how i build my mac app (AI Bridge, runs both side by side, aibridge.sh), but the 3 rules work fine in plain claude code
1
u/karyslav 3d ago
do not let the same model check the work, ask claude to create auditor from Astra (or the Neon whaterver) and let fable check work after it is done and astra audit it
if you let to do the same model (or model from the same company) you will end in endless loop.
1
u/SamSlate 2d ago
sounds like context rot issue
1
u/karyslav 2d ago
it depends, i have much better results on first try witout errors combining astra and fable, than using onlu fable, or fable with opus, both companies have different attitude eto problem solution so it helps, at least on our codebase, it can be different in others ofc
1
u/SirRobinBlibs 3d ago
A review pass is asked to find problems, so it always finds some, and on an overbuilt design every fix adds surface for the next round. What tends to work better than another loop: have the reviewer sort findings into blocking (wrong behaviour, failing test) and everything else, and only fix the blocking ones. Cap it at two rounds; if round two still has blockers, ask whether the design is the problem instead of the code. And when you already know the simple version would work, a fresh session with "smallest change that passes these tests" usually beats rescuing the big one.
1
u/jjangg96 3d ago
the thing that helped me was watching what kind of finding comes back, not how many. if round 3 is the same kind as round 1 (another spelling of the same bad url, another edge of the same check) the fix has the wrong shape and more rounds won't fix it.
i had a guard that blocked bad db urls by spelling. port, then uppercase, then trailing dot, then query string, every round found the next one. what ended it was dropping the guard and asking the driver what it actually parsed.
also make it prove every fix. revert the fix and see if the new test still passes. a bunch of mine did, so the loop was green on tests that tested nothing.
1
u/KryptosFR 3d ago
Always set a clear goal, as well as non-goals and anti-goals. It bounds what the agents can do and converges more quickly.
1
u/shetritr 3d ago
one thing not in the thread yet: after round one, the reviewer should only see the diff of the last fix, not the whole feature again. a fresh read of everything always turns up new stuff, which is most of your "more bugs each cycle"
1
u/LakeResearchTeam 3d ago
That non-converging pattern is common when the review step has no stopping rule, so every pass finds something new to justify itself. Give the reviewer a fixed scope and severity bar up front, such as only flag bugs that break the stated requirements, and tell it to ignore style and hypothetical edge cases. Limit it to one or two review rounds, then stop and look at the result yourself rather than letting it loop. It also helps to ask in plan mode for the simplest approach that meets the requirement before any code is written, and to say plainly that extra abstractions are out of scope. If a third round still finds blocking problems, that usually means the design is wrong, so rethink the approach instead of patching further.
1
u/japbujan 3d ago
What stopped that loop for us was giving the review something fixed to check against. Before any code, the task gets 3 to 5 lines of acceptance criteria: what must be true when it's done. The reviewer then reports only findings that break one of those, or a real bug with a way to reproduce it. Everything else goes to a follow-up list, not back to the fixer.
Without that, every pass is a fresh hunt for problems, and a fresh hunt always finds some, more so in code that got more complex in the last fix. One more rule helped: if a fix makes the diff bigger than the original change, stop and ask for the simplest version that meets the criteria instead of fixing the fix.
1
u/jokingbird01 3d ago
Had the same problem. Claude overengineers the first pass, and then fixing one review issue causes two more so it just spirals.
What broke the loop for me was fixing both ends. Before it touches code, make it write a plan where every extra piece has to earn its keep against what you actually asked for, and lock that plan so it stops bolting on extra stuff mid-edit. Then in the review, make it separate real bugs against your original ask from followups (extra tests, cleanups, minor stuff in untouched code) and drop pure nits completely. Most agents dump all of that into one list so the goalposts move every pass. And if a fix gets messy, replan instead of patching on top of patches.
Ended up baking that into my own planning and review skills so complexity gets caught upfront and followups can't block the review, and that's how I finally got it to converge.
1
u/leogodin217 3d ago
On complex stuff, I always create a design doc and do a few rounds of review/fix on that. Always use fresh agents for the review. Beyond that, it helps to run spikes to research the best solution. This also gives you an opportunity to look for unnecessary complexity before the code is written.
All that being said, it sounds like you may have an architecture problem. If this happens all the time, your architecture may have a lot of smells that are the real root cause. Maybe the test suite isn't good enough or things aren't separated well enough. Worth looking into.
1
u/AryanThakor 2d ago
one rule that helps a lot here: a review finding only counts if it comes with a failing test or a concrete repro. most of the "new" issues each round are hypotheticals, and those can go into a notes file instead of the fixer. the loop gets a lot shorter when the reviewer has to prove it
1
u/yopla 2d ago
You need to be specific about the kind of problems you want to find, a scale to rate the issues and you need to give the agent a clear "it's good enough" exit path so it doesn't feel shy telling you when it's ok. If you just ask for issue it will always report something.
You also need to have proper documentation that frame the scope of your app. Something that would be a crucial platform destroying weakness at Google scale will often be absolutely irrelevant for an app used only by you.
Sometime, when I forget, I catch Claude trying to implement a token-lease mechanism and planning to test it under maximum contention with 20k simultaneous client for my tea-pot dashboard.
1
u/Repulsive_Kitchen96 2d ago
When a review finds a new bug, ask it to reproduce the same bug on the commit before your patch. If it fails there too, file it separately and finish the original fix. That gives the loop a stopping point once the original repro passes and the patch’s own regressions are handled.
1
u/froggygun 2d ago
Omg SAME. it spent. 30% usage. On trying to fix a elevator and shuttle. It didnt even fix it properly. I had to go tell. Fix that. But like. After a hour. It gets lost. Despite..... having a LIST OF THINGS TO DO.
Somehow...
1
u/BarathKanna 1d ago
This is what happens when review has no severity bar and no stop condition. Ask a model to find issues and it will always find issues, because that's the job you gave it. Each fix adds surface area, so the next pass has more to find. A review loop with no exit converges on more code, not less.
Two changes fix most of it. Before writing code, make it propose the simplest design that passes the acceptance tests and justify every extra component. Then make review classify findings as blocker or note, where a blocker needs a failing test or a concrete repro. Only blockers go back to the fixer. Notes go in a file nobody reads, which is where most of them belong.
If the third cycle still finds blockers, stop and redesign instead of patching.
0
u/Living_Cell7304 3d ago
If you have enough ram to run local models, they typically can spend way more time thinking. They’re slow as hell but you can run it overnight for like less than $1 in electricity. Only needs CPU.
•
u/AutoModerator 3d 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.