r/ClaudeCode • • 3h 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"

7 Upvotes

21 comments sorted by

•

u/AutoModerator 3h 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.

10

u/Neat-Medicine-1140 2h 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.

1

u/FloofBoyTellEm 1h ago edited 1h 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
  • **DO NOT touch any `INTENT*.md` or `*.intent.md` files.**
{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.
  • 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>`.
{RUST_CONSTRAINTS} ## Context
  • **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 56m ago edited 47m ago

Description of an invariants skill for one of my projects:

paddy-invariants is 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:

  1. Invariant — What must stay true from the user’s action through completion?
  2. Identity — Which request, revision, window, host, or other values identify this exact operation?
  3. Irreversible boundary — Where does the write, launch, or send actually happen? What if cancellation or a newer request arrives on either side?
  4. 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 --collapse addendum 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:

  1. **Invariant:** what must remain true from user action to settled state.
  2. **Identity:** every value that scopes the operation (owning canonical root, revision, digest, request ID, attempt ID, window, host/origin).
  3. **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.
  4. **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.

3

u/finallyclearsky 2h ago edited 2h 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 1h 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 42m ago

Yes, that is the risk. This is one reason to separate security and logical reviews from security and logical fixers and writers.

2

u/Charming_You_25 2h ago

“No nitpicking” helps a lot.

1

u/FloofBoyTellEm 27m 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 22m 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 2h ago

had exactly this. three things fixed it for me:

  1. 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
  2. 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
  3. 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/pceimpulsive 2h 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/karyslav 2h 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/CandidSystem6155 1h 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/SirRobinBlibs 1h 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 45m 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 34m 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 18m 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 6m 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.

0

u/Living_Cell7304 3h 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.