What file name should I use?
What file name should I use?
The file must be named
AGENTS.md — the name is case-sensitive. Place it at the root of your repository or inside any subdirectory. Agents look for this exact filename when reading context for a task.Are there required fields?
Are there required fields?
No. AGENTS.md is just standard Markdown. Use any headings you like; the agent simply parses the text you provide. There is no schema, no required sections, and no special syntax.
Is there a schema or required format?
Is there a schema or required format?
No. The format is plain Markdown. Any valid
.md file named AGENTS.md is valid. Conventionally, ## headings are used to separate topic areas, but even this is not required.Can I have multiple AGENTS.md files?
Can I have multiple AGENTS.md files?
Yes. In a monorepo, you can place an AGENTS.md in the root and additional ones inside each package or subdirectory. Agents automatically read the nearest file in the directory tree — the closest one to the file being edited takes precedence. The OpenAI main repository uses 88 AGENTS.md files.
Will agents automatically find AGENTS.md?
Will agents automatically find AGENTS.md?
Yes. Agents look for AGENTS.md at the repository root and walk up the directory tree from the file being edited to find the nearest one. You do not need to reference it explicitly in your prompts.
What if instructions conflict?
What if instructions conflict?
The closest AGENTS.md to the edited file wins. Explicit user chat prompts override everything — instructions given directly in chat always take precedence over AGENTS.md.
Will the agent run testing commands found in AGENTS.md automatically?
Will the agent run testing commands found in AGENTS.md automatically?
Yes — if you list them. The agent will attempt to execute relevant programmatic checks and fix failures before finishing the task. Be explicit about which commands must pass before a change is considered complete.
Do I need to list every command?
Do I need to list every command?
No. Only include commands that are non-obvious or that agents are likely to get wrong without guidance. If
npm test is the only test command and it works from the root, you may not need to document it at all. Focus on commands with special flags, filters, or prerequisites.Can I update AGENTS.md later?
Can I update AGENTS.md later?
Absolutely. Treat AGENTS.md as living documentation. Update it whenever your build process, conventions, or tooling changes.
How do I migrate existing docs to AGENTS.md?
How do I migrate existing docs to AGENTS.md?
Rename your existing file and create a symbolic link so tools that expect the old name still work:
How do I configure Aider?
How do I configure Aider?
Configure Aider to read AGENTS.md by adding the following to
.aider.conf.yml:How do I configure Gemini CLI?
How do I configure Gemini CLI?
Configure Gemini CLI to use AGENTS.md in
.gemini/settings.json:More resources
Format reference
Complete reference for the AGENTS.md format, recommended sections, and examples.
Agent compatibility
See which agents support AGENTS.md and any agent-specific notes.
Quickstart
Create your first AGENTS.md file in minutes.
What to include
A guide to the sections that matter most.
