AGENTS.md: brief your coding agents in one file.

Codex, Cursor, Copilot, Claude Code and more read it at the start of every session. Research says it only pays off when it is short and specific.

An open notebook with a pen lying across its blank pages
Photo by Mike Tinnion on Unsplashdithered by Cyborb

AGENTS.md is a plain Markdown file at the root of your repository that tells AI coding agents how your project works: how to install it, run the tests, follow your conventions and avoid known traps. Think of it as a README written for agents instead of people. OpenAI Codex, Cursor, GitHub Copilot, VS Code and recent versions of Claude Code all read it.

The catch is that more is not better. A 2026 study from ETH Zurich found that these files did not generally raise agents’ success rates and added over 20% to inference cost. The instructions inside were followed well, though. So write down what an agent cannot guess, and nothing else.

The short version
  • AGENTS.md is a Markdown file of standing instructions for coding agents, kept at the root of your repo.
  • Most major coding agents read it automatically. A few need a setting or a one-line import.
  • Put in what an agent cannot guess: exact commands, unusual conventions and known traps.
  • Leave out overviews, secrets and rules your tools already enforce.
  • Keep it short, and update it in the same commit that changes how the project builds or tests.

What is AGENTS.md?

The format grew out of work across several agent makers, including OpenAI Codex, Amp, Google’s Jules, Cursor and Factory. In December 2025, OpenAI contributed it to the Agentic AI Foundation, a fund under the Linux Foundation that also holds Anthropic’s Model Context Protocol and Block’s goose. At the time, the foundation said more than 60,000 open-source projects and agent frameworks had adopted it.

Why not just use the README? Because the audiences differ. A README welcomes people with a quick start and a screenshot. An agent needs the tedious details: the exact test command, the folder it must never edit, the check that has to pass before a task counts as done.

Which tools read AGENTS.md?

Support has spread fast, and each tool has its own quirks. As of September 2026, according to each vendor’s docs:

ToolReads AGENTS.md?Worth knowing
OpenAI CodexYes, nativelyAlso reads a global file in ~/.codex. Combined files are capped at 32 KiB by default
Claude CodeYes, from v2.1.277By default, only when the project has no CLAUDE.md. Otherwise, import it (see below)
CursorYesRoot and subfolders, as a simpler alternative to .cursor/rules
GitHub CopilotYesCloud agent, code review and Copilot CLI
VS CodeYesDetects a root file automatically. Nested files are experimental
Gemini CLIWith a settingReads GEMINI.md by default. Add AGENTS.md to context.fileName

The official site lists many more, including Jules, Devin, Windsurf, Zed, Warp, goose, opencode, Aider, Amp, Junie and Factory. Support changes quickly, so check your tool’s docs when something seems ignored.

What to put in AGENTS.md

Write down what a new senior engineer would need on day one, and only that. In practice, that is five things.

  • Setup. The exact install and run commands, including the package manager you actually use.

  • Checks. How to type check, lint, run all tests and run one test file. This is the single most useful section.

  • Conventions that differ from the defaults. Where server code lives, how errors are handled, how money is stored.

  • Gotchas. Generated folders, fake clocks, slow tests, anything that has burned someone before.

  • Boundaries. What needs a human first, such as migrations, billing code or new dependencies.

The ETH Zurich researchers found that agents follow these files closely, but that repository overviews did not help. Their conclusion was that context files are useful for specifying non-standard practices. In other words, document what differs from what an agent would assume.

A complete AGENTS.md example

Here is a full file for a TypeScript web app. It is short on purpose.

AGENTS.md
# AGENTS.md

