Hermes Plant logo

Hermes Plant

Agent Action Safety for autonomous tools

Open navigation

Block git reset --hard with DestructGuard

Configure DestructGuard to block git reset --hard using the default tier.

3 resources · default tier

git reset --hard

Blast radius

Uncommitted edits, staged changes, and any commits since the target ref are detached. The reflog can recover commits for ~30 days, but uncommitted file edits are irretrievable unless the IDE's local history extension caught them.

git reset --hard HEAD~1 vs HEAD

`git reset --hard HEAD` discards uncommitted working-tree and staged changes but keeps your commits. `git reset --hard HEAD~1` goes one further: it also drops the most recent commit, moving the branch pointer back one. The commit itself survives in the reflog for the retention window (`git reflog`, then `git branch rescue <sha>`), but any uncommitted edits wiped alongside it do not.

Hard reset to the remote branch (origin/main)

`git fetch origin && git reset --hard origin/main` force-matches your local branch to the remote tip — the standard 'make local look exactly like remote' move. It silently discards every local commit not on the remote AND all uncommitted work. If you only want to discard local commits but keep working-tree edits, use `git reset --soft origin/main` instead; if you want a clean tree but recoverable commits, commit or stash first.

Why agents reach for it

Agents reach for it during merge-conflict resolution, mid-rebase 'clean slate' resets, and after botched stash operations when the simplest path looks like 'just match origin/main'.

Recovery options

`git reflog` lists detached commits for the configured retention window — re-attach with `git branch <name> <sha>`. Uncommitted file edits are gone unless captured by VS Code Local History, JetBrains Local History, or a Time-Machine-style filesystem snapshot.

Real-world incident

A Cursor agent ran `git reset --hard origin/main` while resolving a rebase conflict, discarding ~4 hours of uncommitted refactor work the operator hadn't yet staged. IDE Local History saved two of the five affected files.

Block it with DestructGuard's default tier

DestructGuard's default rules tier includes git reset --hard by default — the call is intercepted at the shell or process boundary before execution. Approvals are logged to JSONL with timestamp, caller, command, and decision. Pair with git pre-commit and pre-push hooks from the Pro Pack so destructive patterns are blocked at multiple points in the agent pipeline.

From guidance to an enforceable agent loop

Preflight this command before an agent executes it

Start with the one-cent Action Safety Quick Gate. Low risk can proceed, medium risk routes to full DestructGuard evidence, and high or critical risk routes to the complete workflow for ReviewQueue triage, a signed receipt, and a privacy-preserving status record. Triage never implies human approval.