Claude Code, Codex CLI, Cursor, and Gemini CLI do not share one default instruction file. Claude Code’s default chooses project CLAUDE.md before AGENTS.md; Codex CLI starts with AGENTS.md; Cursor picks up root AGENTS.md and CLAUDE.md; Gemini CLI starts with GEMINI.md. To share one file, add an import or configure the filename.
Key facts
- The Claude Code documentation read on 2026-10-06 requires v2.1.277 or later for direct
AGENTS.mdsupport. Its defaultclaude-md-or-agents-mdreadsAGENTS.mdonly when no projectCLAUDE.md,.claude/CLAUDE.md, orCLAUDE.local.mdexists in the working directory or an ancestor. - Cursor automatically picks up root
AGENTS.mdand rootCLAUDE.md. Cursor appliesCLAUDE.mdto every conversation, regardless ofalwaysApplyfrontmatter. - Gemini CLI defaults to
GEMINI.md. Itscontext.fileNamesetting accepts one filename or an array; descendant discovery is limited to 200 directories by default. - Codex CLI walks from the Git root to the working directory, checking
AGENTS.override.md, thenAGENTS.md, then configured fallback names. The default combined instruction budget is 32 KiB. - Claude Code does not load
AGENTS.local.md,AGENTS.override.md, or files under.agents/as project instructions.
Instruction-file comparison
Tool | Default entry point | Override or alternate path | Directory behavior |
|---|---|---|---|
Claude Code |
|
| Current directory and ancestors; subdirectories load on demand |
Cursor | Root |
| Root files load automatically; rule precedence is Team > Project > User |
Gemini CLI |
|
| Global file, ancestors to the |
Codex CLI |
|
| Git root down to the current directory; one file per directory |
Claude Code’s project instructions
Claude Code supports direct AGENTS.md loading from v2.1.277. Under the default Project instructions value, claude-md-or-agents-md, a project CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md in the current directory or an ancestor means Claude Code reads the CLAUDE.md files instead of project AGENTS.md files.
User-level ~/.claude/CLAUDE.md, organization-managed CLAUDE.md, and .claude/rules/ do not trigger that choice. When no project file counts, Claude Code loads AGENTS.md files from the directory chain and loads a subdirectory file when it reads a file there. AGENTS.local.md, AGENTS.override.md, and .agents/ files are not part of this discovery.
The /config setting claude-md-and-agents-md loads both formats. A CLAUDE.md can also import AGENTS.md with @AGENTS.md, which is useful when Claude-specific instructions must sit beside shared instructions.
Cursor’s rules and root files
Cursor’s rules help says a root AGENTS.md is picked up automatically. Cursor treats a root CLAUDE.md the same way and applies it to every conversation, even if its frontmatter says otherwise. Project-specific rules live in .cursor/rules/*.mdc; their frontmatter can use alwaysApply, globs, or description.
Team Rules take precedence over Project Rules, which take precedence over User Rules. Cursor rules apply to Agent Chat; they do not control Tab completion, Inline Edit, or Bugbot PR reviews.
Gemini CLI’s context files
Gemini CLI’s default context filename is GEMINI.md. It loads a global file from ~/.gemini/, searches the current directory and its parents until a context.memoryBoundaryMarkers entry such as .git, and scans descendants. The descendant search limit is 200 directories by default.
Gemini CLI concatenates the discovered files. More specific content supplements or overrides broader context. To read AGENTS.md as well, configure the filename list:
{
"context": {
"fileName": ["GEMINI.md", "AGENTS.md"]
}
}Use /memory show to inspect the loaded context and /memory refresh to rescan it.
Codex CLI’s instruction chain
Codex CLI checks global instructions in ~/.codex or $CODEX_HOME, preferring AGENTS.override.md over AGENTS.md. For a repository, it starts at the Git root and checks each directory down to the current directory. At each level it checks AGENTS.override.md, AGENTS.md, and then the names in project_doc_fallback_filenames, selecting at most one file.
Codex CLI concatenates the selected files from root to leaf. The default project_doc_max_bytes limit is 32 KiB. To let Codex read another shared filename, add it to ~/.codex/config.toml:
project_doc_fallback_filenames = ["CLAUDE.md", "GEMINI.md"]Sharing one instruction file
Use AGENTS.md for tool-neutral instructions. Codex CLI and Cursor read it automatically. Claude Code reads it by default only when no project CLAUDE.md or CLAUDE.local.md is present; otherwise use @AGENTS.md or the claude-md-and-agents-md setting. Gemini CLI needs AGENTS.md added to context.fileName.
This leaves each tool’s private layer intact: CLAUDE.md for Claude Code, .cursor/rules/*.mdc for Cursor-specific matching, and GEMINI.md for Gemini CLI context.
Sources
- Claude Code Memory Documentation: https://code.claude.com/docs/en/memory (read 2026-10-06)
- Cursor Rules Documentation: https://cursor.com/help/customization/rules (read 2026-10-06)
- Gemini CLI Configuration Reference: https://geminicli.com/docs/reference/configuration/ (read 2026-10-06)
- Codex Custom Instructions Documentation: https://www.codex-docs.com/en/docs/agent-configuration/agents-md (read 2026-10-06)
Last verified: 2026-10-06.