Cursor Guardrails
Pre-tool-use hooks for AI code editor authorization
Cursor is an AI code editor. APort integrates through Cursor's hooks to evaluate shell commands, file operations and MCP tool calls before execution.
Quick Start
1. Install guardrail & create passport
npx @aporthq/aport-agent-guardrails cursor2. Configure the integration
# 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 startsTest the authorization boundary
Installer target: cursor. Aliases: none; use the target ID.
npx @aporthq/aport-agent-guardrails cursorDenied-action example
Read .env.aport-smoke-test with a passport that blocks .env* paths.
Expected policy result: deny. Use an empty test file. In warn mode the runtime may continue; enforce mode must stop the read. Hosted mode can record the decision; local mode does not prove hosted audit persistence.
{
"policy_id": "data.file.read.v1",
"allow": false,
"reason": "oap.blocked_pattern"
}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?
The integration evaluates shell execution, file operations, grep, MCP tool calls and subagent starts at supported hook boundaries. Review the integration docs for the events your Cursor version exposes.
Ready to secure your Cursor agents?
Review the setup command and denied-action check before enforcing policy.
Start free for local or individual setup. Upgrade to Team for hosted org audit, signed decisions, GitHub guardrails, and shared enforcement across your team.