"codex delete <session>"
Resolved 💬 33 comments Opened Jan 6, 2026 by divinity76 Closed Jun 12, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What feature would you like to see?
Would be nice if codex had a "delete session" command for sessions you are sure you never want to resume.
Additional information
_No response_
33 Comments
@jif-oai may I pick up this issue?
I'd like to contribute on this awesome project
Thank you
@leonace924, thanks for offering, but we're not accepting feature contributions from the community at this time.
This would be great, because we have
codex execfor non-interactive mode, but when running the Codex CLI programmatically with interactive steps (e.g.: E2E tests), the non-interactive session is not useful and the session list gets spammed.Cool, can I work on this then?
I'm a stickler for clean code, and we need this feature.
Similarly, it would be useful to have the option to remove all sessions except the last
{num}sessions or all sessions prior to{date}.This feature is essential.
Another vote for this. Any way to organise sessions would be helpful, but deleting sessions is simply essential.
another one, basic op
Also, I'd go with this command:
/session_clear. There are named sessions, and sometimes you just want to clear the session (except the first prompt) instead of recreating it each time.For instance, you can create a recurring/permanent session with an initial prompt (with some general instructions + ping to some skills), then work in the session, finish the task, and clear the session. For simple, quick recurring tasks, it is super useful; it will help keep sessions cleaner. It's ideal for tasks you don't want to "record" or track.
In fact, it would be even better if we could manage our conversation records like Gemini does. This would make the conversation list during our development cleaner and more convenient to search. Please consider adding this feature officially.
This feature is still needed. I want to delete sessions I've created with
/fork. Sometimes there are many sessions being accidentally created.I would use this a lot. There are sessions I already know I will never resume, and archive does not feel like the same thing as delete. For now I ended up using a local workaround: https://github.com/hanityx/threadlens
I need this feature too.
i need this function
I also need this. I wonder why this function, which is so basic, has not been made available.
Upvote for it. Any follow-up on this issue?
In fact, there is no management method as good as Gemini's.
i really need this
Upvote for it. Many times I just fork so something and do not need the session anymore
Upvoted!
Meanwhile, you can use this: https://github.com/lingtaolf/cxresume
Same I need this feature, codex when asked about this advised not a good idea to just delete the session files manually because they may still be referenced in the database, so need a tool that will help properly delete old sessions.
We built a small open-source macOS tool for managing local Codex App/CLI conversation history:
https://github.com/LeeeeTX/codex-history-cleaner
It provides a terminal UI to list, search, preview, and delete local Codex sessions from
~/.codex. Deletion is recoverable by default with backups, and permanent deletion is also available with an extra confirmation step.Hope this is useful for anyone who wants local controls for Codex history cleanup.
I built a complete session management toolkit that goes beyond simple deletion:
codex-sessions-manager
Features:
Addresses the concern raised by @radfaraf — it properly handles all database references, not just file deletion.
Install:
npm install -g codex-sessions-manager(or use as MCP server)Upvote for it.
Strongly support this.
Particularly desire this feature.
This feature is much needed. I have sessions that I will never open again.
Liked it
I just discovered this doesn't exist. There is no way to delete a session using codex TUI itself? I have to monkey around in ~/.codex or use third party tools? Astonishing.
This feature will be included in the next release.
@etraut-openai Any updates?