Curser ignored a rule

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I have a rule for never committing/Pushing to GitHub without permission from the user. It ignored it today

Steps to Reproduce

create the rule to never commit and push.
create a plan that says in one of the steps commit and push (I didn’t tell it to add it explicitly to the plan)
build the plan

Screenshots / Screen Recordings

Operating System

Windows 10/11

Version Information

Version: 2.6.13 (user setup)
VSCode Version: 1.105.1
Commit: 60faf7b51077ed1df1db718157bbfed740d2e160
Date: 2026-03-06T06:17:49.499Z
Build Type: Stable
Release Track: Default
Electron: 39.6.0
Chromium: 142.0.7444.265
Node.js: 22.22.0
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26100

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hi Ellie,

This is a known limitation of how Rules work today. Rules are passed to the AI model as instructions in the system prompt, but models are non-deterministic—so they can sometimes deprioritize constraints, especially “don’t do X” rules. It’s more likely to happen when the plan itself includes the prohibited action, because the model gets conflicting signals between “complete this plan” and “don’t commit.”

In your screenshot, the rule was loaded and acknowledged—the agent just prioritized task completion over the constraint.

The reliable fix: Enforcement Hooks

Since you’re on an Enterprise plan, you have access to Enforcement Hooks. These are system-level guardrails that block commands before execution, so the agent can’t run a blocked command regardless of what the model decides.

Step 1: Add a hooks config

Create .cursor/hooks.json in your project (or ~/.cursor/hooks.json to apply to all projects):

{
  "version": 1,
  "hooks": {
    "beforeShellExecution": [
      {
        "command": "./hooks/block-git.sh",
        "matcher": "git commit"
      },
      {
        "command": "./hooks/block-git.sh",
        "matcher": "git push"
      }
    ]
  }
}

Step 2: Add the hook script

Create ./hooks/block-git.sh:

#!/bin/bash
input=$(cat)
command=$(echo "$input" | jq -r '.command // empty')
cat << EOF
{
  "permission": "deny",
  "user_message": "Git commit/push blocked by enforcement hook. Please commit manually.",
  "agent_message": "This command has been blocked. Ask the user to commit and push manually."
}
EOF

Make it executable:

chmod +x ./hooks/block-git.sh

With this in place, even if the model attempts a git commit or git push, it’ll be blocked at the system boundary before anything runs.

Tips to make Rules more reliable (even without hooks)

  • Prefer positive, contextual rules:
    “Always ask for user approval before any git operation, because unauthorized commits can break the workflow” tends to stick better than “Don’t commit.”

  • Keep chats focused: longer conversations increase the odds constraints get deprioritized.

  • Scan the plan before ‘Implement’: remove any commit/push steps the agent added on its own.

You may also find this related thread helpful: Cursor Agent Knowingly Ignored Global Rules.

Best,
Mohit

1 Like

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.