Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before editing a repository, trace the target file’s directory path and read every applicable instruction file from the repository root down to that file’s directory. Check for same-directory AGENTS.override.md files, identify which guidance takes precedence, and note the setup, testing, style, and security rules that apply to your change.

What AGENTS.md tells you—and what it does not

An AGENTS.md file gives coding agents project-specific context and instructions. It complements a human-oriented README; it does not replace the README or guarantee that every instruction in the repository applies to every file. Its scope is the directory tree rooted where the file sits. That means the instructions relevant to a change depend on the target file’s location.

The format is ordinary Markdown, not a prescribed schema. As the AGENTS.md project puts it, “AGENTS.md is just standard Markdown. Use any headings you like; the agent simply parses the text you provide.” Read the file that exists rather than expecting a standard set of headings or fields.

How to find the instructions for a target file

  1. Identify the repository root and target path

    Determine the file you intend to change and its path relative to the repository root. For example, for packages/editor/src/save.ts, check the repository root, then packages, packages/editor, and packages/editor/src. An instruction file in a directory above the target can govern descendants; an instruction file elsewhere in the repository generally does not govern this path.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  2. Check each directory from broad scope to narrow scope

    Look for applicable instruction files at the root and in each directory along the path to the target. Read them in order, from the broadest applicable scope toward the target directory. A nested file can add more specific guidance for its subtree, so do not stop after finding a root-level file.

  3. Check whether an override or configured fallback is selected

    For Codex, the documented discovery process checks AGENTS.override.md before AGENTS.md in each directory and selects at most one instruction file there. It can also use configured fallback filenames. Therefore, an ordinary AGENTS.md may not be the selected file if an override exists beside it. If a project uses a nonstandard instruction filename, check the relevant Codex configuration rather than assuming the filename.

Codex’s documented behavior is tool-specific: other coding agents may discover or combine instruction files differently. The shared Markdown format does not imply a shared discovery or precedence system.

How to resolve instructions that differ

For Codex, applicable instructions are assembled from the repository root toward the working directory, with more-specific guidance later in the chain. The AGENTS.md project summarizes its precedence rule this way: “The closest AGENTS.md to the edited file wins; explicit user chat prompts override everything.” Codex documentation likewise says direct user instructions take precedence over repository instructions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Apply that hierarchy before making changes: honor higher-priority direct user instructions, then follow the most specific applicable repository guidance where it does not conflict. A nested instruction can specialize broader project rules; it should not be treated as permission to ignore a higher-priority user instruction.

Codex’s current documentation describes building the instruction chain at startup, walking from the project root to the current working directory, and concatenating selected files from root to leaf. It also gives a default instruction-size limit of 32 KiB; configuration and product behavior can change. If exact discovery behavior matters, consult the current Codex AGENTS.md documentation and the local configuration.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to extract before editing

Read for rules that affect the specific change, not just general project description. The AGENTS.md project recommends including practical project context such as:

  • Build or setup requirements and commands.
  • Test commands, testing expectations, and relevant test locations.
  • Code style and project conventions.
  • Security considerations.
  • Other team-specific expectations that affect how the work should be done.

Keep those instructions available while editing. If a rule is ambiguous or its command depends on local setup, verify it against the project’s other documentation before relying on an assumption.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A quick pre-edit checklist

  • Have you identified the repository root and exact target-file path?
  • Have you checked instruction files in every ancestor directory down to the target?
  • Have you checked for AGENTS.override.md and, for Codex, any configured fallback filename?
  • Have you resolved broad-versus-specific guidance and any conflict with direct user instructions?
  • Have you captured the applicable setup, test, style, and security requirements?

Sources for the documented rules

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.