Hand the same spec to multiple AI coding agents - Cursor, Claude Code, and OpenAI Codex - and you do not get one build three times. You get three different builds. The models are not the problem: give the same underspecified ticket to three senior engineers and they would diverge too. The problem is that a spec written once travels into three tools that read different files, load different context, and resolve every ambiguity on their own.
This is the practical limit of agent-agnostic specs. A single document feels portable, and at the level of words on a page it is. But the build each agent produces is a function of the words plus everything around them, and the "everything around them" is where Cursor, Claude Code, and Codex quietly disagree.
Key Takeaways
- Divergence is structural, not model quality: Each agent reads a different default instruction file and loads a different slice of the repository, so the same spec lands in three different contexts.
- Instructions are advisory, not binding: Claude Code treats its memory files as context, not enforced configuration, and Codex lets a user prompt override the spec. The spec competes with the model's priors.
- Portability solves distribution, not determinism: A shared
AGENTS.mdgets one file to every tool. It does not make three tools build the same thing from it.- Ambiguity is the variable you control: Divergence is proportional to how much the spec leaves unspecified. Every unanswered question becomes three different guesses.
- The fix is an approved, portable plan: Remove the ambiguity, pin the decisions, and serve the identical approved plan to every agent, with a human sign-off before any of them build.
The experiment: one spec, three agents
Consider an illustrative experiment any team can run in an afternoon. Take one real ticket, write it up as a short spec, and hand the identical text to Cursor, Claude Code, and Codex in three clean checkouts of the same repository. Then compare what each one builds.
A representative spec might read:
## Feature: Partial refunds
Allow customer support to issue a fair prorated refund against a
settled charge. Expose it as an API endpoint. Update the ledger.
Add tests.
That is more detail than most tickets carry, and it is still wide open. "A fair prorated refund" has at least three defensible formulas. "An API endpoint" does not say idempotent (safe to retry without double-charging), versioned, or authenticated. "Update the ledger" does not name the module that owns writes. "Add tests" sets no coverage bar. A human would ask. An agent answers, silently, and the three answers rarely match.
You do not need instrumented tooling to see the divergence. You will see it in the endpoint shape, the refund math, where the write lands, and how much of the surrounding system each agent touched. The interesting question is not whether they diverge but why, because the why tells you what to put in the spec.
Why does the same spec diverge across AI coding agents?
The same spec diverges across multiple AI coding agents because each tool reads a different instruction file, pulls a different slice of the codebase into context, and treats the spec as advisory guidance rather than a binding contract. Identical words land in three different contexts, so every gap the spec leaves open gets filled three different ways.
Three mechanisms drive it, and none of them are fixed by writing a better sentence.
They do not even read the same file
Before a single line is generated, the three agents have already parted ways on where they look for your instructions. By default, Claude Code reads CLAUDE.md from the project (and user and org) scope, Codex reads AGENTS.md with a layered, closest-file-wins lookup, and Cursor reads .cursor/rules/*.mdc files scoped by glob patterns. A spec that lives in only one of those files reaches only one of the three agents.
AGENTS.md, an open, tool-neutral instruction file now stewarded under the Linux Foundation, exists precisely to close this gap. Cursor and Codex both read it, and Claude Code can read an AGENTS.md in place of CLAUDE.md. Getting one spec in front of all three agents is a solved problem, and the mechanics of doing it with a single root file plus thin per-tool shims are covered in our guide to spec-driven development with Cursor, Claude Code, and Copilot. The standard itself is documented at agents.md.
Workflow summary: One shared spec reaches Cursor, Claude Code, and Codex through their instruction files, yet each agent produces a different build because it loads different context and resolves ambiguity independently.
So distribution is solved. Determinism is not. One file in three tools still yields three builds, which is the part teams underestimate when they adopt agent-agnostic specs and expect portability to mean repeatability.
Where the builds actually diverge
Once every agent has the same words, the divergence comes from everything the words do not control. These are the dimensions worth inspecting when you run the experiment, and each one maps to something the spec can pin down.
| Divergence dimension | Why the agents differ | What the spec must pin down |
|---|---|---|
| Context loaded | Codex truncates combined instructions at a byte cap (its docs use a 64 KiB example) and prefers the closest file; Claude Code starts each session with a fresh context window; Cursor attaches rules by file glob. Each sees a different slice of the repo. | Name the exact files, modules, and contracts in scope, so nothing depends on what the agent happened to load. |
| Ambiguity resolution | "A fair prorated refund" and "an API endpoint" have several defensible readings. Each model resolves them against its own priors. | Give testable acceptance criteria and a worked example, not an adjective. |
| Instruction enforcement | Claude Code's own docs call memory files "context, not enforced configuration"; Codex says a user chat prompt overrides AGENTS.md. The spec competes with the prompt and the model. |
Keep the operative constraints few, specific, and non-negotiable, and enforce the hard ones outside the prompt. |
| Execution loop | Claude Code can stop and show a plan before editing; an autonomous Codex run may build straight through. Different loops, different intermediate decisions. | State where a human gate sits before code is written, not after. |
| System reach | One agent edits a single file; another refactors three to make the change "clean." Scope boundaries are read differently. | Declare explicit non-goals and out-of-scope files. |
The pattern is consistent: the spec controls the words, and the agent controls the context the words are read in. The less the words constrain, the more the context decides, and the context is exactly the part that is not portable.
Portability solves distribution, not determinism
The push toward portable AI coding plans - one AGENTS.md, many tools - is good engineering hygiene, and it removes a real class of drift: you no longer maintain three contradictory instruction files by hand. But it is worth being precise about what portability buys you, because the marketing shorthand ("write once, run on any agent") overpromises.
A portable file guarantees that every agent receives the same text. It guarantees nothing about what each agent does with it. Codex can silently drop part of a long spec at its truncation cap. Claude Code can follow its memory file closely on one run and loosely on the next, because it is context rather than enforced configuration. Cursor can leave a rule unattached because no open file matched its glob. The same spec, different AI agents, three outcomes - and none of them violated the spec, because the spec was advice.
This is the same reason keeping one spec aligned across repositories is hard, not just across tools. The failure mode of specification drift we cover in preventing spec drift when agents share a codebase is the multi-repo cousin of this multi-agent one: the artifact looks authoritative, but nothing binds the build to it.
The variable you actually control: ambiguity
You cannot standardize how Cursor, Claude Code, and Codex load context or enforce instructions. Those are product decisions inside tools you do not own. What you can standardize is how little you leave to them.
Divergence is proportional to ambiguity. A spec that says "a fair prorated refund" invites three refund formulas; a spec that says "refund = charge * (days_remaining / term_days), rounded down to whole cents, in the charge currency" invites one. A spec that says "an API endpoint" invites three contracts; one that says "idempotent POST /v1/refunds, keyed on an Idempotency-Key header, 201 on create, 200 on replay" invites one. The precision is not bureaucracy. It is the difference between a portable document and a portable result.
This is what an AI-ready spec template is for: scope, non-goals, affected services, acceptance criteria, and edge cases written densely enough that the three agents have nothing left to guess. When the spec answers the questions, the context the agent loaded stops mattering, because there is no gap for the context to fill. That is also why the problem gets sharper across more than one repository, where the contract binding services together usually lives somewhere the agent never opened, as we detail in AI coding agents across multiple repos.
Removing ambiguity by hand, for every ticket, across every agent, is real work. A planning layer like Enact does it structurally: it turns intent into a spec that names the exact scope and contracts, has product and engineering approve it together, and then serves that one approved plan to Cursor, Claude Code, or Codex over the Model Context Protocol (MCP), an open standard for feeding structured context to coding agents. Same approved plan, same context, to every agent, with the ambiguity already resolved before any of them starts.
Run the experiment, then decide what to pin
The fastest way to convince a team that one spec across coding agents is not the same as one build is to watch it happen. The method is cheap:
- Pick one real ticket. Something with a non-trivial decision in it, like the refund math above.
- Write the spec once. Put it where all three agents will read it (a root
AGENTS.mdis the simplest). - Run three clean checkouts. Hand the identical spec to Cursor, Claude Code, and Codex with no extra prompting.
- Diff the four dimensions. Compare the endpoint contract, the core calculation, where the write landed, and how many files each touched.
- For every divergence, ask one question. Did the spec actually answer this? If not, that gap is your next acceptance criterion.
- Rewrite the spec to close the gaps, and run it again. Convergence rises as ambiguity falls. That curve is the whole point.
By the second or third pass, the builds move toward each other, and what is left tells you which decisions genuinely need a human to make and record before an agent runs. Teams that want to put a number on the rework this avoids can model it with our rework ROI calculator.
The takeaway is not that agent-agnostic specs are a bad idea. They are the right foundation. It is that portability of the document is step one, and portability of the decision - an approved plan, with the ambiguity resolved and a human sign-off attached - is the step that actually makes three agents build the same thing. Get both, and which agent your developer reaches for stops being a variable in what ships.
One approved plan. Any agent. Same build.
See how Enact resolves the ambiguity, gets product and engineering to approve the plan, and serves it to Cursor, Claude Code, and Codex over MCP.
Watch the demo →