Skip to content
Agentic Levels
Start hereLevelsTracksPromptsAbout
Get my levelGet my level

  • Start hereYour first useful task with AI.
  • Level quiz8 questions. No AI needed.
  • Fluency ScoreYour Level and a score, from your own AI.

  • LevelsThe 11 levels, in order.
  • LessonsShort lessons, filter by level.
  • TracksGuided paths by tool, role or goal.
  • Set up your AI tool
  • Starter packFree files that help AI remember.

  • PromptsReady prompts to copy and adapt.
  • ChatGPT vs Claude vs GeminiPick the right one for the job.
  • How-tos
  • ReferenceCommands for Claude Code, Codex, Antigravity.
  • ResourcesHand-picked reading and tools.

  • Your progress
  • Your next moveAn interview that picks your next skill.
  • Your next lessonsThe next lessons at your level.
  • Updates

  • Pricing
  • About
  • FAQ & Feedback
  • Work with us
  • How we handle your data
Sign inPreferences
AboutPricingHow-tosPromptsStarter packMy stackHow we handle your data

© 2026 Fuentes Studio

PrivacyTermsRefundsAccessibilityAI content policyCredits
yourCouncil
Ready to help
✦

What do you want to understand?

Ask anything about what you're learning.

←Codex Fundamentals
  1. Tracks
  2. ›Codex Fundamentals: Module 2
  3. ›Make AGENTS.md useful
3

Level 3 · Lesson 3 of 12 · Free

Make AGENTS.md useful

Repo rules Codex reads before work, and which file wins

After this, you'll be able to write AGENTS.md guidance with commands, boundaries, and proof, place each rule in the right layer, and say which file wins when two disagree.

Before you start

Complete Write a task brief Codex can finish first.

The idea

AGENTS.md is the repo memory Codex reads before it starts. It's a plain text file with that exact name, kept in the project's top folder.

Worked example

Before and after

