← All Frameworks

Cursor Guardrails

Pre-tool-use hooks for AI code editor authorization

Python + TS

Cursor is an AI-powered code editor used by millions of developers. APort integrates via Cursor's hook system, evaluating every shell command, file operation, and MCP tool call before execution.

Quick Start

1. Create passport & config

npx @aporthq/aport-agent-guardrails cursor

2. Install guardrails package

npx @aporthq/aport-agent-guardrails cursor

3. Add to your code

# One command setup - writes hooks.json automatically
npx @aporthq/aport-agent-guardrails cursor

# Hooks fire on: shell execution, file read/write,
# MCP tools, and subagent starts

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 Cursor guardrails work?

APort writes a hooks.json file to your Cursor config that intercepts shell commands, file operations, and MCP tool calls. Each action is evaluated against your passport before Cursor executes it.

What Cursor actions are protected?

Shell execution, file read/write/delete, grep, MCP tool calls, and subagent starts are all evaluated. The guardrail runs inline with zero additional latency for allowed actions.

Ready to secure your Cursor agents?

Get started in under 2 minutes with a single command.