# Cursor Agent Knowingly Ignored Global Rules

**URL:** <https://forum.cursor.com/t/cursor-agent-knowingly-ignored-global-rules/150592>\
**Category:** Bug Reports\
**Tags:** terminal, openai, plan-mode, rules\
**Created:** [February 2, 2026, 8:11am UTC](https://forum.cursor.com/t/cursor-agent-knowingly-ignored-global-rules/150592 "2026-02-02T08:11:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blooming](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@blooming](https://forum.cursor.com/u/blooming)\
**Post date:** [February 2, 2026, 8:11am UTC](https://forum.cursor.com/t/cursor-agent-knowingly-ignored-global-rules/150592/1 "2026-02-02T08:11:05Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

Cursor agent performed action that was explicitly prohibited by a User/Global rule. The agent performed the action, then acknowledge the action was incorrect and referenced the rule.  
Agents response to this action in the summary:  
“npx supabase db push — this connected to the remote DB and applied migrations (the CLI prompted and then proceeded). This violates your “local-only” rule; I’m flagging it immediately so you can verify remote state.”

### Steps to Reproduce

Prompted agent with a plan, i looked it over, and then hit code/implement.  
Used GPT 5.2 thinking for the plan and GPT 5.2 codex extra high for coding.

### Expected Behavior

The agent is suppose to read cursor rules and abide by them. The agent here clearly did not look over the rules before implementing its changes.

### Screenshots / Screen Recordings

 ![cursorerror.png](https://us1.discourse-cdn.com/cursor1/original/3X/5/f/5ff07bba3ab64d1b96da6c0e6e75baac6b46d17c.png)

### Operating System

Windows 10/11

### Version Information

Version: 2.4.23 (system setup)  
VSCode Version: 1.105.1  
Commit: 379934e04d2b3290cf7aefa14560f942e4212920  
Date: 2026-01-29T21:24:23.350Z  
Build Type: Stable  
Release Track: Default  
Electron: 39.2.7  
Chromium: 142.0.7444.235  
Node.js: 22.21.1  
V8: 14.2.231.21-electron.0  
OS: Windows\_NT x64 10.0.26100

### For AI issues: which model did you use?

GPT 5.2 Thinking for the plan, and GPT 5.2 Codex Extra High for the implementation/coding.

### For AI issues: add Request ID with privacy disabled

fe02168b-cae9-48d1-b59e-a971b104be4a

### Additional Information

The agent ran “npx supabase db push” to the Production environment. This could have been catastrophic.

My cursor rule:  
Global Rule: Local Supabase Usage: We utilize local supabase cli.

- When running commands ensure, you use “npx supabase” and not just “supabase”.
- Do not push any code or files to remote linked/Production databases.
- Only focus on local cli.

### Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

---

<div class="post-metadata">

**Author:** ![condor](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/condor/32/73148_2.png) [@condor](https://forum.cursor.com/u/condor)\
**Post date:** [February 2, 2026, 8:33am UTC](https://forum.cursor.com/t/cursor-agent-knowingly-ignored-global-rules/150592/3 "2026-02-02T08:33:48Z")

</div>

hi @blooming, welcome to the Cursor Forum, and thanks for taking the time to write such a detailed report.

Models can behave unexpectedly at times.

Why agents can make mistakes:

- Non-deterministic behavior: the same prompt can sometimes lead to different outputs, so the model may not always follow rules in exactly the same way.
- Long chats: longer conversations can introduce conflicting information into the context window, causing the model to overlook or deprioritize some instructions.
- Too many rules: a large number of rules can make it harder for the model to reliably identify which constraints are most important.
- Conflicting rules: overlapping or contradictory instructions can confuse the model about which behavior to prioritize.
- Imperative statements: many strong “do X / don’t do Y” commands at once can make it harder for the model to choose which imperative to follow.
- Negative statements: “don’t do X”–style rules are often harder for models than positive phrasing, partly because training data contains many examples of the forbidden behavior.

Agent rules tend to work best when:

- Chats stay relatively short and are focused on a single, clearly defined task.
- Rules are phrased positively and include a short explanation, for example: “Always treat Supabase as local-only to avoid breaking the production database.”
- Check with your framework provider what they recommend for local development with AI and how they prevent agents from running destructive commands. I know that some frameworks do that, so its worth asking!

Additionally I suggest:

- Add to your `skills` a DB planning skill which reinforces the usage of local only database change.
- Do not provide access to production databases for agents unless the access is a read only user if you do require production data.

To further reduce risk, you can add a `beforeShellExecution` hook that inspects shell commands and blocks anything dangerous (for example, any `supabase db push` that is not explicitly allowed), so the command never reaches your production environment even if the agent suggests it.

### Quick Setup

1. **Create your hooks configuration file** at either:

- **Project level** : `<project>/.cursor/hooks.json` (applies only to that project)
- **User level** : `~/.cursor/hooks.json` (applies globally)

1. **Configure the hook** with a matcher to target specific commands:

```auto
{
  "version": 1,
  "hooks": {
    "beforeShellExecution": [
      {
        "command": "./hooks/block-command.sh",
        "matcher": "npx supabase db push"
      }
    ]
  }
}

```

### Example hook script

```auto
#!/bin/bash
# block-command.sh - Prevents specific commands from running

# Read JSON input from stdin
input=$(cat)

# Parse the command from the JSON input
command=$(echo "$input" | jq -r '.command // empty')

# Check if command matches dangerous patterns
if [["$command" =~ "npx supabase db push"]]; then
    # Block the command
    cat << EOF
{
  "permission": "deny",
  "user_message": "This command has been blocked for safety",
  "agent_message": "The command '$command' has been blocked because it matches a restricted pattern."
}
EOF
else
    # Allow the command
    cat << EOF
{
  "permission": "allow"
}
EOF
fi

```

---

<div class="post-metadata">

**Author:** ![blooming](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@blooming](https://forum.cursor.com/u/blooming)\
**Post date:** [February 20, 2026, 7:15am UTC](https://forum.cursor.com/t/cursor-agent-knowingly-ignored-global-rules/150592/4 "2026-02-20T07:15:34Z")

</div>

Thanks for the help and suggestion for the hardcode denial.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [March 14, 2026, 7:16am UTC](https://forum.cursor.com/t/cursor-agent-knowingly-ignored-global-rules/150592/5 "2026-03-14T07:16:24Z")

</div>

Closed on March 14, 2026, 7:16am UTC

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