Codex
OpenAI Codex CLI
MCP Servers
Config file location: ~/.codex/config.toml
Command
codex resume --last filters by the current working directory by default, so running it inside a project will try to continue the latest session for that project. Codex does not automatically resume when you cd into a directory, but you can wrap that behavior in a shell function.
Shell Function
No auto-resume
Always start a fresh session with just the base arguments:
Zsh
PowerShell
Auto-resume
Try to continue the latest session for the current directory first; if it fails, start a new one:
Zsh
PowerShell