Where does the bug appear (feature/product)?
Cursor CLI
Describe the Bug
On Windows, Cursor CLI 2026.08.11-e8db854 does not run user-level hooks at all in an interactive agent session.
I have a deny-based fence in ~/.cursor/hooks.json (failClosed: true on beforeReadFile, preToolUse, and
beforeShellExecution, plus a sessionStart policy injection). The agent was asked to read files under
%USERPROFILE%.claude. It did: Read, Glob, Grep, and Shell all succeeded. No deny, no failClosed brick, no
sessionStart additional_context in the agent prompt.
This is not a matcher miss and not a broken hook script.
• The same command, given a real preToolUse / Read payload for a path under %USERPROFILE%.claude, returns
{“permission”:“deny”,…} with exit 0 when I invoke it myself from ~/.cursor (the documented user-hook cwd).
• If Cursor had spawned the hook and the process had failed to start, failClosed: true should have blocked the
tools. It did not.
• beforeShellExecution has been listed as working in CLI since January 2026. Shell still went through.
So the host never entered the hook loop. A deny-based guardrail cannot hold if the process is never spawned and/or
permission: deny is not applied.
I already applied the documented workaround from Cursor CLI ignores hooks from marketplace plugin
(Cursor CLI ignores hooks from marketplace plugin): the fence is also in
~/.cursor/hooks.json, not only in a local/marketplace plugin. File-based hooks still did not fire.
This looks like the same class of failure as the related report on Cursor CLI doesn’t send all events defined in hooks
(Cursor CLI doesn't send all events defined in hooks) titled “Cursor-agent CLI never
invokes hooks.json on Linux (2026.08.11) — same version works on macOS.” I am on that exact CLI version, on Windows.
Steps to Reproduce
- Install a user hook at ~/.cursor/hooks.json that denies access to %USERPROFILE%.claude on beforeReadFile,
preToolUse (Read/Grep/Glob/Shell), and beforeShellExecution, with failClosed: true. Also register sessionStart to
return additional_context with a unique canary string. - Confirm the hook script works outside Cursor: from ~/.cursor, pipe a JSON payload with hook_event_name:
preToolUse, tool_name: Read, and tool_input.path under %USERPROFILE%.claude. Observe permission: deny. - Start an interactive cursor-agent session in a workspace (mine was a folder that is not itself a git repo).
- Ask the agent to read a file under %USERPROFILE%.claude (and/or list that directory with Shell).
Expected Behavior
• sessionStart injects the canary into the agent’s initial context.
• Read / Glob / Grep / Shell targeting %USERPROFILE%.claude are denied.
• If the hook process fails to start or prints invalid JSON, failClosed: true blocks the tool.
Operating System
Windows 10/11
Version Information
Cursor CLI 2026.08.11-e8db854
For AI issues: which model did you use?
grok 4.6 high
Additional Information
Actual Behavior
• No canary / HARD POLICY in the agent context.
• Read, Glob, Grep, and Shell of %USERPROFILE%.claude all succeed and return file contents.
• failClosed: true never trips.
• Manual invoke of the identical command still denies.
That combination means the CLI agent loop never spawned the hook. It is not “the script returned allow.”
Does this stop you from using Cursor
No - Cursor works, but with this issue