
The CLAUDE.md file vs .cursor/rules vs AGENTS.md
What to commit, what to gitignore, and why the CLAUDE.md, Cursor rules, or AGENTS.md file drifts out of date faster than anything else in the repo.
Every team using an AI coding assistant ends up with some form of repo-level instruction file: the CLAUDE.md file for Claude Code, .cursor/rules/*.mdc for Cursor, or a plain AGENTS.md that both of those and a growing list of other tools can read. The question that took longest to settle wasn't what to write in it, it was what to do with it in version control.
| File | Tool | Format |
|---|---|---|
CLAUDE.md | Claude Code | Plain markdown, single file |
.cursor/rules/*.mdc | Cursor | Markdown with frontmatter metadata, one or more files |
AGENTS.md | Cross-tool (OpenAI Codex, Cursor, GitHub Copilot, and others) | Plain markdown, no required fields, over 60,000 open-source projects already use it |
What to commit
Commit the instruction file itself, at the root of the repository, so every clone starts from the same conventions. Six months in, the team that treated it as reviewable documentation (pull requests, diffs, a changelog entry when a convention changed) kept it accurate. The team that let each developer maintain a private copy ended up with three incompatible versions of "how we do commits here" within a quarter.
Which specific file depends on the tool, and it's worth getting current on this rather than assuming last year's convention still holds. Cursor's own documentation no longer mentions the single .cursorrules file at all; Project Rules now live as .mdc files under .cursor/rules/, with frontmatter metadata, and Cursor reads a plain AGENTS.md directly too if you'd rather keep one file across tools instead of a Cursor-specific format. AGENTS.md itself is the more tool-neutral option: an open, plain-markdown standard that OpenAI Codex, Cursor, GitHub Copilot, and a long list of other agents and editors already support, with no required fields and no vendor-specific syntax to maintain.
What to gitignore
Anything generated during a single working session and not meant to outlive it: scratch files, intermediate plans, per-run logs. These are the AI-assistant equivalent of build artifacts, useful while you're looking at them, noise in a diff six months later.
What drifts fastest
The section that goes stale first is almost always the one listing which commands are safe to run without asking first. CI configuration and tooling change more often than architecture does, and a stale allowlist either blocks harmless commands or, worse, quietly permits ones that used to be safe and no longer are. Review that section on the same cadence as your CI config, not once at project setup and never again.
Yes, whichever one you're using. Treat it like any other file that encodes a team convention: reviewed in pull requests, not hand-edited on a laptop and forgotten. Teams that gitignore it end up with as many versions of the convention as there are contributors.
Per-session scratch files, generated plans, and anything the assistant writes to a local working directory during a task. Those are ephemeral by design; committing them just adds noise to diffs.
In the six months this convention was tracked, the file that drifted fastest was the one describing which commands were safe to run without confirmation, tooling and CI changed underneath it roughly monthly. Review it on the same cadence as your CI config, not once at project setup and never again.
Cursor's current documentation no longer references the single .cursorrules file at all. Project Rules now live as .mdc files under .cursor/rules/, with frontmatter metadata, and Cursor also directly supports a plain AGENTS.md for simpler setups. If a repo still has a .cursorrules file, it's worth migrating rather than assuming it's still read the same way.
- Claude Code documentation, CLAUDE.md: Official guidance on repo-level instruction files for Claude Code.
- Cursor documentation, Rules: Current Project Rules format (.cursor/rules/*.mdc) and AGENTS.md support, verified 2026-08-07.
- AGENTS.md: Open, cross-tool standard for the plain-markdown version of this file, verified 2026-08-07.