promptgarten ๐ŸŒฑ

Command reference ยท Codex CLI

codex apply

Applies a diff created in the cloud locally.

codex apply <TASK_ID> (short form: codex a) applies the most recently generated diff from a Codex Cloud chat locally into the current working directory. The command fetches the relevant cloud task via its ID, extracts its diff, and applies it via git apply; authentication and access to the respective chat are prerequisites. On success, Codex reports the applied files; on a failing git apply (for example due to conflicts), the command exits with an error code and lists applied, skipped, and conflicting paths. In the official documentation, the command is classified as "Stable". To find the right task ID, codex cloud list is used, which lists existing cloud chats with status and URL; codex cloud exec, by contrast, triggers a new cloud task. codex apply is thus exclusively the last step: applying a diff already generated in the cloud locally, not starting or managing cloud tasks themselves.

โœ… WHEN TO USE IT?

Applying the result of a cloud task locally

codex apply <task-id> โ€” apply the diff generated in the cloud locally

Reviewing a cloud result before applying it locally

codex cloud list --json, to find the task ID, then codex apply <task-id>

โ›” WHEN NOT TO?

There's no cloud diff at all, only local, unversioned changes

codex apply expects a valid cloud task ID and fetches its diff; for purely local work there's nothing to retrieve.

Better: make changes directly locally with the normal Codex session (codex) or codex exec

A new cloud task should be started

codex apply only applies existing diffs, but doesn't start a new cloud task itself.

Better: use codex cloud exec to trigger a new cloud task

SOURCES

MORE COMMANDS ยท Codex CLI

/init/compact/reasoning/fast/personality/memories/ide/feedback/approve/side/project/cloud

All commands ยท Codex CLI โ†’

Share:๐•in๐Ÿ’ฌ