ai newsFr., 16. Okt.
EilmeldungGrok Builds CLI lud trotz Anweisung ganze Git-Historie hoch

Claude Code gegen Codex CLI: die wichtigsten Befehle im Vergleich

Ein direkter Vergleich von 18 Kommandos und Flags zeigt, wie sich Claude Code und Codex CLI in der Bedienung unterscheiden. Wer zwischen den Tools wechselt, muss etliche Befehle neu lernen.

dev.toDonnerstag 22:02 · 15.10.DE8 Min. Lesezeit
Bild: dev.to

In Claude Code bedeutet -p print: den Prompt ausführen, die Antwort schreiben, sich beenden. In Codex CLI ist -p die Kurzform von --profile, daher fragt codex -p "fix the flaky test" nach einem Config-Profil mit diesem Namen. -c setzt die letzte Unterhaltung in Claude Code fort. In Codex setzt es einen Config-Schlüssel.

Wenn Sie beide Agenten täglich nutzen, greifen Ihre Finger früher oder später zum falschen. Deshalb folgen hier 18 Aufgaben, jeweils auf die Claude-Code-Art und auf die Codex-Art, mit einem Befehl zum Einfügen. Jede Zeile entspricht der Claude-Code-CLI-Referenz und der Codex-Befehlsreferenz Stand 14. Oktober 2026. Ich habe diese Befehle nicht selbst ausgeführt, und beide Tools erscheinen in kurzen Abständen in neuen Versionen. Wenn ein Flag hier von der Dokumentation abweicht, gilt die Dokumentation.

# 1. one shot claude -p "Summarize what src/auth does" codex exec "Summarize what src/auth does" # 2. stdin cat build-error.txt | claude -p "explain the root cause" cat prompt.txt | codex exec - # 3 + 4. JSON für Skripte, finale Nachricht in eine Datei claude -p "List the TODOs" --output-format json | jq -r '.result' codex exec --json "List the TODOs" > events.jsonl codex exec -o todos.txt "List the TODOs" Enter fullscreen mode Exit fullscreen mode Claudes JSON-Format ist ein einzelnes Objekt mit der Antwort in result, dazu session_id und total_cost_usd, wie im Headless-Guide beschrieben. Codex streamt mit --json stattdessen Ereignisse: thread.started, turn.started, turn.completed, turn.failed, item.* und error, laut den Non-Interactive-Dokumenten.

Wenn Sie nur Codex' letzte Nachricht wollen, ist -o kürzer als das Parsen des Streams. Die Beispiele pipen in jq.

Für Zeile 5 funktioniert eine einzige Schema-Datei für beide. Claude nimmt das Schema inline, Codex einen Pfad:

{ "type": "object", "properties": { "functions": { "type": "array", "items": { "type": "string" } } }, "required": [ "functions" ], "additionalProperties": false } Enter fullscreen mode Exit fullscreen mode claude -p "Extract the function names from auth.py" \ --output-format json \ --json-schema " $( cat schema.json ) " | jq '.structured_output' codex exec "Extract the function names from auth.py" \ --output-schema./schema.json -o names.json Enter fullscreen mode Exit fullscreen mode Zwei Voreinstellungen unterscheiden sich, und das fällt in CI auf die Füße. codex exec läuft in einer Read-Only-Sandbox, daher braucht eine Aufgabe, die Dateien ändert, Zeile 11. Ein Lauf von claude -p ohne gesetzten Permission-Modus verwendet den eingebauten Startmodus, der auto sein kann. Geben Sie also den gewünschten Modus explizit an.

Gleiche Tasten, andere Aufgaben: -p und -c bedeuten in den beiden CLIs unterschiedliche Dinge.

