Cursor harness
Use this guide when you run Cursor, either the editor or the cursor-agent CLI, and want Guard to review shell commands, MCP calls, file reads, and file edits while Cursor keeps its own tool approval prompts.
What Guard detectsDirect link to What Guard detects
The Cursor adapter reads:
~/.cursor/mcp.json<workspace>/.cursor/mcp.json~/.cursor/hooks.json
Guard records one artifact per MCP server and preserves:
- project or global scope
stdioorhttptransport- the configured
command,args, andurl
It also records the Guard hook entries in hooks.json, so a missing or edited hook shows up as a change.
How protection attachesDirect link to How protection attaches
Cursor has two surfaces. hol-guard install cursor installs both. hol-guard apps connect cursor without --surface also installs both. Pass --surface editor or --surface cli when you want only one.
| Surface | What Guard changes |
|---|---|
editor | Routes eligible stdio MCP servers through Guard proxies in the global ~/.cursor/mcp.json, and writes Guard hooks to the global ~/.cursor/hooks.json |
cli | Writes the guard-cursor-agent and guard-cursor launcher shims and adds the Guard shim directory to your shell profile |
Guard writes to the global Cursor files, not to project-local hook files.
Editor hooksDirect link to Editor hooks
The hook script is installed at ~/.cursor/hooks/hol-guard-cursor-hook.py. Each hook entry has a 45-second timeout.
| Hook | Role |
|---|---|
beforeShellExecution | Reviews a shell command before it runs |
beforeMCPExecution | Reviews an MCP tool call before it runs |
beforeReadFile | Reviews a file read |
preToolUse | Reviews Write, Edit, StrReplace, MultiEdit, and Delete calls, because Cursor has no separate pre-write event |
afterShellExecution | Observes the result of a shell command |
afterMCPExecution | Observes the result of an MCP call |
The four blocking hooks are written with failClosed: true, so Cursor treats a hook that cannot answer as a block. The two after hooks only observe.
CLI shimsDirect link to CLI shims
guard-cursor-agent wraps the standalone cursor-agent binary. guard-cursor agent ... wraps the Cursor app CLI. Both live in ~/.hol-guard/bin, so that directory has to be on PATH. Install prepends it to your shell profile when it is missing. Open a new terminal afterwards.
Approval modelDirect link to Approval model
Cursor uses the native-harness tier:
- Cursor keeps its own tool approval prompts
- Guard's hooks and artifact checks run alongside them
- a request Guard blocks is listed in the local approval center, and
hol-guard approvalsresolves it from the terminal
Runtime probeDirect link to Runtime probe
Guard also runs the Cursor CLI to see what Cursor actually loaded:
cursor-agent mcp list
Guard compares that output with the servers it found on disk. If Guard finds local servers but Cursor reports none, Guard warns that Cursor may be loading a different config root.
Install and launch flowDirect link to Install and launch flow
hol-guard detect cursor --json
hol-guard install cursor --dry-run
hol-guard install cursor
hol-guard run cursor --dry-run
hol-guard run cursor
hol-guard approvals
To install or repair one surface, or both when you omit --surface:
hol-guard apps connect cursor --surface editor
hol-guard apps connect cursor --surface cli
hol-guard apps repair cursor
To check or remove the install:
hol-guard apps test cursor --json
hol-guard uninstall cursor
Known limitsDirect link to Known limits
- Shell commands typed into Cursor's built-in terminal are not reviewed unless they run inside an agent session.
- Prompt submission is not intercepted. Guard reviews shell, MCP tool, and file read events.
- Guard does not write project-local hook files, so a project that relies on its own
.cursorhooks keeps them separate from Guard's.
Recommended validation loopDirect link to Recommended validation loop
hol-guard detect cursor --json
cursor-agent mcp list
hol-guard run cursor --dry-run
hol-guard receipts
hol-guard status
Use the receipts and warnings together:
- receipts confirm what changed
- runtime warnings confirm whether Cursor is loading the same MCP roots that Guard inspected