Why Is My AGENTS.md Ignored? Codex Instruction Diagnosis

A SKILL.md that finds why Codex skips or half-follows your AGENTS.md: wrong root, an override file, the 32 KiB limit cutting a nested file, or rules too vague to act on.

Skill prompt for Claude Code and Cursor

Prompt

Installs to .agents/skills/why-is-my-agents-md-ignored-codex-instruction-diagnosis/

mkdir -p .agents/skills/why-is-my-agents-md-ignored-codex-instruction-diagnosis && curl -sL "https://prompts-gpt.com/prompts/why-is-my-agents-md-ignored-codex-instruction-diagnosis/raw" -o .agents/skills/why-is-my-agents-md-ignored-codex-instruction-diagnosis/SKILL.md
SKILL.md
Preview
---
name: why-is-my-agents-md-ignored-codex-instruction-diagnosis
description: "A SKILL.md that finds why Codex skips or half-follows your AGENTS.md: wrong root, an override file, the 32 KiB limit cutting a nested file, or rules too vague to act on."
---

# Why Is My AGENTS.md Ignored? Codex Instruction Diagnosis

Source: https://prompts-gpt.com/prompts/why-is-my-agents-md-ignored-codex-instruction-diagnosis

A SKILL.md that finds why Codex skips or half-follows your AGENTS.md: wrong root, an override file, the 32 KiB limit cutting a nested file, or rules too vague to act on.

## Prompt

```
---
name: agents-md-diagnosis
description: Finds out why Codex (or another agent) is not following AGENTS.md, by checking which instruction files actually load and whether each rule can be acted on, then proposes fixes. Use when someone says "Codex ignores my AGENTS.md", "my AGENTS.md isn't working", "the agent keeps breaking my rules" or "which AGENTS.md is loaded".
---

# AGENTS.md diagnosis

## Part 1: is the file loaded?

1. Find the project root with `git rev-parse --show-toplevel` and the directory the user starts Codex from. Codex reads files from the root down to that directory only; a file in a sibling folder never loads.
2. Check the global layer: `echo $CODEX_HOME` (empty means `~/.codex`). In that folder, a non-empty `AGENTS.override.md` replaces `AGENTS.md`.
3. In every directory from root to start directory, list `AGENTS.override.md`, `AGENTS.md` and any names in `project_doc_fallback_filenames` in `~/.codex/config.toml`. Only one file per directory is read, override first. Flag stray override files and empty files.
4. Add up the sizes of the project files that load, from the root down. Codex stops adding project instructions at `project_doc_max_bytes` (32 KiB by default), so the file that crosses the limit is cut partway and anything after it is dropped. Report which file crosses the limit and how much of it fits.
5. Confirm with Codex itself: `codex exec "List every instruction file you loaded, in order, and quote the first rule of each."` Compare with the list from steps 2 to 4.

## Part 2: loaded but not followed?

6. Read every rule and mark it: Checkable (names a command, path or pattern), Vague ("write clean code"), or Conflicting (contradicted by a file closer to the working directory, which wins).
7. For each rule broken in the reported session, note whether the rule is vague, buried after a long section, or competes with an instruction in the user's prompt.
8. If the same file must also serve Claude Code, check that a CLAUDE.md exists and imports it with an `@AGENTS.md` line.

## Output

A load table (layer, path, size, loaded: yes, no, or partly when the byte limit cuts a file, reason), the running total against the byte limit, a rule table (rule, status, fix), and a diff that moves commands to the top, rewrites vague rules as checkable ones and removes duplicates.

## Stop and ask

- An override file looks deliberate (a team or CI setup).
- The fix means deleting another person's rules.
```

## Usage Notes

Save as .agents/skills/agents-md-diagnosis/SKILL.md for Codex, or .claude/skills/ for Claude Code; Cursor and Gemini CLI read the same file. Then ask: "why does Codex ignore the test rule in AGENTS.md?"

Example output

Example for: "Codex ignores the rule to run pnpm test before committing", started from packages/api in a monorepo.

Load table

