Home › Codex lesson 2: AGENTS.md

Codex lesson 2: AGENTS.md

Last checked

Codex reads AGENTS.md files before it starts work, so your test commands, tools and boundaries apply to every task without repeating them.

Step by step

  1. Create ~/.codex/AGENTS.md for preferences that apply to every project.
  2. Add an AGENTS.md at the project root for that repository's rules.
  3. Add more AGENTS.md files in sub-folders when one part of the code needs different rules; the closest file wins.
  4. Check it loaded: codex --ask-for-approval never "Summarize the current instructions."
  5. Keep the files short and specific.

Try it: examples

Good to know

Sources (official pages, read Nov 8, 2026)

Written from OpenAI's official documentation and product pages; we don't run hands-on tests. Features and limits vary by plan and country.

Report an error on this page