Open-source authorization engine that checks every AI agent action and returns allow, deny, human_review, or compute before it runs.
LuD1161/agentjail
Policy guardrails for coding agents like Claude Code, Codex and Cursor, checking each tool call locally before it runs.
- Stars
- 100
- Forks
- 8
- Open issues
- 2
- Last commit
- last month
What is it?
AgentJail is a safety layer for coding agents such as Claude Code, Codex and Cursor. After installation it registers hooks with each supported agent, so every tool call (shell commands, file reads and edits, MCP calls) is evaluated against Open Policy Agent (OPA) Rego rules before it executes. Decisions are allow, ask, or deny, and a persistent local daemon with a decision cache keeps the check fast.
Hooks alone are cooperative checks. Launching an agent through `agentjail run` adds an OS-level sandbox that restricts filesystem access independently of the hook daemon. Optional features include a default-deny network allowlist, a credential broker that delivers explicitly selected secrets to a session, a local web UI and terminal replay of decisions, and local cost reporting for Claude Code, Codex and OpenCode transcripts. The project supports macOS and Linux and is written in Go.
Key features
- 01Checks every agent tool call against OPA Rego policies before it runs
- 02Returns allow, ask, or deny decisions with explanations
- 03Adds an OS sandbox for filesystem restrictions via `agentjail run`
- 04Default-deny network allowlist with optional traffic visibility
- 05Credential broker that delivers only explicitly selected secrets to a session
- 06Local replay viewer, terminal dashboard and cost reports
Use cases
- Preventing a coding agent from running destructive commands such as force-pushes or recursive deletes
- Stopping accidental leaks of .env files or cloud credentials into an agent's context
- Limiting which hosts an agent can send data to during a session
- Reviewing what an agent did and why through session replay
Quick start
- 1
Install minisign first (macOS)
brew install minisign - 2
Install AgentJail via Homebrew
brew install LuD1161/tap/agentjail - 3
Check protection status
agentjail doctor - 4
Launch your agent through AgentJail with the OS sandbox
agentjail run -- codex
Things to know
- Supports only macOS and Linux.
- Hooks alone are cooperative checks, not a filesystem isolation boundary; the OS sandbox requires launching through agentjail run.
- Some protections depend on the daemon being available and on platform sandbox coverage.
In collections
Topics
FAQ
- What is agentjail?
- Policy guardrails for coding agents like Claude Code, Codex and Cursor, checking each tool call locally before it runs. AgentJail is a safety layer for coding agents such as Claude Code, Codex and Cursor. After installation it registers hooks with each supported agent, so every tool call (shell commands, file reads and edits, MCP calls) is evaluated against Open Policy Agent (OPA) Rego rules before it executes. Decisions are allow, ask, or deny, and a persistent local daemon with a decision cache keeps the check fast.
- Is agentjail free to use? What license does it have?
- agentjail is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is agentjail still maintained?
- Updated within 6 months. The last commit to agentjail was on Sep 24, 2026.
- What can I use agentjail for?
- Preventing a coding agent from running destructive commands such as force-pushes or recursive deletes Stopping accidental leaks of .env files or cloud credentials into an agent's context Limiting which hosts an agent can send data to during a session Reviewing what an agent did and why through session replay
- How do I install agentjail?
- Install minisign first (macOS): brew install minisign Install AgentJail via Homebrew: brew install LuD1161/tap/agentjail Check protection status: agentjail doctor Launch your agent through AgentJail with the OS sandbox: agentjail run -- codex
- Where can I get agentjail?
- The source code and installation instructions are on GitHub: https://github.com/LuD1161/agentjail
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A local security tool that scans your AI coding agent sessions for leaked secrets and hooks into Claude Code, Cursor and Codex to block or question risky commands.
Access control for AI coding agents: blocks credential reads, holds risky actions for review, and logs every tool call across Claude Code, Codex, Cursor and MCP servers.
Open-source CLI and library that verifies AI model files, code, live LLM/agent/MCP endpoints, and recorded agent traces, reporting findings and gaps.
Host-agnostic safety middleware that sits between tool-using AI agents and their tools to block risky calls and redact sensitive results.
A runtime guard for AI coding agents that gates every tool call and returns PASS, AUTH or BLOCK before the action executes.