Problem: you run more than one coding agent on the same repo, and every tool reads its project rules from a different file. Keeping those files in sync by hand is tedious, and the moment you forget one, the agents drift out of sync.
| Agent / harness | Where it looks for instructions |
|---|---|
| Claude Code | CLAUDE.md (project root, plus $HOME/.claude/CLAUDE.md global) |
| OpenAI Codex | AGENTS.md (plus $HOME/.codex/AGENTS.md global, AGENTS.override.md) |
| Gemini CLI | GEMINI.md by default (configurable) |
| Junie (JetBrains) | .junie/AGENTS.md, then root AGENTS.md, legacy .junie/guidelines.md |
| Cursor | AGENTS.md or .cursor/rules/*.mdc (legacy .cursorrules) |
Solution: put everything in AGENTS.md and point the others at it.
AGENTS.md is an open Markdown format (agents.md) supported by Codex, Cursor, Junie, and Gemini.
- Codex reads it directly.
- Cursor also reads
AGENTS.mdat the repo root, in addition to its own.cursor/rules/*.mdcfiles. - Junie looks for
.junie/AGENTS.mdfirst, then a rootAGENTS.md, with.junie/guidelines.mdkept as a legacy fallback. - Gemini CLI defaults to
GEMINI.md, but at the time of writing you can optionally addAGENTS.mdtocontext.fileNamein.gemini/settings.json:
{
"context": {
"fileName": [
"AGENTS.md",
"GEMINI.md"
]
}
}
That leaves Claude Code, which still reads CLAUDE.md and, as of mid-2026, does not read AGENTS.md (feature request #6235, one of the most-upvoted open issues in the tracker, no official response yet). There are two ways to fix it.
Option 1: symlink
Claude Code follows symlinks, so make CLAUDE.md point at AGENTS.md:
#!/usr/bin/env bash
ln -s AGENTS.md CLAUDE.md
- Now both names refer to the same file.
- Commit the symlink; git stores it as a link, not a copy.
- The same trick works for any other tool that wants its own filename:
#!/usr/bin/env bash
ln -s AGENTS.md GEMINI.md
ln -s AGENTS.md .junie/guidelines.md
Option 2: import
If you'd rather not deal with symlinks, make CLAUDE.md a one-liner that imports AGENTS.md:
@AGENTS.md
A real second file, but it never changes; Claude pulls in AGENTS.md at runtime.
Proof
The trick: put a codeword in AGENTS.md, then ask each agent for it. If an agent repeats the codeword, it read the file. This script builds a throwaway repo, wires CLAUDE.md both ways (symlink and import), and checks Codex and Claude Code against each. Paste it into a terminal that has the codex and claude CLIs installed:
#!/usr/bin/env bash
set -euo pipefail
QUESTION="What is the project codeword? Reply with only the codeword and nothing else."
# Ask both agents, confirm each answer contains the codeword from AGENTS.md.
verify() {
local label=$1 expected=$2
codex exec -s read-only --skip-git-repo-check -o codex-answer.txt "$QUESTION" >/dev/null 2>&1
local from_codex from_claude
from_codex=$(cat codex-answer.txt)
from_claude=$(claude -p "$QUESTION")
echo "$label:"
[[ "$from_codex" == *"$expected"* ]] && echo " codex PASS" || { echo " codex FAIL (got: $from_codex)"; exit 1; }
[[ "$from_claude" == *"$expected"* ]] && echo " claude PASS" || { echo " claude FAIL (got: $from_claude)"; exit 1; }
}
workdir=$(mktemp -d)
# Option 1: CLAUDE.md is a symlink to AGENTS.md
mkdir "$workdir/symlink" && cd "$workdir/symlink"
echo "If asked for the project codeword, reply with exactly: SYMLINK-OK" > AGENTS.md
ln -s AGENTS.md CLAUDE.md
verify "symlink" "SYMLINK-OK"
# Option 2: CLAUDE.md imports AGENTS.md
mkdir "$workdir/import" && cd "$workdir/import"
echo "If asked for the project codeword, reply with exactly: IMPORT-OK" > AGENTS.md
echo "@AGENTS.md" > CLAUDE.md
verify "import" "IMPORT-OK"
rm -rf "$workdir"
echo "All good."
Output, run in 2026 with Codex (codex-cli 0.138.0) and Claude Code (2.1.169):
symlink:
codex PASS
claude PASS
import:
codex PASS
claude PASS
All good.
References
- AGENTS.md, the open standard
- Claude Code memory and CLAUDE.md
- Custom instructions with AGENTS.md (Codex)
- Provide context with GEMINI.md files (Gemini CLI)
- Rules and AGENTS.md (Cursor)
- Guidelines and memory (Junie)
- Symlink AGENTS.md to tool-specific files (SSW.Rules)
- Feature Request: Support AGENTS.md (#6235)
Using AGENTS.md with Claude Code, Codex, and the rest
One source of truth for coding agents: write AGENTS.md once, then symlink or import it for Claude Code, Codex, Gemini CLI, Junie, and Cursor.