Claude Code Guardrails
PreToolUse hooks for Claude Code CLI authorization
Claude Code is Anthropic's official CLI for Claude. APort integrates via Claude Code's settings.json hook system, evaluating tool calls before execution with the same OAP policy engine used across all frameworks.
Quick Start
1. Create passport & config
npx @aporthq/aport-agent-guardrails claude-code
2. Install guardrails package
npx @aporthq/aport-agent-guardrails claude-code
3. Add to your code
# One command setup - writes settings.json automatically npx @aporthq/aport-agent-guardrails claude-code # Hooks fire on: PreToolUse events for all tools
How It Works
Passport
Your agent gets an OAP passport declaring its identity, capabilities, and operational limits.
Evaluate
Before every tool call, the guardrail evaluates it against the passport's policy. Locally or via hosted API.
Decision
Allow or deny with structured OAP reason codes. Signed decisions create an auditable trail.
Frequently Asked Questions
How do Claude Code guardrails work?
APort writes PreToolUse hooks to your Claude Code settings.json. Before Claude Code executes any tool (shell, file, MCP), the hook evaluates it against your OAP passport policy.
Ready to secure your Claude Code agents?
Get started in under 2 minutes with a single command.