Cursor rules guide: project rules, .mdc files, AGENTS.md, and team rules
Cursor rules give the Agent persistent instructions. Learn the .mdc format, how alwaysApply, globs, and description decide when a rule applies, when AGENTS.md is enough, and how team rule precedence works.
Cursor rules are persistent instructions for Cursor's Agent: when a rule applies, its contents are placed at the start of the model context so the Agent follows the same conventions every time. Project rules live in .cursor/rules as .mdc files with frontmatter, and a plain AGENTS.md in the project root is the simpler alternative when you do not need triggers. This guide walks through the four rule types, how each one is applied, and how to decide where a given instruction belongs, based on Cursor's official documentation.
What rules are for
Cursor's docs give the reason directly: large language models do not keep memory between completions, so rules provide persistent, reusable context at the prompt level. Anything you keep repeating to the Agent, such as "use named exports," "never touch dist/," or "every migration needs a down step," is a candidate for a rule.
Rules only affect Agent (Chat). The FAQ states that rules do not impact Cursor Tab or other AI features. If autocomplete ignores a rule, that is expected behavior rather than a broken rule.
Four rule types and where they live
Cursor supports four kinds of rules. Project rules sit in .cursor/rules, are version-controlled, and are scoped to the codebase. User rules are set in Customize → Rules and apply across all of your projects, which suits personal preferences such as response style. Team rules are managed from the Cursor dashboard and are available on Team and Enterprise plans. AGENTS.md is a plain markdown file that works as a simple alternative to .cursor/rules.
The decision is mostly about ownership. Instructions tied to one repository that teammates should also follow belong in project rules or AGENTS.md. Habits that only matter to you belong in user rules. Organization-wide requirements belong in team rules set by an admin.
The .mdc format and the four ways a rule is applied
Each project rule is a markdown file with frontmatter, and it must use the .mdc extension. Cursor's docs are explicit that a plain .md file inside .cursor/rules is ignored by the rules system because it has no frontmatter for description, globs, and alwaysApply. You can organize rules into subfolders such as frontend/components.mdc.
Those three frontmatter fields decide when a rule enters the context. With alwaysApply: true, the rule is included in every chat and both globs and description are ignored. With alwaysApply: false and globs set, the rule is auto-attached when a matching file is in context. With alwaysApply: false, a description, and no globs, the Agent reads the description and pulls the rule in when it judges it relevant. With none of them, the rule applies only when you -mention it in chat. In the UI these appear as Always Apply, Apply to Specific Files, Apply Intelligently, and Apply Manually.
