I’m not advocating for no source control, but you can avoid loops like this with Architectural Decision Records. If you’re real lazy, let the agent maintain the ADRs and they will usually call out when these “painted into a corner” scenarios happen and you can then reason them around it.
> Hmm, I have destroyed the file again, that's odd. Let me rebuild it from a half recollection of what it was supposed to do based on my compacted context.
It's the right approach if your business is selling tokens and the customer doesn't know any better.
Don’t let adversarial agents work on your code?? What is protecting an ADR against adversarial agents going to solve if they can just embed a highly advanced, obfuscated ‘rm -rf windows32’ anyway