How to fork a Codex session
Use codex fork with the picker, a session ID, or --last to branch earlier Codex work without appending new turns to the original session.
Run codex fork to choose a recorded interactive session and branch it into a new one. Use codex fork <session-id> for an explicit source, or codex fork --last for the newest session. Add a prompt to state the new direction. The source history remains unchanged; current files are still read from today's working tree.
When to use it
Fork is the safe choice when you want the earlier conversation context but need an alternate path. Resume appends to the same session; fork creates a new session whose history begins from the selected source.
Use it safely
1. Open the picker or identify a UUID
A plain invocation opens Codex's session picker. The picker filters by the current directory unless you add --all, so run it from the relevant repository or disable that filter.
codex fork
codex fork --all2. Fork the intended source
Pass the UUID when automation or an audit trail requires an unambiguous source. --last is convenient but can target the wrong conversation after unrelated work.
codex fork <session-id> "Try the smaller schema migration and keep the public API stable."3. Separate conversational and file branches
The new Codex session does not rewind Git. Create or switch a Git branch or worktree before the fork when the code needs an independent state as well.
git switch -c migration-small
codex fork <session-id>Important distinctions
- The installed 0.146.0 help accepts a UUID for SESSION_ID; unlike resume, its fork help does not promise lookup by session name.
- --all affects picker scope; it does not merge or copy sessions between CODEX_HOME directories.
- Forking preserves history but cannot restore files that were overwritten or deleted outside version control.
Where Crowsnest fits
Crowsnest asks Codex's supported app-server to fork or retry completed Codex work rather than editing rollout files. The source remains immutable, and the UI keeps the relationship visible.
Source and version
The exact text and flags on this page were checked against the installed codex-cli 0.146.0 binary on October 9, 2026. Version-specific behavior can change, so compare your own --help output before scripting around it. Official CLI documentation →
Reviewed from first-party CLI output and the released Crowsnest product source. No command on this page bypasses provider limits, billing, authentication, or native history rules.