Free toolGenerate .mcp.json configs for Claude Code, Cursor & Codex →
X

OpenAI · Codex CLI · IDE extension · ChatGPT desktop app

OpenAI Codex rules files explained

Which instruction files OpenAI Codex reads (AGENTS.md, AGENTS.override.md), where to put them, and how to convert from other agents.

Files Codex reads

  • AGENTS.md
  • AGENTS.override.md

AGENTS.md: Yes: global ~/.codex/AGENTS.md plus one AGENTS.md (or AGENTS.override.md) per directory from the repo root down.

Skills folders: .codex/skills/

Who reads what

AgentRules filesAGENTS.md
ClaudeCLAUDE.md, .claude/rules/*.mdOnly when no CLAUDE.md / CLAUDE.local.md exists (default, v2.1.277+); or import it with @AGENTS.md
CodexAGENTS.md, AGENTS.override.mdYes: global ~/.codex/AGENTS.md plus one AGENTS.md (or AGENTS.override.md) per directory from the repo root down
Cursor.cursor/rules/*.mdc, AGENTS.md, .cursorrules (legacy)Yes, in the project root and in subdirectories (nested files combine)
Copilot.github/copilot-instructions.md, .github/instructions/*.instructions.md, AGENTS.mdYes on most surfaces (cloud agent, CLI, VS Code chat, code review); not Copilot Chat on GitHub.com
AntigravityAGENTS.md, GEMINI.md, .agents/rules/*.mdYes: AGENTS.md or GEMINI.md at any directory level, always on
Convert your rules file →

How Codex builds its instruction chain

Codex reads instructions in two scopes. Globally, in your Codex home (~/.codex unless CODEX_HOME is set), it reads AGENTS.override.md if present, otherwise AGENTS.md, and uses only the first non-empty file. For the project, it starts at the project root, usually the Git root, and walks down to your current directory, checking each directory for AGENTS.override.md, then AGENTS.md, then any fallback names.

Files closer to where you work come later in the combined prompt, so they win on conflicts. Codex skips empty files and stops adding once the total reaches project_doc_max_bytes, 32 KiB by default, so a long root file can crowd out a nested one.

AGENTS.override.md is meant for temporary or team-specific changes: OpenAI's example puts one in services/payments/ to replace the general rules there. If your repository already uses another filename, such as TEAM_GUIDE.md, add it to project_doc_fallback_filenames in ~/.codex/config.toml and Codex treats it as an instructions file. To confirm what loaded, OpenAI suggests asking Codex to quote the items from your AGENTS.md before it proposes work.

Source: developers.openai.com · Checked Oct 24, 2026

Featured spot on the rules libraryReach developers choosing tools for their coding agent. Labeled, and it never affects ratings.

Guides, pricing & comparisons