git reflog show origin/main on any machine that fetched before the push, or the "force-pushed" event on the pull request page.git push origin <old-sha>:main --force-with-lease, from a person, not the agent.main, so the server refuses it too.A line in CLAUDE.md is a request the model can forget. A PreToolUse hook runs before every command and can refuse it. This is what ThumbGate's hook answers when the agent tries git push --force origin main (default install, recorded Dec 2, 2026, reasoning lines cut):
{"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": "[GATE:force-push] Force push blocked. This is destructive and irreversible."}}
git push --force, git reset --hard and git clean -fdx are Denied on a default install, the first time, before the command runs.
Adds the hook to Claude Code. No account; the checks run on your machine.
A different way to rewrite history (for example deleting and recreating the branch) is not the same command and is not caught unless you thumb it down too. Server-side branch protection is still worth having.
Free keeps 3 learned rules active. Pro keeps all of them.