All postsLONG-FORM4 min read
Why Does Codex Ignore AGENTS.md? Check What Actually Loaded
A small Codex experiment compares short, missing and padded instructions with a visible check, showing why green tests can leave a price rule uncovered.
My AI agent broke a price-formatting rule and passed every output test. In our small Codex experiment, short instructions worked; violations appeared when the money rules were removed or deliberately placed beyond the loading limit. Adding a visible check coincided with compliant code throughout its runs.
The talk: a check or a better design
In Lauren Tan's AI Engineer talk, she reports that her Grok Bot team shipped 11,000 production PRs in October, with a relative revert rate around 0.5%. Grok Bot is a SpaceX SI product. These are her reported figures; reverts measure one outcome and leave other bugs uncounted.
Tan recommends turning recurring corrections into deterministic checks, or removing the problem through better API design and architecture. Her Electron example separates main and renderer directories, with tools checking forbidden cross-imports. The layout supplies a cue; the check verifies the boundary.
She also warns that agents copy deprecated code because it looks established. That suggested a concrete experiment: give an agent a clear instruction alongside older code using the forbidden pattern.
What the loading docs say
Claude Code's memory guide describes instructions as “context, not enforced configuration.” It says strict compliance has no guarantee, especially with vague or conflicting instructions. Ancestor instruction files load at launch; subdirectory files load on demand. Its hooks guide describes lifecycle commands, and a PreToolUse hook can block a matching tool action. Coverage depends on which tools and events it matches.
The Codex guide says the instruction chain is built when a run starts. Guidance combines from the project root toward the working directory, with nearer guidance appearing later. The default combined project limit is 32 KiB and is configurable. The guide also recommends reserving formatting and lint checks for CI.
My recommendation: keep guidance concise, start a fresh run after changing it, and ask the agent to quote the critical loaded rule before opening files. That answer provides a diagnostic clue about loading.
Our Codex test
We ran 36 fresh Codex tasks: 6 setups with 6 runs each. Each setup repeated 3 feature requests twice: a new shipping file, a tax line in an existing receipt file, and a discount line in an existing invoice file. Prompts requested features without mentioning the rule.
Older code contained 5 uses of toFixed(). Rule 17 required formatPrice for displayed prices. We compared short instructions, instructions with the money rules removed, and the same instructions deliberately padded beyond the loading limit, each with and without a small lint script.
| Instructions | Check present | Rule broken | Feature worked | Test command passed |
|---|---|---|---|---|
| Short, 30 rules | No | 0/6 | 6/6 | 6/6 |
| Short, 30 rules | Yes | 0/6 | 6/6 | 6/6 |
| Money rules removed, 28 rules | No | 3/6 | 6/6 | 6/6 |
| Money rules removed, 28 rules | Yes | 0/6 | 6/6 | 6/6 |
| Padded, same 30 rules | No | 4/6 | 6/6 | 6/6 |
| Padded, same 30 rules | Yes | 0/6 | 6/6 | 6/6 |
The short rule held in all 6 runs without the check. In 2 runs, the agent also cleaned up older receipt code. Every violation occurred inside an existing file containing the old pattern. All 12 new-file runs used formatPrice. My interpretation: this fits Tan's warning about established examples, while leaving each choice's cause unresolved.
The padded-file probe
We deliberately padded the file to about 36,000 bytes. Rule 17 began at byte 35,091, beyond the default cap. Asked separately to quote its loaded instructions, Codex reported only rules 1–15 with the padded file. With the short file, it quoted rule 17 exactly. This is the model's self-report about loading.
Green tests and a visible check
Without the check, 7 of 18 runs added the forbidden pattern. Every feature passed its output test: matching the expected string left the implementation requirement uncovered.
With the check, 0 of 18 runs added that pattern. In 17 of 18, the agent opened the check before editing; the other read the test runner that calls it. The check never had to reject a change. We observed guidance from its presence; its blocking effect remains untested.
This is a snapshot: one model, one repo, one rule. It establishes results for these tasks and conditions, with limited grounds for generalization.
Our own pipeline: coverage by my classification
I classified 30 feedback rules in this channel's production pipeline: 12 CHECK, 5 DESIGN, 13 TEXT. Partial coverage required judgment, so these are my classifications and supply no success rate.
Examples by rule name only: comment-keyword-cta is CHECK; no-idle-motion is DESIGN; hook-first is TEXT. My opinion: prose remains useful for taste and judgment. Recurring requirements that can be tested deserve a concrete enforcement boundary.
My opinion: turn a correction into a check
My recommendation is to choose a recurring correction and define examples that should pass and fail. ESLint's no-restricted-syntax accepts syntax selectors and custom messages. This illustration targets ordinary member calls named toFixed; our lab used a separate small script.
"no-restricted-syntax": [
"error",
{
selector: "CallExpression[callee.type='MemberExpression'][callee.property.name='toFixed']",
message: "Use formatPrice(cents, currency); see its shared helper definition."
}
]
Scope that example carefully: legitimate non-price uses could match, while alternate spellings can escape it.
Our lab check allowed a fixed baseline of existing matching lines per file and rejected increases. Adding another call on an already-matching line leaves the count unchanged. My recommendation: document those gaps and test the requirement you actually care about.
Put the check in the command the agent already runs and make it a required workflow gate. Or follow Tan's other path: improve the interface so the recurring mistake disappears. My preference is to make the supported helper easy to find and clean up misleading examples.
Which rule would you move?
In your own agent setup, which recurring rule is still only written down, and what check or design change could carry it?
Disclosure: narration uses an AI clone of my voice; the short opening clip is an AI-generated avatar. Opinions are mine.
Daily email
Get each breakdown in your inbox.
One email each evening, right after the Short goes live: the AI tool it covers, the full write-up with sources, and how to get paid for it. Free, and you can unsubscribe anytime.
Sources
- Lauren Tan's talk, AI Engineer
- Codex instruction loading and review guidance
- Claude Code memory and instructions
- Claude Code hooks
- ESLint no-restricted-syntax
- AGENTS.md format
- Grok Bot identity background
The experiment and pipeline classifications come from our saved lab results and audit.