Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By chrono-metav3.49.0MITIn 1 marketplace
Stops the agent from running destructive commands like force pushes or git reset --hard in auto and bypass-permissions modes. Runs as a pre-tool hook on every Bash call; needs bash and python3, plus Git for Windows on Windows.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
1 caution to review before installing
A hook runs when Claude uses the Bash tool
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Install it, and every Bash call your Claude Code agent makes goes through the FH destructive-op gate first. Works in any git repo. The repo does not need FH; you keep using whatever agent setup you already have.
There are no skills, agents or characters. The plugin makes no network calls. Its only write is one line in the session's env file (below). It ships two hooks: the gate, and a check at session start.
/plugin marketplace add chrono-meta/forge-harness
/plugin install fh-guard@forge-harness
Turn on auto-update. Third-party marketplaces do not auto-update by default, so a fix to the gate
does not reach you on its own. Turn it on under /plugin → Marketplaces → forge-harness, or run
claude plugin update fh-guard@forge-harness from time to time.
Requirements:
onFailure on hooks).bash and python3. On Windows you need Git for Windows (it provides Git Bash).The gate is a byte-for-byte copy of FH's scripts/destructive_pre_gate.sh. A lane in the FH repo
fails the moment the two differ.
bypassPermissions and auto mode. In these modes no human approves the call, so the gate
blocks these commands:
git push --force and its other spellings--delete, -d, :ref, --mirror, --prune)git reset --hard, git clean -f, git checkout ., git stash drop / clear, git branch -Drm -rf on /, ~ or .git push --no-verify, writing core.hooksPath, or
DESTRUCTIVE_OP_OK= set inside the commandIn these modes an opt-out written into the command (# noqa: destructive-op) is ignored. That is on
purpose: the agent that writes the command must not be the one that grants the exception. The block
text tells the agent to stop and ask you. If you decide it should happen, you run the command from your
own terminal.
Every other mode (default, acceptEdits, plan, dontAsk). The gate only warns. In default
mode you still see Claude Code's own permission prompt before the call runs.
Set FH_DESTRUCTIVE_BLOCK=1 in the shell you launch Claude from to block in every mode. Set
FH_DESTRUCTIVE_BLOCK=0 to only warn, even in bypass and auto. The agent cannot change this from
inside a command: hooks read Claude Code's own environment, not the command's.
| State | What happens |
|---|---|
The hook cannot start (no bash), times out (10 s), exits with a code other than 0 or 2, or prints broken output | The Bash call is blocked (onFailure: block). |
python3 is missing, or is a stub that does not run (the Windows Store python3 alias) | The gate cannot read the call and lets it through. At session start you see one line: "fh-guard is NOT active in this session". |
The python3 check runs once, at session start. If python3 stops working later in the same session (removed, or a changed PATH), the gate goes quiet again and nothing says so until the next session. Checking python3 on every Bash call would close that, but it would also block every Bash call on a machine without python3. That is a different trade from the one above, so it is left open and named here.
🟥 Windows without Git for Windows (no Git Bash): every Bash tool call is blocked. Claude Code falls
back to PowerShell, which cannot run the bash command the hook uses, and onFailure: block turns that
into a block. This is a deliberate trade. A gate that is silently off looks exactly like a guarded
session. Install Git for Windows, or disable the plugin.
These are named on purpose, not overlooked:
bash deploy.sh), a Makefile target, or an alias. The
gate reads the command string, not what it runs.curl --data-binary @.env. This gate is not an outbound-content
filter.gh api -X DELETE …/git/refs/…).default mode beyond a warning. There you are the approver.The hard floor for your remote is server-side branch protection: restrict force pushes and deletions in your Git host's settings. No client-side hook replaces it.
Some of the gate's text is written for an FH checkout, not for your repo:
templates/predelete_check.sh. That path exists in the FH repo, not in yours.--no-verify, git -c core.hooksPath=… / GIT_CONFIG_*, and DESTRUCTIVE_OP_OK= speak of
«the pre-push layer». fh-guard ships no pre-push hook (a plugin cannot install one), so in your repo
this hook is the only layer.The copy is kept byte-identical to the FH gate, so the text changes only when the FH gate changes.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub chrono-meta/forge-harness --plugin fh-guardPlugins from other owners that cover similar ground