All guides

Conventions

The complete guide to AGENTS.md

AGENTS.md is a single Markdown file at your repo root that tells AI coding agents how to work in your project - the build commands, conventions, and gotchas a human README leaves out. Here is what to put in it, where it belongs, which tools read it, and how to keep it accurate as your code changes.

Last reviewed: July 2026

What is AGENTS.md?

AGENTS.md is an open convention: a plain-Markdown file, placed at your repository root, that gives coding agents the operating instructions they need before they touch your code. Think of it as a README written for the machine instead of the newcomer - build and test commands, code style, project layout, and the rules that are obvious to your team but invisible to an agent.

There is no required schema and no special syntax. It is standard Markdown with headings, so anything you would explain to a new engineer in their first hour belongs in it. The value is that you write it once and many different agents read the same file.

What goes in an AGENTS.md file

Keep it scannable - agents, like people, skim. A useful AGENTS.md usually covers a handful of concrete, verifiable things:

  • Project overview: One or two lines on what the project is and how it is structured, so the agent orients before editing.
  • Setup and commands: The exact install, build, lint, and test commands that actually work - the single highest-value thing you can document.
  • Code style and conventions: Naming, error handling, formatting rules, and patterns this codebase prefers over the model's defaults.
  • Testing instructions: How to run the suite, what must pass before a change is done, and any commands that are slow or environment-specific.
  • Guardrails: The "do not do this" list - files not to touch, commands not to run, and boundaries the agent must respect.

Where AGENTS.md lives

The primary file sits at the repository root, where agents look first. For a monorepo, you can also place additional AGENTS.md files inside individual packages or directories - the agent uses the closest file to the code it is editing, so a package can override or extend the root instructions with its own commands and rules.

Because it is committed to the repo, AGENTS.md travels with the code and applies to every developer and every agent working in that tree - unlike an IDE setting that lives only on one machine.

Which tools read AGENTS.md

The point of AGENTS.md is cross-tool reach. It started across agents like OpenAI Codex, Cursor, and Jules, and is now stewarded by the Agentic AI Foundation under the Linux Foundation, with a broad and growing set of tools that read it. Write it once, and many agents pick it up.

The notable exception is Claude Code, which reads CLAUDE.md and does not fall back to AGENTS.md automatically. The common fix is a CLAUDE.md that imports AGENTS.md (via an @AGENTS.md import or a symlink), so both share one source of truth. See our AGENTS.md vs CLAUDE.md vs llms.txt comparison for the full picture.

Keeping AGENTS.md from drifting

An AGENTS.md file is only useful while it is true. The moment someone changes the test runner, renames a package, or swaps a build step without updating the file, the agent starts running the wrong commands - confidently, and at scale.

This is the same documentation drift that hits any README or wiki, except the reader is a machine that will not sense something is off. The durable fix is to treat AGENTS.md as living documentation: tie it to the source of truth, check it when code merges, and correct it through normal review rather than a quarterly cleanup.

How-to

How to create an AGENTS.md file

  1. 1

    Create AGENTS.md at your repo root

    Add a plain-Markdown file named AGENTS.md at the top of your repository and commit it so every agent and teammate shares it.

  2. 2

    Document commands and conventions

    Start with the exact setup, build, lint, and test commands, then add code style, project layout, and any hard guardrails. Keep it short and verifiable.

  3. 3

    Wire it to Claude Code if you use it

    Because Claude Code reads CLAUDE.md and not AGENTS.md, add a CLAUDE.md that imports AGENTS.md so both tools work from one source of truth.

  4. 4

    Keep it current as code changes

    Review AGENTS.md whenever commands or structure change - ideally at merge time - so agents never learn outdated instructions.

Where Moxie Docs fits

Moxie Docs keeps files like AGENTS.md honest. It indexes your GitHub repository, detects when a code change makes your documented commands or conventions stale, and proposes fixes to AGENTS.md and CLAUDE.md as reviewable docs-only PRs - then serves the same current context to agents over its MCP server. Your standing instructions stay true without becoming anyone's chore.

FAQ

Frequently asked questions

Quick answers to the questions developers ask about AGENTS.md guide.

Get started

Give your agents real codebase context.

Connect a repository and Moxie Docs generates living documentation and serves it to your agents over MCP. 14-day free trial, no charge today.