DEV Community

Tidy Byte Tools
Tidy Byte Tools

Posted on Originally published at tidybytetools.github.io

CLAUDE.md, AGENTS.md or Cursor rules: which file should you write?

Each coding agent reads a different instruction file. If you use more than one agent, you can end up with three files that say the same thing. That costs tokens and drifts out of date. Here is a simple way to keep it tidy.

Who reads what

File Read by When it loads
CLAUDE.md Claude Code Every session
AGENTS.md Codex, Cursor and other tools Every task. Codex starts at the project root and walks down to your folder, with at most one file per folder
Cursor rules (.cursor/rules) Cursor Always on, or only when the rule's globs or description match

Setting names and limits change between versions, so check the docs for the version you run. We last checked the Codex docs on Nov 25, 2026: developers.openai.com/codex.

A simple setup for more than one tool

  1. Put the real rules in AGENTS.md.
  2. Make CLAUDE.md one line that imports it: @AGENTS.md.
  3. Use Cursor rules only for things that apply to certain files, with globs.
  4. Put folder rules in a nested AGENTS.md inside that folder (for example src/ui/AGENTS.md), so they load only when work happens there.

How long should they be

  • Codex stops adding AGENTS.md files once the combined size reaches 32 KiB by default. Under 8 KiB is better.
  • For Claude Code, keep CLAUDE.md short. A common target is under 200 lines. Move long workflows into skills.
  • Short files are cheaper and more likely to be read in full.

What to put in them

  • The commands to build, test and run the project.
  • Rules that are not obvious from the code: naming, folders that are off limits, how to write a commit.
  • Things that went wrong before, written as one plain line each.

Leave out old meeting notes, long style essays, and anything the agent can see by reading the code.

Free and paid help

  • Agent Cost Saver (free, also on Gumroad) has cost_audit.py. It flags a CLAUDE.md and AGENTS.md that repeat the same text, oversize files and always-on rules.
  • AGENTS.md Starter Pack has short copy-paste AGENTS.md files for common project types.

Related guides

Made by Tidy Byte Tools.


Originally published at https://tidybytetools.github.io/guides/claude-md-vs-agents-md-vs-cursor-rules/. Tools by Tidy Byte Tools.

Top comments (0)