Before: Write an AGENTS.md that says to write good code and follow best practices (tells Codex nothing new). After: Create a short AGENTS.md for my recipe blog. Use pnpm, run lint and the build after any change to recipe pages, never edit the generated sitemap (a list of the site's pages that a tool builds for you), and ask me before touching the shop or login pages.

What the AI might say

I wrote a short AGENTS.md with sections for commands, boundaries, and when to ask you first. I left out general coding advice.

Why it works

Every line in the After is a command, a boundary, or an approval trigger. Codex can follow each one on every run.

Skip the company-handbook tone. Keep only the rules Codex needs on almost every run.

Md ShapeUse the Ready lane when The file names concrete commands.
ReadyNeeds work
Job fit
The file names concrete commandsThe task is still vague
Proof
The file names risky areasThe result is assumed
Risk
LowBreaks when the file contains stale commands because Codex follows bad proof
Next move
ContinueClarify first

Use Ready only when the proof is visible.

A useful AGENTS.md answers four questions. How do you work here, and what proves a change? What's risky, and what style rules actually matter?

"Write good code" tells Codex nothing useful. "Use pnpm, never edit generated files, run lint after content changes, and keep auth routes off-limits without approval" gives it something to follow.

Here pnpm is a tool that installs a project's add-on packages, generated files are files a tool writes for you, lint is an automatic style and error check, and auth routes are the sign-in pages and code. Keep the file short, because a long doc rots the day people stop updating it.

Stable rules live in AGENTS.md. Task details live in the prompt. A rare procedure lives in a linked doc Codex opens only when it needs it.

Which file wins when two disagree. Codex reads more than one AGENTS.md and joins them in a set order.

First comes your global file, in a hidden folder called .codex in your home folder (written ~/.codex/AGENTS.md). Then come the project files, from the project's top folder down to the folder you are working in.

The file closest to your work comes last, so it overrides the earlier ones. In the same folder, a file named AGENTS.override.md beats AGENTS.md. In the global folder, Codex reads only the first non-empty file it finds, override first.

Here is one conflict. The top-level AGENTS.md says Use npm, and a file inside the shop folder says Use pnpm.

Working in the shop folder, pnpm wins, because that file is closer. Everywhere else, npm still holds.

Place each rule once, where it wins. "Don't touch production data" (the live version real customers use) goes in the project's top file, and "Use pnpm here" goes in that app's own folder.

"Only fix the quote total today" goes in the prompt and nowhere else. Copies in several layers drift apart, and a run then follows a rule you forgot you loaded.

Two limits to know. Codex stops reading once the combined text reaches 32 KiB (a few thousand words), so long files lose their ends. And Codex reads these files when it starts, so quit and reopen Codex after you change one. To see what it loaded, ask: List every instruction file you loaded for this run.

Which file each tool reads. Codex reads AGENTS.md. Claude Code reads CLAUDE.md, so it does not read your AGENTS.md by itself once a CLAUDE.md exists.

For one shared file, ask Claude Code to put the single line @AGENTS.md inside CLAUDE.md, and it pulls the shared rules in. Antigravity reads both AGENTS.md and GEMINI.md.

If you already have a CLAUDE.md. Don't retype it. Ask Codex: Read my CLAUDE.md and write an AGENTS.md with the same rules, keeping only what applies to every task.

Then check the result against the four questions above. You create the file by asking, so there is no command to learn.

If a new hire would need the rule on day one, Codex needs it too.

Try it (17 min)

Paste this into Codex

Part 1. Draft an AGENTS.md for this repo:

Project type: [a website, a phone app, a script, or unknown]
Install command: [command or unknown]
Test/build commands: [commands, or unknown]
Do not touch: [paths or systems]
Generated files: [paths or none]
Style rules: [repo rules]
Human approval required for: [auth, billing, schema, deployment, etc.]

Write a concise AGENTS.md with sections for commands, boundaries, proof, and approval triggers.

If you wrote unknown anywhere, first ask Codex: Read this project and tell me what kind of project it is and which commands install, test and build it. Then ask Codex to save the file as AGENTS.md in the project's top folder. To check it worked, quit and reopen Codex, start a new chat, and ask: What rules did you load from AGENTS.md?

Part 2. Place these rules, one layer each (global file, project AGENTS.md, a folder's own file, or the prompt). No rules of your own? Use: Reply in plain English. Never edit the invoices folder. Use pnpm in the shop app. Only fix the cart total today. Run the tests before saying done.

Then tell me which file wins if the project file says npm and the shop folder's file says pnpm, and name any rule that is stale or duplicated.

What a good response looks like

Part 1, AGENTS.md for the practice site. Commands: open index.html in a browser to see the page; ask me to run the title-and-heading check. Boundaries: only edit index.html and the check; do not add files without asking. Proof: show the check passing before saying done. Ask first: before installing anything. Part 2, placement. Global file: reply in plain English. Project AGENTS.md: never edit the invoices folder, run the tests before saying done. Shop folder's own file: use pnpm. Prompt only: fix the cart total today. If the project file says npm and the shop file says pnpm, the shop file wins inside that folder because it is closer. Nothing here is stale.

Check yours against

  • The file names concrete commands
  • The file names risky areas
  • The file separates repo rules from task-specific instructions
  • The file is short enough to review
  • Each rule sits in one layer, and the closer file is named as the winner in a conflict
  • Writing generic advice Codex already knows.
  • Storing a one-off task brief in AGENTS.md.
  • Adding old commands that no longer pass.
  • Putting the same rule in two layers, so the copies drift apart.
  • Letting the file grow past a few pages, where Codex stops reading at 32 KiB.
  • Changing an AGENTS.md and forgetting to restart Codex.

When this breaks

  • Breaks when the file contains stale commands because Codex follows bad proof instructions.
  • Breaks when two layers hold conflicting rules and you forget that the closer file wins, so a run follows a rule you did not expect.

AI can help with this

Use Codex to help you write AGENTS.md guidance with commands, boundaries, and proof, place each rule in the right layer, and say which file wins when two disagree. Start with the exercise prompt and your real input. Ask for one draft, then check it against this proof: The file names concrete commands. Accept only the version you can verify yourself.

You can now

✓

You can distinguish repo rules from task briefs

  • ✓You can name proof commands
  • ✓You can name protected areas
  • ✓You can say which AGENTS.md wins in a conflict
  • ✓You can say which file Codex, Claude Code, and Antigravity each read

Try it from memory

Pulling this out of your own head now is the part that actually moves it into long-term memory. Re-reading only feels like it does.

Think of a project of yours. Write two rules you'd put in its AGENTS.md and one detail you'd keep in the task prompt instead.

One good answer: 'Rule: run the booking test before saying done. Rule: never touch the payments folder. Prompt only: this week's change to the cancellation page.' If your rules are true for every task and the prompt detail is true only for today, that's the idea.

Key takeaways

AGENTS.md is not documentation for everything. It is the set of repo rules Codex needs before it edits, placed once, in the layer where it should win.

  1. 1Concrete commands beat generic quality advice.
  2. 2Boundaries protect risky systems.
  3. 3The closest file wins, and AGENTS.override.md beats AGENTS.md in the same folder.
  4. 4Task-specific details belong in the prompt, not in any file.
  5. 5Restart Codex after a change, and keep the combined text under 32 KiB.

Go deeper

  • Custom instructions with AGENTS.mdlearn.chatgpt.com (opens in a new tab) ↗
Up nextRead sandbox mode before approving→

Was this helpful?

Related lessons

Write Your First CLAUDE.mdDo Not Stuff CLAUDE.md
← Back to Codex Fundamentals