Which AI coding tool reads which rules file
Every AI coding tool has its own name for the file that holds your project rules. A repository that several people open with different tools can end up with several files that say different things.
This page lists, per tool, which file it reads, with a link to the official source for each row. Where we could not confirm a row, it says so.
The table
| Tool | Files it reads | Good to know | Official source |
|---|---|---|---|
| Claude Code | CLAUDE.md or .claude/CLAUDE.md, CLAUDE.local.md, ~/.claude/CLAUDE.md, .claude/rules/*.md | Files in the working directory and every directory above it load at launch; files in subdirectories load when Claude works there. All files are concatenated, not overridden. @path imports are expanded. It reads AGENTS.md only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or above (v2.1.277 or later). Auto memory MEMORY.md is separate. | Claude Code docs: Memory |
| OpenAI Codex | AGENTS.md, AGENTS.override.md, ~/.codex/AGENTS.md | Global file from ~/.codex first, then one file per directory from the project root down to the working directory. In each directory AGENTS.override.md wins over AGENTS.md. Fallback names go in project_doc_fallback_filenames. Codex stops adding files at project_doc_max_bytes, 32 KiB by default. | Codex docs: AGENTS.md |
| Gemini CLI | GEMINI.md, ~/.gemini/GEMINI.md | Loads the global file, files in your workspace directories and their parents, and files it finds in a directory when a tool touches it. The setting context.fileName takes other names, for example AGENTS.md. Imports use @file.md. /memory show prints the loaded context. | Gemini CLI docs: GEMINI.md files |
| GitHub Copilot | .github/copilot-instructions.md, .github/instructions/*.instructions.md, AGENTS.md, or one CLAUDE.md or GEMINI.md in the repository root | The .instructions.md files carry an applyTo glob in their frontmatter, and excludeAgent can keep one from the cloud agent or code review. With several AGENTS.md files, the nearest one takes precedence. Personal instructions rank above repository instructions, which rank above organization instructions. This row follows the page for Copilot on GitHub; the IDE page was not checked. | GitHub Docs: Add repository custom instructions |
| Cursor | Not confirmed | On 2026-12-05 the Cursor docs address forwarded to a different product's documentation, so we make no claim here. See the section below. | Cursor docs |
| Windsurf | Not confirmed | On 2026-12-05 the Windsurf docs address forwarded to a different product's documentation, so we make no claim here. See the section below. | Windsurf docs |
Each row states what its source says on 2026-12-05. Versions and settings change, so check the linked page when it matters.
AGENTS.md across the tools
AGENTS.md is the one name that shows up in all four confirmed rows, with different rules:
- Codex reads it as its main file.
- GitHub Copilot reads it anywhere in the repository, and the nearest file takes precedence.
- Gemini CLI reads it when you list it in
context.fileName. - Claude Code reads it only when you have no
CLAUDE.md. To keep one shared file next to aCLAUDE.md, import it with a line that says@AGENTS.md, and put Claude-specific text below it:
@AGENTS.md
## Claude Code
Use plan mode for changes under src/billing/.The Claude Code docs describe this import and a setting, Project instructions in /config, that lets Claude read both files. For how to keep one source of rules in a repo, see AGENTS.md, CLAUDE.md and copilot-instructions in one repo.
Cursor and Windsurf
We wanted these two rows in the table and could not back them from an official source today:
- Cursor. Requests to
cursor.com/docs/...were forwarded (HTTP 308) todocs.grok.com/build, which is the documentation of Grok Build, a different product. - Windsurf. Requests to
docs.windsurf.comwere forwarded todocs.devin.ai, to the Devin Local pages.
We did not carry anything over from those pages. Look in the product's own settings or documentation for the file names it reads.
Check your own files with audit-rules
Rule files are loaded into the model's context, so a secret or a hidden instruction inside one reaches everyone who uses that file. cachly publishes a checker for them, audit-rules. It runs locally, makes no network calls and needs Node.js 20 or newer:
npx @cachly-dev/audit-rules .Per its README it scans CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules, .cursor/rules/*.mdc, .github/copilot-instructions.md, .windsurfrules and others, plus MCP configs and .claude/settings.json. It reports leaked secrets, hidden prompt injection, invisible Unicode and over-broad permissions, and it warns when one repository carries rule files for several tools, because those can drift apart. The npm package is @cachly-dev/audit-rules. Try it on a harmless sample with npx @cachly-dev/audit-rules --demo.
Sources
- Claude Code docs: How Claude remembers your project (Claude Code row)
- Codex docs: Custom instructions with AGENTS.md (Codex row)
- Gemini CLI docs: Provide context with GEMINI.md files (Gemini CLI row)
- GitHub Docs: Adding repository custom instructions for GitHub Copilot (GitHub Copilot row)
- audit-rules on GitHub (the checker named at the end)
Checked against the official docs on .
More: AGENTS.md, CLAUDE.md and copilot-instructions in one repo · Claude Code auto memory · CLAUDE.md too long · All docs