Three configuration files. Three different philosophies. And in 2026, one of them is deprecated, one evolved significantly, and one became a genuine cross-tool standard.
This is the definitive breakdown of .cursorrules, CLAUDE.md, and AGENTS.md — their current state, what each one does well, and the decision logic for choosing the right file (or the right combination) for your workflow. Every claim here is verified against the official 2026 docs: Anthropic’s Claude Code documentation and Cursor’s current docs.
If you’ve landed here from a search for “should I use CLAUDE.md or AGENTS.md” — skip to the decision matrix or the migration checklists. If you want the full picture, read on.
The 2026 State of Play
Before comparing, the current status of each file:
.cursorrules — Still functional, but deprecated. Cursor’s own documentation now directs users to .cursor/rules/ (.mdc format) as the canonical system. The legacy single-file format works in 2026 but won’t receive new features.
CLAUDE.md — Significantly expanded in 2026. Claude Code now supports auto memory (MEMORY.md), path-scoped rules via .claude/rules/ with YAML frontmatter, managed policy deployment, and explicit AGENTS.md import syntax. The @import system now supports up to 5 hops. The file is more powerful than ever — and explicitly Claude-only.
AGENTS.md — Emerged as the multi-tool standard. Read natively by Claude Code (via @AGENTS.md import), Codex CLI, Gemini CLI, OpenCode, and Cursor (via discovery). Anthropic’s own docs now say: “If your repository already uses AGENTS.md for other coding agents, create a CLAUDE.md that imports it.” This is the cross-tool standard that the industry settled on.
What Each File Actually Does
.cursorrules (Legacy)
A single markdown file at the project root. No frontmatter, no activation modes, no scoping. Everything in the file applies to every Cursor session in that project.
# .cursorrules
You are an expert TypeScript developer.
Always use functional components in React.
Prefer `const` over `let`. Never use `var`.
Run `npm test` before suggesting you're done.
What happened to it: Cursor built a richer system (.cursor/rules/ with .mdc files) that supports four activation modes, glob-based file scoping, and alwaysApply control. .cursorrules predates all of that. It’s a flat file with no activation logic.
In 2026, .cursorrules still works. Cursor reads it. But there’s no new development on the format. Teams starting fresh should use .cursor/rules/.
.cursor/rules/ (The Modern Cursor System)
Rules live as .mdc files in .cursor/rules/. The YAML frontmatter controls when and how each rule fires:
---
description: "TypeScript API endpoint conventions"
alwaysApply: false
globs: "src/api/**/*.ts"
---
# API Endpoint Rules
- All handlers must validate input with Zod schemas
- Use the standard error response format from `src/lib/errors.ts`
- Add JSDoc comments to all exported functions
- Include integration tests in `tests/api/`
Four activation modes (determined by frontmatter):
| Mode | Config | Behavior |
|---|---|---|
| Always Apply | alwaysApply: true | Included in every session |
| Apply to Specific Files | globs: "src/**/*.ts" | Auto-attached when matching files are open |
| Apply Intelligently | description: "..." (no globs, alwaysApply false) | Agent decides based on description relevance |
| Apply Manually | No description, not always applied | Only via @rule-name mention in chat |
Rules should stay under 500 lines. The .cursor/rules/ directory supports subdirectory organization. Team Rules take precedence over Project Rules, which take precedence over User Rules.
CLAUDE.md (Claude Code Native)
CLAUDE.md is Claude Code’s native persistent context system. It supports four scope levels, @imports, and companion path-scoped rules:
Four scopes (load order, broadest to most specific):
| Scope | Location | Can be excluded? |
|---|---|---|
| Managed policy | /Library/Application Support/ClaudeCode/CLAUDE.md (macOS) | No |
| User instructions | ~/.claude/CLAUDE.md | Yes |
| Project instructions | ./CLAUDE.md or ./.claude/CLAUDE.md | Yes (claudeMdExcludes) |
| Local instructions | ./CLAUDE.local.md | Yes |
All files at the same scope level are concatenated — they don’t override each other.
@import syntax (up to 5 hops deep):
# CLAUDE.md
See @README for project overview and @package.json for npm commands.
# Architecture
@docs/architecture.md
# Git workflow
@docs/git-workflow.md
Path-scoped rules via .claude/rules/:
your-project/
├── CLAUDE.md
└── .claude/
└── rules/
├── testing.md # No frontmatter → always loaded
├── api-design.md # paths: ["src/api/**/*.ts"] → conditional
└── security.md # paths: ["src/**/*.ts", "lib/**/*.ts"]
Rules without paths frontmatter load at launch. Rules with paths load only when Claude reads files matching the pattern.
Auto memory (new in 2026):
~/.claude/projects/<project>/memory/
├── MEMORY.md # Loaded at every session start (first 200 lines / 25KB)
├── debugging.md # Topic file, loaded on demand
└── api-conventions.md # Topic file, loaded on demand
Auto memory is Claude-written context — Claude saves notes based on what it learns in sessions. You can read, edit, and delete these files. The auto memory directory is machine-local and shared across worktrees of the same repo.
AGENTS.md import:
# CLAUDE.md
@AGENTS.md
## Claude Code Specific
- Use plan mode for changes under `src/billing/`
- Subagent dispatch pattern: see @docs/dispatch.md
Claude Code explicitly supports this pattern. /init in a repo with AGENTS.md reads it and incorporates relevant parts into the generated CLAUDE.md.
Key constraints:
- Target under 200 lines per file (longer files reduce adherence)
- Content delivered as user message after system prompt, not enforced configuration
- To hard-enforce behavior, use PreToolUse hooks instead
AGENTS.md (The Cross-Tool Standard)
Plain markdown. No frontmatter. No special syntax. Its power comes from breadth of support:
| Tool | AGENTS.md Support |
|---|---|
| Claude Code | Via @AGENTS.md import in CLAUDE.md |
| OpenAI Codex CLI | Native |
| Google Gemini CLI | Native |
| Cursor | Via project discovery |
| OpenCode | Native |
| Windsurf | Via project discovery |
AGENTS.md nesting is its structural superpower:
monorepo/
├── AGENTS.md # Root: applies to all tools, all packages
├── frontend/
│ └── AGENTS.md # Frontend-specific: React conventions, build commands
├── backend/
│ └── AGENTS.md # Backend-specific: API patterns, database access rules
└── services/
└── auth/
└── AGENTS.md # Service-specific: security requirements, JWT handling
Compatible agents walk the directory tree and compose instructions hierarchically. Each AGENTS.md adds to the parent’s context, it doesn’t replace it.
Subagent definitions (Claude Code extension):
# AGENTS.md
## General Instructions
- Run tests before marking any task complete
- Use TypeScript strict mode
# agents
## security-reviewer
description: Reviews code for security vulnerabilities.
tools: read, bash
model: claude-sonnet-4-6
## test-writer
description: Writes comprehensive test suites for new features.
tools: read, write, bash
isolation: worktree
model: claude-sonnet-4-6
The # agents section is a Claude Code extension to AGENTS.md. Other tools ignore it (it’s just markdown with a heading they don’t parse).
Decision Matrix: Which File Wins
| Scenario | Best Choice | Why |
|---|---|---|
| Solo dev, Claude Code only | CLAUDE.md + .claude/rules/ | Most powerful native features |
| Team using Claude Code + Codex + Gemini | AGENTS.md (+ thin CLAUDE.md wrapper) | Cross-tool compatibility |
| Cursor-only team | .cursor/rules/ (.mdc format) | Four activation modes unavailable elsewhere |
| Monorepo with multiple AI tools, multiple teams | AGENTS.md nested per package | Each team owns their package’s AGENTS.md |
| Enterprise with centralized policies | CLAUDE.md managed policy | Organization-wide enforcement, can’t be excluded |
Migrating from .cursorrules | .cursor/rules/ | Richer activation logic, Cursor’s recommended path |
| Need rules only for specific file types | CLAUDE.md .claude/rules/ with paths: OR .cursor/rules/ with globs: | Both support it; pick based on your primary tool |
| Subagent definitions (Claude Code) | AGENTS.md # agents section | Portable, or .claude/agents/ for project-scope |
Tool Support Matrix (2026)
| Feature | .cursorrules | .cursor/rules/ | CLAUDE.md | AGENTS.md |
|---|---|---|---|---|
| Claude Code | No | No | Native | Via import |
| Cursor | Yes (legacy) | Native | No | Discovered |
| Codex CLI | No | No | No | Native |
| Gemini CLI | No | No | No | Native |
| OpenCode | No | No | No | Native |
| Windsurf | Via discovery | No | No | Via discovery |
| Path-scoped rules | No | Yes (globs:) | Yes (paths:) | No (use nesting) |
| Activation modes | No | 4 modes | Always loaded | Always loaded |
| @imports | No | No | Yes (5 hops) | No |
| User-level config | No | User Rules | ~/.claude/CLAUDE.md | No standard |
| Org/managed policy | No | Team Rules | Managed policy CLAUDE.md | No |
| Subagent definitions | No | No | No | Yes (# agents) |
| Auto memory companion | No | No | Yes (MEMORY.md) | No |
| Size guidance | No limit | 500 lines max | 200 lines recommended | No limit |
The .cursorrules Deprecation: What It Means in Practice
Cursor still reads .cursorrules in 2026. It hasn’t been removed. But:
- No new features are being added to the single-file format
.cursor/rules/supports everything.cursorrulesdoes, plus activation modes and glob scoping- Cursor’s documentation now points to
.cursor/rules/as the canonical approach - The four-mode activation system is the main reason to migrate — it lets rules load selectively rather than dumping everything into every session
Migration from .cursorrules to .cursor/rules/:
The migration is mechanical. The main decision is how to split the monolithic file:
- Create
.cursor/rules/directory - Split content by topic:
code-style.md,testing.md,api-design.md - Add frontmatter to each file based on desired activation:
- Rules for all sessions:
alwaysApply: true - Rules for specific file types:
globs: "src/**/*.ts" - Rules the agent should decide on: just add
description:
- Rules for all sessions:
- Delete
.cursorrules(or keep for backward compatibility with older Cursor)
# Quick check: what's in your .cursorrules?
wc -l .cursorrules
# If > 200 lines, definitely worth splitting into topic files
CLAUDE.md in 2026: What’s New
The 2026 CLAUDE.md documentation reveals several additions that weren’t present in earlier versions:
Auto memory system: Claude now maintains a MEMORY.md in ~/.claude/projects/<project>/memory/. This is Claude-written — it saves learnings from sessions automatically. The first 200 lines or 25KB of MEMORY.md load at every session start. Topic files in the same directory load on demand. You can edit or delete these files at any time.
HTML comment stripping: Block-level HTML comments in CLAUDE.md are stripped before injection into Claude’s context. Use them for maintainer notes without spending context tokens:
<!-- This section is for future maintainers. Claude won't see this. -->
## Build Commands
- `npm run dev` — start development server
claudeMdExcludes setting: For large monorepos where ancestor CLAUDE.md files from other teams are getting loaded, exclude them by path or glob:
{
"claudeMdExcludes": [
"**/other-team/CLAUDE.md",
"/Users/me/monorepo/legacy/.claude/rules/**"
]
}
--add-dir + CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD: Load CLAUDE.md from additional directories outside the main working directory. Useful for shared config repos.
Managed policy via claudeMd key: Organizations can embed CLAUDE.md content directly in managed-settings.json instead of deploying a separate file:
{
"claudeMd": "Always run `make lint` before committing.\nNever push directly to main."
}
Subagent auto memory: Individual subagents can now maintain their own auto memory (separate from the main session’s memory), configured via the subagent definition frontmatter.
AGENTS.md in 2026: Where the Standard Landed
AGENTS.md started as an informal convention and became explicit support across all major AI coding tools in 2025–2026. The significant 2026 development: Anthropic officially documented the @AGENTS.md import pattern and made /init AGENTS.md-aware.
What /init does with AGENTS.md:
- Reads existing
AGENTS.mdwhen present - Incorporates relevant parts into generated CLAUDE.md
- Also reads
.cursorrulesand.windsurfrulesfor context
This makes AGENTS.md the natural starting point for new projects that might use multiple AI tools: write it once, have Claude Code import it, and other tools read it natively.
The # agents section as Claude Code extension:
The AGENTS.md spec doesn’t define a # agents section. But Claude Code reads it as subagent definitions (the description, tools, model, isolation fields). Other tools see it as a markdown section with headings — harmless to them, powerful for Claude Code.
This means a single AGENTS.md file can contain:
- General instructions (all tools)
- Subagent role definitions (Claude Code only)
- Per-package nesting for monorepos (all tools)
Coexistence Patterns
Most production setups combine files rather than picking one exclusively. The most common patterns:
Pattern 1: AGENTS.md + Thin CLAUDE.md Wrapper
# CLAUDE.md
@AGENTS.md
## Claude Code
- Use plan mode for changes under `src/billing/`
- Subagent dispatch: @docs/agent-dispatch.md
- Use isolation: worktree for all file-writing subagents
The @AGENTS.md import brings in all shared instructions. The Claude Code section adds Claude-specific behavior without duplicating content.
Pattern 2: AGENTS.md + .cursor/rules/ for Cursor Teams
your-project/
├── AGENTS.md # Source of truth for all AI tools
├── CLAUDE.md # @AGENTS.md + Claude-specific additions
└── .cursor/
└── rules/
└── cursor-only.mdc # Cursor-specific activation logic
Shared instructions in AGENTS.md. Cursor-specific rules (with activation modes) in .cursor/rules/. Claude-specific additions in CLAUDE.md.
Pattern 3: Monorepo with Hierarchical AGENTS.md
monorepo/
├── AGENTS.md # Root: shared conventions, CI commands
├── CLAUDE.md # @AGENTS.md + Claude subagent definitions
├── frontend/
│ ├── AGENTS.md # React conventions, frontend build commands
│ └── CLAUDE.md # @AGENTS.md + frontend-specific Claude behavior
└── backend/
├── AGENTS.md # API patterns, database rules
└── .claude/
└── rules/
└── api.md # paths: ["**/*.ts"] — Claude-specific API rules
Each package team owns their AGENTS.md. CLAUDE.md wrappers import the local AGENTS.md. Path-scoped rules in .claude/rules/ handle Claude-specific conditionals.
Migration Checklists
Migrating from .cursorrules to .cursor/rules/
- Create
.cursor/rules/directory - Split
.cursorrulescontent by topic (code style, testing, API patterns, etc.) - Create one
.mdcfile per topic in.cursor/rules/ - Add appropriate frontmatter to each file:
alwaysApply: truefor rules that should always be activeglobs: "src/**/*.ts"for file-type-specific rulesdescription: "..."for agent-decided rules
- Test by opening relevant file types and checking rule activation in Cursor
- Delete
.cursorrules(or keep for backward compatibility with older Cursor versions)
Migrating from CLAUDE.md to AGENTS.md (Broadening Tool Support)
- Rename
CLAUDE.md→AGENTS.md - Strip any Claude-specific syntax (subagent definitions,
@imports) fromAGENTS.md - Create a new thin
CLAUDE.mdthat imports AGENTS.md:@AGENTS.md - Add Claude-specific content below the import in CLAUDE.md
- Move subagent definitions to
.claude/agents/(project scope) or keep in the# agentssection of AGENTS.md - Verify other tools (Codex, Gemini CLI) pick up AGENTS.md correctly
Migrating from AGENTS.md to CLAUDE.md (Claude-Only Setup)
- Rename
AGENTS.md→CLAUDE.md(or keep AGENTS.md and create CLAUDE.md with@AGENTS.md) - Break large CLAUDE.md into path-scoped rules in
.claude/rules/ - Add YAML frontmatter
paths:to rules that should only apply to specific files - Enable auto memory if desired (
/memorytoggle orautoMemoryEnabled: true) - Set up user-level rules in
~/.claude/rules/for personal preferences
The Honest Answer for New Projects
For most teams starting a new project in 2026:
If you’re Claude Code-only: Start with CLAUDE.md. Use .claude/rules/ for path-scoped instructions. Let auto memory accumulate learnings. You’ll have the richest feature set.
If you might use multiple AI tools: Write AGENTS.md first. Create CLAUDE.md that does @AGENTS.md plus Claude-specific additions. When you add Cursor, add .cursor/rules/ for Cursor-specific activation logic. Each tool reads what it understands; nothing is duplicated.
If you’re Cursor-first: Start with .cursor/rules/. If you add Claude Code later, add an AGENTS.md with your shared conventions and a CLAUDE.md that imports it.
The important thing: these files are not mutually exclusive. The most common production setup uses all three — AGENTS.md as the shared foundation, CLAUDE.md as the Claude-specific layer, and .cursor/rules/ for Cursor’s activation system.
Related Articles
- AGENTS.md vs CLAUDE.md: When to Use Which (2026) — Use-case-driven decision guide
- Migrating .cursorrules to AGENTS.md (2026) — Step-by-step migration guide
- AGENTS.md vs Cursor Project Rules (2026) — Detailed comparison of AGENTS.md nesting vs. Cursor’s glob system
- CLAUDE.md Best Practices (2026) — Writing effective CLAUDE.md for Claude Code
- Writing Effective AGENTS.md Files — Practical guide to AGENTS.md structure and subagent definitions
Frequently Asked Questions
Q: Is .cursorrules still supported in 2026?
Yes, Cursor still reads .cursorrules. But Cursor’s documentation now points to .cursor/rules/ as the canonical system. The legacy format works but won’t receive new features. Teams starting fresh should use .cursor/rules/ for the four-mode activation system.
Q: Does Claude Code read AGENTS.md directly?
No. Claude Code reads AGENTS.md when you import it from CLAUDE.md using @AGENTS.md. Without that import, Claude Code doesn’t see AGENTS.md. Anthropic’s docs say explicitly: “create a CLAUDE.md that imports it so both tools read the same instructions without duplicating them.”
Q: What is the difference between CLAUDE.md and auto memory?
CLAUDE.md is written by you — explicit instructions. Auto memory (MEMORY.md) is written by Claude based on what it learns in sessions. Both load at session start. Auto memory is Claude’s notes to itself; CLAUDE.md is your instructions to Claude.
Q: Can AGENTS.md and CLAUDE.md coexist in the same project?
Yes — this is the recommended pattern for multi-tool teams. Keep shared instructions in AGENTS.md. Create a CLAUDE.md that starts with @AGENTS.md and adds Claude-specific content below. Both tools read the same base instructions without duplication.
Q: How do CLAUDE.md path-scoped rules differ from Cursor’s globs?
Both scope rules to file patterns, but differently. Claude Code’s .claude/rules/ uses paths: frontmatter — rules load when Claude reads matching files. Cursor’s .cursor/rules/ uses globs: — rules auto-attach when matching files are open. Cursor also has four activation modes; Claude Code rules are either always-loaded or path-triggered.