AGENTS.md
Also called CLAUDE.md · Rules file · .cursorrules · Instructions file · GEMINI.md
The instructions file at the repo root that every session reads first: commands, conventions, gotchas. CLAUDE.md in Claude Code.
AGENTS.md is a plain Markdown file at the root of a repository that a coding agent loads whenever a session begins. It is the standing brief for the codebase: how to run the tests, which package manager to use, the conventions that matter, and the traps that have bitten before. Codex and a growing list of tools read AGENTS.md; Claude Code reads CLAUDE.md; Cursor keeps rules in a .cursor/rules directory. Same idea, different filename.
Because it is loaded every session, it is the cheapest way to fix a repeated mistake and the easiest file to bloat. Every line costs context on every request, and a file that grows into a full architecture guide starts crowding out the task. The other failure is silence: no file at all, so each session guesses the build command, guesses the style, and re-learns the same lesson you taught it last week.
Keep it short and operational. Commands first, then conventions, then gotchas, each as a line or two. For anything longer, point to a document instead of pasting it, and let progressive disclosure do the rest: the agent reads the deep doc only when the task needs it. Update it when the agent gets something wrong twice. It works alongside the system prompt, which the harness controls, and the memory system, which holds facts the agent writes for itself.
- Claude Code
CLAUDE.mdat the repo root, optional ones in subdirectories, and a personal one under~/.claude/;/initdrafts a first version. - CodexReads
AGENTS.mdfrom your home directory, the repo root, and nested directories, merged with the nearest file taking precedence. - Cursor
.cursor/rules/*.mdcfiles, scoped by glob so a rule only loads for matching paths; the legacy.cursorrulesstill works.
“Every session it runs npm test and the suite is under pnpm. I'm tired of correcting it.”
“Put it in AGENTS.md. One line: 'Use pnpm; run tests with pnpm test.'”
“That's all?”
“That's all. It's loaded with every new session, so you never have to say it twice.”
Course 01 puts every one of these terms to work: you install Claude Code, run the loop, and ship a real project — permission modes, compaction, hooks and all.
Start Course 01 →