# 6. dort weitermachen, wo Sie aufgehört haben, in diesem Verzeichnis claude -c codex resume --last codex resume --last --all # das Neueste aus einem beliebigen Verzeichnis # 7. eine bestimmte Sitzung claude -n auth-refactor # beim Start benennen claude -r auth-refactor # später dorthin zurückkehren codex resume # Picker codex resume --include-non-interactive # 8. skriptgesteuerte Nachfrage id = $( claude -p "Find N+1 queries in src/" \ --output-format json | jq -r '.session_id' ) claude -p "Rank them by impact" --resume " $id " codex exec "Find N+1 queries in src/" codex exec resume --last "Rank them by impact" Enter fullscreen mode Exit fullscreen mode claude -c überspringt Sitzungen, die mit -p gestartet wurden, während claude -p --continue sie einschließt (CLI-Referenz). codex resume --last sucht nur im aktuellen Verzeichnis, sofern Sie nicht --all hinzufügen, und sowohl der codex-resume-Picker als auch --last lassen codex-exec-Sitzungen aus, außer Sie ergänzen --include-non-interactive (Codex-Referenz). Dieser Filter gilt nur für codex resume: codex exec resume --last, in Zeile 8 verwendet, ist der skriptgesteuerte Weg und greift auch exec-Läufe auf (Non-Interactive-Dokumente). codex exec resume akzeptiert außerdem einen Sitzungsnamen anstelle der ID.

# 9 + 10. Modell und Effort für eine Sitzung claude --model opus --effort high codex -m gpt-6.1-sol -c model_reasoning_effort = '"high"' # 11. Headless bearbeiten lassen claude -p "Apply the lint fixes" --permission-mode acceptEdits codex exec --sandbox workspace-write "Apply the lint fixes" # 12. nur in einem Wegwerf-Container oder einer VM claude --dangerously-skip-permissions codex --yolo Enter fullscreen mode Exit fullscreen mode Claude Code akzeptiert Aliase (sonnet, opus, haiku, fable) oder einen vollständigen Modellnamen. gpt-6.1-sol ist das Beispielmodell in Codex' eigenen Config-Dokumenten, tauschen Sie es also gegen ein Modell ein, das Ihr Konto nutzen kann.

Beim Effort unterscheiden sich die beiden am stärksten. Claudes --effort akzeptiert low, medium, high, xhigh, max oder ultracode, je nach Modell, und gilt nur für diese Sitzung. Die Codex-Referenz listet kein Effort-Flag, daher setzen Sie den Schlüssel model_reasoning_effort, dessen dokumentierte Werte von low bis xhigh sowie max und ultra reichen, wieder je nach Modell. Codex parst -c-Werte als TOML und fällt auf einen simplen String zurück, und die zusätzlichen Anführungszeichen sind die Form, die seine Seite zur erweiterten Konfiguration verwendet. Innerhalb einer Sitzung gibt es bei Claude /model und /effort, während Codex' /model beides setzt, sofern das Modell Effort unterstützt.

Claudes acceptEdits schreibt Dateien ohne Nachfrage und genehmigt gängige Dateisystembefehle wie mkdir, touch, mv und cp automatisch. Abgesehen von Read-Only-Befehlen benötigen andere Shell-Befehle weiterhin eine Allow-Regel (Headless-Guide).

Codex teilt die Entscheidung in zwei Teile: --sandbox (read-only, workspace-write, danger-full-access) legt fest, worauf Befehle zugreifen dürfen, und --ask-for-approval bestimmt, wann es innehält und nachfragt. Wenn Ihr Muskelgedächtnis -a untrusted oder -a on-failure eintippt: Die Config-Referenz führt untrusted inzwischen als nicht unterstützt und on-failure als veraltet. Verwenden Sie on-request oder never.

Claude Code verfügt zusätzlich über eine Sandbox auf Betriebssystemebene für Shell-Befehle, die jedoch standardmäßig aus ist: Führen Sie /sandbox aus, um sie zu aktivieren (macOS, Linux und WSL2).

Für Zeile 12 entspricht --dangerously-skip-permissions --permission-mode bypassPermissions, und Codex' Referenz sagt, --yolo solle "nur in einer extern gehärteten Umgebung" verwendet werden.

