Guide · Cursor

Why Cursor ignores your rules, and what actually enforces them

By Shamaz Khan · 18 Nov 2026 · 5 min read

You wrote careful Cursor rules. The agent follows them for a while, then edits a file you said never to touch, or reintroduces a pattern you banned. It isn't a bug in your rules file. It's what rules files are.

Rules are context, not constraints

Cursor project rules (in .cursor/rules/), the older .cursorrules file, AGENTS.md and CLAUDE.md all do the same thing: add text to the model's context. The model weighs that text against everything else it's seeing: your prompt, the code, error messages, its own plan. When those pull in a different direction, a rule can lose.

Common reasons rules get ignored

How to write rules that stick

Enforce the rules that matter

Some rules can only be guidance ("prefer composition"). Others can be checked after every change: which files changed, whether protected paths were touched, whether the behaviours you care about still work. Those should be checked, not hoped for.

npx stet-cli init                       # writes AGENTS.md from one charter
stet scope set "Add CSV export" --allow "src/export/**,tests/export/**"
# ...Cursor does the task...
stet guard                              # anything outside the scope or in protected paths?
stet check                              # do locked behaviours still pass?

Stet keeps AGENTS.md and CLAUDE.md in sync with the scope, locks and decisions, so the rules Cursor reads and the rules Stet checks are the same rules.

FAQ

Why does Cursor ignore my .cursorrules?

Rules files are added to the model's context and weighed against everything else it sees. Long, vague or conflicting rules, rules that are not attached for the current files, and long sessions all make it more likely the agent drifts from them.

Should I use .cursorrules or .cursor/rules?

Cursor's project rules live in .cursor/rules; the single .cursorrules file is the older format. Many teams also keep an AGENTS.md so other agents read the same rules.

How do I enforce Cursor rules?

Turn the important rules into checks that run on the diff: allowed paths for the task, protected paths, and commands that prove key behaviours still work. Run them at commit and in CI.

Put guardrails on your AI coding agent

Stet is a free, open-source CLI and MCP server for Claude Code, Cursor, Codex and Copilot. It runs locally: no account, your code never leaves your machine.

npx stet-cli init · Install · Setup guide · GitHub

Related