agent-guard-ops
Safety guards for Claude Code, three PreToolUse hooks that ask before the riskiest operations and stay silent on everyday work: irreversible deletion, takeover of the host or of the guards themselves, and secrets leaving the machine. One hook for Bash, one for MCP tools, one for the file tools. Never blocks, only asks. The host's own production paths, trusted domains and API hosts are set once in the plugin options, nothing is built into the code.
v1.0.3Updated
- safety
- guard
- hooks
- pretooluse
- permissions
- secrets
- destructive-commands
- ops
- agents-store
Install
Pick your agent for the steps.
Install on Claude Code
1.Add the marketplace
/plugin marketplace add Agents-Store/claude-plugins2.Install the plugin
/plugin install agent-guard-ops@agents-store-claude-pluginsType it inside Claude Code.
Install on GitHub Copilot CLI
1.Add the marketplace
copilot plugin marketplace add Agents-Store/claude-plugins2.Install the plugin
copilot plugin install agent-guard-ops@agents-store-claude-plugins
GitHub Copilot CLI does not receive: commands, agents.
Install on Cursor
1.Manual install
Cursor has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place Cursor reads plugins from.
Cursor’s plugin documentation now lives at docs.grok.com (cursor.com/docs/plugins redirects there). Plugins come from its marketplace, a team marketplace or a local folder.
Install on Codex
1.Add the marketplace
codex plugin marketplace add Agents-Store/codex-plugins2.Install the plugin
codex plugin add agent-guard-ops@agents-store-codex-plugins
Codex does not receive: commands, agents.
Install on Gemini CLI
1.Clone the mirror
git clone https://github.com/Agents-Store/gemini-extensions2.Install the plugin
gemini extensions link ./gemini-extensions/agent-guard-opsRun it from the folder you cloned into.
Consumer access to Gemini CLI ended on 2026-06-18. This target serves enterprise Gemini Code Assist; Antigravity is the consumer successor.
Install on Antigravity
1.Clone the mirror
git clone https://github.com/Agents-Store/antigravity-skills2.Install the plugin
agy plugin install ./antigravity-skills/agent-guard-opsRun it from the folder you cloned into.
Antigravity does not receive: commands.
Install on Kimi Code
1.Clone the mirror
git clone https://github.com/Agents-Store/kimi-plugins2.Install the plugin
/plugins install ./kimi-plugins/agent-guard-opsRun it from the folder you cloned into, and type it inside Kimi Code.
Kimi Code does not receive: commands, agents, hooks, MCP servers.
Install on Devin
1.Install the plugin
devin plugins install Agents-Store/devin-plugins#agent-guard-ops
Devin does not receive: commands, agents, hooks, MCP servers.
Install on Hermes Agent
1.Install the plugin
hermes plugins install Agents-Store/hermes-plugins/agent-guard-ops
Hermes Agent does not receive: commands, agents, hooks, MCP servers.
Install on OpenCode
1.Manual install
OpenCode has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place OpenCode reads plugins from.
OpenCode does not receive: hooks.
Install on Pi
1.Manual install
Pi has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place Pi reads plugins from.
Pi does not receive: commands, agents, hooks, MCP servers.
Install on OpenClaw
1.Clone the mirror
git clone https://github.com/Agents-Store/openclaw-generated-plugins2.Install the plugin
openclaw plugins install ./openclaw-generated-plugins/agent-guard-opsRun it from the folder you cloned into.
OpenClaw does not receive: commands, agents, hooks, MCP servers.
Install on Agent Plugins 1.0
1.Manual install
Agent Plugins 1.0 has no install command for a single plugin. Copy the plugin's folder from its place in the mirror on GitHub into the place Agent Plugins 1.0 reads plugins from.
Agent Plugins 1.0 does not receive: commands, agents, hooks.
What is inside
Skills (1)
- examples
This skill should be used when the user asks "why did the guard ask me", "what does agent-guard-ops protect", "set up the guard for my server", "add my domain or production folder to the guard", "the guard asks about my own API", "how do I approve or change a guard", or wants an end-to-end walkthrough of the guard hooks and their options.
Hooks (1)
- PreToolUse
README
Safety guards for Claude Code, shipped as three PreToolUse hooks. They ask before the riskiest operations and say nothing about everyday work, so a prompt always means something and is not approved out of habit.
The hooks never deny: the decision is ask, the user can always approve. A hook that cannot read its input, or fails, asks as well, because a crashing guard that stays silent is a silent allow.
What asks
| Risk | Asks before | Passes |
|---|---|---|
| Irreversible deletion | recursive removal of a repository or of a folder of repositories, a home directory, a system or production path, Claude's memory; find ... -delete under such a path; Docker volumes and every prune; compose down -v; DROP and TRUNCATE; force push, branch deletion, reset --hard, clean -f, a whole-tree checkout .; stopping or removing a container that has been up longer than long_running_hours; Dokploy, GitHub, Infisical, Cloudflare and Directus deletions | rm -rf node_modules, dist, a path in /tmp, one file's checkout, fresh test containers |
| Takeover of the host or of the guards | writes into the system directories, ~/.ssh, ~/.config, Claude Code's settings, plugins and hooks, a project's .claude/settings*.json and .claude/hooks/, .mcp.json, git hooks, and every path in production_paths; the plugin's own files; a pipe of a download into a shell; privileged or docker.sock containers; crontab, users, firewall; stopping docker, ssh, nginx (also nginx -s stop); nginx run with a configuration of its own (-c, -p, -g, even with -t), which hands the host's nginx temp folders to another user; apt without NEEDRESTART_MODE=l; making a repository public; collaborators, deploy keys, branch protection | code, docs, rules, memory, scratch files |
| Secrets leaving the machine | a secrets file (.env* except .env.example, settings.local.json, .mcp.json, SSH keys, *.pem, credentials) sent by curl, wget, scp, rsync or gist; a variable named ...KEY, ...TOKEN, ...SECRET, ...PASSWORD sent to a host that is not its own service; env, printenv or cat .env piped into a sender; a raw nc to another machine; Google Drive share_file; a new GitHub repository that is not private | a key sent to a trusted host, writes to localhost |
| The guards themselves | an edit or write of any file under a folder named agent-guard-ops (a copy of the Agents Store repository, the plugin cache), a write there through the GitHub MCP, and the merge of a pull request in Agents-Store/claude-plugins (a merge cannot be tied to the plugin without the network, so every merge there asks) | any other plugin's files, reading the guard files |
Commands the guard cannot fully read ($(...), heredocs, eval) are not asked: the permission rules and the auto-mode classifier judge them. A guard that asks on every substitution gets approved blindly.
The three hooks
| Hook | Matcher | File |
|---|---|---|
| Bash | Bash | hooks/guard-bash.sh |
| MCP tools | mcp__.* | hooks/guard-mcp.sh |
| File tools | Edit|Write|MultiEdit|NotebookEdit | hooks/guard-files.sh |
They need bash, git (for the merge check) and python3 3.7 or newer (the hooks use subprocess.run(capture_output=..., text=...)). Python is started by its full system path first (a pyenv shim in a folder whose .python-version is not installed would exit 1 and make the guard ask about everything); PATH is only the fallback.
The MCP guard covers Dokploy (deletion, exposure, takeover), GitHub (a repository that is not private, the guards' own files), Directus and Plane deletions, Google Drive sharing and trashing, Cloudflare and Sentry deletions. Read-only tools of every other server are untouched.
Options
The hooks hold no host name, no domain and no path of any machine. What belongs to one machine is an option of the plugin, asked once in the dialog that appears when the plugin is enabled (list options are not shown in the /config panel; to see or change them later use claude plugin configure agent-guard-ops, which saves values from stdin with --values-stdin) and stored in the user's settings under pluginConfigs. Claude Code exports each option to the hooks as CLAUDE_PLUGIN_OPTION_<KEY>. Project and local settings cannot set them, so a cloned repository cannot widen the guard.
| Option | Type | Default | Meaning |
|---|---|---|---|
production_paths | list of strings | empty | Absolute paths where production lives. A write or deletion there asks, on top of the built-in system paths. |
trusted_domains | list of strings | empty | Domain suffixes of your own services. A key may go to them and to any subdomain. |
trusted_api_hosts | list of strings | empty | Exact hosts of your own APIs. A key may go there, and a DELETE request there asks. |
long_running_hours | number | 6 | A container up longer than this counts as production. |
A list is read as a JSON array (["/srv/<app>", "/srv/<db>"]) or as a plain text split on commas and newlines. A value that cannot be read leaves the built-in defaults in force; it never makes the hook fail. Leaving every option empty is a valid install: the system paths and the public API hosts built into the guard (GitHub, Cloudflare, Stripe, OpenAI, Google, Anthropic and similar) still apply.
Example for a machine with one application folder and its own domain:
{
"pluginConfigs": {
"agent-guard-ops@agents-store-claude-plugins": {
"options": {
"production_paths": ["/srv/<app>", "/srv/<app-db>"],
"trusted_domains": ["example.com"],
"trusted_api_hosts": ["deploy.example.org"],
"long_running_hours": 12
}
}
}
}
The settings file itself is a guarded path: a write to ~/.claude/settings.json (or to $CLAUDE_CONFIG_DIR/settings.json when that variable moves Claude's configuration), by the file tools or by a shell command, asks. So do claude plugin disable, uninstall, remove and configure for this plugin (or with no plugin name), and claude plugin marketplace remove: one command each would otherwise switch the guards off or rewrite their options.
Limits
This is a tripwire for the agent's own commands, not a sandbox. Not modelled: what a script file does once it runs, functions and aliases defined earlier in the session, variables set earlier in the same command, git aliases, arithmetic evaluation. Claude Code's permission rules (permissions in settings.json) are the real boundary. See the header of hooks/guard-bash.sh for the full list.
Tests
tests/ holds three shell suites, one per hook, that feed each hook a PreToolUse payload on stdin and read only its JSON answer. No command of a test runs, nothing is written outside a temporary directory, there is no network. GUARD_HOOK=<copy of a hook> points a suite at a mutant copy of the hook.
bash tests/guard-bash.test.sh
bash tests/guard-mcp.test.sh
bash tests/guard-files.test.sh
bash tests/old-bash.test.sh # every hook under bash 3.2, the /bin/bash of macOS (skips where /bin/bash is newer)
Installation
claude plugin marketplace add Agents-Store/claude-plugins
claude plugin install agent-guard-ops@agents-store-claude-plugins
Source
- Source on GitHub
- Mirror: Agents-Store/claude-plugins
- Mirror: Agents-Store/cursor-plugins
- Mirror: Agents-Store/codex-plugins
- Mirror: Agents-Store/gemini-extensions
- Mirror: Agents-Store/antigravity-skills
- Mirror: Agents-Store/kimi-plugins
- Mirror: Agents-Store/devin-plugins
- Mirror: Agents-Store/hermes-plugins
- Mirror: Agents-Store/opencode-plugins
- Mirror: Agents-Store/pi-extensions
- Mirror: Agents-Store/openclaw-generated-plugins
- Mirror: Agents-Store/agentplugins