
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. A practical question comes up quickly: what to commit, and what to keep out of 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. Treat it as reviewable documentation: change it through pull requests, so a convention change shows up in a diff and gets discussed. If each developer keeps a private copy, the copies drift apart, and the assistant follows different rules depending on whose machine it runs on.
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 documentation no longer mentions the single .cursorrules file. Project Rules live as .mdc files under .cursor/rules/, with frontmatter fields (description, globs, alwaysApply); plain .md files there are ignored. Cursor also reads a plain AGENTS.md in the project root or any subdirectory, if you'd rather keep one file across tools. AGENTS.md is the more tool-neutral option: an open, plain-markdown standard supported by OpenAI Codex, Cursor, the GitHub Copilot coding agent, Gemini CLI, VS Code and many other agents and editors, with no required fields.
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 most likely to go stale is the one listing which commands are safe to run without asking. CI configuration and tooling usually change more often than architecture, 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.
Correction, October 23, 2026: an earlier version of this article described two teams observed over six months. We have no record of that observation, so it has been removed, and the advice now stands on its reasoning. We've also updated the Cursor details and linked Claude Code's CLAUDE.md documentation.
Yes, whichever one you use. Treat it like any other file that encodes a team convention, reviewed in pull requests rather than hand-edited on one laptop. If it isn't committed, each contributor ends up with a different version of the conventions.
Per-session scratch files, generated plans and anything the assistant writes to a local working directory during a task. Those are temporary by design; committing them adds noise to diffs.
Whenever the conventions it describes change. The list of commands that are safe to run without confirmation tends to go stale first, because tooling and CI change more often than architecture, so review it whenever you change your CI configuration.
Cursor's current documentation doesn't mention the single .cursorrules file. Project Rules live as .mdc files under .cursor/rules/ with frontmatter, and Cursor also supports a plain AGENTS.md. If a repository still has a .cursorrules file, migrate it rather than assuming it's still read the same way.
- Claude Code documentation, memory and CLAUDE.md: How Claude Code reads CLAUDE.md files, verified 2026-10-23.
- Cursor documentation, Rules: Project Rules format (.cursor/rules/*.mdc) and AGENTS.md support, verified 2026-10-23.
- AGENTS.md: Open, cross-tool standard; used by over 60,000 open-source projects, verified 2026-10-23.