Universal security guardrails and workflow policies for AI coding agents.
Overview
Security guardrails and workflow policies for AI coding agents. Blocks dangerous operations at the hook level — not just as instructions. See docs/configuration.md for the full list of enforced rules. Download the latest .deb from GitHub Releases and install: After installing via either method, install guardrails for your agent: The script installs the agentguard wrapper to ~/.local/bin/. After this, use the agentguard command for everything: If ~/.local/bin is not in your PATH, add this to your shell profile: Re-running is safe — existing files are backed up with a timestamp suffix. settings.json is merged, not overwritten. Removes only what agentguard owns: hooks, instruction file, Kiro agent config, CLI wrapper. Claude settings.json is surgically unmerged — your own keys untouched, file not deleted.
README
agentguard
Security guardrails and workflow policies for AI coding agents. Blocks dangerous operations at the hook level — not just as instructions.
Supports Claude Code, OpenAI Codex, Kiro, Cursor, Grok, Gemini CLI, GitHub Copilot CLI, Windsurf and Google Antigravity CLI. See Agents for each one, and docs/configuration.md for the full list of enforced rules.
Installation
Homebrew (macOS and Linux)
brew tap SumonMSelim/agentguard
brew install agentguard
apt / deb (Debian, Ubuntu, WSL)
Download the latest .deb from GitHub Releases and install:
VERSION=x.y.z # latest release number, without the leading "v"
curl -LO https://github.com/SumonMSelim/agentguard/releases/download/v${VERSION}/agentguard_${VERSION}_all.deb
sudo dpkg -i agentguard_${VERSION}_all.deb
Requires: jq (sudo apt-get install jq).
Manual
Requires: bash, jq.
# Clone once
git clone https://github.com/SumonMSelim/agentguard.git ~/agentguard
# Bootstrap the `agentguard` CLI (one-time only)
~/agentguard/install.sh claude # one-time only: bootstraps the `agentguard` CLI wrapper into ~/.local/bin
The script installs the agentguard wrapper to ~/.local/bin/. If that is not in your PATH, add this to your shell profile:
export PATH="$HOME/.local/bin:$PATH"
Install guardrails
After any of the methods above, install guardrails for your agents:
agentguard # one agent, e.g. agentguard claude (see Agents below)
agentguard all # every supported agent
Common options:
--dry-run # preview changes without writing anything
--skills none # skip skill packs
--skills karpathy-guidelines,other # append specific skills only
--project # install to current project directory (skills only)
Re-running is safe — existing files are backed up with a timestamp suffix. settings.json is merged, not overwritten.
Agents
Install, check and activate each agent. Click an agent to expand it.
Uninstall
agentguard uninstall claude
agentguard uninstall all
agentguard uninstall claude --dry-run # preview first
Removes only what agentguard owns: its hooks and hook entries, and the instruction file if agentguard created it (otherwise only its skill sections). Merged config files keep your own keys and hooks. The ~/.local/bin/agentguard CLI wrapper is removed only by agentguard uninstall all, so the command keeps working for the agents you still have.
Check installation status
agentguard check claude
agentguard check all
Reports which hooks, files, settings, and CLI wrapper are present or missing. Exits 1 if anything is out of order — useful in CI to assert guardrails are in place.
Read the audit log
agentguard log # last 50 lines from every agent with a log
agentguard log claude --blocked # only what the guardrails blocked
agentguard log all --since 2h # last 2 hours (30m, 7d, ...)
agentguard log codex --tail 0 # every line
Reads audit.log.1 then audit.log. With more than one agent, lines are merged in time order and prefixed with the agent name. Exits 1 with a hint when no log is found. See Audit log for the paths.
Diagnose a broken install
agentguard doctor # every tracked agent (every agent if none is tracked)
agentguard doctor codex
One screen per agent: the agentguard check result, whether the agent CLI is on PATH (and its version), activation steps agentguard cannot do for you (Codex /hooks approval, the Kiro 2.x agentguard agent, Gemini hooksConfig.enabled, a disabled Antigravity entry), and the audit log: size, last entry and BLOCKED lines in the last 24 hours. Also shows the agentguard, bash and jq versions, tracked agents and disabled directories. Exits 1 when any line is FAIL; WARN lines (no agent CLI on PATH, no audit log yet) do not fail.
Disable per directory
For throwaway projects (pet projects, POCs, sandboxes) where you want the AI to have full access, disable agentguard for that directory:
# In the project root, in your shell (NOT inside Claude):
agentguard disable # disable in current dir
agentguard enable # re-enable
agentguard status # show state for current dir
# Or target another path:
agentguard disable /path/to/poc
agentguard enable /path/to/poc
Disabling adds the absolute path to ~/.agentguard/disabled-dirs. Every hook reads that file on each tool call and short-circuits (no-op) when the active directory matches an entry or sits below one. Other directories keep their guardrails.
Gated: agentguard disable requires an interactive terminal and asks you to type yes, read from /dev/tty rather than stdin, so no agent can run it. It also refuses inside a Claude Code session (CLAUDECODE=1), and the block-self-edit hook blocks agentguard disable / install.sh disable for every agent. Only you can disable, from your own shell. agentguard disable --dry-run previews without asking. Re-enabling is open.
Upgrade
agentguard upgrade
Pulls the latest agentguard, then uninstalls and reinstalls every agent you previously set up — in one step. Your own settings.json keys, your protected-branch choice, your own instruction-file content and your selected skills are preserved: skill sections are stripped and re-applied from the new release. An instruction file that agentguard created is replaced with the new version, so edits you made inside it survive only in the timestamped .bak copy. Project-level Cursor installs are not tracked (see Cursor).
On a .deb install, the upgrade downloads SHA256SUMS from the same release and aborts if the package checksum does not match.
To check if an update is available without upgrading:
agentguard check claude
# prints an update notice if a newer version exists
Skills
Skills are behavioural packs appended to the agent’s instruction file at install time. core skills are included when --skills is omitted; all others are opt-in via --skills. An explicit --skills list installs only the skills it names.
| Skill | Tags | What it does |
|---|---|---|
karpathy-guidelines |
core |
Think before coding, simplicity first, surgical changes, goal-driven execution |
docker |
— | Image security, build efficiency, runtime hardening |
go |
— | Idiomatic Go: errors, interfaces, concurrency, testing, security |
php |
— | Modern PHP: strict types, security, PSR standards, architecture |
laravel |
— | Laravel: thin controllers, Eloquent, queues, security |
java |
— | Modern Java (17+): design, immutability, security, testing |
aws |
— | AWS: IAM least privilege, secrets, networking, security posture |
gcp |
— | GCP: IAM, Workload Identity, Security Command Center |
kubernetes |
— | K8s: pod security, RBAC, resource limits, HA |
terraform |
— | Terraform: state management, security, module design, workflow |
Global skills
Install once, active in every project. Best for universal practices that apply regardless of stack.
# Core skills only (default)
agentguard claude
# Add language/cloud skills globally
agentguard claude --skills go,aws,kubernetes
# Skip all skills
agentguard claude --skills none
Per-project skills
--project appends skills to the instruction file in the current directory instead of ~. No hooks or settings changes — skills only. Requires agentguard CLI (installed on any global install).
| Agent | File written | Notes |
|---|---|---|
| Claude Code | .claude/CLAUDE.md in CWD |
|
| Codex | AGENTS.md in CWD |
|
| Cursor | .cursor/ in CWD (hooks + AGENTS.md) |
Always project-local; full install |
| Grok | AGENTS.md in CWD |
Hooks global only (project rules supported) |
| Gemini CLI | GEMINI.md in CWD |
|
| Copilot CLI | .github/copilot-instructions.md in CWD |
|
| Windsurf | AGENTS.md in CWD |
Root AGENTS.md is an always-on workspace rule |
| Antigravity | AGENTS.md in CWD |
Workspace rule file |
| Kiro | — | Not supported; prints warning |
# All agents at once — recommended:
agentguard all --project --skills go,aws
# Or one agent (file per the table above):
agentguard claude --project --skills go,aws
# Preview without writing:
agentguard all --project --skills go,aws --dry-run
Claude Code loads both ~/.claude/CLAUDE.md (global) and .claude/CLAUDE.md (project) simultaneously — project skills layer on top. Codex loads ~/.codex/AGENTS.md (global) plus the project AGENTS.md. Cursor reads only the project-local AGENTS.md.
Recommended pattern: install core skills globally (guardrails apply everywhere), add language and cloud skills per project where relevant.
Adding a skill
Create skills//SKILL.md with YAML frontmatter (name, tags, description, license) followed by markdown content. Tag core to auto-include on every install. The installer picks it up automatically — no registration needed.
Notes
block-env.sh— best-effort on the bash surface.block-env-read.shis the primary layer (intercepts Read/Write/Edit tools directly).- Protected branches — install prompts for which branches to protect from direct commit/push (default:
main,master). Your answer is saved to~/.agentguard/configand applies across all agents. Override per-shell withexport AGENTGUARD_PROTECTED_BRANCHES="main,master,develop".
→ Configuration reference — protected branches, settings.json merge rules, audit log rotation.
License
Recommended Tools
Try a different keyword or remove a filter.
Install
npx skillfish add sumonmselim/agentguard