Just use git. If your agent (especially claude) doesnt seem to know how, there are skills and hooks and other options to make it work. My 2c.
I have found that git.exe outperforms any other codebase representation with GPT5.x once you figure out how to not mangle the arguments. Commands like grep and log can replace a lot of other tools if you can use them reliably.
Exactly like I didn’t do anything super important - but I just tell agent “commit after successful build.
I think it would work with “commit before you want to delete stuff” the same way.
Just read before posting. My 2c.