Guide

AGENTS.md: The Open Standard for AI Agent Instructions

Every AI coding tool invented its own instruction file. AGENTS.md is the open, tool-agnostic answer — one markdown file at your repo root that a growing number of agents can read. Here's what it is, what goes in it, and a real example you can copy.

9 min readLast updated October 2026

Quick answer

AGENTS.md is a plain markdown file at the root of your repository that tells AI coding agents how to work on your project — build and test commands, conventions, and do/don't rules. It's deliberately tool-agnostic: rather than one proprietary file per tool, you write your instructions once and a growing number of agents read the same file. It's the closest thing the ecosystem has to a cross-tool standard.

1. What AGENTS.md Is and Why It Exists

As AI coding agents arrived, each one shipped with its own way of reading project context. Claude Code reads CLAUDE.md. Cursor reads .cursorrules (now .cursor/rules). GitHub Copilot reads .github/copilot-instructions.md. Every tool solved the same problem — "how does the agent know the rules of this repo?" — with a different, incompatible file.

The result was predictable: teams using more than one tool ended up maintaining the same instructions in two or three places, where they quietly drifted out of sync. AGENTS.md exists to consolidate that sprawl. It's a single, plain markdown file that a growing number of coding agents agree to look for, so you write your project's instructions once and any compatible agent can read them.

There's nothing magic about the format — that's the point. It's just markdown, readable by humans and agents alike, living next to your code. The value is in the convention: a shared filename and a shared expectation of what belongs inside it.

2. What Goes in an AGENTS.md File

There's no rigid schema, but good AGENTS.md files converge on a handful of sections. Each one answers a question an agent would otherwise have to guess at:

Project overview

A sentence or two: what this is, the stack, where it runs. Enough for the agent to orient itself before touching anything.

Build / test / run commands

The exact commands to install, run the dev server, build, test, and lint. This is the single most useful section — agents reach for it constantly.

Conventions

Language settings, naming, formatting, and the small decisions that keep a codebase consistent — strict mode, named exports, how money and dates are handled.

Do and don't rules

Explicit guardrails. "Add a test for every new branch." "Never put secrets in the client bundle." "Don't edit generated files." Agents follow literal rules well.

Directory notes

A short map of the important folders and what belongs in each, so the agent puts new code in the right place instead of inventing a structure.

A realistic AGENTS.md example

Here's a complete AGENTS.md for a small TypeScript billing service. Notice the commands sit near the top, the rules are concrete, and the whole thing stays short enough that an agent will actually read it:

AGENTS.md
# AGENTS.md

## Project overview
Billing service for a SaaS product. TypeScript + Node, Postgres via Prisma,
deployed to Fly.io. Handles subscriptions, invoices, and Stripe webhooks.

## Commands
- Install:   pnpm install
- Dev server: pnpm dev           # http://localhost:3000
- Build:     pnpm build
- Test:      pnpm test           # Vitest, run before every commit
- Lint:      pnpm lint           # ESLint + Prettier, must pass in CI
- Migrate:   pnpm prisma migrate dev

## Conventions
- TypeScript strict mode. No `any` — use `unknown` and narrow.
- Prefer named exports. One React component per file.
- Money is stored in integer cents, never floats.
- All dates are UTC ISO-8601 at the boundary.

## Do
- Add a Vitest test for every new branch of logic.
- Keep Stripe keys in environment variables only.
- Update the Prisma schema and generate a migration in the same change.

## Don't
- Don't call the Stripe API from the client bundle.
- Don't edit files in `src/generated/` — they are built artifacts.
- Don't skip the lint step to "fix it later".

## Directory notes
- src/routes/   HTTP handlers, thin — delegate to services.
- src/services/ business logic lives here.
- src/db/       Prisma client + repositories.
- src/generated/ auto-generated, do not touch.

Keep yours in the same spirit: concrete commands, concrete rules, no filler. If a line wouldn't change what the agent does, cut it.

