That is the problem: docs/AGENTS.md only counts when Codex works inside docs/. It reads AGENTS.md from your home folder (~/.codex/AGENTS.md), from the repo root, and from the folders on the way down to where you are working. Move it to the root of the repo.
Two things that make the rules stick better once it is found:
- Give the command, not the wish. "Run
pnpm testbefore you say you are done" works better than "make sure tests pass". - Keep it short. A page of rules gets followed; five pages get skimmed.
You can check what it loaded by asking at the start of a session: "Which AGENTS.md files did you read?"