Command reference ยท Codex CLI
codex resume
Continues an earlier Codex session via the CLI.
codex resume continues a previous interactive session from the terminal, either specifically via a SESSION_ID or generally via --last for the most recently used session.
According to the docs, --last by default only refers to sessions in the current working directory; with --all, sessions outside the current directory are included too. --include-non-interactive additionally expands the selection (picker or --last) to include non-interactive sessions. The same resume logic exists for non-interactive mode as codex exec resume [SESSION_ID], also with --last/--all, plus an optional directly appended follow-up PROMPT and --image/-i for attaching images to this follow-up task. Distinct from the standalone codex resume call is the slash command /resume, which according to the Codex source code is used within an already-running session to switch to a different saved session.
โ WHEN TO USE IT?
Continue the last session directly
codex resume --last
Continue a session non-interactively in a script
codex exec resume --last "briefly summarize the latest changes"
โ WHEN NOT TO?
Already in a running interactive session
For switching within the TUI, the standalone CLI call codex resume is unnecessary.
Better: use /resume within the session
Continuing a session from a different directory
According to the docs, --last by default only refers to the current working directory.
Better: use codex resume --all to also include sessions outside the current directory
SOURCES
- Codex CLI docs: Reference โ learn.chatgpt.com
MORE COMMANDS ยท Codex CLI