Guide

AGENTS.md vs Cursor rules: which one should you use?

Last updated

Cursor reads both. AGENTS.md is a plain Markdown file that Cursor, Codex and many other coding agents read, while Cursor rules are .mdc files in .cursor/rules that only Cursor reads, each with settings for when it applies. Use AGENTS.md for instructions every agent on the project should follow, and add Cursor rules when you need a rule to load only for certain files or only on request.

Cursor rules vs AGENTS.md side by side

AGENTS.mdCursor project rulesLegacy .cursorrules
Where it livesAGENTS.md in the project root and any subdirectory.mdc files in .cursor/rulesOne .cursorrules file in the project root
Who reads itCursor, Codex and the other tools listed on agents.md; Claude Code when a project has no CLAUDE.mdCursor onlyCursor only
When it appliesIn Cursor, a nested file applies when you work with files in its folderAlways, when the agent judges it relevant, when matching files are in context, or when @-mentionedAlways (the "Always Apply" type matches the old behavior)
FormatPlain Markdown, no required fieldsMarkdown with description, globs and alwaysApply front matterOne file; migrate it by copying it into an .mdc rule
StatusCurrent, an open formatCurrent"Legacy and will be deprecated"

Cursor also has two kinds of rules that live outside the repository. User Rules are set in Customize → Rules, apply "across all your projects" and sync with your Cursor account; user rule files in ~/.cursor/rules (Windows: %USERPROFILE%\.cursor\rules) stay on that machine and don't sync. Team Rules, on Team and Enterprise plans, are managed from the Cursor dashboard and can be enforced so members cannot turn them off. When rules conflict, Cursor's order is "Team Rules → Project Rules → User Rules."

Does Cursor use AGENTS.md?

Yes. Cursor's documentation says: "Cursor supports AGENTS.md in the project root and subdirectories." It calls AGENTS.md a "simple alternative to .cursor/rules."

Nested files work too. You can place AGENTS.md files "in any subdirectory of your project, and they will be automatically applied when working with files in that directory or its children." Cursor combines them with the files in parent folders, "with more specific instructions taking precedence." A monorepo can have:

project/
  AGENTS.md            # rules for the whole repository
  frontend/
    AGENTS.md          # rules for frontend work
  backend/
    AGENTS.md          # rules for backend work

Cursor reads CLAUDE.md the same way. Its help pages say a CLAUDE.md in the project root is "always applied to every conversation, regardless of any alwaysApply frontmatter setting."

How .mdc rules decide when to load

This is the main thing Cursor rules can do that AGENTS.md can't. Each .mdc file starts with front matter, and three fields decide when Cursor includes it:

alwaysApplydescriptionglobsWhat Cursor does
trueanyanyIncludes it in every chat
falseanysetIncludes it when a matching file is in context
falsesetnot setIncludes it when the agent decides it's relevant
falsenot setnot setIncludes it only when you @-mention it

For example, .cursor/rules/react-components.mdc:

---
description: How we write React components
globs: src/**/*.tsx
alwaysApply: false
---
- Use functional components.
- Keep components under 200 lines.

The extension matters: "A plain .md file in .cursor/rules is ignored by the rules system because it has no frontmatter." If you want plain Markdown, Cursor points you to AGENTS.md. You can create a rule by typing /create-rule in the agent chat, or from Customize → Rules → Add Rule.

Two limits apply to all of them. Rules only reach Agent (Chat): they "do not impact Cursor Tab or other AI features." And Cursor suggests keeping each rule "under 500 lines," split into focused files.

When to use AGENTS.md

  • You or your team use more than one coding agent, such as Cursor and Codex. Codex reads AGENTS.md files from the repository root down to your current folder; it does not read .cursor/rules.
  • Your instructions are short and apply to most tasks: how to build and test, code style, folder layout.
  • You want instructions per package in a monorepo. A nested AGENTS.md covers that in both Cursor and Codex without any front matter.
  • You want a file people can read on GitHub without knowing Cursor's format.

When to use Cursor rules

  • A rule matters only for some files, such as database migrations or one framework. A globs pattern keeps it out of every other chat.
  • You have a long procedure, like how to add a new API endpoint, that you want loaded only when the agent judges it relevant or when you @-mention it.
  • Your whole team should follow a rule in every repository. Team Rules do that, and only Cursor has them.
  • The rule is about Cursor itself, so other agents don't need it.

Move off .cursorrules

Cursor's help pages say "the .cursorrules file in your project root is legacy and will be deprecated." Their migration steps:

  1. Open the command palette (Cmd+Shift+P on Mac, Ctrl+Shift+P on Windows and Linux) and choose "New Cursor Rule."
  2. Copy your .cursorrules content into the new rule file.
  3. Set the rule type to "Always Apply," which matches the old behavior.
  4. Delete .cursorrules.

If the content is general project guidance, you can move it into AGENTS.md instead, so other agents read it too.

Keep one set of instructions for several tools

  1. Put the shared instructions in a root AGENTS.md. Cursor and Codex read it as is.
  2. For Claude Code, you need nothing extra if the project has no CLAUDE.md: Claude Code reads AGENTS.md in that case. If you need a CLAUDE.md for Claude-specific notes, start it with @AGENTS.md so it imports the shared file. Remember that Cursor also loads CLAUDE.md in every chat, so keep it short.
  3. Keep only Cursor-specific, file-scoped rules as .mdc files in .cursor/rules. Don't copy AGENTS.md content into an always-apply rule, or Cursor gets the same text twice.
  4. Put package-specific rules in nested AGENTS.md files rather than glob rules, if every agent needs them.

More detail is in What is AGENTS.md? and What are Cursor rules?.

Notes that keep growing

AGENTS.md and always-apply rules load in full, so every line costs context in every chat. Codex stops adding AGENTS.md files at 32 KiB combined by default. Past decisions, gotchas and facts that only some tasks need fit better in a memory the agent searches when it needs them. Memlo is one such memory for Claude Code, Codex, ChatGPT and other MCP clients, but its sign-in doesn't work from Cursor yet. See CLAUDE.md and AGENTS.md vs a memory server for when files are enough.

Frequently asked questions

Does Cursor read nested AGENTS.md files?

Yes. Cursor applies an AGENTS.md in a subdirectory when you work with files in that folder or below it, combined with the files above it. The more specific file wins where they disagree.

Is .cursorrules still supported?

It still works, but Cursor calls it "legacy" and says it "will be deprecated." Move its content into an .mdc rule in .cursor/rules set to Always Apply, or into AGENTS.md.

Can I put plain .md files in .cursor/rules?

No. Cursor ignores .md files there. Rules in .cursor/rules must use the .mdc extension. Use AGENTS.md for plain Markdown.

Does Codex read Cursor rules?

No. Codex reads AGENTS.md, AGENTS.override.md and any file names you list in project_doc_fallback_filenames in ~/.codex/config.toml. To share rules with Codex, put them in AGENTS.md.

Can Cursor read AGENTS.md from my home folder?

Cursor's documentation describes AGENTS.md in the project root and subdirectories. For instructions across all projects, use User Rules in Customize → Rules, or user rule files in ~/.cursor/rules.

Sources

Checked on November 18, 2026:

Give every agent the same memory

Ask your agent to add Memlo, or get started below. Memlo is invitation only for now.

Memlo is invitation only for now. We'll email you when your invitation is ready.