What is your go to move when an AI coder starts looping on the same bug?

by•

It’s so annoying when you feed an error to an agent it fixes one thing, breaks another, and then reverts right back to the first issue two turns later.

Once the chat gets flooded with raw logs it feels like it completely forgets the big picture and just starts guessing.

Do you just wipe the chat completely at that point or is there a prompt trick that actually gets it to stop and rethink?

20 views

Add a comment

Replies

Best

Letting it do self reflection along the way seems to help a lot.

Also, asking for a continuation prompt, and starting over in a fresh session with a clean context window.

Sometimes I also give the prompt to another model entirely (switching between codex and claude code), that seems to work pretty well.

What I also found is that some bugs are more structural problem by the AI coder introducing a kind of entropy in your codebase, duplication, mismatching docs, too big functions, etc... so I often run an "entropy-reduction" loop, where it scans the codebase architecture, the performance, security, doc drift, etc.. a few more axis, which then afterwards I use n subagents to create plans to address those points, this helps a lot with keeping things under control.

I usually trim everything down to the few errors that actually changed the situation.