AGENTS.md
AGENTS.md is a plain Markdown file of instructions for AI coding agents, a "README for agents", that Codex reads before doing any work. Codex loads a global ~/.codex/AGENTS.md and then every AGENTS.md from the repository root down to the working folder, closest last, up to 32 KiB; /init writes a first one. The open format is now stewarded by the Agentic AI Foundation.
AGENTS.md is a Markdown file you put in a repository to tell AI coding agents how to work on it: the build and test commands, the code style, what to avoid. Codex "reads AGENTS.md files before doing any work" (OpenAI docs), and so do many other agents, because AGENTS.md is an open format, described by its site as "a README for agents" and used by over 60,000 open-source projects. Type /init in Codex to have it write a first draft for your project (Developer commands).
OpenAI first showed AGENTS.md at the launch of Codex on May 16, 2025, when its engineers said "we've introduced this concept of an AGENTS.md file", released it as an open format in August 2025, and later gave it to the Agentic AI Foundation under the Linux Foundation, which it co-founded with Anthropic and Block (OpenAI). The first Codex launch, on May 16, 2025, already said Codex "can be guided by AGENTS.md files placed within your repository" (OpenAI).
Quick facts
| What it is | Plain Markdown; no required fields or headings (agents.md) |
| Global file | ~/.codex/AGENTS.md, or AGENTS.override.md beside it (OpenAI docs) |
| Project files | Every AGENTS.md from the project root down to the working folder |
| Which wins | The file closest to your working folder, read last |
| Size limit | 32 KiB combined by default (project_doc_max_bytes) |
| Create one | /init in Codex |
| Released | Shown with Codex on May 16, 2025; open format August 2025 |
| Steward | The Agentic AI Foundation, under the Linux Foundation |
| Adoption | Over 60,000 open-source projects, by the site's count |
What goes in an AGENTS.md file?
Anything you would tell a new teammate who writes code but has never seen the project. The format's site suggests a project overview, build and test commands, code style, testing instructions and security considerations, plus commit and pull request rules, deployment steps and known traps (agents.md). A short example:
# AGENTS.md
## Setup commands
- Install deps: `pnpm install`
- Run tests: `pnpm test`
## Code style
- TypeScript strict mode
- Single quotes, no semicolons
Agents run the test commands you list and try to fix failures before finishing (agents.md). A README stays for people; AGENTS.md holds the detail that would clutter it.
How Codex finds AGENTS.md files
Codex builds an instruction chain once per run (in the interactive CLI, once per session) (OpenAI docs):
- Global. In the Codex home folder (
~/.codex, or whereverCODEX_HOMEpoints), it readsAGENTS.override.mdif there is one, otherwiseAGENTS.md. Only the first non-empty file counts. - Project. From the project root (usually the Git root) down to the folder you are working in, it checks each folder for
AGENTS.override.md, thenAGENTS.md, then any fallback names you configured, and takes the first one it finds there. With no project root, it checks only the current folder. - Merge. It joins the files from the root down, so the closest file comes last and overrides anything earlier.
Empty files are skipped, and Codex stops adding files once the total reaches project_doc_max_bytes, 32 KiB by default. Codex stops at the working folder, so put specialized rules as close to the code as possible. A quick check: codex --ask-for-approval never "Summarize the current instructions." should quote your rules back (OpenAI docs).
Override files
AGENTS.override.md replaces the AGENTS.md in the same folder. In a subfolder it lets one team use different rules (a payments service that runs make test-payments instead of npm test); in ~/.codex it is a temporary global override you delete to go back to your normal rules (OpenAI docs).
Other file names and a bigger limit
If a repository already keeps agent rules in another file, add its name to project_doc_fallback_filenames in ~/.codex/config.toml, and raise the size limit if needed:
project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"]
project_doc_max_bytes = 65536
Codex then checks AGENTS.override.md, AGENTS.md, TEAM_GUIDE.md and .agents.md in that order in each folder (OpenAI docs). For files named AGENT.md, the format's site suggests renaming to AGENTS.md and leaving a symbolic link behind (agents.md).
Create one with /init
- Open Codex in the folder where the instructions should live (the repository root for project-wide rules).
- Type
/init. - Read the generated
AGENTS.md, correct it to match how the project really works, and commit it.
Source: Developer commands, OpenAI docs, read Nov 6, 2026. /init for AGENTS.md was announced in the ChatGPT release notes on Jun 11, 2026.
Code review rules
Codex Code Review reads a ## Code Review Rules section in the AGENTS.md closest to the changed code. Keep it to a few rules about consequential, project-specific behavior, each with its safe path or exception, and leave formatting and lint to CI (OpenAI docs, GitHub review). Codex Cloud tasks also use AGENTS.md to find the project's lint and test commands (Codex Cloud (Legacy)).
Keep it short
Codex reads the combined files before every task, and OpenAI's tips for making Codex usage last include "Reduce the size of your AGENTS.md" (pricing). Put rules that only matter in one folder in that folder's file, and package repeatable procedures as skills instead (Codex CLI).
Which tools read AGENTS.md?
OpenAI lists Amp, Codex, Cursor, Devin, Factory, Gemini CLI, GitHub Copilot, Jules and VS Code among the tools that adopted it (OpenAI). Some need a setting: the format's site shows Gemini CLI reading it through .gemini/settings.json and Aider through read: AGENTS.md in .aider.conf.yml (agents.md). Rival agents are compared on Codex vs Claude Code and Codex vs Cursor.
The open format and the Agentic AI Foundation
The format grew out of a Codex need: a predictable place to find a project's conventions, build steps and test rules. OpenAI released it in August 2025 as a file to sit beside README.md, and the format's site credits OpenAI Codex, Amp, Google's Jules, Cursor and Factory with shaping it. OpenAI then co-founded the Agentic AI Foundation (AAIF) under the Linux Foundation with Anthropic and Block, supported by Google, Microsoft, AWS, Bloomberg and Cloudflare, and contributed AGENTS.md to it; Anthropic contributed the Model Context Protocol and Block its goose agent (OpenAI, agents.md). The site notes that OpenAI's main repository had 88 AGENTS.md files when it was written.
Frequently asked questions
What is AGENTS.md? AGENTS.md is a Markdown file of instructions for AI coding agents, a "README for agents", holding build and test commands, code style and project rules. Codex reads it before every task, and many other coding agents support the same open format.
Where does Codex look for AGENTS.md? Codex reads a global file in ~/.codex first, then every AGENTS.md from the repository root down to the folder you are working in; the closest file comes last and wins.
How do I create an AGENTS.md file? Type /init in Codex to generate a draft for the current folder, then edit it to match the project and commit it. Any Markdown with headings you choose works; there are no required fields.
Is there a size limit for AGENTS.md in Codex? Yes. Codex stops adding AGENTS.md files once their combined size reaches 32 KiB by default; raise it with project_doc_max_bytes in config.toml.
What is AGENTS.override.md? AGENTS.override.md replaces the AGENTS.md in the same folder for Codex, so one folder or your global setup can use different rules without deleting the shared file.
Sources
- Custom instructions with AGENTS.md, OpenAI docs, read Nov 6, 2026
- Developer commands, OpenAI docs, read Nov 6, 2026
- Review GitHub pull requests with Codex, OpenAI docs, read Nov 6, 2026
- Codex Cloud (Legacy), OpenAI docs, read Nov 6, 2026
- Pricing, OpenAI docs, read Nov 6, 2026
- Codex CLI, OpenAI docs, read Nov 6, 2026
- ChatGPT release notes, OpenAI Help Center, read Nov 6, 2026
- AGENTS.md, the format's site, read Nov 6, 2026
- OpenAI co-founds Agentic AI Foundation, donates AGENTS.md, OpenAI, read Nov 6, 2026 (no date shown in the copy read)
- Introducing Codex, OpenAI, May 16, 2025
- A research preview of Codex in ChatGPT, OpenAI, May 16, 2025 (video)
- Automatic code reviews with OpenAI Codex, OpenAI, Nov 4, 2025 (video)
Moments
A research preview of Codex in ChatGPT
OpenAI
- AGENTS.md is a Markdown file you put in a repository to tell AI coding agents how to work on it: the build and test…
- OpenAI first showed AGENTS.md at the launch of Codex on May 16, 2025, when its engineers said "we've introduced this…
- Anything you would tell a new teammate who writes code but has never seen the project. The format's site suggests a…
- Agents run the test commands you list and try to fix failures before finishing (agents.md). A README stays for people…
Automatic code reviews with OpenAI Codex
OpenAI
See also
-
CodexCodex is OpenAI's coding agent: it reads a codebase, edits files, runs commands and tests, reviews pull requests and works in the cloud. As of Nov 6, 2026 it lives inside the ChatGPT desktop app, in the Codex CLI, in IDE extensions, in Codex Cloud and on mobile, and every ChatGPT plan includes some of it, Free and Go too.
-
Codex Code ReviewCodex code review posts a GitHub review on your pull requests when you comment @codex review or turn on automatic reviews at chatgpt.com/settings/code-review; it flags only P0 and P1 issues and follows Code Review Rules in your AGENTS.md. GitLab merge requests are in beta, and Codex also reviews local changes with /review and works from Slack, Linear and a GitHub Action. -
Codex CloudCodex Cloud runs OpenAI's coding agent on OpenAI's servers: you connect GitHub repositories, publish a cloud environment, and start tasks from ChatGPT on the web, the desktop app or a phone, each in its own workspace that keeps working while your computer sleeps. It needs ChatGPT Plus or higher; Free and Go do not include it. -
Codex vs Claude CodeOpenAI Codex and Anthropic's Claude Code are both coding agents that read a repository, run commands and make changes; Claude Code leads the independent coding leaderboards as of Nov 6, 2026, while Codex is cheaper to start (it is on ChatGPT Free and Go) and runs cloud tasks and GitHub reviews from the same ChatGPT plan.
-
Codex vs CursorOpenAI Codex is a coding agent included with ChatGPT plans, while Cursor is an AI code editor now owned by SpaceX and sold inside The X Subscription with Grok models; as of Nov 6, 2026 Codex's GPT-6 models score far higher on independent leaderboards, while Cursor offers a full editor and other makers' models at API prices.
-
Codex AppThe Codex app is now the Codex view of the ChatGPT desktop app for macOS, Windows and Linux, where Codex runs parallel chats, worktrees, Computer Use, Appshots, Goal mode, Record and Replay and remote control from a phone. It replaced the standalone Codex app OpenAI launched on Feb 2, 2026.