Subscribe

One rules file for every AI coding agent

Short version: write your instructions once in AGENTS.md. Make CLAUDE.md a one-line file that imports it. Use Cursor .mdc rules only for extras that are scoped to certain files. Run a small script to check the layout. Most vendor facts below were checked against each vendor's docs on Nov 3, 2026; the Codex import question was re-checked on Nov 10, 2026, and the sources are linked because docs change.

Last updated

Which tool reads which file

ToolAGENTS.mdCLAUDE.md.cursor/rules/*.mdc
OpenAI CodexYes. In each directory from the project root down to your working directory it checks AGENTS.override.md, then AGENTS.md. Combined size is capped at 32 KiB by default [1]Not on its default list; ignored unless you add the name to project_doc_fallback_filenames [1]Not documented
Claude CodeRead directly only when there is no CLAUDE.md in your working directory or above it (docs say this needs v2.1.277 or later). Otherwise import it from CLAUDE.md [2]Yes; @path imports are expanded [2]Not documented
CursorYes, in the project root and subdirectories [3]Yes; its help page says it reads CLAUDE.md the same way as AGENTS.md [4]Yes; the .mdc extension is required [3]
GitHub CopilotCloud agent and code review on GitHub.com: yes. VS Code Copilot Chat: AGENTS.md only [5]Cloud agent and code review on GitHub.com: yes. Not listed for VS Code Copilot Chat [5]Not documented. Copilot has its own .github/copilot-instructions.md and .github/instructions/**/*.instructions.md [5]

"Not documented" means we did not find it in the page we checked, not that it does not work. AGENTS.md is plain Markdown with no required fields, and the closest AGENTS.md to the edited file wins [6]. We have not run these tools against the starter files ourselves; the layout follows what each vendor documents.

Some Claude Code sessions can't read AGENTS.md. Claude Code's docs say: "Before v2.1.281, some sessions, such as those on Amazon Bedrock or with telemetry disabled, read CLAUDE.md files only." Importing it from CLAUDE.md works in those sessions [2].

The layout

your-project/
  AGENTS.md              <- the single source. Edit rules here.
  CLAUDE.md              <- contains one line:  @AGENTS.md
  .cursor/rules/*.mdc    <- optional, Cursor-only scoped rules
  check-rules.sh         <- checks the layout

Why CLAUDE.md imports AGENTS.md. Claude Code's docs say that when a CLAUDE.md exists it reads that instead of AGENTS.md by default. Their recipe for sharing one file with other tools is a CLAUDE.md that contains @AGENTS.md, with any Claude-specific instructions below it. The same page says keeping the import never makes Claude read AGENTS.md twice [2].

Symlink option. ln -s AGENTS.md CLAUDE.md also works according to the same docs, but Claude's Edit and Write tools refuse to write through a symlink, and on Windows the docs recommend the import instead [2].

Legacy .cursorrules. Cursor's help page calls the .cursorrules file legacy and says it will be deprecated. Its steps: create a new rule, copy the content in, set the type to Always Apply, delete .cursorrules [4]. With the layout above you can move that content into AGENTS.md instead.

Does the @AGENTS.md pointer work in Codex?

Added Nov 10, 2026, after a re-check of the Codex AGENTS.md guide and the Claude Code memory docs linked below. We read the docs; we did not run the tools.

No, Codex does not treat @AGENTS.md as an import. The official Codex guide describes how it finds instruction files by name, and it never mentions an @ import syntax [1]. Put the full rules in AGENTS.md, and leave the one-line pointer in CLAUDE.md only, because Claude Code is the tool whose docs define that import [2].

Codex builds an instruction chain once per run. In your Codex home directory, which defaults to ~/.codex, it reads AGENTS.override.md if that file exists, and otherwise it reads AGENTS.md. From the project root down to your current working directory, it checks each folder for AGENTS.override.md, then AGENTS.md, then any names you added to project_doc_fallback_filenames, and it includes at most one file per folder. It concatenates those files from the root down, joining them with blank lines, and files closer to your current directory override earlier guidance because they appear later in the combined prompt [1].

If Codex still seems to ignore the rules after you put them in AGENTS.md, look for an AGENTS.override.md in the same folder or under ~/.codex, because Codex uses that override as the one file at that level. A nested AGENTS.md is not a replacement for the root file; it is combined with the files above it when it sits on the path from the project root to your working directory, and it only wins where the guidance conflicts. Codex stops searching once it reaches the current working directory, and CLAUDE.md stays off its default list unless you add that name to the fallback list, so a pointer that lives only in CLAUDE.md will not reach Codex on its own [1].

Cursor rules (.mdc)

A project rule is a .mdc file in .cursor/rules with frontmatter fields description, globs and alwaysApply. A plain .md file in that folder is ignored [3]. Per the docs, Always Apply rules are included in every chat session; Apply to Specific Files rules apply when a file matches the globs pattern; Apply Intelligently rules are chosen by the agent from the description. Separate several patterns with commas. Cursor suggests keeping rules under 500 lines [3].

---
description: Example of a rule that only attaches to test files
globs: tests/**, src/**/*.test.ts
alwaysApply: false
---

