OpenAI Codex: AGENTS.md location, format and template
Where OpenAI Codex reads project instructions, whether it reads AGENTS.md, and what the format allows. From the official documentation, checked Oct 7, 2026. See also OpenAI Codex: pricing, popularity and alternatives.
Project files
AGENTS.mdin each folder from the project root down to where you work; files closer to your folder come later and winAGENTS.override.mdreplacesAGENTS.mdat that level- Other names via
project_doc_fallback_filenamesin config.toml
Global (all projects)
~/.codex/AGENTS.md(orAGENTS.override.md) in$CODEX_HOME
AGENTS.md
✓ Native format.
Format and limits
- At most one file per folder:
AGENTS.override.md, thenAGENTS.md, then the fallback names. - Combined instructions stop at
project_doc_max_bytes, 32 KiB by default. - Plain Markdown, no front matter.
Sources: learn.chatgpt.com/docs/agent-configuration/agents-md
Templates
AGENTS.md for a TypeScript project
AGENTS.md# AGENTS.md
## Project
One paragraph: what this repository does and who uses it.
## Commands
- Install: `pnpm install`
- Dev server: `pnpm dev`
- Tests: `pnpm test` (run before you finish)
- Lint and types: `pnpm lint && pnpm typecheck`
## Layout
- `src/app/`: routes and pages
- `src/lib/`: shared logic, no UI code
- `tests/`: mirrors `src/`
## Conventions
- TypeScript strict mode; avoid `any`.
- Follow the patterns already in `src/` before adding new ones.
- Small, focused functions; name things for what they do.
## Boundaries
- Never read or edit `.env*` files or commit secrets.
- Ask before adding a dependency or changing a public API.
## Done means
Tests pass, lint is clean, and the change is explained in the PR description.
AGENTS.md for a Python project
AGENTS.md# AGENTS.md
## Project
One paragraph: what this package does.
## Commands
- Set up: `uv sync`
- Tests: `uv run pytest -q`
- Lint and format: `uv run ruff check . && uv run ruff format .`
- Types: `uv run mypy src`
## Conventions
- Python 3.12; type hints on every public function.
- Use `pathlib`, f-strings and dataclasses; no new global state.
- Tests live in `tests/` and name the behaviour they check.
## Boundaries
- Don't touch `migrations/` without asking.
- Never print or log secrets; config comes from environment variables.
Nested AGENTS.md in a monorepo
packages/api/AGENTS.md# API package
Applies to everything under `packages/api/`, on top of the root AGENTS.md.
- Run `pnpm --filter api test` instead of the full test suite.
- Handlers live in `src/routes/`, one file per resource.
- Validate every request body with the schemas in `src/schemas/`.
- Database access only through `src/db/`; no raw SQL in handlers.
Codex instruction settings
~/.codex/config.toml# Folders without AGENTS.md: read these names instead
project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"]
# Raise the 32 KiB cap on combined instructions
project_doc_max_bytes = 65536
Written by AgentGid as a starting point; swap in your own commands and folders.
Other agents
Claude Code CLAUDE.mdCursor .cursor/rules/*.mdcGitHub Copilot .github/copilot-instructions.mdGemini CLI GEMINI.mdWindsurf (Devin Desktop) .windsurf/rules/*.mdCline .clinerules/Roo Code .roo/rules/Aider CONVENTIONS.mdZed .rulesJetBrains Junie .junie/AGENTS.mdKiro .kiro/steering/*.mdAmp AGENTS.mdContinue .continue/rules/goose AGENTS.md / .goosehintsOpenCode AGENTS.mdKilo Code AGENTS.mdAugment Code .augment/rules/Factory Droid AGENTS.mdQwen Code QWEN.mdWarp AGENTS.mdDevin AGENTS.mdJules AGENTS.mdReplit Agent replit.mdCrush CRUSH.md / AGENTS.md