AGENTS.md Not Loaded in OpenAI Codex CLI — Discovery Order, Size Cap & Fix
Symptom: OpenAI Codex CLI ignores repo commands or rules written in CLAUDE.md / AGENTS.md.
Codex CLI reads AGENTS.md (and AGENTS.override.md) — NOT CLAUDE.md — walking from the Git root down to your current working directory, capped by default at 32 KiB (project_doc_max_bytes). It also does NOT expand Claude Code's @import syntax, so putting @CLAUDE.md inside AGENTS.md leaves Codex with a literal 10-byte line.
Broken vs. Fixed Configuration
# AGENTS.md (Codex reads this literally and sees ZERO rules!) @CLAUDE.md
# AGENTS.md (read natively by Codex, Cursor, Copilot, Windsurf) # Billing API — Node 22 + TypeScript - Fast test: npx vitest run src/billing/webhook.test.ts - Typecheck: npx tsc --noEmit # CLAUDE.md (Claude Code expands @AGENTS.md natively!) @AGENTS.md
Why This Happens
The single most common mistake in multi-agent repos is keeping all instructions in CLAUDE.md and creating a 1-line AGENTS.md containing @CLAUDE.md. Codex does not resolve @includes, so it receives zero instructions. Always reverse the direction: put canonical prose in AGENTS.md and put @AGENTS.md inside CLAUDE.md.
Step-by-Step Fix
- 01Make AGENTS.md the real canonical file (not a pointer)
Move shared project instructions into AGENTS.md, then point CLAUDE.md to @AGENTS.md.
- 02Stay well below Codex's 32 KiB default cap
Keep root AGENTS.md under 10–15 KB (~150 lines) so neither Codex (32 KiB) nor Claude Code (40K chars) truncates it.
- 03Check for stray AGENTS.override.md files
If an AGENTS.override.md exists in the same directory, Codex prioritizes it over AGENTS.md.
Automated AgentLint Checks That Catch This
Frequently Asked Questions
Does Codex CLI support @include directives like Claude Code?
No. Codex reads plain Markdown from AGENTS.md and AGENTS.override.md without expanding @file pointers.
Can I increase Codex's 32 KiB AGENTS.md limit?
You can raise project_doc_max_bytes in ~/.codex/config.toml, but keeping AGENTS.md compact (<150 lines) improves compliance across every model.