Skip to content

This notebook belongs to

Sadat Jubayer

Senior Software Engineer at Premio

If found, please return to hello@jubayer.dev

Vol. 7Seven years of building

Started
January 2020
Everyday tools
TypeScript, Vue, React, Next.js, NestJS, React Native
Education
B.Sc. CSSE, AIUB, 2020
2 min readAI Tools

Share one AGENTS.md across coding agents

Keep repository guidance in AGENTS.md and import it from CLAUDE.md so Codex and Claude Code share the same instructions.

You change a test command in AGENTS.md. A week later, Claude Code runs the old command because the same instructions live in CLAUDE.md. Keep the shared rules in one place and import them from the file Claude Code reads.

Put shared commands in the root file

Start with the repo root. Move the commands and boundaries both tools need into AGENTS.md. Codex reads that file as project guidance. If you launch it from a package directory, it can pick up narrower guidance on the way from the root to that directory. Codex's instruction-file guide describes that search order.

Write instructions you could check against a diff or a shell log. For a repository with an isolated test suite, an entry might say to run pnpm test from the root and leave generated files alone. If a command only works inside a package, give its directory in the same sentence.

Keep the copy in source control so a change to the command can ship with the script it names. If your CI configuration runs something different, compare the two before telling an agent which command to use.

Import the file from CLAUDE.md

In the same directory, put this on its own line in CLAUDE.md.

@AGENTS.md

Claude Code reads that line as a file import. Its memory documentation documents the import syntax. Keep a Markdown heading below the import if you have instructions that apply to Claude Code alone.

Relative paths resolve from the file containing the import. A CLAUDE.md under .claude/ would use @../AGENTS.md to reach the root file. Leave the import outside code fences and inline code so Claude Code can expand it.

Check what each session picked up

Start a fresh session in the directory people use for the project. In Claude Code, open /memory to see the files loaded into the session, including imports. For Codex, ask it to name the project's test command without running it. A fresh session helps you distinguish loaded guidance from instructions you pasted into an earlier conversation.

Try that check from a package directory too if you keep nested guidance. If the tools disagree there, find the nearer instructions that name a different command. Move the shared command back to the root file and leave the package-specific exception next to the code it applies to.