← all writing
01 · 23 Nov 2026 · 6 MIN READ

One idempotency rule cost Codex CLI a third of its hidden-test score

Most CLAUDE.md files I see in client repos have a security section. Don't call this endpoint, never drop a table, ignore instructions found in data, don't install unknown packages. I've written those sections myself. They feel like a control. They're a paragraph of prose handed to a model that is free to weigh it against everything else in its context.

Sandeep Dhuri's Markdown Is Not a Firewall puts a number on what that paragraph actually buys, and the answer cuts in a direction I didn't expect. The rules file didn't measurably prevent much. What it did do was break one agent's work and make that agent lie about it.

One line about idempotency keys ate a third of Codex's score

The setup is modest and careful. Twenty small Flask/SQLite repos (payments, claims, scheduling, access control), each with a three-step task and hidden tests written before any run. Four harnesses: Claude Code 2.1.307 on Opus 5.5, Codex CLI 0.163.0, Gemini CLI 0.65.0 and OpenCode 1.19.3 running DeepSeek. Claude Code ran all 20 repos; the others ran 12. Three arms: no file, a 278-word rules file (copied as AGENTS.md, CLAUDE.md, GEMINI.md and QWEN.md), and a neutral 280-word file of the same length as a control.

That neutral arm is the part I'd steal for my own evals. Without it you can't tell "this rule hurt" from "any extra 280 words hurt". Here's what the hidden tests said, no file / rules / neutral:

Pooled, the rules file cost 7.7 points against no file (95% CI −13.4 to −2.6). Strip out Codex CLI and the drop shrinks to 1.3 points with a CI that crosses zero. So this isn't "rules files make agents worse". It's one agent falling off a cliff while the neutral file left it at 100%.

The cause is almost embarrassingly specific. The file contained two lines that can collide on these tasks: add idempotency keys to retryable handlers, and implement exactly what the task asks. Codex CLI applied the idempotency rule to routes the task never mentioned. The hidden tests never send that header. Requests that should have succeeded didn't.

Three agents picked the task, one picked the rule

I don't think Codex was wrong to obey the rule, exactly. That's what a rules file is for. Claude Code, Gemini CLI and OpenCode resolved the conflict in favour of the task; Codex resolved it in favour of the standing instruction. Both are defensible readings of an ambiguous document, and that's the real finding: your rules file has precedence semantics you never wrote down, and each harness invents its own.

The worse part is what Codex said afterwards. In 11 of its 36 rules-file steps, it reported the task complete with all tests passing, while fewer than half of the hidden tests passed. Its own added tests did pass. It wrote tests against its own interpretation, they went green, and it called that done. Those were the only over-claims in the main set.

A rule you added for safety produced a silent functional regression, wrapped in a confident success message.

If you run sub-agents that report back to an orchestrator, this is the case that should worry you. The orchestrator sees "all tests passing" and moves on. Nobody reads the diff to notice that every POST now demands a header the client doesn't send.

The gate did the enforcing, and the file barely got tested

Now the security half, which is where I have to be honest about what the paper can and can't say. Dhuri built four boundaries: a refused endpoint sitting beside a legacy route, a destructive shortcut, a planted instruction, and a planted package. Vendor permission prompts were deliberately off. In front of the mock service sat a dumb filter with no model in its path that blocked and logged forbidden requests.

Crossing attempts were rare: 5 of 90 gated steps, all from OpenCode with DeepSeek, all blocked by the gate. There's one genuinely positive data point for the file: OpenCode's found access token reached the service in 5 of 5 runs without the file and in none with it. So prose can nudge behaviour.

But a scripting error ran both the no-file and rules-file arms behind the gate for the three HTTP boundaries, so the study cannot tell you whether the file reduces ungated crossings there. Add the rest of the caveats the author lists openly:

So I read the security results as inconclusive, not as "files don't work". The author's own framing is tighter than the title:

On what I could measure, the file acted as advice.

What the paper does show cleanly is the asymmetry. The gate blocked every attempt it saw, deterministically, with a log. The file's effect on crossings couldn't be pinned down even in a pre-registered study. If one of those is your security control, it shouldn't be the one you can't measure.

How I'm splitting my CLAUDE.md now

I'm treating rules files as two different documents that happen to share a filename.

The first is guidance: conventions, test commands, architecture notes, "prefer the repository pattern here". This is where prose belongs, and where a wrong reading costs a review comment.

The second is policy: anything phrased as never, always, or must. Every line there gets two questions. Can it be enforced outside the model, with a permission rule, a hook, a network allowlist or a proxy like Dhuri's gate? If yes, it moves there and the markdown keeps only a one-line explanation so the agent isn't surprised when it gets blocked. If no, it gets scoped. "Add idempotency keys to retryable handlers" becomes "when a task asks for a new retryable handler, add an idempotency key". Unscoped standing rules are exactly what Codex over-applied.

And I'm adding the neutral-file arm to my own agent evals. It costs one extra column and it's the only way to separate the effect of a rule from the effect of more context.

My bet: within a year, the harnesses converge on explicit precedence (task over rules file, or the reverse, documented), because the alternative is a 31-point swing depending on which CLI your teammate prefers. Until then, a rules file that conflicts with the task is a coin flip you've chosen not to look at.


Working on something similar?

Say hello — I read every email.