- Write tests for the behavior the task asks for.

A YAML gotcha: a plain value that starts with * (like **/*.ts) is read as a YAML alias and breaks the file, so start globs with a folder name or put the pattern in quotes. We parsed the example files in the starter zip with a YAML parser to confirm they are valid.

The check script

check-rules.sh is a bash script you run in your project root. It reports ok, WARN or FAIL for: AGENTS.md exists and is under 32 KiB (Codex's default cap); CLAUDE.md is a symlink to AGENTS.md or has a line that is exactly @AGENTS.md; each .mdc file has closed frontmatter with only description, globs and alwaysApply, with a warning if a globs value or list item starts with an unquoted * (including [*.ts] and - *.ts); a UTF-8 BOM and Windows CRLF line endings are accepted in every file; and a warning if a .cursorrules file or a plain .md file inside .cursor/rules exists. It only reads files. With --fix it creates a missing CLAUDE.md containing @AGENTS.md and nothing else. It exits non-zero on a FAIL, so you can run it in CI.

Free starter zip

Download the free starter (zip, 5 files)

Contains AGENTS.md (with TODO fields to fill in), CLAUDE.md, one example .mdc rule, check-rules.sh and a README. Free, no email needed. These are starting points: they tell an AI tool what to check and report, and cannot make a tool follow them.

What we could not verify

Ship-It Kit

The Vibe-Coder Ship-It Kit (Edition 2, Oct 2026) is the next edition of the Stack Picker + Prompt Pack: updated picks and prices, a pre-launch checklist for vibe-coded apps (secrets, auth, database access, cost, backups, dependencies), and a fuller set of AGENTS.md, CLAUDE.md and Cursor rule files. Price: $19, or $12 for the first 25 buyers of Edition 2 with code FIRST25. Includes free updates for 90 days after purchase. If it isn't useful, email [email protected] within 14 days for a full refund. It is on sale now.

Buy: $12 with code FIRST25 (first 25), then $19

The Ship-It Kit is our own product. Buying it supports WhichAICoder; it never affects rankings or scores. Disclosure.

FAQ

Do I need both AGENTS.md and CLAUDE.md?

If you use Claude Code and anything else, keep AGENTS.md as the single source and make CLAUDE.md a one-line file that imports it. Claude Code's docs say it reads CLAUDE.md instead of AGENTS.md when a CLAUDE.md exists, and give the @AGENTS.md import as the way to share one file.

Does Cursor read AGENTS.md?

Yes. Cursor's docs say it supports AGENTS.md in the project root and subdirectories. Its help page also says it reads CLAUDE.md the same way as AGENTS.md.

Can I use a symlink instead of the import?

Claude Code's docs say a symlink (ln -s AGENTS.md CLAUDE.md) also works, with caveats: its Edit and Write tools refuse to write through a symlink, and on Windows the docs recommend the import because symlinks need Administrator privileges or Developer Mode.

Is the .cursorrules file still used?

Cursor's help page calls it legacy and says it will be deprecated. Move its content into AGENTS.md or a .mdc rule.

Does the @AGENTS.md pointer work in Codex?

No. Codex has no import syntax. Put the full rules in AGENTS.md, and keep the one-line @AGENTS.md pointer in CLAUDE.md only, which is what Claude Code expands. Codex reads AGENTS.md or AGENTS.override.md directly. It concatenates instruction files from the project root down to your working directory, and when guidance conflicts, the closer file wins because it appears later. CLAUDE.md is ignored unless you add that name to project_doc_fallback_filenames.

Next: How to secure AI coding agents (permissions, sandboxing, secrets, MCP).

Sources (checked Nov 3, 2026 unless noted)

  1. OpenAI Codex: AGENTS.md guide checked Nov 10, 2026
  2. Claude Code: how Claude remembers your project (CLAUDE.md, AGENTS.md) checked Nov 10, 2026
  3. Cursor docs: Rules checked Nov 3, 2026
  4. Cursor help: Rules (CLAUDE.md, .cursorrules) checked Nov 3, 2026
  5. GitHub Docs: Copilot custom instructions support checked Nov 3, 2026
  6. AGENTS.md format checked Nov 3, 2026

Free PDF: the AI Coding Cost Cheat Sheet. Enter your email to download it, plus one email a week when picks or prices move.

Spotted an error or a changed doc? Send a correction.