Claude Code hook

agentjail

Policy guardrails that check every Claude Code, Codex or Cursor tool call against local rules.

100 stars 8 forksHooks Source

Install

Install
brew install LuD1161/tap/agentjail
From source
git clone https://github.com/LuD1161/agentjail.git

From the README

Policy checks and OS sandboxing for coding agents

A safety rail for Claude Code, Codex, and Cursor.
Install policy hooks, then launch your agent through AgentJail for OS-level filesystem protection.

 
 
 
 
 

Install minisign through your trusted package manager first (brew install minisign on macOS; sudo apt-get install minisign on Debian/Ubuntu). The installer verifies the signed release manifest before extracting or running the download.

or

Follow the installer's shell activation instruction, restart any running agent, then start your first protected session:

Installation registers hooks; agentjail run adds the OS sandbox. Hooks alone are cooperative checks, not a filesystem isolation boundary. For automatic sandboxing of ordinary agent commands, opt into the PATH shim. Use --tunnel when you also want network visibility; the launch banner reports the active protection level.

A coding agent gets blocked before it fires. ▶ Watch the 36-second demo with sound · source in video/.

Recent updates

See CHANGELOG.md for full details, or check the releases page.

How it works

Supported agent tool calls are checked against policy before execution while the daemon is available:

Hooks provide policy decisions and explanations. Launching through agentjail run adds the OS sandbox, which enforces filesystem restrictions independently of the hook daemon.

- 🪝 Zero-config - one install command auto-detects your agents and wires the hook
- ⚡ ~8 ms median - persistent OPA daemon + decision cache. You won't feel it
- 🛡️ Defense in depth - hook-level policy + optional kernel sandbox (agentjail-shield)
- 📜 Real policy engine - OPA Rego rules, not regex hacks
- 🔒 Explicit failure posture — credential and approval authorization fail closed.…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Go
License
Apache-2.0
Last updated
24 September 2026
Topics
agent-securityai-agentsclaude-codecodexcursordevsecopsgolangguardrailsllmopapolicy-as-coderego

FAQ

What is agentjail?

Policy guardrails that check every Claude Code, Codex or Cursor tool call against local rules. It is a hook for Claude Code, from LuD1161/agentjail on GitHub.

How do I install agentjail?

Run brew install LuD1161/tap/agentjail, then follow the setup in the README.

Is agentjail popular?

LuD1161/agentjail has 100 GitHub stars and 8 forks. It was last updated on 24 September 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.