How long should AGENTS.md, CLAUDE.md and Cursor rules be? The size limits in each tool's docs
Published · Facts checked against official vendor pages on November 5, 2026 · Rankings are independent of sponsorships
Every coding agent now reads some kind of instruction file, and most people write them the same way: add a line every time the agent gets something wrong, and never remove any. The files grow, the agent starts ignoring parts of them, and in some tools the end of the file is silently cut off. Each vendor documents a size recommendation or a hard limit, but they live on four different docs pages. We read all four on November 5, 2026; here are the numbers, what happens when you go over, and how to get more out of a short file.
Tools in this post
The short version
Cursor recommends keeping each rule under 500 lines and splitting big ones into several composable rules.
Claude Code recommends under 200 lines per CLAUDE.md. Longer files use more context and, in Anthropic's words, reduce adherence.
Codex stops adding AGENTS.md content once the combined size of all the files it loaded reaches 32 KiB by default. That is a hard cutoff, not a suggestion.
GitHub Copilot has no size limit in its repository-instructions docs. Copilot code review used to stop reading an instruction file at 4,000 characters, and GitHub's changelog says that limit was removed on June 12, 2026.
Cursor: under 500 lines, scoped and referenced
Cursor's rules docs list the best practices in one place: keep rules under 500 lines, split large rules into multiple composable ones, give concrete examples or referenced files, and avoid vague guidance. Each rule is a file in .cursor/rules with frontmatter that controls when it applies: always, intelligently (the agent reads the description and decides), for specific files (globs), or only when you @-mention it.
The docs also say what not to put in a rule: whole style guides (use a linter instead), every command you could run (the agent already knows npm, git and pytest), rare edge cases, and copies of code that already exists in the repo. Instead, reference a file with @filename. The agent reads the referenced file with its tools when it needs it, so the file's contents are not inlined into the prompt. Anything that must always be in context has to go in the rule body.
Our free FastAPI and Supabase rules follow this shape: one stack per rule, an intelligent-apply description, and short imperative bullets.
Claude Code: under 200 lines, then move things out
Anthropic's memory docs say to target under 200 lines per CLAUDE.md file. The advice is to move instructions that matter for only part of the codebase into path-scoped rules in .claude/rules/, which load only when Claude works with matching files, and to move multi-step procedures into skills. Splitting a big file with @path imports helps you organize it, but the docs are explicit that it doesn't reduce context cost, because imported files load together with the file that imports them.
There are also hard limits. Claude Code skips a CLAUDE.md over 4 MiB entirely. Subdirectory CLAUDE.md files and path-scoped rules that load on demand have a per-file limit (40,000 characters on a 200K-token context window, more on a 1M window); past it, Claude receives only the start of the file plus a note to read the rest. Auto memory's MEMORY.md index loads only its first 200 lines or 25 KB, whichever comes first. Claude Code warns at startup and in /status when an instruction file is over the recommended length.
Two things are worth knowing if your file has grown. Running /doctor prompt-audit (Claude Code v2.1.283 or later) has Claude check your instruction files for outdated, missing or contradictory content and proposes edits without applying them. And anything that must happen every time, such as running a linter before each commit, belongs in a hook, because the docs say CLAUDE.md is context, not enforced configuration. Our CLAUDE.md template is built to stay well inside the 200-line target, and skills vs subagents vs CLAUDE.md explains where each kind of instruction should live.
Codex: a 32 KiB budget shared by every AGENTS.md
Codex builds its instructions by walking from the project root down to your working directory, reading at most one file per directory (AGENTS.override.md first, then AGENTS.md, then any fallback names you configured), and joining them with blank lines. It skips empty files and stops adding files once the combined size reaches project_doc_max_bytes, which is 32 KiB by default. Files closer to your working directory come later in the prompt, so they override earlier guidance.
The practical consequence is that a long root file can crowd out the nested files that matter most for the directory you're working in. Codex's troubleshooting section lists "Instructions truncated" as a known symptom and gives two fixes: raise project_doc_max_bytes, or split large files across nested directories so the critical guidance stays intact. Our AGENTS.md starter keeps the root file short for that reason.
GitHub Copilot: no cap in the docs, but keep it short anyway
GitHub's repository-instructions docs describe three kinds of instruction: a repository-wide .github/copilot-instructions.md, path-specific .github/instructions/NAME.instructions.md files with an applyTo glob, and AGENTS.md files, where the nearest one in the directory tree takes precedence. They don't state a size limit for any of them. The prompt GitHub supplies for generating a copilot-instructions.md with its cloud agent does ask for instructions that are no longer than 2 pages and not task-specific, which is a useful target.
Copilot code review is the one place a hard number used to matter. GitHub's docs said it only read the first 4,000 characters of any instruction file, and plenty of older guides still repeat that. GitHub's changelog for June 12, 2026 says the limit has been removed. Two other details from the current docs help when you tune review behavior: path-specific instructions on GitHub.com are used only by Copilot cloud agent and code review (you can pick one with excludeAgent), and when reviewing a pull request Copilot reads instructions from the head branch, so you can test an edit in the same PR that makes it.
Use that to keep review instructions separate from coding instructions: our free code review instructions apply only to review, and the test-file instructions apply only to test paths, so neither adds noise to every request.
How to get more from a short file
The same habits come out of all four sets of docs:
- Write instructions you could verify. "Use 2-space indentation" and "run npm test before committing" work better than "format code properly" and "test your changes", Anthropic's docs say.
- Cut what the agent can find itself: directory listings, dependency lists and conventions your linter already enforces. Keep commands, pitfalls and the rules that differ from the tool's defaults.
- Scope instead of stacking. Use Cursor globs, Claude Code path-scoped rules, nested AGENTS.md files and Copilot applyTo so each task loads only what applies.
- Point to files rather than pasting them. Cursor's docs recommend referencing files so rules stay short and don't go stale as code changes.
- Add a rule only after the agent makes the same mistake twice, and delete rules that contradict each other. Anthropic notes that when two instructions conflict, Claude may pick one arbitrarily.
- Put hard requirements in enforcement, not prose: a hook, a linter, CI or a permission rule. Instruction files are guidance.
Start with these files
Our free CLAUDE.md, AGENTS.md and Cursor rules are each one short file you can adapt. If you use more than one agent, which file each agent reads shows how to share one source of truth. The paid Cursor Rules: Next.js 16 pack splits its guidance into 12 scoped rules for exactly the reasons above, and the Claude Code Agent Kit moves procedures out of CLAUDE.md into skills and subagents. Compare the tools themselves on our Cursor, Claude Code, OpenAI Codex and GitHub Copilot pages.
FAQ
- How long should a CLAUDE.md be?
- Anthropic's docs say to target under 200 lines per CLAUDE.md file, because longer files consume more context and reduce adherence. Move instructions that apply to only part of the codebase into path-scoped rules in .claude/rules/, and procedures into skills.
- What is the size limit for AGENTS.md in Codex?
- By default Codex stops adding AGENTS.md content once the combined size of the files it has loaded reaches 32 KiB (project_doc_max_bytes). You can raise the limit or split instructions across nested directories.
- How long can a Cursor rule be?
- Cursor's docs recommend keeping each rule under 500 lines and splitting large rules into several composable ones. They also suggest referencing files instead of copying their contents into the rule.
- Does Copilot code review still stop reading after 4,000 characters?
- No. Older docs said it read only the first 4,000 characters of an instruction file, but GitHub's changelog for June 12, 2026 says that limit has been removed. Shorter, well-organized files are still easier for any agent to follow.
Free and paid rules for your agents
- CLAUDE.md project memory template (free)
- AGENTS.md starter for any stack (free)
- Cursor rules for Next.js (core) (free)
- Cursor rules for FastAPI (Pydantic v2, deps, tests) (free)
- Copilot code review instructions (what to flag, what to skip) (free)
- Copilot path-specific instructions for tests (free)
- Cursor Rules: Next.js 16 ($9): 12 scoped Cursor rules, AGENTS.md and CLAUDE.md for Next.js 16.4 with Cache Components.
- Claude Code Agent Kit ($19): Installable Claude Code plugin: 12 subagents, 8 skills and 3 tested safety hooks.
Related changelog
- 2026-11-09 · Anthropic releases Claude Fable 5.2 at $8 / $40 per 1M tokens, 20% below Fable 5.1
- 2026-11-09 · Claude Fable 5.2 is generally available in GitHub Copilot for Pro+, Max, Business and Enterprise
- 2026-11-06 · Cursor adds realtime voice chat with agents, powered by Grok Voice
- 2026-11-05 · Cursor cloud agents can now build, host and share live apps with a database and Cursor SSO
Sources
Prices change often. Always confirm on the vendor's site before buying. See the full tier lists and the changelog.