(Been using Claude Code and Qwen Code for most of my projects so far, but heard good things about Codex, so I am just sharing the Cheat Sheet I am using, prepared by various AI agents.)
One-page reference for developers using both tools. Verified against current official docs.
🚀 Session lifecycle
| Intent | Claude Code | Codex CLI |
|---|---|---|
| Show/find commands | /help or type / | Type / in composer |
| Init project instructions | /init → CLAUDE.md | /init → AGENTS.md |
| Session status | /status | /status |
| Compress context | /compact | /compact |
| Resume session | /resume (in-session) | codex resume --last (CLI-level) |
| New chat / clear | /clear | /new (no /clear in Codex) |
| Side question | /btw <q> | /side |
| Fork conversation | /fork or /branch | /fork |
| Switch model | /model | /model |
| Exit | /exit | Ctrl-D (twice to force) |
🔍 Inspect & review changes
| Intent | Claude Code | Codex CLI |
|---|---|---|
| View diff | /diff (interactive viewer) | /review (fused view + review) |
| Code review | /review or /code-review [--fix] | /review (vs. base branch) |
| Security review | /security-review | Use a skill or prompt |
| Undo agent changes | /rewind or Esc, Esc | Use git reset |
| Export conversation | /export [filename] | Parse session logs |
Portable fallback for both: git diff, git diff --stat, git diff --check
🔐 Permissions & safety
Claude Code permission modes (docs):
| Mode | Runs without asking | Use for |
|---|---|---|
default | Reads only | Sensitive work |
acceptEdits | Edits + common FS commands | Active iteration |
plan | Reads + classifier-approved | Exploration |
auto | Everything + safety checks | Long tasks |
bypassPermissions | Everything | Containers only |
Shift+Tabcycles:default → acceptEdits → plan/planenters plan mode directly/permissionsmanages allow/ask/deny rules
Codex sandbox + approvals (docs) — two orthogonal axes:
# ~/.codex/config.toml
sandbox_mode = "workspace-write" # read-only | workspace-write | danger-full-access
approval_policy = "on-request" # untrusted | on-request | never/plantoggles plan mode/approveapproves one retry after an auto-review denial- Sandbox is OS-enforced — stronger than Claude’s approval layer
⚠️ bypassPermissions ≠ danger-full-access. First skips prompts; second removes the OS sandbox. Different blast radius.
⌨️ Keyboard shortcuts
| Action | Claude Code | Codex CLI |
|---|---|---|
| Cancel current action | Ctrl-C | Ctrl-C |
| Exit | /exit or Ctrl-C on empty | Ctrl-D (×2 to force) |
| Interrupt response | Esc | Esc |
| Rewind menu | Esc, Esc | No equivalent |
| Cycle permissions | Shift+Tab | No equivalent |
| Reverse-search history | Ctrl-R | Ctrl-R |
| Multi-line input | \ + Enter | Ctrl-J |
| Clear terminal | Terminal shortcut | Ctrl-L |
| Transcript / bottom panel | Ctrl-O (transcript) | Ctrl-O (open folder) ⚠️ different |
📁 File layout (portable repo)
project/
├── AGENTS.md # Universal — both tools read this
├── CLAUDE.md # Thin adapter: @import AGENTS.md
├── .agent/ # Tool-neutral collateral
│ ├── HANDOFF.md
│ ├── DECISIONS.md
│ └── workflows/*.md
├── .agents/skills/ # Codex skills
├── .claude/
│ ├── skills/ # Claude skills
│ ├── agents/ # Subagents
│ ├── settings.json # Team, checked in
│ └── settings.local.json
├── .codex/
│ ├── hooks.json
│ └── config.toml
├── .mcp.json # Claude MCP (project-scope)
├── scripts/ # Portable verbs
└── MakefileGolden rule: AGENTS.md = source of truth. CLAUDE.md imports it via @AGENTS.md.
To make Codex fall back to CLAUDE.md:
# ~/.codex/config.toml
project_doc_fallback_filenames = ["CLAUDE.md"]🔧 Skills & subagents
| Concept | Claude Code | Codex CLI |
|---|---|---|
| Skills directory | .claude/skills/<name>/SKILL.md | .agents/skills/<name>/SKILL.md |
| List skills | /skills | /skills or $ to mention |
| Subagents | .claude/agents/<name>.md | Plugins bundle agents |
| Custom commands | .claude/commands/ | ~/.codex/prompts/ (deprecated → use skills) |
Shared SKILL.md frontmatter:
---
name: review
description: When and how this skill triggers.
---
Skill instructions here.🔌 MCP servers (not auto-shared between tools)
Claude Code — .mcp.json at project root:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_TOKEN" }
}
}
}Codex — ~/.codex/config.toml or .codex/config.toml:
[mcp_servers.github]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
env = { GITHUB_PERSONAL_ACCESS_TOKEN = "$GITHUB_TOKEN" }- Manage in-session:
/mcp(both tools) - Configure both — one config does not populate the other
☁️ Delegation & cloud
| Intent | Claude Code | Codex CLI |
|---|---|---|
| Delegate to cloud | /autofix-pr, /teleport | /cloud, codex cloud exec |
| Background local task | /background, /tasks | Use codex exec & |
| Headless / CI | claude -p (--print) | codex exec |
Codex has the more mature cloud-delegation model; Claude has the richer local harness.
🔄 Switching protocol (in 5 steps)
- Commit or stash — clean working tree.
- Write
.agent/HANDOFF.md— objective, files changed, decisions, verification, next action. - Verify shared files —
AGENTS.mdcurrent;CLAUDE.mdstill imports it; MCP servers present in both configs. - Start new tool fresh — read HANDOFF, run
/status,git status,./scripts/agent-review. - Run
make verifybefore any change.
📝 .agent/HANDOFF.md template
# Agent handoff
## Objective
## Current status
## Files changed
- `path/to/file.py`: what changed
## Decisions
## Verification
- make lint — passed
- make test — 142 passed
## Known issues
## Next action
1.
2.💬 Prompt patterns that survive tool changes
Before editing (both tools):
Do not edit files yet. Inspect the repository, identify relevant files,
list assumptions and risks, and propose a numbered implementation plan.
Wait for approval.Review:
Review the current git diff. Prioritize correctness, security, data-loss risks,
missing tests, and backwards-compat problems. Do not modify files.
Report by severity with file:line references.Handoff:
Write .agent/HANDOFF.md with objective, decisions, changed files,
verification results, known issues, and next steps.Capability check (start of session):
Before beginning, report:
1. Which instruction files you loaded.
2. Which tools/MCP servers are available.
3. Your current permission/sandbox mode.
4. Verification commands you can run.⚡ Portable shell verbs
Teach both tools the same vocabulary — survives every rename:
make verify # lint + test + review
make test
make lint
make review
./scripts/agent-status # git status + branch + diff --stat
./scripts/agent-review # diff --check + full diffThen either agent takes: “Run make verify. Report failures with file and line numbers.”
🚨 Emergency reset
Ctrl-C, Ctrl-C # cancel
git status # what did the agent touch?
git stash # or: git checkout -- <file>
git worktree remove .. # if in a worktree⚠️ Top pitfalls
- ❌
/clearand/resumedon’t exist as Codex slash commands → use/newandcodex resume - ❌ Codex doesn’t read
CLAUDE.mdby default → add toproject_doc_fallback_filenames - ❌ MCP servers aren’t shared between tools → configure both
- ❌
bypassPermissions≠danger-full-access→ different blast radius - ❌
Shift+TabandCtrl-Odo different things in each tool - ❌ Codex quarantines new hooks → use
/hooksto trust them - ❌
mv CLAUDE.md AGENTS.mdis not a migration → hooks, skills, MCP, subagents all lost - ❌ Never run both agents on the same working tree → use
git worktree
🔗 Verify against your installed version
Claude Code: /help (or press ? in a session)
Codex CLI: type / in composer, or codex --helpInterfaces change fast — re-verify these commands whenever either tool updates.

Leave a Comment