One set of rules for Claude Code, Codex and Antigravity: keeping CLAUDE.md, AGENTS.md and GEMINI.md in step
Each AI coding tool reads its own instruction file. Here are four ways to keep CLAUDE.md, AGENTS.md and GEMINI.md identical, including on Windows.
Claude Code reads CLAUDE.md, Codex and opencode read AGENTS.md, and Google's Antigravity CLI reads GEMINI.md. If you use more than one of these tools, your project rules drift apart unless something keeps the files in step. There are four ways to do it: import one file from the others, symlink them, generate them from one source, or let a tool manage a shared block. On Windows, symlinks are the option that causes trouble.
Which tool reads which file
| File | Read by |
|---|---|
CLAUDE.md |
Claude Code |
AGENTS.md |
OpenAI Codex, opencode, and a growing list of other tools |
GEMINI.md |
Google Antigravity CLI (and Gemini CLI before it) |
The duplication is a long-standing complaint. The request for Claude Code to support AGENTS.md collected more than 6,000 reactions before it was closed as completed in August 2026 (issue 6235). A follow-up asking for fuller support is still open (issue 31005). So the tools are converging, but if you support three of them today you still have three files to think about. Check each tool's current documentation before assuming it reads another tool's file.
One developer summed up the cost: "Every time I updated a skill/rule, I had to update it in 3+ places" (Hacker News).
Option 1: one real file, the others import it
Keep the rules in AGENTS.md and make the other files one line long.
<!-- CLAUDE.md -->
@AGENTS.md
Claude Code supports importing another file with the @path syntax. This is the simplest setup when it works for every tool you use. Its weakness is that not every tool supports imports the same way, so test each one by asking it to repeat a rule from the shared file.
Option 2: symlinks
Make CLAUDE.md and GEMINI.md links to AGENTS.md. On macOS and Linux this is one command and it works well. On Windows it has three problems:
- Creating a symlink needs Developer Mode turned on, or an elevated prompt.
- Git only checks links out as links when
core.symlinksis true. Otherwise a teammate gets a small text file containing a path, and their agent reads that path as the entire rule set. - Some sync and backup tools replace links with copies without telling you.
If your team is all on one operating system, symlinks are fine. On a mixed team, prefer option 1 or 3.
Option 3: generate the files from one source
Keep a single rules.md and copy it into place with a small script, run by hand or from a git hook.
# sync-rules.ps1
$source = Get-Content .\docs\agent-rules.md -Raw
foreach ($name in 'CLAUDE.md', 'AGENTS.md', 'GEMINI.md') {
Set-Content -Path $name -Value $source -NoNewline -Encoding utf8
}
Plain copies work on every operating system and in every tool. The cost is that someone will edit a generated file directly. Guard against that with a check that fails when the three differ:
$hashes = 'CLAUDE.md', 'AGENTS.md', 'GEMINI.md' | ForEach-Object { (Get-FileHash $_).Hash }
if (($hashes | Select-Object -Unique).Count -ne 1) { throw 'Rule files have drifted. Run sync-rules.ps1.' }
Run that in your test script or continuous integration and drift cannot merge.
Option 4: a managed block inside each file
Some rules are the same everywhere, and some belong to one tool. A managed block handles both: a marked section that a tool rewrites, and free space around it that you own. This is the approach CPLai takes, described below.
What belongs in the shared rules
Shorter is better. Every line is read at the start of every session, so a long file costs tokens and gets followed less well. Keep to things an agent cannot work out from the code:
- How to build, test and run the project
- Branch and commit conventions, and what must never be pushed
- Where files go, and where they must not
- Actions that need your approval: deploys, deletes, sending email
- Style rules you will otherwise correct ten times
Leave out anything the agent can read from the repository, and anything that changes weekly. Put per-task detail in the task, not in the rules.
A second kind of drift: skills
Rules files are not the only thing that fragments. Reusable procedures, now commonly packaged as skills, do too. Agent Skills started at Anthropic and was released as an open format, a folder with a SKILL.md file, that other agent products have adopted (agentskills.io). Where your tools support the same format, keep skills in one place rather than a copy per tool.
How CPLai handles it
CPLai generates and maintains a managed block inside CLAUDE.md, AGENTS.md and GEMINI.md for each project. The block sits between two comment markers, and every file receives the same content. CPLai only changes what is between the markers, so anything you write outside them is kept. You can add your own instructions that go into every project's block, and CPLai refreshes the block when agents and terminal tabs launch (Agent Memory Files).
The practical effect is that a Claude Code session, a Codex session and an Antigravity session opened on the same project start from the same rules and the same pointers to company knowledge, without a sync script. If you use one tool and one file, you do not need any of this.
Sources
- Claude Code issue 6235, AGENTS.md support, closed August 2026
- Claude Code issue 31005, follow-up, open
- Hacker News discussion on duplicated rules, February 2026
- Agent Skills, open format, read November 2026