A lightweight convention - originally introduced by OpenAI and now hosted under the Agentic AI Foundation - for giving AI coding agents project-specific guidance through a plain Markdown file at the root of a repository. AGENTS.md is the guidance-layer complement to the MCP tool layer and A2A communication layer.
The primary AGENTS.md file MUST be placed at the repository root so any coding agent cloning the project can locate it without knowing the repository's layout
A fixed well-known location is the whole point of the convention - agents must be able to find project guidance without per-repo configuration
AGENTS.md SHOULD use conventional top-level Markdown headings such as Project Overview, Setup Commands, Code Style, Testing Instructions, and Security Considerations so agents can target specific information instead of reading the entire file
A small standard vocabulary of section headings lets agents extract the exact instructions they need for a task without having to interpret prose for every request
AGENTS.md SHOULD remain readable by humans - structured prose, command blocks, and short lists are preferred over machine-oriented formats like embedded JSON or YAML
The file doubles as onboarding documentation for human contributors; keeping it human-first means it stays current as part of normal code review
Projects SHOULD include a Setup Commands section listing the exact shell commands an agent should run in order to install dependencies and prepare a working tree
Setup is the single most common thing agents get wrong on a new repo; an explicit command list is cheaper to maintain than a prose description and eliminates guessing
AGENTS.md SHOULD complement rather than duplicate README.md - README targets humans first and AGENTS.md targets agents first, so they can diverge where the audiences differ
Duplicated content drifts out of sync; splitting by audience keeps each file useful without forcing every change to happen twice
Nested AGENTS.md files SHOULD only apply to tasks operating inside their subdirectory tree, and SHOULD NOT override global guidance for work elsewhere in the repo
Monorepos mix languages and subprojects whose conventions differ; scoping nested files to their own tree lets each subproject express its rules without leaking across the repo
A nested AGENTS.md SHOULD inherit from the parent directory's AGENTS.md unless it explicitly supersedes a particular section
Writing every rule from scratch in every package is a maintenance burden; inheritance keeps shared defaults in one place and lets subprojects customize only what they need