中文
All Agent Engineering

Spec file

Where Cursor rules go: .cursor/rules and AGENTS.md

Where Cursor rule files go, their format, four apply modes, root and nested AGENTS.md scope, and legacy .cursorrules. Per official docs, not tested.

Cursor has four kinds of rules: Project Rules, User Rules, Team Rules and AGENTS.md. This page covers the two that live in your repository, project rules in .cursor/rules and AGENTS.md in the root or subdirectories, and what the current official docs say about the older .cursorrules.

Verified
· Not tested by us
Applies to
  • Cursor Cursor only[1]
Tools

File locations

PathScopeHow it is read
.cursor/rulesProject rules folder, version-controlledCursor: rules are .mdc files; .md files are ignored[1]
AGENTS.mdProject rootCursor: a simple alternative to .cursor/rules, plain markdown without metadata[1]
frontend/AGENTS.mdSubdirectory (path taken from the official page sample)Cursor: applied automatically when working with files in that directory or its children, combined with parents, more specific takes precedence[1]

When to use

  • You use Cursor and want to commit project conventions as files in the repository.[1]
  • You want to know why a rule is not applied, or which apply mode to pick.[1]
  • You want to know how far root and nested AGENTS.md reach in Cursor.[1]

When not to use

  • You use a different tool: other tools load files differently and this page does not apply.[1]
  • You need migration or compatibility notes for the old .cursorrules: the current official docs do not mention it, to be confirmed.[1]

Rule file location and format

Version basis: the Cursor rules page does not state a document version, so this page is based on cursor.com/docs/rules as read on the verification date, 2026-10-28; later official changes are not covered.[1]

  • Project rules live in .cursor/rules as .mdc files and are version-controlled; you can name a file anything you want.
  • The docs say project rules must use the .mdc extension; a plain .md file in .cursor/rules is ignored by the rules system because it has no frontmatter to specify description, globs and alwaysApply. If you prefer plain markdown, the docs suggest AGENTS.md instead.
  • Rules can be organised in folders, for example .cursor/rules/frontend/components.mdc.
  • Each rule is frontmatter metadata plus content; the frontmatter controls how the rule is applied.

[1]

Example: a rule file with frontmatter (our own, fields taken from the official page)
---
description: Frontend component conventions
globs: src/components/**/*.tsx
alwaysApply: false
---

- Use named exports, not default exports
- Keep components under 200 lines

[1]

The four apply modes

Rule types and the frontmatter conditions behind them (summarised from the official text)
Apply modeOfficial descriptionFrontmatter condition
Always ApplyApplied to every chat sessionalwaysApply is true; globs and description are ignored
Apply to Specific FilesWhen a file matches a specified patternalwaysApply is false; the description column shows "—" in the original table; globs is provided; auto-attached when a matching file is in context
Apply IntelligentlyWhen Agent decides it is relevant based on the descriptionalwaysApply is false; description is provided; globs is omitted; Agent reads the description and pulls the rule in when relevant
Apply ManuallyWhen @-mentioned in chat, for example @my-rulealwaysApply is false; description is omitted; globs is omitted; included only when you @-mention the rule in chat (the original table row is false / omitted / omitted, not all three unset)

[1]

  • Official FAQ: if a rule is not applied, check the rule type first; for Apply Intelligently make sure a description is defined, and for Apply to Specific Files make sure the file pattern matches the files in question.
  • Separate multiple globs with commas, for example docs/**/*.md, docs/**/*.mdx.

[1]

The four kinds of rules and their order

The four kinds of Cursor rules
KindWhere it livesOfficial description
Project RulesStored in .cursor/rules in the repositoryVersion-controlled and scoped to your codebase
User RulesCustomize → Rules in Cursor settingsGlobal to your Cursor environment, used by Agent (Chat)
Team RulesManaged from the team dashboardAvailable on Team and Enterprise plans
AGENTS.mdProject root or subdirectoriesAgent instructions in markdown format, a simple alternative to .cursor/rules

[1]

When several rules apply, the documented order is Team Rules, Project Rules, User Rules; all applicable rules are merged, and earlier sources take precedence when guidance conflicts.[1]

How far root and nested AGENTS.md reach

  • Root: AGENTS.md goes in the project root as an alternative to .cursor/rules for simple cases; it is a plain markdown file without metadata.
  • Subdirectories: the docs say Cursor supports AGENTS.md in the project root and subdirectories; an AGENTS.md in any subdirectory is applied automatically when working with files in that directory or its children.
  • Nesting: instructions from nested files are combined with parent directories, and more specific instructions take precedence.

[1]

The sample tree on the official page has AGENTS.md (global), frontend/AGENTS.md, frontend/components/AGENTS.md and backend/AGENTS.md, for the whole project, frontend, components and backend respectively.[1]

The old .cursorrules

The current official docs do not mention .cursorrules, so whether it is still read or has been deprecated is to be confirmed. Per the current official page: project rules go in .mdc files under .cursor/rules, and plain markdown goes in AGENTS.md.[1]

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. Cursor · Rules | Cursor Docs

Found an error? Tell us →