AI Agent Rules Files Cheat Sheet: CLAUDE.md, AGENTS.md, Cursor, Copilot, Gemini and More
Checked against Agent instruction files Each vendor's docs as read on 28 Nov 2026 (Claude Code memory page, Cursor rules, GitHub Copilot custom instructions, Gemini CLI, Codex, Cline, Continue, Devin Desktop) on 28 November 2026. Each section links to the official docs it was checked against.
This sheet is for teams that use more than one coding agent and want to know which file each one actually reads. It lines up file paths, scopes and precedence rules from each vendor's own documentation as published on 28 Nov 2026. Every row comes from those pages; none of it was tested against a live agent, so each row is marked untested.
When to use what
If you only remember one thing: put shared, tool-neutral guidance in a root AGENTS.md. The agents.md site lists Codex, Cursor, Gemini CLI, Devin, Zed, Windsurf and the Copilot coding agent among its readers, and Cline and Devin Desktop pick it up too. Write build commands, test commands and conventions there once.
Then add a tool-specific file only for what that tool needs on top. Claude Code is the case to watch: per its memory docs it reads AGENTS.md only when no CLAUDE.md or CLAUDE.local.md sits in the working directory or above it. If you keep both, make CLAUDE.md import the shared file with an @AGENTS.md line so Claude still sees it. Gemini CLI reads only GEMINI.md until you list AGENTS.md under context.fileName.
Use path-scoped rules for anything that applies to part of the repo: .claude/rules/*.md with paths:, .cursor/rules/*.mdc with globs, .github/instructions/*.instructions.md with applyTo. Scoped rules keep the always-loaded context small, which matters because every line of an always-on file is sent with every request. Paste a draft into the token counter to see what it costs per turn, and test your glob patterns in the glob tester before trusting them.
For the reasoning behind a single shared file, our post on AGENTS.md and repository instructions goes further. The tool pages for Claude Code, Cursor and GitHub Copilot cover the agents themselves.
Files found up the directory tree are concatenated, not overridden, ordered from the filesystem root down to your working directory. Subdirectory files load when Claude touches files there.
/Library/Application Support/ClaudeCode/CLAUDE.mdManaged policy file on macOS (Linux and WSL: /etc/claude-code/CLAUDE.md); org-wide and cannot be excluded with claudeMdExcludes
~/.claude/CLAUDE.mdYour personal instructions for every project on this machine
./CLAUDE.md or ./.claude/CLAUDE.mdProject instructions committed for the team
./CLAUDE.local.mdPersonal per-project notes; add it to .gitignore yourself
.claude/rules/*.mdModular rule files, discovered recursively; ~/.claude/rules/ holds user-level ones that load before project rules
paths:
- "src/api/**/*.ts"YAML frontmatter that makes a rule load only when Claude works on matching files
@path/to/file.mdImport another file into CLAUDE.md; relative to the importing file, up to four hops deep
/initGenerate a starter CLAUDE.md from the codebase, or suggest edits if one exists
Codex walks from the project root (usually the git root) down to the working directory and includes at most one file per directory. Closer files come later, so they win.
~/.codex/AGENTS.mdGlobal Codex instructions (or under CODEX_HOME); AGENTS.override.md there is checked first
AGENTS.override.mdPer-directory override that Codex reads before AGENTS.md in the same folder
project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"]Extra filenames Codex accepts, set in ~/.codex/config.toml
project_doc_max_bytes = 65536Raise the instruction size cap from its 32 KiB default; content past the cap is truncated
AGENTS.md (nested)agents.md says the file closest to the edited file wins and explicit chat prompts override everything
Source: https://agents.md/
Cursor lists precedence as Team Rules, then Project Rules, then User Rules; all applicable rules are merged and earlier sources win on conflict.
.cursor/rules/*.mdcProject rules, version-controlled, subfolders allowed; a plain .md there is ignored
alwaysApply: trueAlways Apply mode: the rule goes into every chat
description: "..."Apply Intelligently mode: the agent decides from the description whether to include it
globs: src/**/*.ts,src/**/*.tsxApply to Specific Files mode: included when a matching file is in context; comma-separate patterns
@my-rulePull in an Apply Manually rule (no description or globs) by mentioning it
AGENTS.md (root or subfolder)Plain markdown without metadata; nested files combine with parents and the more specific one takes precedence
GitHub says personal instructions take priority, then repository, then organization, but all relevant sets are sent, so avoid contradictions between levels. Code review reads instructions from the pull request's head branch.
.github/copilot-instructions.mdRepository-wide instructions for Copilot
.github/instructions/NAME.instructions.mdPath-specific instructions, in or below .github/instructions
applyTo: "**/*.ts,**/*.tsx"Frontmatter globs that decide which files a path-specific file covers
excludeAgent: "code-review"Stop Copilot code review (or "cloud-agent") from reading this file
AGENTS.md (any folder)Agent instructions; the nearest one in the directory tree takes precedence
CLAUDE.md or GEMINI.md (repo root)A single root file of either name is also accepted as agent instructions
The CLI concatenates every file it finds and sends the result with each prompt.
~/.gemini/GEMINI.mdGlobal default instructions for all projects
GEMINI.md (workspace and parents)Found by searching configured workspace directories and their parents
GEMINI.md (just in time)When a tool touches a directory, the CLI scans it and its ancestors up to a trusted root
"context": { "fileName": ["AGENTS.md", "GEMINI.md"] }settings.json entry that makes Gemini CLI read AGENTS.md as well
@./components/instructions.mdImport another markdown file; relative and absolute paths both work
/memory showPrint the full concatenated memory the model receives
/memory reloadRe-scan and reload every GEMINI.md after you edit one
Continue rows: https://docs.continue.dev/customize/deep-dives/rules. Devin Desktop rows: https://docs.devin.ai/desktop/cascade/memories.
.clinerules/ or .cline/rules/Cline workspace rule folders at the project root; both are searched
~/Documents/Cline/RulesCline global rules on macOS and Linux (Documents\Cline\Rules on Windows)
paths:
- "src/components/**"Cline conditional rule frontmatter; paths: [] means the rule never fires
.cursorrules, .windsurfrules, AGENTS.mdOther files Cline detects automatically; ~/.agents/AGENTS.md works as a global file
.continue/rules/01-general.mdContinue rule file; files load in lexicographic order, so number prefixes set the order
globs / regex / alwaysApply / descriptionContinue frontmatter keys that decide when a markdown rule is included
.devin/rules/*.mdDevin Desktop workspace rules, one per file; ~/.devin/global_rules.md is the global file
trigger: always_on | glob | model_decision | manualDevin Desktop activation modes set in rule frontmatter
AGENTS.md, AGENTS.local.md, AGENT.mdRead by Devin Desktop as always-on rules from the workspace root down to the working directory
Worked example: One AGENTS.md shared by Claude Code, Gemini CLI and Copilot
Say the repo already has a root AGENTS.md and you are adding Claude Code and Gemini CLI. You want one source of truth.
# CLAUDE.md (repo root)
@AGENTS.md
## Claude-only
- Use the /test skill before committing.
// .gemini/settings.json
{
"context": { "fileName": ["AGENTS.md", "GEMINI.md"] }
}
What each tool ends up reading, according to its docs:
- Claude Code finds
CLAUDE.md, so it skips loadingAGENTS.mdon its own. The@AGENTS.mdimport pulls it back in, so Claude gets the shared rules plus the Claude-only line. - Gemini CLI now looks for both names and concatenates what it finds, so the shared file reaches it with no copy.
- Copilot's coding agent reads the nearest
AGENTS.mdwithout any setup. - Codex reads
AGENTS.mdfrom the root down to your working folder.
To confirm, run /memory show in Gemini CLI and look for the shared headings. In Claude Code, ask it to list the instruction files it loaded. If a heading is missing, check the filename spelling and whether a CLAUDE.md higher up the tree is masking the shared file.
Common mistakes
Adding a CLAUDE.md to a repo that relies on AGENTS.md and wondering why Claude ignores the shared rules.
Claude Code reads AGENTS.md only when no CLAUDE.md exists in or above the working directory. Add
@AGENTS.mdat the top of CLAUDE.md.Saving Cursor project rules as
.cursor/rules/style.md.Cursor's docs say project rules must end in
.mdc; a plain.mdin that folder is ignored. Rename the file.Expecting Gemini CLI to read AGENTS.md out of the box.
Set
context.fileNamein settings.json to a list that includesAGENTS.md, then run/memory reload.Writing a rule in CLAUDE.md and treating it as a hard block, such as never touching a production config.
The Claude Code docs say these files are context, not enforced configuration. Use a PreToolUse hook or permission rules for anything that must never happen.
Letting a 40 KB AGENTS.md grow in a Codex project.
Codex truncates at
project_doc_max_bytes, 32 KiB by default. Move area-specific guidance into nested AGENTS.md files or raise the limit deliberately.Putting conflicting advice in personal, repo and org Copilot instructions and expecting the personal one to cleanly win.
GitHub sends all relevant sets together. Priority only helps the model choose; remove the contradiction instead.
Related cheat sheets
Sources
- https://code.claude.com/docs/en/memory
- https://cursor.com/docs/context/rules
- https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions
- https://geminicli.com/docs/cli/gemini-md/
- https://learn.chatgpt.com/docs/agent-configuration/agents-md
- https://docs.cline.bot/features/cline-rules
- https://docs.continue.dev/customize/deep-dives/rules
- https://docs.devin.ai/desktop/cascade/memories
- https://agents.md/
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.