Concept
Keeping CLAUDE.md and AGENTS.md consistent across a team
Last updated
CLAUDE.md and AGENTS.md are markdown files of standing instructions that coding agents load at the start of a session: build commands, conventions and rules for the repository. Claude Code reads CLAUDE.md. AGENTS.md is an open format read by Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf and others, and current versions of Claude Code read it too.
To keep them consistent across a team, make one file the source and point the other at it, keep the shared file short and reviewed like code, keep personal preferences out of it, and move anything that changes with each feature into a document the agent fetches per task.
Which agent reads which file
| Tool | Reads | Nested files and precedence |
|---|---|---|
| Claude Code | CLAUDE.md or .claude/CLAUDE.md, CLAUDE.local.md, ~/.claude/CLAUDE.md, and an organization-managed CLAUDE.md. Reads AGENTS.md when no CLAUDE.md or CLAUDE.local.md is present (v2.1.277 and later, or v2.1.281 on Amazon Bedrock or with telemetry off), or alongside it with a setting. | Loads every file from the working directory up and concatenates them, root first. Files in subdirectories load when Claude reads files there. |
| Codex | ~/.codex/AGENTS.md, then AGENTS.override.md or AGENTS.md at each level of the repository. | Walks from the Git root down to the working directory. Closer files come later and override earlier guidance. Stops adding content at 32 KiB by default. |
| Cursor | Project rules in .cursor/rules, plus AGENTS.md in the root and in subdirectories. | Nested AGENTS.md files scope instructions to part of the codebase. Team Rules, then Project Rules, then User Rules. |
| GitHub Copilot | .github/copilot-instructions.md and path-specific .github/instructions/*.instructions.md files. Its agent also reads AGENTS.md, or a single CLAUDE.md or GEMINI.md in the root. | The nearest AGENTS.md in the directory tree takes precedence. Path-specific files use applyTo globs. |
AGENTS.md is stewarded by the Agentic AI Foundation under the Linux Foundation. It has no required fields, and its own guidance says explicit chat prompts from the user override everything in the file.
One source, one pointer
Two files maintained by hand drift. Pick AGENTS.md as the source when the team uses more than one agent, since most of them read it, and make CLAUDE.md a pointer. The Claude Code docs give three ways to do that.
- Import it. A CLAUDE.md that starts with
@AGENTS.mdloads the shared file first, then any Claude-specific lines below it. This also covers sessions that cannot read AGENTS.md directly. - Symlink it.
ln -s AGENTS.md CLAUDE.mdkeeps one copy. The docs advise the import instead if anyone clones the repository on Windows, where a committed symlink can check out as a one-line text file. - Rely on direct reading. Claude Code v2.1.277 and later read AGENTS.md when there is no CLAUDE.md or CLAUDE.local.md in the working directory or above it. Sessions on Amazon Bedrock or with telemetry off need v2.1.281 or later. A personal CLAUDE.local.md counts, so adding one switches that person back to CLAUDE.md only unless they set
claude-md-and-agents-mdin/config.
@AGENTS.md ## Claude Code Use plan mode for changes under `src/billing/`.
The import pattern above is the example from the Claude Code docs.
Rules that keep a shared file healthy
- Write instructions someone can verify. “Run
npm testbefore committing” works; “Test your changes” does not give the agent anything to check. - Keep it short. The Claude Code docs suggest under 200 lines per CLAUDE.md because longer files consume context and reduce adherence. Codex stops adding AGENTS.md content once the combined instructions reach 32 KiB by default.
- Scope what applies to part of the code. Use path-scoped rules in
.claude/rules/, Cursor rules for specific files, Copilot instruction files withapplyTo, or a nested AGENTS.md in the package it covers. - Keep personal preferences personal. Put them in
CLAUDE.local.mdor~/.claude/CLAUDE.md, not in the shared file. - Review changes like code. Edits to the shared file go through pull requests, with one owner who decides when two rules disagree.
- Remove conflicts. The Claude Code docs warn that Claude may pick one of two contradictory instructions arbitrarily. Claude Code v2.1.283 and later can run
/doctor prompt-auditto find outdated and conflicting instructions. - Enforce in settings, guide in the file. Instruction files are context the agent tries to follow. Hard limits, such as blocked commands, belong in hooks or managed settings.
Where a single instruction file stops scaling
An instruction file is the right home for facts that hold across features. It reaches its limits when a team asks it to carry more:
- Decisions that change weekly. What the team agreed about a feature last Tuesday does not belong in a file every session loads, and the product and design people who made the decision rarely edit the repository.
- Per-task intent. The file cannot tell an agent what this change is for, what is out of scope, or how the result will be checked.
- Context cost. Every line loads in every session, so each new rule competes with the code the agent needs to read.
- Many repositories. Each repository carries its own copy, so one convention change becomes a pull request per repository. Symlinked shared rules and an organization-managed CLAUDE.md help Claude Code users, but they do not reach every agent.
Where Hamster fits
Keep CLAUDE.md or AGENTS.md for stable repository facts. Hamster holds the context that changes and the context a whole team owns: Skills and Methods for conventions that span repositories, Blueprints for product and architecture context, and Briefs and Plans for the intent and acceptance criteria of each change.
hamster sync writes that context as markdown into .hamster/ in each repository and generates .claude/skills/hamster-project-context/SKILL.md, which tells the agent where every synced file lives. hamster skills sync puts the team's Skills in .agents/skills/, where coding agents load them like any other skill. Agents that prefer a live connection read and update the same content through the Hamster MCP server. The instruction file stays short because it no longer has to carry the plan.
Free for 10 Briefs a month. Unlimited free viewer seats, pay only for creators.
Questions people ask
- Does Claude Code read AGENTS.md?
- Yes. Claude Code v2.1.277 and later read AGENTS.md when there is no CLAUDE.md or CLAUDE.local.md in the working directory or above it. Sessions on Amazon Bedrock or with telemetry off need v2.1.281 or later. To read both, set Project instructions to claude-md-and-agents-md in /config, or import the file with @AGENTS.md from CLAUDE.md.
- Should CLAUDE.md import AGENTS.md or be a symlink to it?
- Use the @AGENTS.md import if anyone works on Windows or you want Claude-specific lines under the shared content. A symlink works when neither applies, though Claude Code edits the target file, AGENTS.md, rather than writing through the link.
- How long should CLAUDE.md or AGENTS.md be?
- The Claude Code docs suggest under 200 lines per CLAUDE.md file, because longer files consume more context and reduce adherence. Codex stops adding AGENTS.md content once the combined instructions reach 32 KiB by default.
- What happens when two instruction files disagree?
- It depends on the tool. AGENTS.md says the nearest file in the directory tree takes precedence, Codex lets closer files override earlier ones, and Claude Code concatenates files and may follow either of two contradictory instructions. The fix is to remove the conflict.
- What belongs in CLAUDE.md, and what belongs somewhere else?
- CLAUDE.md and AGENTS.md hold facts that are true in every session: commands, conventions, layout and hard rules. The intent, decisions and acceptance criteria for a specific change belong in a reviewed document the agent reads for that task.
Related
Sources
- Claude Code docs, How Claude remembers your project
- AGENTS.md
- Codex docs, AGENTS.md
- Cursor docs, Rules
- GitHub Docs, Adding repository custom instructions for GitHub Copilot
Checked October 1, 2026.