## Setup
- Install with `pnpm install`. Do not use npm or yarn.
- Copy `.env.example` to `.env.local`. Never commit any `.env` file.
- Start the dev server with `pnpm dev` (http://localhost:3000).

## Checks
- Type check: `pnpm typecheck`
- Lint: `pnpm lint`
- All tests: `pnpm test`
- One file: `pnpm vitest run src/lib/cart.test.ts`
- Before you say a task is done, run all three checks. They must pass.

## Conventions
- TypeScript strict mode. No `any`: use `unknown` and narrow it.
- Server code lives in `src/server/`. Never import it from `src/components/`.
- Store money as integer cents. Format it only in the UI with `formatPrice()`.
- User-facing text goes through `t()` from `src/i18n`. No hardcoded strings.

## Gotchas
- `src/generated/` is written by `pnpm codegen`. Never edit it by hand.
- Tests use a fake clock. Call `vi.useRealTimers()` if a test needs real time.

## Ask before you
- Write a database migration.
- Touch anything in `src/billing/`.
- Add a new dependency.

Every line is either a command, a rule an agent would not infer, or a trap. There is no mission statement and no tour of the folder structure.

These are usually the exact checks a coding agent should also run unattended in CI; our guide to running a coding agent in GitHub Actions shows a working pipeline file.

What to leave out

Belongs in AGENTS.md
  • Exact install, test, lint and build commands
  • How to run a single test
  • Conventions that differ from the defaults
  • Generated files and folders to never edit
  • Actions that need a human’s approval
Leave it out
  • Long project overviews and history
  • Style rules your formatter already enforces
  • API keys, tokens or private URLs
  • Vague advice such as “write clean code”
  • Instructions meant for human contributors

Anything that must happen every time belongs in tooling, not prose. Claude Code’s docs make the same point: for rules that can never be skipped, use a hook, a shell command that runs automatically at a fixed point.

And remember that AGENTS.md is usually committed and often public. Treat it like any other file in the repo, and never paste a secret into it.

How long should AGENTS.md be?

Shorter than you think. Codex stops reading once the combined files reach 32 KiB by default. Claude Code’s docs suggest keeping its own instructions file under 200 lines, warning that longer files “consume more context and reduce adherence.”

The reason is the context window. Every line loads into the context window at the start of every session, whether the task needs it or not. That is why context engineering starts with this file. Know-how that only some tasks need, such as how to cut a release, fits better in agent skills, which load only when relevant.

Keep it current, too. A stale command is worse than a missing one, because the agent will run it confidently. Update AGENTS.md in the same pull request that changes the build.

PromptAudit your AGENTS.md
Read AGENTS.md, then check it against this repository.
1. Run every command it lists and report any that fail or no longer exist.
2. Flag instructions that contradict the code, the config files or each other.
3. Flag generic advice an agent would follow anyway, such as "write clean code".
4. Suggest cuts first and additions second. Keep the result under 200 lines.
Do not edit the file. Show me the proposed diff.

AGENTS.md vs CLAUDE.md and other tool files

Several tools had their own instruction files before AGENTS.md caught on: CLAUDE.md for Claude Code, GEMINI.md for Gemini CLI, .cursor/rules for Cursor and .github/copilot-instructions.md for Copilot. The clean setup today is one AGENTS.md as the source of truth, with tool files that point to it.

For Claude Code, this matters because it reads CLAUDE.md instead of AGENTS.md when both exist. The fix from Anthropic’s docs is a CLAUDE.md that imports the shared file, with any Claude-only notes below it:

CLAUDE.md
@AGENTS.md

## Claude Code

Use plan mode for changes under `src/billing/`.

A symlink (ln -s AGENTS.md CLAUDE.md) also works on macOS and Linux. On Windows, use the import, because Git often checks symlinks out as plain text files there.

For Gemini CLI, list AGENTS.md in the context.fileName setting of the project’s .gemini/settings.json:

.gemini/settings.json
{
  "context": {
    "fileName": ["AGENTS.md", "GEMINI.md"]
  }
}

Standing instructions set the ground rules. Each task still needs a clear request, and our prompts for coding agents cover that half. For a bigger feature, writing that request as a proper spec first is its own approach, covered in our guide to spec-driven development.

FAQ

Does Claude Code read AGENTS.md?

Yes, from version 2.1.277, when your project has no CLAUDE.md. If it has one, Claude reads that instead, so add an @AGENTS.md line at the top of your CLAUDE.md to load both.

Where should AGENTS.md go?

At the root of your repository. In a monorepo, you can add one per package. Most tools use the file nearest to the code being edited.

Is AGENTS.md the same as a README?

No. A README is for people who want to understand and use the project. AGENTS.md is for agents that need exact commands, conventions and boundaries to change it safely.

Should I let an AI write my AGENTS.md?

An agent can draft it, but edit hard. In the ETH Zurich study, neither generated nor hand-written files improved success on average, yet agents did follow the instructions. Keep the specific ones and cut everything generic.

Can AGENTS.md contain secrets?

Never. It is committed with your code and often public. Point to where secrets live, such as .env.local, without including the values.

Key takeaways
  • AGENTS.md is a README for coding agents, and most major tools read it.
  • Include commands, unusual conventions, gotchas and boundaries.
  • Leave out overviews, secrets and anything your tools already enforce.
  • Keep it short. Every line costs context on every session.
  • One AGENTS.md as the source of truth, with tool-specific files importing it.

Next, learn how agent skills teach an agent a whole task, or how MCP connects agents to your tools.

Sources
  1. AGENTS.md, Agentic AI Foundation
  2. Custom instructions with AGENTS.md, OpenAI
  3. How Claude remembers your project, Anthropic
  4. Rules, Cursor
  5. Support for different types of custom instructions, GitHub
  6. Use custom instructions in VS Code, Microsoft, September 2026
  7. Provide context with GEMINI.md files, Google
  8. Linux Foundation announces the formation of the Agentic AI Foundation, Linux Foundation, December 2025
  9. Evaluating AGENTS.md: are repository-level context files helpful for coding agents?, Gloaguen et al., ETH Zurich, February 2026 (revised June 2026)
cyborb.ai

Stop reading about it. Build it.

Describe what you want in plain words. Cyborb plans the work, writes and runs the code, makes the assets, and puts the result online.

Download Cyborb

Free to start. No card required.