# AGENTS.md: what it is, which agents read it and how to write one

URL: https://agentvera.dev/en/blog/agents-md/ · Published: 2026-11-23

AGENTS.md explained: the open file that tells coding agents how to build, test and work in a repository, which CLIs read it in 2026, and how to write one that helps.

**In short:**

- AGENTS.md is a plain Markdown file that tells coding agents how to build, test and follow a repository’s conventions. It has no required format and is stewarded by the Agentic AI Foundation.
- Codex, Copilot, Cursor, Amp, opencode, Goose, Droid, Windsurf, Kiro, Cline, Kimi Code, Crush, Mistral Vibe and Hermes read it natively. Claude Code reads it when a project has no CLAUDE.md; Gemini CLI needs one setting.
- Research in 2026 found that short, hand-written files help a little and auto-generated ones can hurt and cost more. Keep exact commands, non-obvious rules and boundaries; leave out what the code already shows.

AGENTS.md is a plain Markdown file in a repository that tells AI coding agents how to work in it: how to install, build and test, which conventions to follow and what to avoid. **It started at OpenAI in August 2025, is now stewarded by the Agentic AI Foundation under the Linux Foundation, and is read natively by most coding CLIs in 2026, Claude Code included.**

This guide covers what AGENTS.md is, which agents read it and how, what to put in it, what research says about whether it helps, and how to share one file across several agents.

## What AGENTS.md is

