AGENTS.md vs llms.txt: Two Files, Two Readers (2026)
Both are plain Markdown, both are conventions rather than enforced standards, and both are frequently described as "the file that tells AI about your project." They have almost nothing else in common. One is read inside your repository, the other is fetched from your website.
The Short Answer
| AGENTS.md | llms.txt | |
|---|---|---|
| Reader | Coding agents — OpenAI Codex, Jules, Cursor, Aider, Zed, Warp and others | External AI crawlers, chat assistants with search, IDE agents browsing docs |
| Lives in | Repository root, plus nested copies per package | Site root, or any path such as /docs/llms.txt |
| Transport | A git checkout | A plain HTTP GET, cacheable at the edge |
| Contains | Build and test commands, code style, boundaries, PR rules | Site name, one-line summary, curated links to the pages that matter |
| Governance | Open format, stewarded by the Agentic AI Foundation under the Linux Foundation | Community proposal by Jeremy Howard, documented at llmstxt.org |
AGENTS.md Is a Repository Contract
The agents.md project defines AGENTS.md as a "README for agents" — the extra, sometimes detailed context that would clutter a README written for humans: exact build steps, test invocations, conventions that differ from tool defaults, and the files an agent should never touch. The site reports adoption across more than 60,000 open-source projects.
Real files look like real engineering notes. The root AGENTS.md in openai/codex runs about 320 lines and is mostly Rust-specific constraints and sandbox warnings. Apache Airflow's copy opens with an SPDX license header before its first instruction. Shape, not length, is what carries over:
# AGENTS.md
## Setup commands
- Install deps: `pnpm install`
- Run tests: `pnpm test`
## Code style
- TypeScript strict mode
- Use functional patterns where possible
## Boundaries
- Never edit files under `src/generated/`
- Do not modify the sandbox environment-variable checks In a monorepo, place a second AGENTS.md inside each package. Agents read the nearest file in the directory tree, so the closest one takes precedence and every subproject can ship tailored instructions.
llms.txt Is a Site Contract
The llms.txt
proposal was updated to v2 in August 2026, and the v2 text is explicit about placement: the file
can sit at the site root or at any path, covering the pages under that path. It also recommends
publishing a clean Markdown twin for each page — either with .md appended
(page.html.md) or with the extension replaced (page.md) — so the links
inside your file point at content an agent can read without stripping HTML.
# Acme Docs
> API documentation for Acme's payments platform, covering charges,
> refunds and webhooks.
## Guides
- [Quickstart](https://docs.acme.com/quickstart.md): first charge in 5 minutes
- [Refunds](https://docs.acme.com/refunds.md): partial and full refund flows
## Optional
- [Changelog](https://docs.acme.com/changelog.md)
The same v2 document leans on HTTP to help clients find both artefacts: a
rel="alternate" type="text/markdown" link points at the Markdown version of a page,
and rel="describedby" points at the llms.txt file that covers it — expressed either
as HTML elements or as a server-level Link: response header, which requires no page
changes. Chrome's Lighthouse agentic browsing checks now audit sites for the file, and the labs
themselves ship one: OpenAI, Anthropic and Gemini all publish llms.txt for their developer
documentation.
The Discovery Difference
llms.txt has two discovery channels: the /llms.txt convention and the
describedby link relation. AGENTS.md has exactly one — the folder it sits in. There
is no registry, no HTTP header, no sitemap entry. That single fact explains the nesting rule, the
per-package files, and why the format's own documentation stresses that the closest file wins.
The Claude Code Exception
One major agent still does not read AGENTS.md natively. Anthropic's memory documentation states it plainly: "Claude Code reads CLAUDE.md, not AGENTS.md." The documented fixes are cheap, so a repository does not have to choose between tools:
- Create a
CLAUDE.mdthat imports it — a line containing@AGENTS.mdexpands the file into Claude's context at session start, and Claude-specific rules can follow below it. - Or symlink instead of duplicating:
ln -s AGENTS.md CLAUDE.md(on Windows a symlink needs Administrator rights or Developer Mode, so use the import). - Or run
/initonce, which reads AGENTS.md whenCLAUDE_CODE_NEW_INIT=1is set, and/import(Claude Code v2.1.213+) which copies a supported agent's configuration into Claude Code.
Two size limits are worth knowing because they are enforcement, not advice: the docs target under 200 lines per memory file and say Claude Code skips a file over 4 MiB. Imported files still load at launch, so splitting into imports organises a file without shrinking the context it consumes.
What the Evidence Says About Context Files
An ETH Zurich and LogicStar.ai preprint, "On the Impact of AGENTS.md Files on the Efficiency of AI Coding Agents" (revised June 2026), measured generated and developer-written context files against real GitHub pull requests. The result is unromantic: context files consistently increased the number of steps agents needed, developer-written files produced a marginal gain in task success, and LLM-generated files were marginally negative.
The practical rule that follows is the same one that keeps llms.txt useful: write down only what the reader cannot infer. For a repository that means exact commands, non-obvious constraints and past failures. For a site it means a short summary and a curated list of the handful of pages that answer questions — not a mirror of your sitemap. Curation is the whole product in both cases.
Which One Do You Actually Need?
- Public docs site plus a repo: both files, and keep them separate — never paste an AGENTS.md into llms.txt or the reverse.
- Marketing site, no code: llms.txt only. Draft it from your sitemap with the generator and validate before publishing with the checker.
- Private repository, no public site: AGENTS.md alone. There is nothing for external crawlers to read.
- Open-source project with hosted docs: both — AGENTS.md for contributors' agents, llms.txt and its Markdown twins for everyone else's.
Related reading: how llms.txt differs from the action layer in llms.txt vs MCP, the nine rules for a file AI engines trust, and which assistants actually fetch it, per which AI engines read llms.txt.