Claude Code vs OpenAI Codex CLIUpdated 2026-03-16

SUMMARY

Claude Code (CLI) uses markdown configuration while OpenAI Codex CLI (CLI) uses markdown. They differ on 2 of 11 compared features. Both tools provide AI-assisted development but take different approaches to project configuration.

FEATURE COMPARISON

FeatureClaude CodeOpenAI Codex CLI
Config formatmarkdownmarkdown
Hierarchy support
Global config
Project config
Subdirectory scoping
File inclusion / imports
Ignore file.claudeignore.codexignore
IDE integrationCLICLI
Schema / structureFree-form (Markdown)Free-form (Markdown)
Git committed
EncodingUTF-8UTF-8

FILE MAPPING

PurposeClaude CodeOpenAI Codex CLI
Project instructionsCLAUDE.mdAGENTS.md
User-local overrides.claude/settings.local.jsonAGENTS.override.md
Ignore patterns.claudeignore.codexignore
Settings / configuration.claude/settings.json~/.codex/config.toml
skills.claude/skills/*/SKILL.md.agents/skills/*/SKILL.md

SIDE-BY-SIDE CODE SAMPLES

Claude Code
CLAUDE.md
markdown
# Project Name

> TypeScript + React monorepo. Deployed on Vercel.

## Code Style

- TypeScript strict mode — no `any`, no `ts-ignore`
- Named exports only (no default exports)
- Prefer functional patterns: map/filter/reduce over for-loops
- Error handling: use Result<T, E> from `src/lib/result.ts`

## Architecture

- `src/routes/`   — Route handlers (thin layer, delegates to services)
- `src/services/`  — Business logic, one file per domain entity
- `src/db/`        — Drizzle ORM schema and query helpers
- `src/lib/`       — Shared utilities (logger, result type, validation)

## Commands

```bash
pnpm install          # Install dependencies
pnpm dev              # Start dev server (port 3000)
pnpm test             # Run Vitest suite
pnpm test:e2e         # Run Playwright tests
pnpm lint             # ESLint + Prettier check
pnpm db:migrate       # Run pending Drizzle migrations
```

## Git Conventions

- Conventional Commits: `feat:`, `fix:`, `chore:`, `docs:`
- Branch naming: `feat/short-description`, `fix/issue-number`
- Squash merge to main; delete branches after merge

## Notes

- The `src/legacy/` directory is being migrated. Do not add new code there.
- All dates are stored as UTC. Never use local time.

@docs/api-patterns.md
@docs/database-conventions.md
OpenAI Codex CLI
AGENTS.md
markdown
# AGENTS.md

## Project Overview

This is a Next.js 14 e-commerce application using the App Router,
Server Components, and Drizzle ORM with PostgreSQL.

## Code Conventions

- Use TypeScript strict mode throughout
- Prefer Server Components; use "use client" only when necessary
- Name files with kebab-case: `product-card.tsx`, not `ProductCard.tsx`
- Co-locate tests: `product-card.test.tsx` next to `product-card.tsx`

## Architecture

- `app/`           — Next.js App Router pages and layouts
- `components/`    — Shared UI components
- `lib/`           — Utilities, database client, auth helpers
- `actions/`       — Server Actions for mutations

## Testing

- Use Vitest for unit tests, Playwright for E2E
- Mock database calls using `lib/test-utils.ts` helpers
- Every new component needs at least one test

## Build Commands

```bash
pnpm dev          # Start dev server
pnpm build        # Production build
pnpm test         # Run Vitest
pnpm test:e2e     # Run Playwright
pnpm lint         # ESLint check
```

KEY DIFFERENCES

1. File inclusion / imports

Claude Code: Supported. OpenAI Codex CLI: Not supported.

2. Ignore file

Claude Code: .claudeignore. OpenAI Codex CLI: .codexignore.

3. Concatenation vs nearest-ancestor resolution

Claude Code concatenates all CLAUDE.md files from global scope down through every directory level. Codex uses nearest-ancestor resolution for AGENTS.md — only the closest file to the working directory applies, though it merges parent files when traversing upward to the project root.

4. Global configuration scope

Claude Code supports a global ~/.claude/CLAUDE.md that applies to all projects. Codex has no global equivalent — AGENTS.md is always project-scoped, starting from the repository root.

5. Override mechanism

Claude Code uses .claude/settings.local.json (JSON) for personal overrides of tool permissions. Codex uses AGENTS.override.md (Markdown) for personal instruction overrides, keeping the same format as the main config.

6. @-import support

CLAUDE.md supports @filename.md directives to compose instructions from multiple files. AGENTS.md does not support file inclusion — each file is self-contained.

WHICH SHOULD I USE?

Decision Tree
Are you already using Claude or OpenAI models?
├── YES Use the CLI that matches your model provider — Claude Code for Anthropic, Codex for OpenAI.
└── NO
    Do you need global config that applies across all projects?
    ├── YES Claude Code — its global CLAUDE.md provides cross-project defaults.
    └── NO
     Either tool works — both support project-level Markdown config with subdirectory scoping.

PORTABILITY TIP

sync-instructions.sh
bash
# Maintain a single source of truth:
cp AI-INSTRUCTIONS.md CLAUDE.md
cp AI-INSTRUCTIONS.md .cursorrules
cp AI-INSTRUCTIONS.md AGENTS.md

SEE ALSO

agentconfig.ing2026-03-16COMPARE(1)