Answers
CLAUDE.md and AGENTS.md drift apart in 7% of repos that copy one into the other: import instead
Published
A CLAUDE.md that copies AGENTS.md drifts: in our sample of 745 repos with both files at the root, 7.0 percent held a copy that had already drifted and another 6.6 percent a copy still in step, waiting to. Replace the copy with @AGENTS.md on the first line of CLAUDE.md, so there is one file to edit and Claude Code imports it every session.
For Claude Code. Vendor facts are from the pages linked below, read on November 18, 2026.
Fix a drifted pair
- Diff the two files:
diff <(sort CLAUDE.md) <(sort AGENTS.md)shows lines only one of them has. - Decide which line is true for each difference, from the code, not from either file, and keep it in AGENTS.md.
- Replace CLAUDE.md with
@AGENTS.mdand only the Claude-specific lines below it. - To keep it from coming back, add a CI step that fails if CLAUDE.md stops starting with
@AGENTS.md, or generate both files with ruler or rulesync.
head -1 CLAUDE.md | grep -qx "@AGENTS.md" || { echo "CLAUDE.md must import AGENTS.md"; exit 1; }The numbers
| Measure | Value | Source |
|---|---|---|
| CLAUDE.md beside AGENTS.md: a copy that drifted | 7.0% of pairs (54 sampled) | Harbor study, 18 Oct 2026 |
| A copy still in step | 6.6% of pairs (45) | Harbor study, 18 Oct 2026 |
| Imports it with @AGENTS.md | 25.4% (207) | Harbor study, 18 Oct 2026 |
| Is a symlink to AGENTS.md | 23.0% (177) | Harbor study, 18 Oct 2026 |
| Root AGENTS.md files with a CLAUDE.md beside them | 36.5% (weighted) | Harbor study, 18 Oct 2026 |
Study figures are weighted estimates from 1,935 CLAUDE.md and 1,970 AGENTS.md files sampled from public GitHub repositories on 18 October 2026, with GitHub's own counts for the totals. Every figure is in the study's CSV, and the method is in the study.
What the docs say
- Claude Code memory docs, AGENTS.md section: With a CLAUDE.md in the working directory or above, Claude reads CLAUDE.md files only, unless CLAUDE.md imports AGENTS.md or the Project instructions setting loads both.
Where Harbor fits
Harbor connects Claude Code, Codex, Cursor and GitHub Copilot (the CLI and VS Code agent mode; the cloud agent is not supported yet) through hooks and an MCP server. It keeps one set of team rules and serves the same ones to every agent, so there is no second copy to drift. When a push deletes the file a rule is about, the rule is retired, or flagged if other repos still use it. Each rule shows how often it was served and how often an answer cited it. A citation is evidence a rule was used, not proof it was obeyed.
Read next
- Keep CLAUDE.md, AGENTS.md and .cursorrules in sync
- "Read AGENTS.md" does not import it
- The study behind the numbers
- Leave the directory tree out of CLAUDE.md and AGENTS.md: it goes stale and the agent can list files itself
- Claude Code strips HTML comments from CLAUDE.md, so a rule inside one never loads
- Share CLAUDE.md rules across repos with ~/.claude/rules, a symlinked .claude/rules, or a managed CLAUDE.md
- Every answer, by agent and problem
Questions
How do I keep CLAUDE.md and AGENTS.md in sync?
Do not keep two copies. Put the rules in AGENTS.md and make CLAUDE.md start with @AGENTS.md, or make it a symlink. If you need generated per-agent files, use ruler or rulesync with a check in CI.
How often do CLAUDE.md and AGENTS.md drift apart?
In our October 2026 sample of 745 repos with both files at the root, 7.0 percent of the CLAUDE.md files were copies that had drifted: they held some of the AGENTS.md lines but missed at least five.
Which file wins when they disagree?
In Claude Code, the CLAUDE.md, because by default it does not read AGENTS.md at all when a CLAUDE.md exists. Codex reads AGENTS.md. So the same repo gives Claude and Codex different rules.