ContextPruner

CLAUDE.md vs AGENTS.md: which one do you need?

CLAUDE.md and AGENTS.md do the same job for different agents. Here's which tools read which file, whether you need both, and how to keep them in sync.

·

Short answer

CLAUDE.md and AGENTS.md do the same job — briefing an AI coding agent on your repo — but for different tools: CLAUDE.md is what Claude Code reads, while AGENTS.md is the cross-agent standard that a growing number of tools look for. If you only use Claude Code, CLAUDE.md is enough; if you work across tools, keep one AGENTS.md and point CLAUDE.md at it so the content lives in a single place.

Short answer: they're the same kind of file for different tools. Both AGENTS.md and CLAUDE.md are plain-Markdown instructions that tell an AI coding agent how to work in your repo. The only real difference is which agent goes looking for which filename.

Which tool reads which file

FileRead by
AGENTS.mdCross-agent standard — most coding agents now read it natively
CLAUDE.mdClaude Code and Claude
GEMINI.mdGoogle Gemini / Gemini CLI
.cursor/rules/*.mdcCursor
.github/copilot-instructions.mdGitHub Copilot

CLAUDE.md, GEMINI.md, and the Cursor/Copilot files came first, each tool inventing its own. AGENTS.mdis the later attempt at a shared, vendor-neutral name so you don't need one file per tool.

Do you need both?

It depends on how many tools touch the repo:

What happens if both exist

A tool reads its own file first: Claude Code uses CLAUDE.md even if an AGENTS.mdsits right next to it. Where directory nesting is supported, the file nearest the code being edited wins, so a subdirectory's instructions override the root for that folder. Precedence, though, is rarely the real problem. The real problem is drift: two files that started identical and slowly disagreed, so the answer you get depends on which tool a teammate happened to open.

Keeping them in sync

The whole point is that the instructions are the same everywhere, so maintain one source of truth and generate the rest. Three ways to avoid drift:

And if the files are already committed, you can check for drift instead of guessing: the lint check compares your existing configs against your current tree and flags where they disagree.

New to the format itself? Start with What is AGENTS.md? for the structure and a worked example.

Related guides