# 13. derselbe Server in beiden Agenten claude mcp add context7 -- npx -y @upstash/context7-mcp codex mcp add context7 -- npx -y @upstash/context7-mcp # 14. ein Remote-Server claude mcp add --transport http notion https://mcp.notion.com/mcp codex mcp add notion --url https://mcp.notion.com/mcp claude mcp list codex mcp list Enter fullscreen mode Exit fullscreen mode Bei beiden Tools ist alles nach -- der Befehl, der im Beispiel den Context7-Server startet. Claudes Standard-Scope ist local, also nur dieses Projekt, gespeichert in ~/.claude.json. Verwenden Sie --scope user für alle Projekte oder --scope project, um eine.mcp.json zu schreiben, die Ihr Team committet (Claude-MCP-Dokumente).

Codex verwaltet MCP-Server in der config.toml zusammen mit den übrigen Einstellungen, standardmäßig ~/.codex/config.toml, und die.codex/config.toml eines Projekts darf Server erst hinzufügen, wenn Sie diesem Projekt vertrauen (Codex-MCP-Dokumente).

Für Zeile 15 können Sie eine einzige Datei behalten. Codex liest AGENTS.md aus seinem Codex-Home und dann vom Projektstamm bis zu Ihrem Arbeitsverzeichnis und stoppt standardmäßig bei 32 KiB (AGENTS.md-Dokumente). Claude Code ab Version 2.1.277 liest AGENTS.md direkt, aber nur, wenn sich in Ihrem Arbeitsverzeichnis oder darüber keine CLAUDE.md,.claude/CLAUDE.md oder CLAUDE.local.md befindet. Ihre ~/.claude/CLAUDE.md zählt nicht (Memory-Dokumente). Wenn Sie bereits eine CLAUDE.md haben, setzen Sie diese Zeile an den Anfang:

@AGENTS.md Enter fullscreen mode Exit fullscreen mode /init existiert in beiden Tools und schreibt die jeweils eigene Datei des Agenten: CLAUDE.md für Claude, ein AGENTS.md-Gerüst für Codex.

Für die Zeilen 16 und 17 verläuft Claudes Priorität von managed settings über --settings,.claude/settings.local.json und.claude/settings.json bis hinunter zu ~/.claude/settings.json (Settings-Dokumente). Codex liest.codex/config.toml nur in vertrauenswürdigen Projekten, und ein Profil ist inzwischen eine eigene Datei neben der config.toml (Config-Basics):

# ~/.codex/ci.config.toml model_reasoning_effort = "low" approval_policy = "never" sandbox_mode = "read-only" Enter fullscreen mode Exit fullscreen mode claude -p "Check for type errors" --settings./ci-settings.json codex exec --profile ci "Check for type errors" Enter fullscreen mode Exit fullscreen mode Wenn Sie noch [profiles.ci]-Tabellen in der config.toml haben, liest Codex sie ab Version 0.134.0 nicht mehr, wie auf der Seite zur erweiterten Konfiguration steht. Verschieben Sie jede in eine eigene Datei.

claude -w fix-login #.claude/worktrees/fix-login codex --worktree "Fix the flaky login test" Enter fullscreen mode Exit fullscreen mode Claude legt den Worktree unter <repo>/.claude/worktrees/<name> ab. Codex startet "in einem neuen verwalteten Git-Worktree", und codex exec --worktree lässt sich nicht mit resume kombinieren (Codex-Referenz). Jeder Agent verwaltet seine eigenen, sodass der Betrieb beider weiterhin zwei Sätze von Worktrees und zwei zu beobachtende Terminals bedeutet.