3. How It Relates to CLAUDE.md and .cursorrules

AGENTS.md, CLAUDE.md, and .cursorrules are the same idea wearing different labels. They all give an agent persistent project context; they differ in filename, format, and which tools look for them.

AGENTS.mdCLAUDE.md.cursorrules
Read byMany agents (open)Claude CodeCursor
FormatMarkdownMarkdownPlain text / .mdc
LocationRepo root (nestable)Repo root & ~/.claude/.cursor/rules/ (new)
PortabilityHighestClaude onlyCursor only

Want the full breakdown of which file to use when? Read the complete CLAUDE.md vs AGENTS.md vs .cursorrules comparison, or go deeper on the Claude-specific format in the CLAUDE.md guide.

4. Adoption and Portability

AGENTS.md is read by a growing number of coding agents, which is exactly what makes it worth adopting: it is the closest thing to a cross-tool standard right now. If you switch tools, or your teammates use different ones, a single AGENTS.md means nobody has to re-author the project's rules for each agent.

Mechanically it's refreshingly simple. It's a markdown file at the repository root. In a monorepo you can nest an AGENTS.md per package or subproject, and agents use the file closest to the code they're touching — so a shared root file can set org-wide conventions while each package refines the specifics.

Because it's just a file in your repo, it's version controlled, reviewed in pull requests, and shared by the whole team automatically. No per-developer setup, no tool-specific config — clone the repo and the instructions come with it.

5. Best Practices

A good AGENTS.md is short, specific, and maintained. A few rules that hold up in practice:

Keep it concise

Agents have finite context. A tight, high-signal file gets read and followed; a sprawling one gets skimmed or truncated. If a line doesn't change the agent's behaviour, delete it.

Put commands first

Build, test, run, and lint commands are what agents reach for most. Keep them near the top and keep them exact — the literal command they should run, not a prose description of it.

Nest per package in monorepos

Put shared conventions in the root AGENTS.md and package-specific details in a nested file inside each subproject. The agent reads the closest file, so each package gets the right instructions without duplication.

Keep it in version control

Commit it, review changes to it in pull requests, and treat it like code. When a convention changes, the AGENTS.md changes in the same PR — so the rules and the code never drift apart.

6. The Enforcement Gap

Here's the uncomfortable truth about every rules file — AGENTS.md included: a rules file is only as good as the agent's adherence to it. The agent reads AGENTS.md at the start of a session and then, as the session runs long, drifts. After context compaction it may not even remember the file existed. Three features in, under pressure to just ship, the "never skip the lint step" rule quietly loses. A file the agent ignores halfway through a build gives you false confidence, which is worse than no file at all.

Keeborg was built around this problem before "spec-driven development" was even the accepted term. It's an opinionated, battle-tested dev system for AI coding agents — and where open, unopinionated scaffolds hand you a blank file and wish you luck, Keeborg adds the layer that makes the rules actually stick:

A rules file alone

  • Read once, then drifts over a long session
  • Forgotten after context compaction
  • Rules silently lose under time pressure
  • No check that the work actually met them

Keeborg enforces it

  • A 95/100 quality gate the agent can't skip
  • Session continuity that survives compaction
  • A security audit that blocks deploy
  • Opinions as rules, not suggestions in a README

AGENTS.md is the right place to write your project's rules down — adopt it. Just know that writing them down is step one. If you've watched an agent read your rules and then wander off anyway, the enforcement layer is the piece you were missing. See how it fits the wider methodology in the spec-driven development guide.

Generate an agent rules file free

Describe your project and get a structured CLAUDE.md in seconds — the same context an AGENTS.md needs, ready to use or adapt, without writing it from scratch.

Try the free generator
Free No account

Make the rules actually stick

The Keeborg dev system goes past the rules file — a 95/100 quality gate, session continuity that survives context compaction, and a security audit that blocks deploy. Personalised to your stack.

Get the dev system
One-time payment Preview before you buy

Frequently Asked Questions