FireGuard

Cursor Integration

Install FireGuard hooks for Cursor prompts, shell commands, tool calls, and file access.

Use the Cursor integration when you want FireGuard to check agent activity before Cursor submits prompts or runs actions in your workspace.

Requirements

  • python3 available on PATH.
  • A FireGuard API key.
  • A FireGuard project ID with the policies and security guardrails you want to enforce.

Install

Install the Cursor hooks:

curl -fsSL https://raw.githubusercontent.com/fireravenai/fireraven-agent-hooks/refs/heads/main/install.sh | sh -s -- --agent cursor

Or install from a local clone of github.com/fireravenai/fireraven-agent-hooks:

./fg install --agent cursor
./fg doctor

Configure

Edit config.env in ~/.cursor/hooks/:

FIRERAVEN_GUARDRAILS_API_KEY=fg_...
FIRERAVEN_PROJECT_ID=00000000-0000-0000-0000-000000000000

Optional overrides (installer defaults are normal / open if omitted):

FIRERAVEN_API_URL=https://api.fireraven.ai
# FIRERAVEN_EXECUTION_MODE=fast
FIRERAVEN_REQUEST_TIMEOUT_SEC=15
# FIRERAVEN_FAIL_MODE=closed

Restart Cursor after editing config.env.

Configuration reference

VariableRequiredDefaultDescription
FIRERAVEN_GUARDRAILS_API_KEYyesOrganization FireGuard API key. See FireGuard API keys.
FIRERAVEN_PROJECT_IDyesFireGuard project ID from Project Settings → General. See Project configuration.
FIRERAVEN_API_URLnohttps://api.fireraven.aiFireGuard API base URL.
FIRERAVEN_EXECUTION_MODEnonormalExecution mode sent on each guardrail API call. See below.
FIRERAVEN_REQUEST_TIMEOUT_SECno15HTTP timeout in seconds for FireGuard requests.
FIRERAVEN_FAIL_MODEnoopenHook behavior when FireGuard cannot be reached. See below.

FIRERAVEN_EXECUTION_MODE

Controls how FireGuard runs policy and security checks for each hook invocation. The value is passed as execution_mode on input and output guardrail API requests.

ValueDefaultUse when
normalyesYou want complete response-path results. FireGuard runs guardrails sequentially and returns full policy and security details.
fastYou want lower latency in the IDE. FireGuard runs eligible checks in parallel and returns as soon as a blocking result is known.

This setting can override the project default for agent hook calls without changing the project configuration in the Fireraven app. See FireGuard concepts — Execution modes.

FIRERAVEN_FAIL_MODE

Controls hook behavior when FireGuard cannot be reached because of a network error, request timeout, or HTTP failure.

ValueDefaultUse when
openyesDeveloper velocity should take priority over enforcement during transient API failures. The hook allows the action through.
closedYou want enforcement even during outages. The hook blocks the Cursor action (deny / continue: false). Use for strict production enforcement.

closed and open apply only to FireGuard connectivity failures. Policy violations, guardrail blocks, and missing FIRERAVEN_GUARDRAILS_API_KEY or FIRERAVEN_PROJECT_ID always block regardless of FIRERAVEN_FAIL_MODE.

What Cursor Checks

EventModeWhat FireGuard checks
beforeSubmitPromptBlockingUser prompts before submission.
beforeShellExecutionBlockingShell commands before execution.
beforeMCPExecutionBlockingMCP tool name and arguments (failClosed).
beforeReadFileBlockingFile path and body (failClosed). Local sensitive paths (for example .env, keys) hard-deny before FireGuard.
preToolUseBlockingAll tools (matcher: ".*"). Shell, Read, and MCP are deferred to the dedicated hooks above to avoid double FireGuard checks.
subagentStartBlockingSubagent launch.
afterFileEditAuditWritten hunks after the edit; cannot undo.

Blocking responses

beforeSubmitPrompt blocks with:

{
  "continue": false,
  "user_message": "Blocked by Fireraven FireGuard."
}

Other blocking events return:

{
  "permission": "deny",
  "user_message": "Blocked by Fireraven FireGuard.",
  "agent_message": "Blocked by Fireraven FireGuard."
}

afterFileEdit is audit-only and returns an empty success object.

Human override

On FireGuard policy or security violations for beforeShellExecution, beforeMCPExecution, beforeReadFile, preToolUse, and subagentStart, the hook shows a blocking OS confirmation dialog (zenity or kdialog on Linux, osascript on macOS, MessageBox on Windows):

  • Allow continues that action once.
  • Deny, timeout, or no display keeps the deny.

Local sensitive-path blocks and missing FIRERAVEN_GUARDRAILS_API_KEY or FIRERAVEN_PROJECT_ID are not overridable. Prompt blocks on beforeSubmitPrompt stay hard deny — edit the prompt instead.

Cursor’s native permission: "ask" is not used; it is not reliably enforced today.

If Cursor also loads Claude Code third-party hooks, Fireraven’s Claude adapter no-ops under Cursor so enforcement stays on these native Cursor hooks.

JSONC and existing hooks

~/.cursor/hooks.json may contain JSONC comments (// or /* */). That is useful for temporarily disabling hooks or documenting entries.

The Fireraven installer reads JSONC and applies surgical edits so:

  • Existing comments and formatting stay in place.
  • Third-party hooks (for example another tool’s preToolUse matcher) are kept alongside Fireraven’s live preToolUse entry.
  • Commented-out Fireraven blocks stay commented; the installer registers separate live Fireraven entries.

If install fails with a JSONC parse error, fix syntax problems in the file (not comments). Re-run the installer after correcting the file.

Verify

From a clone of the hooks repository, use:

./fg doctor

Windows

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/fireravenai/fireraven-agent-hooks/refs/heads/main/install.ps1))) -Agent cursor

The PowerShell installer writes:

FilePurpose
%USERPROFILE%\.cursor\hooks.jsonCursor hook registration
%USERPROFILE%\.cursor\hooks\Fireraven hook scripts and config
%USERPROFILE%\.cursor\hooks\config.envFireraven credentials

The installer registers Cursor hooks as py -3 hooks/cursor_guardrail.py, which Cursor runs from %USERPROFILE%\.cursor. After editing config.env, restart Cursor or reload the window, then check View > Output > Hooks if a hook does not appear to run.

If the Python launcher is not available in Cursor's hook environment, edit hooks.json to use the fallback:

{
  "command": "powershell -NoProfile -ExecutionPolicy Bypass -File hooks/run_cursor_guardrail.ps1"
}

On this page