AGENTS.md explained: instruction files for coding agents
What AGENTS.md is, what to put in it, how nested files and CLAUDE.md or copilot-instructions.md fit in, and a template for your repository.

AGENTS.md is a plain Markdown file in the root of a code repository that tells AI coding agents how to work on the project: how to install dependencies, build, run the tests, follow the code style and prepare a pull request. The AGENTS.md site calls it "a README for agents." Agents read it automatically before they start a task, so you write the instructions once instead of repeating them in every chat.
The format has no required fields or headings. As of November 2026 the site lists more than twenty tools that read it, including Codex, Cursor, Jules, Gemini CLI, Zed, Warp, VS Code, Aider and GitHub Copilot's coding agent, and the format is now maintained by the Agentic AI Foundation under the Linux Foundation. Some tools also have their own file, such as CLAUDE.md for Claude Code. Below is what to put in the file, how nested files work, and how to keep one source of truth across tools.
What should you put in AGENTS.md?
Put in the things an agent cannot work out from the code, or would get wrong on the first try. The AGENTS.md site suggests a project overview, build and test commands, code style guidelines, testing instructions and security considerations, plus pull request rules and deployment steps if they apply.
A template you can copy:
# AGENTS.md
## Project
A TypeScript API server and a React admin app in one pnpm workspace.
`apps/api` is the server, `apps/admin` is the web app, `packages/shared` holds types.
## Setup
- Install: `pnpm install`
- Start everything: `pnpm dev`
## Checks before you finish
- Type check: `pnpm typecheck`
- Tests: `pnpm test` (all), `pnpm --filter api test` (one package)
- Lint and format: `pnpm lint --fix`
Run all three and make sure they pass before you say a task is done.
## Code style
- TypeScript strict mode. No `any` in new code.
- Named exports only.
- Database access goes through `apps/api/src/db/`, never directly from routes.
## Do not
- Edit files in `packages/shared/generated/`; run `pnpm codegen` instead.
- Add a dependency without saying why in the pull request.
- Commit `.env` files or print secrets in logs.
## Pull requests
- Title: `area: short summary`, e.g. `api: add invoice void endpoint`
- Include the commands you ran and their result.
The four backticks only let the example show its inner code here. Your file starts at # AGENTS.md.
How is AGENTS.md different from a README?
A README is written for people deciding whether to use a project and how to get started. AGENTS.md is written for an agent that is about to change the code, so it holds details that would clutter a README: exact check commands, conventions reviewers enforce, generated folders to leave alone.
| README.md | AGENTS.md | |
|---|---|---|
| Reader | New users and contributors | Coding agents |
| Focus | What it is, how to install and use it | How to build, test and change it safely |
| Tone | Explanatory | Short, direct rules |
| Typical length | As long as it needs | Short enough to load on every task |
Keep the two from contradicting each other. If the README already explains setup well, AGENTS.md can link to it and add only the agent-specific rules. Writing the human side is covered in how to write a README.
How do nested AGENTS.md files work?
In a monorepo, put an AGENTS.md in each package that needs its own rules, next to the root one. According to the AGENTS.md site, agents read the nearest file in the directory tree, "the closest AGENTS.md to the edited file wins," and explicit instructions in the chat override everything.
repo/
AGENTS.md rules for the whole repo
apps/
api/
AGENTS.md API-specific test and migration rules
admin/
AGENTS.md UI conventions, component test commands
packages/
shared/
Keep the root file about what is shared and put package details lower down. The site notes that one large repository it uses as an example had 88 AGENTS.md files at the time of writing.
Which tools use their own instruction files?
Several tools read a file of their own, alongside or instead of AGENTS.md. These are the common ones, as documented in November 2026:
| Tool | Its file | Reads AGENTS.md? |
|---|---|---|
| Claude Code | CLAUDE.md or .claude/CLAUDE.md, plus .claude/rules/*.md |
Yes, when there is no CLAUDE.md or CLAUDE.local.md in the working directory or above it (Claude Code v2.1.277 or later) |
| GitHub Copilot | .github/copilot-instructions.md, and .github/instructions/*.instructions.md with an applyTo pattern |
Listed as supported for Copilot's coding agent |
| Gemini CLI | GEMINI.md |
Can be configured to, through the context setting in .gemini/settings.json |
| Cursor | Rules in .cursor/rules/ |
Listed as supported |
Claude Code has a few details worth knowing, from its memory documentation:
~/.claude/CLAUDE.mdholds personal instructions for every project, and aCLAUDE.local.mdin the project holds personal notes you add to.gitignore.- Files are combined, not overridden: instructions from parent folders load first and closer ones are read last.
- A CLAUDE.md can import another file with
@path/to/file. /initgenerates a starting CLAUDE.md from the codebase.- The docs recommend keeping each CLAUDE.md under 200 lines, because longer files "consume more context and reduce adherence."
How do you keep one file for every tool?
Keep AGENTS.md as the source and make the tool-specific files point to it, so you never edit the same rule in three places.
For Claude Code, a one-line CLAUDE.md imports it:
@AGENTS.md
Lines below the import can add rules only Claude Code needs. For tools that only read their own file name, the AGENTS.md site suggests a symbolic link:
ln -s AGENTS.md CLAUDE.md
Symbolic links can behave differently on Windows checkouts, so check that the link survives a clone on every platform your team uses before relying on it.
How do you write instructions agents follow?
Write the file like a checklist from a careful reviewer, not like documentation. Agents follow short, specific, testable rules more reliably than general advice.
- Give exact commands.
pnpm --filter api testbeats "run the API tests." - Say how to verify. Tell the agent which checks must pass before it reports a task as done.
- Name the boundaries. Generated folders, migration files, public APIs: say what not to touch and what to do instead.
- Prefer rules to explanations. "Use
date-fns, notmoment" is enough; the history of the decision belongs elsewhere. - Keep it short. Every line loads on every task. Move rules for one area into a nested file or a path-scoped rule.
- Update it when the agent gets something wrong. A repeated mistake is a missing line.
- Keep secrets out. The file is committed and read by every tool and teammate.
Treat changes to AGENTS.md like code changes: review them in pull requests, because a wrong rule affects every task after it. For more on structuring the files agents read, see context engineering with files, and for reusable task prompts rather than standing rules, see a Markdown prompt library.
Editing agent instructions in Noteline
Noteline, which we make, edits AGENTS.md and CLAUDE.md as plain Markdown files, with headings, lists and fenced code formatted as you type and the Table of Contents panel (Cmd+Shift+O on a Mac, Ctrl+Shift+O on Windows and Linux) for jumping between sections of a long file. Files in hidden folders, such as .github/copilot-instructions.md or .claude/rules/, do not appear in the sidebar, so open those in your code editor. More on using it alongside a codebase is on the developers page.