How to keep AGENTS.md and CLAUDE.md in sync across repos, with five ways compared

A symlink is enough inside one repo: make CLAUDE.md point to AGENTS.md. Across repos, a copy script plus a CI check keeps files identical, but someone must run it. A shared repo or one shared doc gives rules a single home, and agents read it only when told to.

Start free

The short answer

There are two problems here, and they need different fixes. One is two files in the same repo, AGENTS.md and CLAUDE.md, saying the same thing. The other is the same rules repeated across several repos. This page is for someone running two to ten repos with Claude Code, Codex or both.

Inside one repo, a symlink or a CLAUDE.md that imports AGENTS.md is enough. Across repos, no way is automatic: every one needs someone or something to run it. Each way below was tried on December 5, 2026 in a scratch folder of four small git repos, and the output shown is what came back.

What each agent reads, per its own docs

Claude Code's memory docs, read December 5, 2026, say it reads AGENTS.md only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in your working folder or above it. With both files present it reads the CLAUDE.md files only, unless that CLAUDE.md imports AGENTS.md. Reading AGENTS.md directly needs Claude Code 2.1.277 or later, and before 2.1.281 some sessions, such as those on Amazon Bedrock or with telemetry disabled, read CLAUDE.md files only, so import AGENTS.md from a CLAUDE.md there.

Codex's AGENTS.md guide, read the same day, says it checks AGENTS.override.md then AGENTS.md in each folder from the project root down to where you work, and stops adding files at 32 KiB by default. So one AGENTS.md per repo works for Codex without anything else. For where each file should live, see Where CLAUDE.md and AGENTS.md live for a team and how Claude Code and Codex find AGENTS.md across repos.

Way 1: a symlink, tried

We ran ln -s AGENTS.md CLAUDE.md in a repo and committed it. ls -l showed CLAUDE.md -> AGENTS.md, cat CLAUDE.md printed the AGENTS.md text, and git stored it as mode 120000, a symlink. That works on a Mac or Linux machine in no time.

What broke: We cloned the same repo with git's core.symlinks set to false, which is how a checkout without symlink support behaves. CLAUDE.md came out as a small text file containing only the words AGENTS.md. An agent reading that file gets those two words, not your rules. A symlink is fine if everyone works on Mac or Linux, and it only covers one repo.

Way 2: a copy script, tried

We wrote a four-line shell script that copies a shared AGENTS.md into each repo and writes a CLAUDE.md containing @AGENTS.md. Running it for two repos took 0.007 seconds, and both repos then held the shared text.

What broke: We added one line to the shared file and diff showed the two repos were stale, with no warning. Nothing runs the script for you. It needs a person, a git hook or a scheduled job, and each repo then needs a commit for the changed copy. Tools such as source-agents describe scanning projects and fixing how AGENTS.md and CLAUDE.md source each other, according to its README; we read it and did not run it.

Way 3: a CI check, tried

We wrote a check that compares a repo's AGENTS.md to the shared one and fails when they differ. After we edited one repo's copy by hand, it printed AGENTS.md differs from shared copy and exited with status 1, in 0.005 seconds.

What it does well: it catches drift before it ships. What it does not do: fix it. Someone still has to copy the right file in, and a CI job needs read access to wherever the shared file lives.

Way 4: a shared repo, tried

We put the rules in one repo and added it to another as a git submodule. After we committed a new line to the shared repo, the other repo still showed the old text. It only changed after we ran git submodule update --remote, which then printed the update and showed the new line.

So a shared repo gives one home, and every consumer still has to pull. It also makes everyone learn submodules.

Way 5: one shared doc in Almanac that the repos point to

Almanac reads the markdown docs in your GitHub repos and lists each CLAUDE.md, AGENTS.md and GEMINI.md it finds under Key docs. An agent connected at https://almanac.io/mcp can read a doc with read_doc and search with search_docs. If a repo's AGENTS.md has one line telling agents to read the shared rules doc in Almanac, every repo reads the same current text, with no copies to sync.

The limits are real. The agent only reads it if it follows that line and has Almanac connected, so it is not loaded at startup the way a file is. We did not run this way in the scratch folder, so this is what the code and docs say, not a test. Changes an agent makes to a key doc always arrive as a suggested edit for a person, so an agent cannot rewrite the shared rules on its own.

Which to choose

Use a symlink when it is one repo and your team is on Mac or Linux. Use the copy script plus the CI check when you need the full rules as files in every repo and can run the script. Use a shared repo when your team is comfortable with submodules. Use Almanac when non-developers must edit the rules and you want one current copy that agents read through a connector.

Questions people ask

Can I symlink CLAUDE.md to AGENTS.md?

Yes, inside one repo on Mac or Linux. In our test a checkout without symlink support turned CLAUDE.md into a text file holding only the word AGENTS.md, so a CLAUDE.md that contains the line @AGENTS.md is safer.

How do I keep the same AGENTS.md in several repos?

A script copies it, a CI check catches drift, a shared repo gives it one home, or one shared doc in Almanac holds it. In our tests none updated by itself.

Does Claude Code read AGENTS.md?

Per its docs read December 5, 2026, only when there is no CLAUDE.md in your folder or above it, unless a CLAUDE.md imports it, and it needs Claude Code 2.1.277 or later.

Related

Start free