Guide
AGENTS.md: what it is and how to write one
AGENTS.md is an open format: a Markdown file in a repository that tells coding agents how to work on it. Codex, Cursor and Copilot read it; Claude Code and Gemini CLI can. It can be thought of as a README for agents.
Ahmet Karaca · · Updated
What is AGENTS.md?
AGENTS.md is a Markdown file at the root of a repository that tells coding agents how to build and test the project, which conventions to keep and what not to touch. It is stewarded by the Agentic AI Foundation under the Linux Foundation. agents.md lists more than twenty agents that read it, among them OpenAI Codex, GitHub Copilot's coding agent, Cursor, Gemini CLI and Jules, and says over 60,000 open-source projects use the format.
There is no required structure. Plain headings and short lists work best, because the agent reads the whole file every time.
How do nested and personal files work?
- In a monorepo, each package can have its own AGENTS.md. The file closest to what is being edited wins, and what you type in the chat overrides all of them.
- Codex reads files from the repository root down to the current folder and joins them in that order, so a closer file has the last word. It stops adding files at 32 KiB by default. A file named
AGENTS.override.mdis read in place ofAGENTS.mdin the same folder. - Codex also reads a personal file before any project one:
~/.codex/AGENTS.mdin your home folder. That is the place for how you work, as opposed to how the project works.
Claude Code reads AGENTS.md too, since v2.1.277, but only when there is no CLAUDE.md or CLAUDE.local.md in your working folder or above it; your personal ~/.claude/CLAUDE.md does not count against it. If both exist, it reads CLAUDE.md alone. To share one file, put an @AGENTS.md line in your CLAUDE.md, or change Project instructions in /config.
AGENTS.md or CLAUDE.md: which tool reads which file?
| Tool | Reads AGENTS.md | Its own file | Personal file |
|---|---|---|---|
| Codex | Yes, from the repository root down to the current folder | AGENTS.md is its file | ~/.codex/AGENTS.md |
| Claude Code | Only when no CLAUDE.md is found, or through @AGENTS.md | CLAUDE.md | ~/.claude/CLAUDE.md |
| Cursor | Yes, at the root and in subfolders | .cursor/rules/ | User Rules in settings |
| Copilot in VS Code | Yes, at the root and in nested folders | .github/copilot-instructions.md | ~/.copilot/copilot-instructions.md |
| Gemini CLI | When context.fileName lists it | GEMINI.md | ~/.gemini/GEMINI.md |
So the choice is rarely one or the other. A repository used with several agents can keep AGENTS.md as the single shared file and give Claude Code a one-line CLAUDE.md that says @AGENTS.md. A repository used only with Claude Code needs only CLAUDE.md. The instruction files guide compares all five in more detail.
Why is AGENTS.md not being read?
- Claude Code: a
CLAUDE.mdorCLAUDE.local.mdexists in your folder or above it, so Claude reads that instead. Add@AGENTS.mdto it. - Codex: an
AGENTS.override.mdin the same folder takes its place, an empty file is skipped, and nothing is added once the files together pass 32 KiB. - Cursor: rules in
.cursor/rulesare separate; a plain.mdfile placed there is ignored, while AGENTS.md at the root is read. - VS Code: the agent picked in the chat decides which files are read. Run Chat: Open Customizations to see what the current session found.
- Gemini CLI: it reads
GEMINI.mdunlesscontext.fileNameinsettings.jsonnames AGENTS.md as well.
What is worth writing in it?
Commands the agent cannot guess, conventions it would otherwise break, and the things you keep correcting. A sentence earns its place when it changes what the agent does; a sentence that restates good practice in general costs reading time on every request and changes nothing.
# Project ## Commands - Install: pnpm install - Test: pnpm test - Lint before every commit: pnpm lint ## Conventions - TypeScript strict mode - Do not edit generated files under dist/
Preferences about yourself belong in your personal file instead. A preference committed to a shared repository becomes everyone's rule.
# How I work - Ask before deleting files or running destructive commands. - Plan in a few lines before touching more than three files. - Write commit messages in the language the repository already uses.
Sources, checked on
Where Coredence fits
The personal part is the hard part to write, because it comes from months of corrections spread across every assistant you use. Coredence measures it instead: it reads your own sessions, commits and notes, consolidates them into memories about how you work, and keeps each one tied to the traces it grew from. If you turn it on, it writes your mind into ~/.codex/AGENTS.md and refreshes it every cycle, in its own marked section, leaving what you wrote there yourself untouched. Claude Code, Copilot and Gemini get the same mind in their own files.
Coredence runs on macOS 14 or later (Apple silicon) and Windows 10 or later, with no Coredence account. Consolidation needs a model, and you choose it: your Claude Code subscription, your own API key, or a local model through Ollama. On those paths Coredence itself is free to use. It is not open source. If you would rather not bring a key, its own paid plans include the model.
Try it in your browser