Aditya Sharma

AGENTS.md: What 300 Top GitHub Repos Actually Do

On this page, 8 sections

The short answer: keep one AGENTS.md, keep it under 32 KB, and if you also keep a CLAUDE.md, make its first line @AGENTS.md.

I did not want to repeat the usual advice, so on 25 November 2026 I checked what 300 of the most starred code repositories on GitHub really have in their root folder. Then I tested the one rule that trips people up.

Terminal output of a scan of 300 top GitHub repos showing 169 with AGENTS.md and 10 files over 32,768 bytes

What is AGENTS.md?

It is a plain Markdown file that tells AI coding agents how to work in your project. Build commands, test commands, rules, things not to touch.

The official site calls it a “README for agents”. It has no required fields. It says the format is now looked after by the Agentic AI Foundation under the Linux Foundation, and that more than 60k open source projects use it.

Codex, Cursor, Gemini CLI, GitHub Copilot’s coding agent, Aider, Zed and many others are on its list of supporting tools.

What 300 top repositories actually do

My method is simple. I asked GitHub for repositories with more than 5,000 stars that had a push since 25 October 2026 and were not archived. I sorted them by stars, dropped the ones with no code language, and took the first 300. The smallest had 59,988 stars. Only the root folder was checked.

File in the root folderRepos out of 300Share
AGENTS.md16956%
CLAUDE.md8528%
GEMINI.md145%
.cursorrules21%

178 repositories had AGENTS.md, CLAUDE.md or both. AGENTS.md appears about twice as often as CLAUDE.md in this set.

The older .cursorrules file is rare here. Only 2 of the 300 had it in the root. That says nothing about newer rule folders, which I did not count.

The trap: two files, and one gets ignored

Claude Code can now read AGENTS.md by itself, from version 2.1.277. A lot of guides still say it cannot.

The catch is in the official memory docs. By default it reads AGENTS.md only when there is no CLAUDE.md or CLAUDE.local.md in your working folder or above it. Your personal file in ~/.claude does not count.

Claude Code documentation table showing that with both AGENTS.md and CLAUDE.md only the CLAUDE.md files are read by default

I tested it with Claude Code 2.1.310 on my Mac. Three empty folders, a made up codeword in each file, the small Haiku model, all tools switched off so it could only answer from what was loaded.

Terminal test where Claude Code answers MANGO-42 with only AGENTS.md, KIWI-7 when CLAUDE.md is added, and MANGO-42 with an import
Folder hasWhat Claude Code answered
Only AGENTS.mdThe AGENTS.md codeword
AGENTS.md and a separate CLAUDE.mdOnly the CLAUDE.md codeword
AGENTS.md and a CLAUDE.md that says @AGENTS.mdThe AGENTS.md codeword

This was one run per folder, so treat it as a check of the documented rule, not a benchmark. It matched the docs all three times.

How 76 repositories handle both files

76 of the 300 had both files. This is where I expected a mess. Most of them have solved it.

What the pair looks likeRepos
CLAUDE.md imports AGENTS.md32
CLAUDE.md is a symlink14
AGENTS.md is a symlink5
Two identical copies2
CLAUDE.md only mentions AGENTS.md in words11
CLAUDE.md never mentions AGENTS.md12

The last two rows are the ones to look at.

A sentence such as “see AGENTS.md” is not an import. The docs say Claude then sees the file only if it decides to open it.

In the 12 with no mention, the default setting never loads AGENTS.md for Claude Code. Some of those pairs may be split on purpose. If yours is not, you have two rulebooks and each tool is reading a different one.

The size limit almost nobody mentions

Codex has a budget for project instruction files. The Codex docs give the setting as project_doc_max_bytes, 32 KiB by default. That is 32,768 bytes, shared across the files it collects from the project root down to your folder.

I read the loader in the Codex source. A file bigger than what is left gets cut at that byte, and a warning is recorded. I did not run Codex for this post.

In my set, 162 repositories had a real AGENTS.md file (the other 7 were symlinks). The median was 9,125 bytes, so most are fine. 10 were over 32,768 bytes.

The netdata AGENTS.md file on GitHub showing 928 lines and 70.3 KB

The largest was netdata at 72,036 bytes. At the default budget, less than half of it fits. The cut lands inside the section called SOW System, so the later sections, Durable Artifacts and Repository Rules, would not load.

Someone can raise the limit in their own Codex settings. I checked the .codex/config.toml file in those 10 repositories and found none that raises it there.

Does a bigger file even help?

Be careful here. Researchers from ETH Zurich and LogicStar studied this in Evaluating AGENTS.md (first posted February 2026, last revised 29 September 2026).

Their finding: context files do “not generally improve task success rates”, while raising inference cost “by over 20% on average”. The agents did follow the instructions. Repository overviews were the part that did not help.

Their advice fits what I would do anyway. Write down the unusual things, such as the exact test command or the rule an agent cannot guess from the code. Skip the tour of the folders.

My own setup is not perfect. My main CLAUDE.md is 301 lines, and Anthropic’s docs suggest staying under 200. My home folder also has a two line AGENTS.md that does nothing except say it is stale and point to the real file.

The setup I would use today

  • Put shared rules in AGENTS.md at the root.
  • If you need Claude only notes, add a CLAUDE.md with @AGENTS.md as the first line and your notes below it.
  • If you have no Claude only notes, you can skip CLAUDE.md on a recent Claude Code. Keep the import if your team runs older versions.
  • Check the size with wc -c AGENTS.md. Stay well under 32,768 bytes.
  • Put folder rules in a nested AGENTS.md inside that folder instead of growing the root file, then check that each tool you use picks them up.
  • Delete lines an agent could learn by reading the code.

The import is safer than a symlink if anyone on your team uses Windows, which the Claude Code docs point out.

@AGENTS.md

## Claude only notes
Use plan mode before touching the billing folder.

If you are choosing between the tools themselves, I wrote about how I pick between Claude Code and Codex. For rules that must be enforced and not just suggested, see my tested guide to Claude Code hooks. And if you connect agents to outside tools, read the MCP server security fixes first.

Frequently asked questions

Does Claude Code read AGENTS.md?

Yes, from version 2.1.277. By default it does so only when there is no CLAUDE.md or CLAUDE.local.md in your working folder or above it. With both, add @AGENTS.md to your CLAUDE.md or change the Project instructions setting.

How long should AGENTS.md be?

As short as it can be while still saying what an agent cannot guess. Codex has a default budget of 32,768 bytes for project instruction files. The median file in my scan of top repositories was 9,125 bytes.

Where do I put AGENTS.md?

At the root of the repository. You can add more files in subfolders. The official site says the file closest to the edited code takes precedence.

The docs, source code and repository data here were all checked on 25 Nov 2026. The scan covers one day and one set of popular repositories, not every project.

Run wc -c AGENTS.md in your main project now. If you also have a CLAUDE.md, open it and look at the first line.

Tell me where I am wrong

Your email is not published and I do not add it to any list. Corrections with a source are the ones I act on fastest.