Ich baue Hermes IDE, also bewerten Sie diesen Abschnitt vor diesem Hintergrund. Hermes betreibt die jeweilige Oberfläche jedes Agenten in einem echten Terminal, sodass die obigen Slash-Befehle dort unverändert funktionieren, und eine einfache Shell-Sitzung führt die Headless-Befehle aus den Tabellen aus. Drücken Sie ⌘N (Strg+Umschalt+N unter Windows und Linux) und beschreiben Sie die Aufgabe. Hermes startet den Agenten auf seinem eigenen Branch hermes/<name> in seinem eigenen Worktree, mit der Aufgabe als erstem Prompt. Sie wählen Agent, Modell, Effort und Konto pro Aufgabe. Einmal für Claude Code und einmal für Codex, und jeder arbeitet in seinem eigenen Checkout, auf seinem eigenen Branch.

Das ⌘N-Dialogfeld für neue Aufgaben in Hermes 2.3: Claude Code in einem neuen hermes/-Worktree mit aktiviertem Accept edits, den Chips für zusätzliche Ordner und der Vorschau "Hermes will run" für den claude-Befehl.

Dann stellt man sie nebeneinander. Mit ⌘D (Ctrl+Shift+D) rechts teilen oder mit ⌘⇧D (Ctrl+Shift+S) unten, und zwischen den Bereichen mit ⌘⌥→ (Alt+→) wechseln, entsprechend der Shortcuts-Liste. Wenn einer davon für eine Freigabe anhält, springt ⌘I (Ctrl+Shift+I) zu dem Agenten, der am längsten wartet, und man antwortet im eigenen Terminal dieses Agenten. Hermes beantwortet niemals eine Berechtigungsanfrage an deiner Stelle.

Hermes ist kostenlos, als Quelloffen unter BSL 1.1 verfügbar und läuft auf macOS, Windows und Linux. Die aktuelle Version 2.3.3 erschien am 13. Oktober 2026. Es besteht keine Verbindung zu Anthropic, OpenAI oder Nous Research.

Behalte die Übersichtstabelle beim nächsten Wechsel des Agenten mitten in einer Aufgabe griffbereit, und lade die Hermes IDE herunter, wenn du Claude Code und Codex in geteilten Bereichen auf separaten Worktrees nutzen möchtest. Wenn sie dir eine Verwechslung erspart, hilft ein Stern auf GitHub anderen Entwicklern dabei, das Projekt zu finden. Für die Muster hinter diesen Funktionen, etwa Approval Gates, Sandboxes und fortsetzbare Agenten-Schleifen, ist der AI Agents Pocket Guide die kurze Lektüre.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

In Claude Code, -p means print: run the prompt, write the answer, exit. In Codex CLI, -p is --profile, so codex -p "fix the flaky test" asks for a config profile with that name. -c continues your last conversation in Claude Code. In Codex it sets a config key.

If you run both agents every day, your fingers will pick the wrong one sooner or later. So here are 18 tasks, the Claude Code way and the Codex way, each with a command you can paste. Every row matches the Claude Code CLI reference and the Codex command reference as of October 14, 2026. I haven't run these commands myself, and both tools ship often, so when a flag here disagrees with the docs, the docs win.

# 1. one shot claude -p "Summarize what src/auth does" codex exec "Summarize what src/auth does" # 2. stdin cat build-error.txt | claude -p "explain the root cause" cat prompt.txt | codex exec - # 3 + 4. JSON for scripts, final message to a file claude -p "List the TODOs" --output-format json | jq -r '.result' codex exec --json "List the TODOs" > events.jsonl codex exec -o todos.txt "List the TODOs" Enter fullscreen mode Exit fullscreen mode Claude's json format is one object with the answer in result, plus session_id and total_cost_usd, per its headless guide. Codex's --json streams events instead: thread.started, turn.started, turn.completed, turn.failed, item.* and error, per its non-interactive docs.

If you only want Codex's last message, -o is shorter than parsing the stream. The examples pipe into jq.

For row 5, one schema file works for both. Claude takes the schema inline, Codex takes a path:

