Track lessons
AGENTS.md vs CLAUDE.md vs Cursor Rules: One Source of Truth
Teams now use several coding agents, and duplicated instruction files quickly disagree. AGENTS.md can hold shared repository guidance while thin tool-specific files keep only behavior unique to each agent.
When to use
- Use the same commands and constraints across multiple coding agents.
- Prevent copied instruction files from drifting.
- Keep scoped or tool-only features in their native configuration.
Example
Codex, OpenCode and Cursor share commands and safety rules from AGENTS.md; CLAUDE.md imports that source and adds one Claude-only review skill.
TL;DR
Write rules once in AGENTS.md; make CLAUDE.md import it.
echo '@AGENTS.md' > CLAUDE.mdSteps
- 1
Put shared rules in AGENTS.md
Start with commands and durable repository constraints that should remain identical regardless of which supported agent performs the work.
AGENTS.md# Agent instructions ## Commands - Install: `npm ci` - Test: `npm test` ## Rules - Never edit src/gen/. - Add a test for every bug fix. - 2
Point Claude Code at it
Keep CLAUDE.md thin: import the shared source, then add only behavior that applies specifically to Claude Code.
CLAUDE.md@AGENTS.md ## Claude-only - Use the review-diff skill before finishing. - 3
Keep Cursor rules for scoping only
Use .mdc files for glob-specific rules, not for repeating AGENTS.md.
- 4
Personal defaults
Keep preferences that should not affect teammates in each tool's personal instructions directory rather than committing them to the repository.
paths~/.codex/AGENTS.md # Codex, all projects ~/.claude/CLAUDE.md # Claude Code, all projects
Gotchas
- Two copies of the same rule will drift; delete duplicates.
- Nested AGENTS.md files override parent ones for that folder.
- Tool-specific features (skills, subagents, Bugbot) stay in their own files.
Cheat sheet
| AGENTS.md | Codex, OpenCode, Cursor |
| CLAUDE.md + @AGENTS.md | Claude Code |
| .cursor/rules/*.mdc | Cursor scoped rules |
| .cursor/BUGBOT.md | Cursor Bugbot reviews |
Related
Sources
Reviewing agent output? CodeCrab reviews pull requests locally with your own AI tools.
