Claude Code, Codex and Cursor
Why does Cursor ignore my rules?
Alexandru Lupascu, CTO & Co-founder · Updated
Cursor usually ignores a rule for one of five reasons documented in Cursor's own docs: the file is a plain .md instead of .mdc in .cursor/rules, the rule type keeps it out of context (no description, or a glob that matches nothing), you are using Tab completion or Bugbot, where rules do not apply, a Team Rule takes precedence, or the rule points to a file the Agent did not open. Cursor places applied rule text at the start of the model's context, so even a loaded rule is guidance rather than a hard limit. Check these causes in order before you rewrite the rule.
How do you check whether a rule is loaded at all?
Start with the file and its frontmatter, because most skipped rules do not reach the context at all:
- Extension. Project rules must be
.mdcfiles in.cursor/rules/. According to Cursor's rules reference, a plain.mdfile there is ignored because it has no frontmatter fordescription,globsandalwaysApply. - Rule type. The frontmatter decides when Cursor includes the rule:
| Frontmatter | When Cursor includes the rule |
|---|---|
alwaysApply: true | Every chat session; globs and description are ignored |
globs set, alwaysApply: false | When a matching file is in context |
description set, no globs | When the Agent decides the description is relevant |
| None of these | Only when you @-mention the rule |
- Feature. Rules apply to Agent (Chat) only, not to Tab completion or Bugbot PR reviews.
- Status. Open Customize > Rules to see all rules and their status.
Why does a loaded rule still get ignored?
A loaded rule can lose to other text in the same context. Cursor merges Team Rules, Project Rules and User Rules, and when guidance conflicts, earlier sources win in that order, so a team rule can override yours. Cursor also applies a root CLAUDE.md to every conversation and combines nested AGENTS.md files with their parents; if these files disagree, the model has to choose.
File references are a second cause. Cursor does not inline a file mentioned as @service-template.ts; the Agent reads it only when it decides it needs it, so paste must-have content into the rule body.
Wording is the third. Cursor recommends rules under 500 lines, split by concern and written like clear internal docs with concrete examples. A .cursorrules file is legacy, and Cursor says it will be deprecated; move its content into a rule set to Always Apply.
How do you make an instruction hold every time?
Use a hook for anything that must not happen. Cursor hooks are scripts defined in .cursor/hooks.json or ~/.cursor/hooks.json that run before or after stages of the agent loop and can block an action: beforeShellExecution, beforeMCPExecution and preToolUse can deny a call, and exit code 2 blocks it. Cursor's rules docs say plainly that "AI guidance should not be your only security control." On Team and Enterprise plans, an admin can also mark a Team Rule as enforced so members cannot turn it off. Claude Code has the same split between instructions and hooks, explained in Why does Claude Code ignore my CLAUDE.md instructions?
What changes when several agents share the same rules?
For one developer in one repository, well-scoped .mdc rules plus a few hooks are usually enough. With several people and tools, the harder problem is placing the right procedure for each task instead of loading every rule into every chat. elephant.broker is a pluggable runtime for AI agents that connects to Cursor, Claude Code, Codex or your own harness through an MCP server, native plugins or a REST API. On every turn, elephant.broker places versioned procedures for the task at hand where the model pays attention, and its guardrails block red lines before execution, with human approval where it matters.
Sources
- Cursor: Rules reference, Rules help, Hooks
- elephant.broker: overview, features
Product details come from each vendor's public documentation as viewed on 2026-10-28 and may have changed. Product names are trademarks of their respective owners; elephant.broker is not affiliated with them.