Resuming Previous OpenAI Codex Conversations
What You'll Learn
Learn how to resume previous OpenAI Codex sessions using the --resume
flag, allowing you to continue work where you left off.
Prerequisites
- OpenAI Codex CLI installed
- Previous OpenAI Codex sessions to resume
Steps
Step 1: List Available Sessions
Start OpenAI Codex with the --resume
flag without specifying a session ID to see available sessions:
codex --resume
OpenAI Codex will display a list of recent conversations you can resume, showing:
- Session IDs
- Creation dates
- Brief context from each session
Step 2: Select a Session Interactively
From the list displayed, choose the session you want to resume by:
- Using arrow keys to navigate
- Pressing Enter to select
- Or typing the number corresponding to the session
Step 3: Resume a Specific Session Directly
If you know the session ID, you can resume directly:
codex --resume abc123
Replace abc123
with your actual session ID.
Step 4: Continue with Additional Commands
You can also provide a new prompt when resuming:
codex --resume abc123 "continue working on the authentication feature"
Example Usage
Interactive Resume
# Show list of sessions and select interactively
codex --resume
# Output example:
# Recent sessions:
# 1. [2025-07-05] Session ID: xyz789 - Working on React components
# 2. [2025-07-04] Session ID: abc123 - Database migration scripts
# 3. [2025-07-04] Session ID: def456 - API endpoint development
#
# Select a session (1-3):
Direct Resume with Command
# Resume specific session with new instructions
codex --resume xyz789 "add unit tests for the Button component"
Tips & Variations
- Session Management: OpenAI Codex stores session data in the
.codex/
directory of your project - Cross-Directory Resume: You can resume sessions from different directories if you have the session ID
- Combine with Other Flags: Use
--resume
with other flags like--model
or--add-dir
Troubleshooting
-
Issue: Session not found Solution: Ensure you're using the correct session ID and that the session data still exists
-
Issue: Can't see session list Solution: Check that you have previous sessions in your
.codex/
directory -
Issue: Session context seems incomplete Solution: The session may have been too old or the context files may have been modified
Important Notes
- Session data is stored locally in your project's
.codex/
directory - Sessions are project-specific unless you're using global sessions
- Very old sessions may have degraded context quality
- The
--resume
flag is different from--continue
which continues the most recent interaction