elvex Collab is free during beta. Sign up now to lock in preferred pricing. Sign up free →

What Is AGENTS.md? AGENTS.md vs CLAUDE.md, Explained

AGENTS.md is a plain Markdown file, usually kept at the root of a code repository, that tells AI coding agents how to work on that project: how to install, build and test it, the code style to follow, which folders to leave alone and anything else a new contributor would need to know. Think of it as a README written for agents instead of people.

Why it matters

A coding agent starts each session knowing nothing about your project. Without instructions it guesses, and the guesses are generic: the wrong test command, a formatting style your team doesn’t use, edits to files that are generated automatically. An AGENTS.md gives every session the same starting point, so you stop repeating the same instructions in prompts.

The name is a shared convention. Many coding agents, including Codex and Cursor, look for a file called AGENTS.md, so one file can serve a team where people use different tools. Some tools also read their own file, such as CLAUDE.md for Claude Code.

Writing a good one

  • Commands first. Install, build, test and lint, exactly as they should be typed.
  • Rules the code doesn’t show. “Never edit files in generated/” or “every API change needs a migration” are the kind of thing an agent can’t work out by reading.
  • Short. The file goes into the agent’s context window every session, so a long one costs tokens and buries the rules that matter.
  • Current. Review changes to it like code and update it when the project changes. A stale instruction is worse than none, because the agent will follow it.

Large repositories can have more than one, with a file in a subfolder adding rules for that part of the code.

Which agents read AGENTS.md

Agent Reads AGENTS.md? Its own file
OpenAI Codex Yes: “Codex reads AGENTS.md files before doing any work” AGENTS.override.md takes precedence in the same folder
Claude Code Yes, when there’s no CLAUDE.md; can be set to read both CLAUDE.md
Cursor Not stated in the Cursor pages we checked Cursor rules

How Codex finds it

Codex looks for a global file in ~/.codex (AGENTS.override.md, else AGENTS.md), then walks from the project root (usually the Git root) down to the current folder, reading one file per folder, AGENTS.override.md before AGENTS.md. Together they’re capped by project_doc_max_bytes, 32 KiB by default. Codex also uses a “Code Review Rules” section in AGENTS.md for GitHub code review.

AGENTS.md vs CLAUDE.md

Both are Markdown instruction files for coding agents. AGENTS.md is the name Codex and many other agents look for; CLAUDE.md is Claude Code’s. “Claude Code reads CLAUDE.md at the start of every session,” and by default reads AGENTS.md only when there’s no CLAUDE.md in the working directory or above it; a setting makes it read both.

AGENTS.md CLAUDE.md
Read by Codex and other agents Claude Code
When Claude Code reads it Only if there’s no CLAUDE.md, unless set to read both Every session
Personal version AGENTS.override.md (Codex) CLAUDE.local.md
Best use Rules shared across every agent your team uses Claude-specific additions

For a team using several agents: keep the shared rules in AGENTS.md, and have CLAUDE.md point to it, or set Claude Code to read both, so Codex, Claude Code and the rest all start from the same instructions.

How elvex relates

elvex publishes its own AGENTS.md: a setup guide written for agents, so a person can point their agent at it and have it work through connecting to elvex.

  • What is AGENTS.md?
    A Markdown file in a code repository that tells AI coding agents how to work on the project: commands, conventions and rules the code doesn’t show.
  • What’s the difference between AGENTS.md and CLAUDE.md?
    AGENTS.md is read by Codex and many other agents; CLAUDE.md is Claude Code’s own file. Claude Code reads AGENTS.md only when there’s no CLAUDE.md, unless you set it to read both.
  • Does Claude Code read AGENTS.md?
    Yes, when there’s no CLAUDE.md in the working directory or above it. A setting makes it read both files.
  • Where should AGENTS.md go?
    At the root of the repository, with optional extra files in subfolders for rules that only apply there. Codex also reads a global one in ~/.codex.
  • How long should AGENTS.md be?
    Short. It’s loaded into the agent’s context every session; Codex caps the combined files at 32 KiB by default.

Sources: Codex AGENTS.md (OpenAI), Claude Code memory and best practices (Anthropic), checked November 20, 2026.

Bring your agent. Bring your team.