The [agents.md](https://agents.md/ "agents.md") site calls it a README for agents. A README explains a project to people; AGENTS.md holds the details an agent needs and a person usually does not want in the README: exact commands, test steps, conventions the code does not show and things not to touch.

There is no schema. No field or heading is required; it is ordinary Markdown, and each agent reads it as part of its instructions. More than 60,000 open-source projects use it, according to agents.md and the Linux Foundation.

**A short history:**

- **August 2025:** OpenAI releases the format, shaped with Sourcegraph (Amp), Google (Jules), Cursor and Factory, to replace a pile of tool-specific files (`.cursorrules`, `CLAUDE.md`, `GEMINI.md` and so on).
- **9 December 2025:** the Linux Foundation forms the [Agentic AI Foundation](https://www.linuxfoundation.org/press/linux-foundation-announces-the-formation-of-the-agentic-ai-foundation "Agentic AI Foundation"), with AGENTS.md, Anthropic’s MCP and Block’s goose as its founding projects.
- **September 2026:** Claude Code, the last big holdout, starts reading AGENTS.md.

## Which agents read AGENTS.md (November 2026)

| Agent | Reads AGENTS.md | Notes |
|---|---|---|
| Codex | Yes | Also `AGENTS.override.md` and a global `~/.codex/AGENTS.md`; 32 KiB combined by default (`project_doc_max_bytes`) |
| Claude Code | Yes, since 2.1.277 | By default only when there is no CLAUDE.md; change it under Project instructions in `/config` |
| GitHub Copilot | Yes | Coding agent, code review, Copilot CLI and JetBrains; also reads CLAUDE.md and GEMINI.md |
| Cursor | Yes | Root and subfolders, as an alternative to `.cursor/rules` |
| Gemini CLI | With a setting | `"context": {"fileName": ["AGENTS.md", "GEMINI.md"]}` in `.gemini/settings.json` |
| Amp | Yes | Current folder and parents; subfolder files load when Amp reads files there |
| opencode | Yes | Plus a global `~/.config/opencode/AGENTS.md`; falls back to CLAUDE.md |
| Goose | Yes | Default context files are `AGENTS.md` and `.goosehints` |
| Factory Droid | Yes | Also `.factory/`, `.agents/` and personal folders |
| Windsurf | Yes | Root file always on, subfolder files apply in their folder |
| Kiro | Yes | Treated as always-included steering |
| Cline | Yes | After `.clinerules`; also `~/.agents/AGENTS.md` |
| Qwen Code | Yes | Default in current versions; older ones used QWEN.md |
| Kimi Code | Yes | `/init` writes one; also `~/.kimi-code/AGENTS.md` |
| Crush | Yes | Its init writes AGENTS.md by default |
| Mistral Vibe | Yes | Only in folders you have marked as trusted |
| Hermes Agent | Yes | First match of HERMES.md, AGENTS.md, CLAUDE.md and others |
| Aider | Manually | `aider --read AGENTS.md`, or `read: AGENTS.md` in `.aider.conf.yml` |

Each of our CLI guides covers the details for its agent, for example [Codex](/en/blog/how-to-use-codex-cli/ "Codex CLI guide"), [Gemini CLI](/en/blog/how-to-use-gemini-cli/ "Gemini CLI guide"), [Kimi Code](/en/blog/how-to-use-kimi-code/ "How to use Kimi Code") and [Hermes Agent](/en/blog/how-to-use-hermes-agent/ "How to use Hermes Agent").

## Claude Code and AGENTS.md

Many guides still say Claude Code only reads CLAUDE.md. That changed in version 2.1.277, released in September 2026. How it works by default:

- Claude Code reads AGENTS.md **only when the project has no CLAUDE.md**, `.claude/CLAUDE.md` or `CLAUDE.local.md` in the current folder or above.
- Your personal `~/.claude/CLAUDE.md` and `.claude/rules/` do not count for that check; they load alongside AGENTS.md.
- It reads AGENTS.md files from the current folder upward at the start, and subfolder ones when it reads files there. `@path` imports inside AGENTS.md work.
- It does not read `AGENTS.override.md`, `AGENTS.local.md` or anything under `.agents/`.

The trap: adding a `CLAUDE.local.md` for personal notes quietly stops AGENTS.md from loading. To load both, change Project instructions in `/config`.

On older versions, or if you want Claude-only notes on top, keep a CLAUDE.md that imports the shared file:

```markdown
@AGENTS.md

## Claude Code only
- Use plan mode for changes that touch more than three files.
```

A symlink (`ln -s AGENTS.md CLAUDE.md`) also works, but Anthropic’s docs advise against it if anyone on the team uses Windows. For the Claude-specific side, see our [CLAUDE.md best practices](/en/blog/claude-md-agents-md/ "CLAUDE.md best practices").

## Does AGENTS.md actually help?

Two 2026 studies are worth knowing before you write one.

- **"Evaluating AGENTS.md"** ([arXiv 2602.11988](https://arxiv.org/abs/2602.11988 "Evaluating AGENTS.md")) ran Claude Code, Codex and Qwen Code on SWE-bench Lite and on 138 tasks from repositories with developer-written files. LLM-generated files slightly lowered success rates and raised cost by about 20%, adding several steps per task. Developer-written files helped a little (about +2%), and beat generated ones by about 7%. Agents followed the instructions; repository overviews were what did not help.
- **"Agent READMEs"** ([arXiv 2511.12884](https://arxiv.org/abs/2511.12884 "Agent READMEs")) looked at 2,303 real files. Most cover testing, implementation details and architecture; only about 15% mention security or performance.

The lesson is not to skip AGENTS.md. It is to write it yourself, keep it short, and include only what changes what the agent does.

## What to put in AGENTS.md

A good file answers the questions a new teammate would ask on their first day, in the order they would ask them:

```markdown
# AGENTS.md

## Commands
- Install: `pnpm install`
- Test one file: `pnpm vitest run path/to/file.test.ts`
- Before finishing: `pnpm lint && pnpm typecheck && pnpm test`

## Conventions
- TypeScript strict; no `any`. Dates go through `src/lib/dates.ts`.
- API handlers return `Result<T>`, never throw.

## Boundaries
- Ask first: database migrations, new dependencies.
- Never: edit `src/generated/` (run `pnpm codegen`), commit `.env` files.

## Done means
- Tests pass, no new lint warnings, CHANGELOG.md updated for user-facing changes.
```

What earns a place:

- **Exact commands with flags**, especially where the obvious tool is wrong (`make build`, not `go build`). Put them near the top.
- **A testing ladder:** the fast focused test first, then the package checks, then the full suite.
- **Conventions the code does not show**, such as which of two patterns in the codebase is the current one.
- **Boundaries in three tiers:** always, ask first, never. Name generated files and the source to edit instead.
- **A definition of done**, so the agent knows when to stop.

## What to leave out

- **Repository tours.** Agents read folders well; the study above found overviews did not help.
- **Generic advice** ("write clean code", "add tests"). It costs tokens and changes nothing.
- **Rules a linter or formatter already enforces.** Let the tool enforce them.
- **Copies of other docs.** Link to them instead.
- **Secrets, and paths that no longer exist.** Stale instructions are worse than none.
- **Long procedures.** Move them into skills, which load only when needed.

As for length, Claude Code’s docs suggest under 200 lines per file, Codex reads 32 KiB by default, and Factory’s caps are 80,000 characters. Treat those as ceilings, not targets.

## Monorepos and nested files

Put shared rules in the root AGENTS.md and add a file in a package only when it really differs, such as a Python service in a TypeScript repository. The spec says the file closest to the edited code takes precedence, and a direct instruction in the chat overrides them all.

Agents implement that differently. Codex, Claude Code and Gemini CLI load files from the root down, so the nearer file comes later and wins. Copilot CLI and opencode merge everything without a defined order, so avoid rules that contradict each other between levels.

## Moving to AGENTS.md from other files

If you already have a `.cursorrules`, `CLAUDE.md` or `GEMINI.md`, agents.md suggests renaming it to AGENTS.md and leaving the old name as a link or an import. For Claude Code, a CLAUDE.md containing `@AGENTS.md` is the most portable choice. For Gemini CLI, add AGENTS.md to `context.fileName`. Then delete the instructions that only repeat what the code shows.

A note on examples: many articles point to the root AGENTS.md in the openai/codex repository. It was removed on 30 September 2026; only nested files remain there, so look at the samples on agents.md instead.

## Using one AGENTS.md across agents in AgentVera

AGENTS.md is most useful when several agents work on the same code, which is what [AgentVera](/en/ "AgentVera") is for: a desktop app that runs Claude Code, Codex, Gemini CLI, Cursor, opencode and a dozen other CLIs side by side in real terminals. Every agent opens the same project folder, so they all pick up the same AGENTS.md, and the [workspace](/en/features/workspace/ "Workspace") shows them in one grid.

Two features sit next to it. The [skill gallery](/en/features/skill-gallery/ "Skill gallery") holds the long procedures that do not belong in AGENTS.md and shares them with your team. [Brain](/en/features/brain/ "Brain") keeps decisions and past conversations that agents can recall when a task touches earlier work, so AGENTS.md can stay short.

The free plan runs 2 agents at once and includes MCP, Git, Docker, SSH, code review and token savings. Pro is $9.99 a month and has no agent limit; you can try Pro free for 7 days, and if you cancel before it ends you are not charged. To try it, [download AgentVera](/en/download/ "Download AgentVera").

## Wrapping up

AGENTS.md is the one instructions file that nearly every coding agent reads in 2026. Write it by hand, start with exact commands, add the conventions and boundaries the code does not show, and stop there. Claude Code reads it when there is no CLAUDE.md, Gemini CLI needs one setting, and Aider needs `--read`; everything else picks it up on its own.

Sources: [agents.md](https://agents.md/ "agents.md"), [Agentic AI Foundation announcement](https://www.linuxfoundation.org/press/linux-foundation-announces-the-formation-of-the-agentic-ai-foundation "Linux Foundation"), [Claude Code memory docs](https://code.claude.com/docs/en/memory "Claude Code memory"), [Claude Code changelog](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md "Claude Code changelog"), [Codex AGENTS.md docs](https://learn.chatgpt.com/docs/agent-configuration/agents-md "Codex AGENTS.md"), [Gemini CLI context files](https://geminicli.com/docs/cli/gemini-md/ "Gemini CLI GEMINI.md"), [Copilot CLI instructions](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions "Copilot CLI instructions"), [Cursor rules](https://cursor.com/docs/context/rules "Cursor rules"), [Evaluating AGENTS.md](https://arxiv.org/abs/2602.11988 "arXiv 2602.11988"), [Agent READMEs](https://arxiv.org/abs/2511.12884 "arXiv 2511.12884"), [Writing an effective AGENTS.md](https://aaif.io/blog/writing-an-effective-agents-md "AAIF blog").

## Frequently asked questions

**What is AGENTS.md?** AGENTS.md is a Markdown file, usually in the root of a repository, that gives AI coding agents the instructions a new developer would need: how to install, build and test, code conventions and things to avoid. It is often described as a README for agents. It has no required fields or headings.

**Does Claude Code read AGENTS.md?** Yes, since version 2.1.277 (September 2026). By default it reads AGENTS.md only when the project has no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md; the Project instructions option in /config can load both. On older versions, put @AGENTS.md in a CLAUDE.md.

**Does Gemini CLI support AGENTS.md?** Yes, with one setting. Gemini CLI reads GEMINI.md by default; add "context": {"fileName": ["AGENTS.md", "GEMINI.md"]} to .gemini/settings.json to make it read AGENTS.md as well.

**Should I use AGENTS.md or CLAUDE.md?** If more than one agent works on the repository, keep the shared rules in AGENTS.md. Claude Code reads it when there is no CLAUDE.md, and if you need Claude-specific notes, a CLAUDE.md that starts with @AGENTS.md imports the shared file without loading it twice.

**How long should AGENTS.md be?** Short. There is no limit in the spec, but Claude Code’s docs recommend under 200 lines per file, Codex reads 32 KiB of combined instructions by default, and a 2026 study found that longer, generated files raised costs by about 20% without improving results.

**Where do I put AGENTS.md in a monorepo?** One at the root for shared rules and one in each package that really differs. The spec says the closest file to the edited code takes precedence; most agents load the files from the root down, so the nearer file comes later and wins.

---

**About AgentVera.** AgentVera is a desktop app for macOS, Windows and Linux, built by Solviera Teknoloji. It runs 18 AI coding agents (Claude Code, Codex, Gemini CLI, Copilot, Cursor, Antigravity, opencode, Hermes, Qwen Code, Kimi Code, Kiro, Amp, Droid, Goose, Vibe, Crush, Aider, Cline) side by side, per project, in real terminals with the user's own CLI installs and logins. The free plan runs 2 agents at once. Download: https://agentvera.dev/en/download/ · Pricing: https://agentvera.dev/en/pricing/