{ "type": "object", "properties": { "functions": { "type": "array", "items": { "type": "string" } } }, "required": [ "functions" ], "additionalProperties": false } Enter fullscreen mode Exit fullscreen mode claude -p "Extract the function names from auth.py" \ --output-format json \ --json-schema " $( cat schema.json ) " | jq '.structured_output' codex exec "Extract the function names from auth.py" \ --output-schema./schema.json -o names.json Enter fullscreen mode Exit fullscreen mode Two defaults differ, and they bite in CI. codex exec runs in a read-only sandbox, so a task that edits files needs row 11. A claude -p run with no permission mode set takes the built-in starting mode, which can be auto, so pass the mode you want.

Same keys, different jobs: -p and -c mean different things in the two CLIs.

# 6. pick up where you left off, in this directory claude -c codex resume --last codex resume --last --all # latest from any directory # 7. a specific session claude -n auth-refactor # name it when you start claude -r auth-refactor # come back to it later codex resume # picker codex resume --include-non-interactive # 8. scripted follow-up id = $( claude -p "Find N+1 queries in src/" \ --output-format json | jq -r '.session_id' ) claude -p "Rank them by impact" --resume " $id " codex exec "Find N+1 queries in src/" codex exec resume --last "Rank them by impact" Enter fullscreen mode Exit fullscreen mode claude -c skips sessions started with -p, and claude -p --continue includes them ( CLI reference ). codex resume --last looks only in the current directory unless you add --all, and both the codex resume picker and its --last leave out codex exec sessions unless you add --include-non-interactive ( Codex reference ). That filter is on codex resume only: codex exec resume --last, used in row 8, is the scripted path and picks up exec runs ( non-interactive docs ). codex exec resume also takes a session name in place of the ID.

# 9 + 10. model and effort for one session claude --model opus --effort high codex -m gpt-6.1-sol -c model_reasoning_effort = '"high"' # 11. let it edit, headless claude -p "Apply the lint fixes" --permission-mode acceptEdits codex exec --sandbox workspace-write "Apply the lint fixes" # 12. only inside a throwaway container or VM claude --dangerously-skip-permissions codex --yolo Enter fullscreen mode Exit fullscreen mode Claude Code takes aliases ( sonnet, opus, haiku, fable ) or a full model name. gpt-6.1-sol is the example model in Codex's own config docs, so swap in a model your account can use.

Effort is where the two differ most. Claude's --effort accepts low, medium, high, xhigh, max or ultracode, depending on the model, and lasts for that session only. The Codex reference lists no effort flag, so you set the model_reasoning_effort key, whose documented values include low through xhigh, max and ultra, again depending on the model. Codex parses -c values as TOML and falls back to a plain string, and the extra quotes are the form its advanced config page uses. Inside a session, Claude has /model and /effort, and Codex's /model picks both, where the model supports effort.

Claude's acceptEdits writes files without asking and auto-approves common filesystem commands such as mkdir, touch, mv and cp. Apart from read-only commands, other shell commands still need an allow rule ( headless guide ).

Codex splits the decision in two: --sandbox ( read-only, workspace-write, danger-full-access ) sets what commands can touch, and --ask-for-approval sets when it stops to ask. If your muscle memory types -a untrusted or -a on-failure, the config reference now lists untrusted as unsupported and on-failure as deprecated. Use on-request or never.

Claude Code has an OS-level sandbox for shell commands as well, but it is off by default: run /sandbox to turn it on (macOS, Linux and WSL2).

For row 12, --dangerously-skip-permissions equals --permission-mode bypassPermissions, and Codex's reference says to use --yolo "only inside an externally hardened environment".

# 13. the same server in both agents claude mcp add context7 -- npx -y @upstash/context7-mcp codex mcp add context7 -- npx -y @upstash/context7-mcp # 14. a remote server claude mcp add --transport http notion https://mcp.notion.com/mcp codex mcp add notion --url https://mcp.notion.com/mcp claude mcp list codex mcp list Enter fullscreen mode Exit fullscreen mode In both tools, everything after -- is the command that starts the Context7 server in the example. Claude's default scope is local, meaning this project only, stored in ~/.claude.json. Add --scope user for every project, or --scope project to write a.mcp.json your team commits ( Claude MCP docs ).

