Aditya Sharma

Claude Code vs Codex: How I Decide Which to Open

On this page, 5 sections

I do not pick between Claude Code and Codex by model. I pick by what each one reads before it starts work, and by whether my rules can be enforced or only requested. On both counts the two tools are closer than the comparison posts make them sound.

I use both, depending on the task. I have not run a head-to-head benchmark, so this post makes no claim about which writes better code. It covers the part I can check against the docs: instructions, hooks and licence. I read each source on 17 November 2026.

Two documentation excerpts side by side, key phrases highlighted. OpenAI's Codex guide: Codex concatenates AGENTS.md files from the root down and stops adding files at 32 KiB by default. Claude Code's memory docs: discovered CLAUDE.md files are concatenated into context, ordered from the filesystem root down. Headline: Two tools, one instruction file.

What each tool reads before it starts

Codex reads AGENTS.md. Its docs say it builds an instruction chain once per run: a global file in ~/.codex first, then one file per directory from the project root down to where you start. Files closer to you override earlier ones, and the combined size stops at project_doc_max_bytes, which is 32 KiB by default.

Claude Code reads CLAUDE.md. A user file in ~/.claude applies to every project, a project file applies to the repo, and files in subdirectories load on demand. Its docs say it can also read a repository’s AGENTS.md, and that a CLAUDE.md should stay under 200 lines because longer files cost context and reduce adherence.

So the shape is the same: a global file, a project file, nearer files win. If you write your working agreements once in plain markdown, you are not locked into either tool.

Hooks are where the real difference sits

The Claude Code memory docs say CLAUDE.md files are context, not enforced configuration. Claude reads them and tries to follow them. That is the sentence that shaped my own setup.

My CLAUDE.md is a handful of behavioural rules, and anything that must never be forgotten lives in a hook, a script that runs on an event. I wrote up how that looks in Claude Code hooks explained.

Both tools now have hooks. Claude Code lists SessionStart, UserPromptSubmit, PreToolUse (which can block a call), PostToolUse and Stop. The Codex docs list PreToolUse, PermissionRequest, PostToolUse, UserPromptSubmit and Stop, among others. Codex adds one rule I like: non-managed hooks must be reviewed and trusted before they run.

What I checkClaude CodeCodex
Instruction fileCLAUDE.md, can also read AGENTS.mdAGENTS.md, global plus per directory
Size guidanceUnder 200 lines per file32 KiB combined by default
Hooks that can run before a tool callPreToolUse, can blockPreToolUse and PermissionRequest
Source codeI did not checkPublic repo, Apache License 2.0
From the Claude Code memory and hooks docs, the Codex AGENTS.md and hooks docs, and the openai/codex LICENSE file, all opened 17 November 2026.

How I decide which one to open

  • The task already has a hook-heavy workflow. If a task depends on rules my hooks enforce, I stay where those hooks live.
  • The task is a fresh second opinion. A second tool reading the same plain instruction file is a cheap check on whether my rules are clear or only clear to the tool that wrote them.
  • The repo already has an AGENTS.md. Both tools can read it, so I do not rewrite it.
  • I need to read the source. If I want to see how the agent loop treats a permission, I can read the public Codex repository. That is a real reason to pick it, and it has nothing to do with model quality.

None of this is a scoreboard. It is how I would judge the move, and it is the reason I stopped asking which tool is better. The better question is which one respects the rules I already wrote down.

What I could not verify

  • Which tool writes better code. I did not benchmark them and I will not put a number on it.
  • Whether my own hooks run unchanged under Codex. I read its hook docs; I did not port my scripts.
  • Anything about price or limits. Those change often, so I left them out.

If you use only one of them today, copy your instruction file into the other tool’s format and run one real task there. You learn more from what it ignores than from any comparison post, including this one.

If MCP is part of that setup, my MCP versus CLI check is the next thing to read, and what an MCP server is covers the basics.

Sources

Tell me where I am wrong

Your email is not published and I do not add it to any list. Corrections with a source are the ones I act on fastest.