AI rules file formats explained
Short answer: write AGENTS.md. Codex, Cursor and GitHub Copilot read it directly; Claude Code reads it through a one-line @AGENTS.md import in CLAUDE.md (or directly when there is no CLAUDE.md); Gemini CLI reads it with one setting. Add tool-specific files only when you need file-scoped rules.
AGENTS.md
AGENTS.md
The open, cross-tool standard. One Markdown file at the repo root.
CLAUDE.md
CLAUDE.md
Project memory for Claude Code. Can import AGENTS.md with `@AGENTS.md`.
Cursor rules (.mdc)
.cursor/rules/*.mdc
Scoped project rules with frontmatter (`description`, `globs`, `alwaysApply`).
.cursorrules (legacy)
.cursorrules
The original single-file format. Still read, but .cursor/rules is recommended.
Copilot instructions
.github/copilot-instructions.md
Repo-wide instructions plus path-scoped `.github/instructions/*.instructions.md`.
Windsurf rules
.windsurf/rules/*.md
Rule files with a `trigger` (always_on, glob, model_decision, manual).
GEMINI.md
GEMINI.md
Context file for Gemini CLI, or point it at AGENTS.md via settings.
Comparison
| File | Location | Read by |
|---|---|---|
| AGENTS.md | AGENTS.md | Codex, Cursor, GitHub Copilot, Jules, Zed, Warp, opencode, Aider (via config) and 20+ more |
| CLAUDE.md | CLAUDE.md | Claude Code |
| Cursor rules (.mdc) | .cursor/rules/*.mdc | Cursor |
| .cursorrules (legacy) | .cursorrules | Cursor (legacy single file) |
| Copilot instructions | .github/copilot-instructions.md | GitHub Copilot (Chat, coding agent, code review, CLI) |
| Windsurf rules | .windsurf/rules/*.md | Windsurf / Devin Desktop |
| GEMINI.md | GEMINI.md | Gemini CLI |