Codex keeps MCP servers in config.toml with the rest of its settings, ~/.codex/config.toml by default, and a project's.codex/config.toml can add servers only once you trust that project ( Codex MCP docs ).

For row 15 you can keep one file. Codex reads AGENTS.md from your Codex home, then from the project root down to your working directory, and stops at 32 KiB by default ( AGENTS.md docs ). Claude Code v2.1.277 and later reads AGENTS.md directly, but only when there is no CLAUDE.md,.claude/CLAUDE.md or CLAUDE.local.md in your working directory or above it. Your ~/.claude/CLAUDE.md doesn't count ( memory docs ). If you already have a CLAUDE.md, put this line at the top:

@AGENTS.md Enter fullscreen mode Exit fullscreen mode /init exists in both and writes each agent's own file: CLAUDE.md for Claude, an AGENTS.md scaffold for Codex.

For rows 16 and 17, Claude Code's precedence runs from managed settings, through --settings,.claude/settings.local.json and.claude/settings.json, down to ~/.claude/settings.json ( settings docs ). Codex reads.codex/config.toml only in trusted projects, and a profile is now its own file next to config.toml ( config basics ):

# ~/.codex/ci.config.toml model_reasoning_effort = "low" approval_policy = "never" sandbox_mode = "read-only" Enter fullscreen mode Exit fullscreen mode claude -p "Check for type errors" --settings./ci-settings.json codex exec --profile ci "Check for type errors" Enter fullscreen mode Exit fullscreen mode If you still have [profiles.ci] tables inside config.toml, Codex 0.134.0 and later no longer reads them, per the advanced config page. Move each one into its own file.

claude -w fix-login #.claude/worktrees/fix-login codex --worktree "Fix the flaky login test" Enter fullscreen mode Exit fullscreen mode Claude puts the worktree at <repo>/.claude/worktrees/<name>. Codex starts "in a new managed Git worktree", and codex exec --worktree can't be combined with resume ( Codex reference ). Each agent manages its own, so running both still leaves you with two sets of worktrees and two terminals to watch.

I build Hermes IDE, so weigh this section with that in mind. Hermes runs each agent's own interface in a real terminal, so the slash commands above work there unchanged, and a plain shell session runs the headless commands from the tables. Press ⌘N (Ctrl+Shift+N on Windows and Linux) and describe the task. Hermes starts the agent on its own hermes/<name> branch in its own worktree, with the task as the first prompt. You pick the agent, model, effort and account per task. Do it once for Claude Code and once for Codex, and each works in its own checkout, on its own branch.

The ⌘N New task sheet in Hermes 2.3: Claude Code on a new hermes/ worktree with Accept edits, the extra-folder chips, and the "Hermes will run" preview of the claude command.

Then put them next to each other. Split right with ⌘D (Ctrl+Shift+D), or down with ⌘⇧D (Ctrl+Shift+S), and move between panes with ⌘⌥→ (Alt+→), per the shortcuts list. When one of them stops for an approval, ⌘I (Ctrl+Shift+I) jumps to the agent that has waited longest, and you answer in that agent's own terminal. Hermes never answers a permission prompt for you.

Hermes is free, source-available under BSL 1.1, and runs on macOS, Windows and Linux. The latest release, 2.3.3, shipped on October 13, 2026. It is not affiliated with Anthropic, OpenAI or Nous Research.

Keep the tables open the next time you switch agents mid-task, and download Hermes IDE if you want Claude Code and Codex in split panes on separate worktrees. If it saves you a mix-up, a star on GitHub helps other developers find it. For the patterns underneath these flags, such as approval gates, sandboxes and resumable agent loops, the AI Agents Pocket Guide is the short read.

Originaltitel: Claude Code vs Codex CLI: 18 Commands and Flags Side by SideQuelle: dev.to (dev.to). Original öffnen