Tip, Tricks, and Hacks for OpenAI Codex CLI https://github.com/openai/codex/
codex resume
Sessions are stored at ~/.codex/sessions/YYYY/MM/DD/
You can then fairly easily find your session and manage it.
Example:
% codex resume
Resume a previous session
Type to search
Created Updated Conversation
> 47 minutes ago 39 minutes ago You are in the folder of a decompiled "com.blackmagicdesign.android.blackmagiccam" app.
59 minutes ago 55 minutes ago You are in the folder of a decompiled "com.blackmagicdesign.android.blackmagiccam" app.
4 hours ago 4 hours ago can you see **just the code that I have staged for commiting**?
...
I want to delete the 2nd one from today (2025/10/10)
% ls -la ~/.codex/sessions/2025/10/10/
total 752
drwxr-xr-x@ 7 pv staff 224 Oct 10 11:04 .
drwxr-xr-x@ 9 pv staff 288 Oct 10 07:10 ..
-rw-r--r--@ 1 pv staff 34810 Oct 10 07:13 rollout-2025-10-10T07-10-52-0199ce75-d3d0-7140-bb15-482a79f42452.jsonl
-rw-r--r--@ 1 pv staff 904 Oct 10 10:21 rollout-2025-10-10T10-21-45-0199cf24-9501-7700-b4f0-057fb0d0a6a3.jsonl
-rw-r--r--@ 1 pv staff 928 Oct 10 10:51 rollout-2025-10-10T10-51-42-0199cf40-02a4-7eb0-9dca-ba7897e8afad.jsonl
-rw-r--r--@ 1 pv staff 6025 Oct 10 10:56 rollout-2025-10-10T10-52-43-0199cf40-efb9-7ce1-a75e-a8f77d0f5a50.jsonl
-rw-r--r--@ 1 pv staff 317570 Oct 10 11:12 rollout-2025-10-10T11-04-34-0199cf4b-c7fd-74b2-b50f-dbe863b32256.jsonl
% rm ~/.codex/sessions/2025/10/10/rollout-2025-10-10T10-52-43-0199cf40-efb9-7ce1-a75e-a8f77d0f5a50.jsonl
% codex resume
Resume a previous session
Type─to─search
Created Updated Conversation
> 51 minutes ago 43 minutes ago You are in the folder of a decompiled "com.blackmagicdesign.android.blackmagiccam" app.T
4 hours ago 4 hours ago can you see **just the code that I have staged for commiting**?
20 hours ago 13 hours ago Build a modern system-event ingestion module that emits display (on/off/unlock), device boot/...
...│
aka: Toggle your auth type between chatgpt
or apikey
If you reach your ChatGPT account's weekly limit then you can switch over to
using OPENAI_API_KEY
.
There are several real-world usability problems with this though:
- If you reached the ChatGPT limit while in a [
chatgpt
auth] session (which might be almost always) then you cannot resume that session in anapikey
auth session.
See issues: - You cannot easily tell from the
codex resume
list what auth a previous session used.
With that in mind, you can change your auth from chatgpt
to apikey
and start fresh sessions.
The process to do this is documented ok at https://github.com/openai/codex/blob/main/docs/authentication.md.
But I followed the directions and [surprise] it still did not work... because I was running into the above issues by trying to resume a "chatgpt" authed session.
Here are my steps to go from chatgpt
auth to apikey
auth:
- Obtain your OpenAI API Key from either wherever you keep it
or get a new one from https://platform.openai.com/api-keys.
The API Key needs to have permissionResponses API /v1/responses = Write
. export OPENAI_API_KEY="sk-proj-..."
printenv OPENAI_API_KEY | codex login --with-api-key
codex
and enter a fresh prompt and it should work.
To go back from apikey
auth to chatgpt
auth:
rm ~/.codex/auth.json
codex login
codex
and enter a fresh prompt and it should work
- Someone should write an app that manages (rename, delete, etc) the sessions!