Reference · 8 min read · Updated 2026-10-20
GEMINI.md vs CLAUDE.md vs AGENTS.md vs Cursor rules vs Copilot instructions
Which rules file each AI coding tool reads, where to put it, and how to keep one source of truth when you use more than one tool.
Every AI coding tool wants a rules file, and they all picked different names. The good news: the content is basically the same Markdown everywhere. This guide covers where each one goes and how to avoid maintaining five copies.
Quick reference
| Tool | Project file | Notes |
|---|---|---|
| AGENTS.md agents (e.g. OpenAI Codex) | AGENTS.md in the repo root | An open convention meant to work across tools. Nested AGENTS.md files in subfolders can add folder-specific instructions. |
| Claude Code | CLAUDE.md in the repo root | Also supports a user-level file for all projects and files in subfolders. Its /init command can draft one from your codebase. |
| Gemini CLI | GEMINI.md in the repo root | Also supports a global file in your home config folder and files in subfolders. The context file name is configurable. |
| Cursor | .cursor/rules/*.mdc | Each rule file has a small frontmatter header controlling when it applies. The older single .cursorrules file is legacy. |
| GitHub Copilot | .github/copilot-instructions.md | Repository-wide instructions. Copilot also supports more targeted instruction files; see GitHub's docs. |
Other Gemini-based agents (Google's Antigravity, for example) also work with project rules. One real project we studied kept its core rules in GEMINI.md and topic rules in .agents/rules/*.md. Check your tool's docs for the exact folders it loads automatically.
The Cursor .mdc header
Cursor rule files are Markdown with a YAML frontmatter block on top:
---
description: "Core project rules"
globs:
alwaysApply: true
---
# Project rules
- ...
alwaysApply: true: included in every request. Use this for your main brain file.globs: file patterns (likesrc/**/*.ts) that attach the rule when matching files are involved. Good for scoped rules.description: helps the agent decide when to pull in a rule that isn't always applied.
Global, project, and folder levels
Most tools support layers, from broadest to narrowest:
- User or global: your personal preferences for every project ("I use Windows and PowerShell", "explain things simply"). Lives in your home folder or the tool's settings, not in the repo.
- Project: the brain file in the repo root. Shared with anyone (and any AI) working on the project.
- Folder: extra rules for one part of the codebase, such as a
server/folder with different conventions.
Keep project facts in the project file so they travel with the repo, and personal taste in the global one.
Using more than one tool? Keep one source of truth
Plenty of people use two or three AI tools on the same repo. Copy-pasting the same rules into five files guarantees they drift apart. Better options:
- One main file, thin pointers. Put everything in
AGENTS.md. In the other files, write one line: "Follow all instructions in AGENTS.md." Some tools also support importing another file directly (Claude Code, for example, supports@pathimports inCLAUDE.md). - Configure the file name where the tool allows it. Some tools let you point them at
AGENTS.mdinstead of their default name, and several now readAGENTS.mdnatively. - Generate them all from the same answers. The Brain File Generator outputs every format from one form, so you can regenerate when rules change.
CLAUDE.md to AGENTS.md works on macOS and Linux, but symlinks in git can misbehave on Windows unless they're enabled. Pointer files are the safer cross-platform choice.What to write in it
The file name matters much less than what's inside. If you haven't written one yet, start with what a brain file is, then pick the guide for your project type.