Skip to content

AGENTS.md vs CLAUDE.md: what differs and which to use

By the Toolbay team · Checked against the sources below on

Both files hold the same kind of thing: instructions for a coding agent. AGENTS.md is an open format read by many agents (Codex, Cursor, GitHub Copilot, Gemini CLI and more). CLAUDE.md is Claude Code's own file, with extras like imports and path-scoped rules.

If more than one agent touches your repo, write the shared rules in AGENTS.md and put @AGENTS.md at the top of CLAUDE.md. One copy of the rules, every agent covered.

AGENTS.md and CLAUDE.md compared (official docs, checked 2026-11-24)
AGENTS.mdCLAUDE.md
Read byCodex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Zed, Aider and others (agents.md list); Claude Code when no CLAUDE.md existsClaude Code
LocationsRepo root and any subfolder; Codex also ~/.codex/AGENTS.mdManaged policy, ~/.claude/CLAUDE.md, ./CLAUDE.md or ./.claude/CLAUDE.md, ./CLAUDE.local.md, subfolders
Several filesNearest file wins; chat instructions overrideAll files are joined; closer ones are read last
Size limitCodex: 32 KiB total by defaultGuidance: under about 200 lines per file
ImportsNot part of the format@path/to/file, up to four levels
Per-file rulesUse nested files.claude/rules/*.md with a paths list
FrontmatterNoneNone in CLAUDE.md; paths in .claude/rules files

Use both with one line

CLAUDE.md
@AGENTS.md

## Claude Code only
- Use the code-review skill before you say a change is done.

Claude Code's docs give this exact pattern for repos that already have an AGENTS.md. Recent Claude Code versions also read AGENTS.md directly when there is no CLAUDE.md at all.

Choose AGENTS.md if

  • Your team uses more than one agent, or might.
  • You want the rules to read like a README that people can follow too.

Choose CLAUDE.md if

  • Only Claude Code works on the repo.
  • You need imports or path-scoped rules to keep the always-loaded part short.

Whichever you choose, the same rules decide whether the agent follows it: exact commands, checkable rules, short files, no contradictions between files.