LayerPathSizeLoadedReason
Global~/.codex/AGENTS.override.md0.2 KiBYesNon-empty override, replaces ~/.codex/AGENTS.md
Global~/.codex/AGENTS.md3.1 KiBNoReplaced by the override
RootAGENTS.md29.4 KiBYesFits under the limit on its own
packages(no AGENTS.md)0 KiBNoNo file in this folder
packages/apiAGENTS.md4.0 KiBPartlyOnly the first 2.6 KiB fit before the limit

Running total (project files): 29.4 KiB for the root file leaves 2.6 KiB of the 32 KiB default. packages/api/AGENTS.md is 4.0 KiB, so the total would be 33.4 KiB and the last 1.4 KiB is cut. The test rule sits in that last part (line 58 of 64), so it never reaches Codex.

Codex's own answer listed the override, the root file and packages/api/AGENTS.md, and quoted the first rule of each. Asked about the test rule, it said it had no such instruction, which matches the cut.

Rules (all 41 in the root AGENTS.md)

RuleStatusFix
"Keep code clean and consistent"VagueReplace with "Run pnpm lint --fix before finishing"
"Use the shared logger"CheckableKeep
"Tests are optional for docs changes"Conflictingpackages/api says always test; scope it to docs/
3 pages of architecture historyVagueMove to docs/architecture.md and link it
The other 37 rules (commands, paths, naming)CheckableKeep; 2 duplicates merged

Diff (root AGENTS.md, excerpt)

+## Commands
+- Lint: `pnpm lint --fix` before finishing
+- Test: `pnpm test` before every commit
-Keep code clean and consistent.
-Tests are optional for docs changes.
+Tests are optional only for changes inside docs/.
-## Architecture history
-(3 pages, moved)
+Architecture notes: see docs/architecture.md

Result: root AGENTS.md goes from 29.4 to 9.8 KiB, so with packages/api the project total is 13.8 KiB and the test rule loads. The ~/.codex/AGENTS.override.md is flagged for you to remove or rename (left in place, in case it is deliberate).

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • It separates "not loaded" from "loaded but not followed", which need completely different fixes.
  • Asking Codex to quote the first rule of each file it loaded gives ground truth instead of guessing from the folder tree.
  • The byte total explains rules that work in small repos and vanish in monorepos, where nested files get cut.

Save as .agents/skills/agents-md-diagnosis/SKILL.md for Codex, or .claude/skills/ for Claude Code; Cursor and Gemini CLI read the same file. Then ask: "why does Codex ignore the test rule in AGENTS.md?"

Common edits

  • For Claude Code only, swap the Codex steps for CLAUDE.md files and the /memory command to see what loaded.
  • Raise project_doc_max_bytes in config.toml if splitting the root file is not an option, and say so in the output.

Reuse it: Use in a workflowAdapt in the builder

More in Codex

Codex Writes an AGENTS.md for This Repository From the Real Setup

Has Codex inspect your repository and write a short, accurate AGENTS.md with the real build, test and lint commands, conventions and boundaries, checked by actually running them.

copilot-instructions.md Generator From Your Repo's Real Build, Test and Style Setup

Has GitHub Copilot inspect your repo and write a .github/copilot-instructions.md with the real build, test and lint commands and checkable conventions, plus up to three path-scoped .instructions.md files.

AI Tools & Prompt Engineering

Diagnose Why an AI Answer Missed and Rewrite the Prompt

Paste a prompt, the weak output and what went wrong to get a root-cause table, a targeted rewrite and a small test plan, so you fix the instruction instead of guessing.

Coding

Find the failing line in a stack trace

Isolate your application code from noisy framework trace logs and explain the root runtime crash. Use it when debugging confusing error logs.

Personal & Life

Guide Where to Tap Next One Step at a Time from a Screenshot

Get one clear tap-by-tap instruction from your settings screenshot, then upload a fresh screenshot after each step until you finish.

Customer Support

Draft friendly reproduction questions for vague bugs

Generate painless, jargon-free troubleshooting questions to help non-technical users share the exact steps engineers need to reproduce bugs.