feat: session persistence
Resolved 💬 5 comments Opened Apr 16, 2025 by yuan-alex Closed Aug 7, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator)
responded on this thread — see the highlighted reply below.
Allow the user to continue a previously saved session/thread with the same current working directory by using a command like /session. This command can only be used before any message has been sent.
Incremental thread state is already persisted in ~/.codex/sessions/rollout-*.json but an alternative structure is necessary to store thread information.
A simple alternative could allow the user to continue the most recently saved thread state for the current working directory.
5 Comments
Could you expand on
?
I agree, I really miss the feature to return to the old session
https://github.com/openai/codex/discussions/341 is also asking for this, and has some good design ideas.
https://github.com/openai/codex/issues/118 as well.
The existing rollout files store the entire thread state at each generation step. The
session.idfield of each rollout is a randomly generated UUID. There is no explicit or reliable index of what threads exist or how they're related to a specific project. A new thread structure will help map project directories to rollouts so we can easily restore the latest rollout.~/.codex/threads.jsonThanks for the feedback! Please try the latest version of Codex CLI to see if this issue persists. If it does, we'd appreciate any further details or contributions to the
codex-rs/implementation.