"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_

View original on GitHub ↗

33 Comments

fury0928 · 6 months ago

@jif-oai may I pick up this issue?
I'd like to contribute on this awesome project
Thank you

etraut-openai contributor · 6 months ago

@leonace924, thanks for offering, but we're not accepting feature contributions from the community at this time.

TomasHubelbauer · 5 months ago

This would be great, because we have codex exec for 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.

fury0928 · 5 months ago
This would be great, because we have codex exec for 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?

congjinruo · 5 months ago

I'm a stickler for clean code, and we need this feature.

nirfse · 5 months ago

Similarly, it would be useful to have the option to remove all sessions except the last {num} sessions or all sessions prior to {date}.

k4pl3r · 4 months ago

This feature is essential.

pelegm · 4 months ago

Another vote for this. Any way to organise sessions would be helpful, but deleting sessions is simply essential.

joshuasp95 · 4 months ago

another one, basic op

cleacos · 4 months ago

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.

lory-cliver-hh · 4 months ago

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.

off6atomic · 3 months ago

This feature is still needed. I want to delete sessions I've created with /fork. Sometimes there are many sessions being accidentally created.

hanityx · 3 months ago

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

Cufoon · 3 months ago

I need this feature too.

TimTuYu · 3 months ago

i need this function

LetterTree · 3 months ago

I also need this. I wonder why this function, which is so basic, has not been made available.

HUGHNew · 3 months ago

Upvote for it. Any follow-up on this issue?

lory-cliver-hh · 3 months ago

In fact, there is no management method as good as Gemini's.

floatDreamWithSong · 2 months ago

i really need this

PanJason · 2 months ago

Upvote for it. Many times I just fork so something and do not need the session anymore

ze-codes · 2 months ago

Upvoted!

gioisco · 2 months ago

Meanwhile, you can use this: https://github.com/lingtaolf/cxresume

radfaraf · 2 months ago

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.

LeeeeTX · 2 months ago

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.

1939869736luosi · 2 months ago

I built a complete session management toolkit that goes beyond simple deletion:

codex-sessions-manager

Features:

  • Full lifecycle management: list, filter by project/time/status, export, delete, restore
  • Recoverable trash — deleted sessions can be restored (not just backed up)
  • Multi-layer cleanup — handles raw files, JSONL indexes, SQLite records, and global state references (not just one layer)
  • Integrity verification — detect orphaned files or stale index entries
  • MCP server + CLI — works with AI coding agents (Claude Code, Codex, Kiro) or standalone
  • Preview mode before any destructive operation
  • Side conversation (fork) aware

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)

cooltzy · 2 months ago

Upvote for it.

lulusiyuyu · 1 month ago

Strongly support this.

ylme · 1 month ago

Particularly desire this feature.

ousmanito · 1 month ago

This feature is much needed. I have sessions that I will never open again.

almeidazs · 1 month ago

Liked it

allentc · 1 month ago

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.

etraut-openai contributor · 1 month ago

This feature will be included in the next release.

leaxoy · 7 days ago
This feature will be included in the next release.

@etraut-openai Any updates?