Sessions: resume, fork and queue
Work that takes longer than one sitting needs a way back in. Codex saves sessions, and the table below is everything you can do with a saved one.
| Command | What it does |
|---|---|
codex resume | Pick a previous session, or --last for the most recent |
codex fork | Copy a session into a new one, leaving the original alone |
codex queue | Add a message to a session that is already running |
codex archive, codex delete | Put one away, or remove it for good |
Resume continues the same conversation. Fork branches it, which is what you want before trying a second approach: the first one is still there if the second is worse.
The same from a script
codex exec has both as subcommands, so a pipeline can continue a thread rather than starting from nothing every time.
codex exec resume --last "now add tests for what you just changed"That is the cheap version of context: the second command does not have to re-explain the first, because it is the same thread.
Queueing while it works
codex queue puts a message in front of a session that is mid-run. It is the scripted version of typing while the agent is busy: the instruction waits, and is read when the current step finishes.
- Run
codex resumeand look at how your own sessions are listed. - Fork a session before trying something you might regret, and compare the two.
Every expert started right here.