Skip to content

Glossary · AGENTS.md

What is AGENTS.md?

AGENTS.md is a plain Markdown file in a repository that tells coding agents how to work in it: build and test commands, code style, and rules. The agents.md site calls it "a simple, open format for guiding coding agents", a README for agents. Many coding agents read it, so one file can serve several.

In practice

The agents.md site describes it as a README for agents: a predictable place to put the context and instructions an agent needs. It is standard Markdown with no required fields. Suggested sections are a project overview, build and test commands, code style, testing instructions and security considerations.

In a large repository you can add a separate AGENTS.md in each subproject. The site says agents read the nearest file in the directory tree, so the closest one takes precedence, and what you type in chat overrides everything.

Stewardship of the format sits with the Agentic AI Foundation, under the Linux Foundation. It is a convention, not a product. It isn't a plan for one job, and it doesn't enforce anything: an agent treats it as instructions to follow.

How to start

  1. Create AGENTS.md at the repo root.
  2. Add the commands to build, test and run, and the code style.
  3. List what not to touch.
  4. If you use Claude Code, you are done: it reads AGENTS.md directly when there is no CLAUDE.md. Add a CLAUDE.md with the line @AGENTS.md only for Claude-specific lines.
  5. Treat it as living documentation: update it when a rule changes.

Common mistakes

  • Copying the same rules into a second file by hand. Import or link instead.
  • Writing a long essay. Short, checkable lines are easier for an agent to follow.
  • Putting this week's priorities in it. They change too often for a rules file.

Why it matters for product builders

If you run more than one agent, each can have its own rules file, and the copies drift. One shared AGENTS.md means you explain how you work once.

Cursor, Codex and Grok document that they read AGENTS.md. Claude Code reads it when a repository has no CLAUDE.md, and a CLAUDE.md can import it. See [CLAUDE.md vs AGENTS.md](/guides/claude-md-vs-agents-md).

What changes in AI-first products

This is a response to a new problem: several agents in one repository, each looking for its own file. The format gives them one name to agree on.

A shared rules file holds how you build. It does not say what to build next. Annsa holds that, as ranked priorities and specs with the evidence and Done When lines, which Claude Code, Cursor, Codex and Grok read over MCP.

See how Annsa does it: The spec →

Questions people ask.

Q1

What is AGENTS.md used for?

It tells coding agents how to work in your repository: how to build and test, the code style, and anything they should not touch. The agents.md site calls it a README for agents.
Q2

Which agents read AGENTS.md?

The vendors' own docs say Cursor, Codex and Grok read it. Claude Code reads it when a repository has no CLAUDE.md, and a CLAUDE.md can import it with an @AGENTS.md line.
Q3

What should an AGENTS.md contain?

Commands to build and test, code style, how to structure changes, and things not to touch. There are no required fields. Keep what changes weekly, such as priorities, out of it.
Q4

Do I need both AGENTS.md and CLAUDE.md?

Only if you use Claude Code and want Claude-specific lines. Keep the shared rules in AGENTS.md and have CLAUDE.md import it, so there is one source.

Sources

  1. What to include, nested files and precedence.

  2. AGENTS.md and CLAUDE.md in Claude Code.

Last reviewed 2026-10-21

Put it to work with your agents.

Try Annsa