CLAUDE.md and AGENTS.md: what the evidence says, plus a starter

Updated 2026-11-06

As of 2026-11-05. Vendor pages were re-read on that date and change often; recheck the linked page before relying on a detail. We summarise these sources and did not run any of the studies. Measured studies say repo-level instruction files did not reliably improve task success, and they added cost. Their clearest measured effect was changing which tools the agent used.

What measured studies found

What to put in—and leave out

How each tool loads instruction files

Tool[vendor] Loading behavior and limits
Claude CodeCLAUDE.md is native. Parent files load at launch; subdirectory files load on demand. Imports use @path/to/file, relative to the importing file, up to four hops. Target under 200 lines; files over 4 MiB are skipped; on-demand files may be cut after 40,000 characters in a 200K-context session. AGENTS.md loads directly only if no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md exists above or in the working directory; otherwise use @AGENTS.md or the claude-md-and-agents-md setting. Requires v2.1.277 or later for direct AGENTS.md support.
CodexAGENTS.md; root through current directory, concatenated. Default combined limit: 32 KiB (project_doc_max_bytes); Codex stops adding files at the limit.
Cursor.mdc files in .cursor/rules; plain .md there is ignored. Rules can always apply, apply intelligently, match file globs, or be invoked manually. Also reads root and nested AGENTS.md; more specific files win. Keep each rule under 500 lines. Team rules precede project rules, which precede user rules.
Gemini CLIGEMINI.md; AGENTS.md can be enabled with context.fileName. Loads up to the root plus subdirectories; no size guidance was found. Vendor notice (page read 2026-11-05): Gemini CLI was replaced by Antigravity CLI on 2026-06-18 for unpaid-tier and Google One users.
Copilot.github/copilot-instructions.md; .github/instructions/NAME.instructions.md with applyTo globs, currently for cloud agent and code review; also reads AGENTS.md anywhere, nearest wins, and root CLAUDE.md or GEMINI.md. Personal instructions precede repo, then organisation; relevant sets are supplied together. No general size limit was found.

[vendor / project site] AGENTS.md is plain Markdown with no required fields; nearest file wins, and an explicit chat prompt overrides files. The site reports 60,000+ projects using it, a self-reported, unverified figure. https://agents.md, read 2026-11-04.

[opinion] A shared AGENTS.md, a one-line Claude bridge (@AGENTS.md), and a Gemini context.fileName setting are a practical cross-tool pattern; keep the shared file under Codex’s 32 KiB cap and Claude’s 200-line advice.

Common failures

Where sources conflict or leave questions open

Copy-ready starter files

These starter files are not yet tested. They follow the evidence above: only what the agent cannot work out from the code, commands first, one line per fact. Replace every placeholder in angle brackets. The Definition of done section makes the agent run checks on every task, which costs more: in the Gloaguen study, removing the testing section lowered cost significantly on one benchmark.

Base starter (AGENTS.md)

# <Project name>

<One sentence: what this is and who uses it.>

## Commands
- Install: <cmd>
- Run all tests: <cmd>
- Run one test file: <cmd path/to/file>
- Lint and format: <cmd>
- Typecheck: <cmd>
- Run locally: <cmd>   (needs <env var / service>; see <.env.example>)

## Definition of done
Run lint, typecheck and the tests for the files you changed. Report the result of each, with the failing output if any. Do not say "done" without running them.

## Conventions the code does not show
- <Use X helper for Y, never Z. Reason: ...>
- <Directory A is legacy but still live; do not copy its patterns into new code.>
- <Generated files in B: never edit; run <cmd> instead.>

## Gotchas
- <Thing that fails confusingly and the fix.>
- <Tests that need a service or key, and how to set it up.>

## Boundaries
- Always: <e.g. add a test for a bug fix.>
- Ask first: <schema changes, new dependencies, deleting files, anything that touches production or sends messages.>
- Never: <commit secrets; edit applied migrations; force-push; run destructive commands on shared data.>

## When unsure
Ask one specific question rather than guessing. State what you assumed if you proceed.

Claude Code bridge (CLAUDE.md next to it)

@AGENTS.md

## Claude Code only
- <Anything specific to Claude Code: e.g. which skills or hooks exist.>

Enforce the boundaries with settings rather than prose: permissions.deny for secret files and migrations, a Stop hook running typecheck and tests, a PostToolUse hook for the formatter. For Gemini CLI, set context.fileName in .gemini/settings.json to include AGENTS.md. Codex, Cursor and Copilot read AGENTS.md as is.

Solo founder, one product: add to the base starter

## Where things live
- <Customer-facing copy lives in X; never change pricing or legal text without asking.>
- <Deploy: how, and what must be true first.>
## Money and people
Never send email or messages, post publicly, spend money or change billing without explicit approval in this chat.

Small team, 2 to 10 people with several agents in parallel: add to the base starter

## Working in parallel
- One task per branch; branch name: <type/short-name>. Commit message: <format>.
- Do not touch files outside the task. If you need a change elsewhere, say so and stop.
- Before opening a PR: rebase, run the checks in "Definition of done", and paste their output in the PR description.
- Pull requests are reviewed by a human; do not merge.
## Shared state
- <Where the task list / decisions live and how to add to them.>

Monorepo

The root file holds only rules that apply everywhere. Each package gets one short file with its own commands and gotchas, without repeating root rules. In Claude Code, subdirectory files load on demand. In Codex, keep the sum from root to leaf under 32 KiB.

Cheap tests to run

[opinion] Use the cheapest capable model, a fixed set of 5 to 10 real past or synthetic tasks, a yes/no checking script, and at least 3 repeats per condition because runs are noisy.