---
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?"
