Wire

Rules files compared: CLAUDE.md, AGENTS.md, Cursor rules and Copilot instructions.

Claude Code, Codex, Cursor and GitHub Copilot each read a rules file of their own, and most of them now read AGENTS.md too. This page says which agent loads which file, from where and when, checked against each vendor’s own docs, and what Harbor does with the files you already have.

Which agent reads which file

A rules file is a Markdown file of instructions that a coding agent loads into its context. Each agent has its own, and AGENTS.md is the one most of them share. Read across a row to see who loads that file.

Which agent loads which committed rules file. A dot means the vendor pages listed under Sources do not say the agent reads it.
FileClaude CodeCodexCursorGitHub Copilot
CLAUDE.mdYes, its own fileOnly if you add it to project_doc_fallback_filenamesYes, applied to every conversationCloud agent: one at the repo root, in place of AGENTS.md. Code review on GitHub.com: yes. Copilot CLI: yes. VS Code: with chat.useClaudeMdFile
AGENTS.mdYes, when there is no CLAUDE.md in the folder you start in or above, unless you set it to read bothYes, its own fileYes, at the root and in subfoldersYes: cloud agent and code review (the nearest file wins), VS Code, Copilot CLI
.cursor/rules/*.mdc··Yes, its own format·
.cursorrules·Only if you add it to project_doc_fallback_filenamesLegacy, and "will be deprecated"·
.github/copilot-instructions.md···Yes, its own file
.github/instructions/*.instructions.md···Yes, for the files its applyTo matches

Some files belong to one person and are never committed. They load only on that person’s machine:

Personal rules files, and who they reach.
FileAgentReaches
~/.claude/CLAUDE.mdClaude CodeYou, in every project
~/.claude/rules/Claude CodeYou, in every project
CLAUDE.local.mdClaude CodeYou, in one project. Add it to .gitignore
~/.codex/AGENTS.mdCodexYou, in every project. AGENTS.override.md beside it wins
User RulesCursorYou, in every project. Set in Customize, Rules
~/.copilot/copilot-instructions.mdCopilot CLIYou, across repositories

For one file of yours, check which agents load your rules file from where it sits: paste it into the rule-file checker, and it also marks the lines no agent enforces.

Claude Code: CLAUDE.md, CLAUDE.local.md and imports

  • Where. ./CLAUDE.md or ./.claude/CLAUDE.md for the team, through version control; ~/.claude/CLAUDE.md for you in every project; CLAUDE.local.md at the project root for you in this project only; and a managed CLAUDE.md that your organization puts on each machine (/Library/Application Support/ClaudeCode/ on macOS, /etc/claude-code/ on Linux and WSL).
  • When it loads. At launch, Claude Code loads CLAUDE.md and CLAUDE.local.md from the folder you start in and every folder above it. All of them are joined, not overridden, and the ones closer to where you started are read last. A CLAUDE.md in a subfolder loads once Claude reads, writes or edits a file in that subfolder. After /compact, the project-root CLAUDE.md is read again from disk.
  • Imports. A line @path/to/file pulls that file in. Relative paths resolve from the file that holds the import, and imports can nest four hops deep. An imported file loads with the CLAUDE.md that names it, so splitting a file this way does not make it cheaper.
  • Rules by path. Markdown files in .claude/rules/ load at launch, or, with paths frontmatter, only when Claude works with files that match.
  • Size. Anthropic’s guidance is under 200 lines per CLAUDE.md: longer files use more context and reduce adherence.

Running /init also reads your Cursor rules, in .cursor/rules/ or .cursorrules, and .github/copilot-instructions.md, and folds the relevant parts into the CLAUDE.md it writes.

Does Claude Code read AGENTS.md?

Yes, since Claude Code v2.1.277, but by default only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the folder you start in or any folder above it. Your ~/.claude/CLAUDE.md, a managed CLAUDE.md and .claude/rules/ files do not count for that check; they load alongside AGENTS.md.

  • To read both, type /config and set Project instructions to claude-md-and-agents-md. Each folder’s CLAUDE.md then loads first and its AGENTS.md after it.
  • A subfolder’s AGENTS.md loads when Claude opens a file there with the Read tool, if that subfolder has no CLAUDE.md of its own.
  • Watch CLAUDE.local.md. It counts, so adding one for your own notes in a repo that relies on AGENTS.md stops Claude reading AGENTS.md for you.

The longer answer, with the cases, is does Claude Code read AGENTS.md.

Codex: AGENTS.md and ~/.codex/AGENTS.md

  • Yours. Codex first reads its home folder, ~/.codex unless you set CODEX_HOME: an AGENTS.override.md if it is there and not empty, otherwise AGENTS.md. Only one file is used at this level.
  • The project’s. From the project root, usually the Git root, Codex walks down to the folder you started in. In each folder it takes at most one file: AGENTS.override.md, then AGENTS.md, then any fallback names you set. Files are joined from the root down, so the one nearest your folder comes last and wins.
  • When. Once per run. In the terminal UI that usually means once per session you launch.
  • Size. Codex stops adding files once the combined size reaches project_doc_max_bytes, 32 KiB by default.
  • Other names. Codex reads a file by another name, CLAUDE.md included, only if you list it in project_doc_fallback_filenames in ~/.codex/config.toml. Names not on that list are ignored.

Because Codex walks only from the root down to where you start, an AGENTS.md in a folder below that is not on the walk. More on what gets cut in why Codex ignores AGENTS.md.

Cursor: .cursor/rules, AGENTS.md and the legacy .cursorrules

  • Project rules live in .cursor/rules/, are version-controlled, and must use the .mdc extension: a plain .md file there is ignored. Cursor suggests keeping each rule under 500 lines.
  • How a rule applies is set by its frontmatter fields description, globs and alwaysApply: Always Apply in every chat, Apply Intelligently when Agent decides the description fits, Apply to Specific Files when a file matches the globs, and Apply Manually when you @-mention it.
  • AGENTS.md is read at the project root and in subfolders. A nested one applies to files in its folder and below, combined with its parents. A CLAUDE.md is applied to every conversation.
  • .cursorrules at the root is legacy, and Cursor says it will be deprecated. Its replacement is a project rule set to Always Apply.
  • Beyond the repo: User Rules (Customize, Rules) are yours in every project, and Team Rules come from the dashboard on Team and Enterprise plans. When they conflict, Team Rules come first, then Project Rules, then User Rules.
  • Where rules apply. Rules apply to Agent (Chat), not to Tab completion or Bugbot reviews.

GitHub Copilot: copilot-instructions.md, *.instructions.md and AGENTS.md

  • Repository-wide: .github/copilot-instructions.md.
  • Path-specific: .github/instructions/NAME.instructions.md, with an applyTo glob in its frontmatter. Add excludeAgent to keep one from the cloud agent or code review. Where a repository-wide file also exists, both are used.
  • Agent instructions: one or more AGENTS.md anywhere in the repository, and the nearest one in the directory tree wins. Instead of AGENTS.md, a single CLAUDE.md or GEMINI.md at the root also works.
Which Copilot surface reads which kind of file, from GitHub’s support table and VS Code’s docs.
SurfaceReads
Copilot Chat on GitHub.comRepository-wide instructions, plus your personal and organization ones
Cloud agent and code reviewRepository-wide, path-specific and agent instructions, plus organization ones
Copilot Chat in VS CodeRepository-wide and path-specific instructions; AGENTS.md at the workspace root by default (chat.useAgentsMdFile), nested ones only with chat.useNestedAgentsMdFiles, off by default; CLAUDE.md through chat.useClaudeMdFile
Copilot CLIcopilot-instructions.md, path-specific *.instructions.md files, AGENTS.md, CLAUDE.md (also .claude/CLAUDE.md) and GEMINI.md, from the repository root, the folder you start in and the folders between; your own in ~/.copilot/

On GitHub.com, when several apply, personal instructions come first, then the repository’s, then the organization’s, and Copilot is given all of them. Copilot CLI and Copilot Chat in VS Code combine theirs with no set order.

CLAUDE.md vs AGENTS.md: which should a team keep?

If your team uses more than one agent, keep AGENTS.md as the shared file: Codex, Cursor and GitHub Copilot read it, and Claude Code reads it when there is no CLAUDE.md. If you also need Claude-only instructions, Anthropic’s docs give one way to keep a single shared file: a CLAUDE.md that imports AGENTS.md and adds the rest below it. Claude reads the imported file first, then the rest.

CLAUDE.md
@AGENTS.md

## Claude Code

Run the payments tests with pnpm test:payments before a commit.

A symlink (ln -s AGENTS.md CLAUDE.md) also works when there is nothing Claude-only, except for anyone on Windows, where Git can check the link out as a one-line text file. A CLAUDE.md that only says “read AGENTS.md” in words is the one that fails: Claude sees AGENTS.md only if it decides to open it.

How do you share CLAUDE.md across multiple repos?

On its own, Claude Code has no file that reaches a whole team across repos. A project CLAUDE.md reaches one repo. ~/.claude/CLAUDE.md and ~/.claude/rules/ reach every repo, but only on your machine. The managed CLAUDE.md reaches everyone only once IT distributes it to each machine, with MDM, Group Policy, Ansible or similar.

The other options are per session: --add-dir gives Claude another folder, and its CLAUDE.md loads only with CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 set. An import of a file outside your working directory asks you to approve it the first time. Codex works the same way: files in the repo, and a personal file per machine. Cursor’s Team Rules, on its Team and Enterprise plans, and Copilot’s organization instructions do reach a whole team, each inside its own agent.

Harbor is built for this case. A rule approved once reaches every repo bound to its Space, on the machine of every teammate who can read that Space, in Claude Code, Codex, Cursor and GitHub Copilot. Scope agent memory by repo and team with Spaces explains which repos get which rules.

What a rules file cannot do on its own

  • It is per repo, per agent and per machine. A decision your team made has to be copied into each repo’s file, under each agent’s name, and a personal file never reaches a teammate. A vendor’s team-wide layer reaches that vendor’s agent only.
  • It is context, not enforcement. Anthropic’s docs say Claude treats these files “as context, not enforced configuration”, and point to a PreToolUse hook to block an action whatever Claude decides. Hooks or CLAUDE.md: which enforces a rule? covers that half.
  • It goes stale quietly. Nothing tells you a line is out of date, and when two lines contradict each other, Claude may pick one arbitrarily. The file also cannot tell you which of its lines an agent ever used.
  • It has a size budget. Codex stops adding files at 32 KiB by default, Anthropic suggests under 200 lines a CLAUDE.md, and Cursor under 500 lines a rule.

How Harbor imports your rules files

When harbor init or harbor bind turns Harbor on in a repo, it looks for the rules files the repo commits and offers to send them to your team’s Review queue:

harbor init~/acme-api
This repo commits CLAUDE.md and AGENTS.md.
Send their rules to your team's review queue? Harbor reads the text
with a model (keys and tokens are blanked first), and nothing reaches an
agent until someone on your team approves it. [Y/n]
  • Which files. CLAUDE.md, AGENTS.md, .cursorrules, .cursor/rules/*.mdc and .github/copilot-instructions.md, at the root or in any folder, outside node_modules, dist, build, vendor and other generated trees.
  • Committed text only. Only files git tracks, and only as committed: an untracked file, or an edit you have not committed, never leaves your machine.
  • At most 10 files a run, 64 KB each. A larger file is a document, not a rules file, and is not sent. A repo with more than 10 sends the next 10 on the next run, and the summary says how many are left.
  • Read once. A CLAUDE.md that is a symlink to AGENTS.md, or only says @AGENTS.md, is read as one file. A file the repo already sent is not sent again, so a later edit to it does not reach Harbor through the import.
  • Your answer. Enter is yes, and Ctrl+C is no. --import-rules sends without asking, and --no-import-rules neither asks nor sends. With no terminal to ask on (an agent’s shell, CI, --json), nothing is sent, and the summary says how to send it later.

Every imported rule waits in Review, in every capture setting, with Waiting because harbor init imported it from a repo’s instruction file, and those wait for a person. A rule the brain already holds is not filed twice. The repo has to be in a Space first; otherwise the summary says not sent: this repo has no Space.

Agents check your rules files before they record

Harbor’s MCP server tells every agent that records a learning to check it against the repo’s rules files first. In its own words: “Before you record, check it against the repo’s own rules files you were given (CLAUDE.md, AGENTS.md, Cursor rules). If it contradicts a line there, do not record it: quote that line to the user, ask which one is right, and offer to fix the file if the file is out of date. A rule the user just stated wins: record it and offer to update the file.”

So a learning that reverses your CLAUDE.md is raised with you in the session, instead of going live beside the line it contradicts.

Sources

Each vendor fact on this page is from these pages, read on 31 October 2026.