Docs

Cursor Setup

Clawkeeper hooks into Cursor Composer's tool use lifecycle. Shell commands, MCP tool calls, and prompts are evaluated before execution; file reads and edits are captured post-execution for audit.

What gets monitored

ToolEnforcement
Shell commands (run_terminal_cmd)Block or warn before execution
MCP tool calls (mcp__*)Block or warn before execution
PromptsBlock or warn before submission
File reads (read_file)Audit after execution
File writes (edit_file, write_file)Audit after execution (no pre-execution block)

File writes in Cursor are audit-only — Cursor's edit_file and write_file hooks fire post-execution. If pre-execution blocking of file writes is a requirement, use Claude Code or Windsurf.

Installation

Get your API key from Settings → API Keys in the dashboard, then run the installer for your project:

bash install-hooks.sh --ide cursor --project /path/to/project

The installer writes .cursor/hooks.json to the project root and sets your API key in the hook headers.

What gets generated

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "run_terminal_cmd|mcp__*",
        "hooks": [
          {
            "type": "http",
            "url": "https://clawkeeper.dev/api/v1/evaluate?tool=cursor",
            "headers": {
              "Authorization": "Bearer YOUR_API_KEY"
            }
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "edit_file|write_file|read_file",
        "hooks": [
          {
            "type": "http",
            "url": "https://clawkeeper.dev/api/v1/audit?tool=cursor",
            "headers": {
              "Authorization": "Bearer YOUR_API_KEY"
            }
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "http",
            "url": "https://clawkeeper.dev/api/v1/evaluate?tool=cursor",
            "headers": {
              "Authorization": "Bearer YOUR_API_KEY"
            }
          }
        ]
      }
    ]
  }
}

Commit .cursor/hooks.json to your repo so every developer who clones it gets automatic coverage.

Connecting to the dashboard

After running the installer, open Cursor and start a Composer session. Clawkeeper registers the workstation on the first event. You can verify coverage in the Workstations page of your dashboard within a few seconds.

Known limitations

File writes are audit-only. Cursor's edit_file and write_file hooks fire post-execution. Clawkeeper receives the event and records it in the audit trail, but the write has already happened. If pre-execution blocking of writes is required, use Claude Code or Windsurf.

Prompt blocking is record-only in some Cursor versions. The UserPromptSubmit hook was not enforced in Cursor versions prior to 0.45. If your team is on an older release, prompt events are captured but the block verdict is ignored. Shell and MCP blocking is not affected.

Permission deny bug. In Cursor 0.44 and earlier, returning a non-2xx response from a PreToolUse hook sometimes fails to surface the rejection message to the user. The tool call is still blocked, but Cursor may show a generic error instead of Clawkeeper's block reason. This is resolved in Cursor 0.45+.

Matchers use glob syntax, not regex. The mcp__* matcher in .cursor/hooks.json requires glob-style patterns. Cursor does not support the regex patterns used in Claude Code's settings.json.

Enforcement status

CheckStatus
Shell command blockingEnforced
MCP tool call blockingEnforced
Prompt blockingEnforced (Cursor 0.45+)
File read auditEnforced
File write blockingNot available — audit only
Session check-inAuto (registered on first event)