Skip to content

"codex delete <session>" #8784

Closed
Closed

Description

@divinity76

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

Activity

  1. fury0928 commented on Jan 8, 2026

    @fury0928

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

  2. etraut-openai commented on Jan 8, 2026

    @etraut-openai
    Contributor

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

  3. TomasHubelbauer commented on Feb 1, 2026

    @TomasHubelbauer

    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.

  4. fury0928 commented on Feb 2, 2026

    @fury0928

    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?

  5. congjinruo commented on Feb 8, 2026

    @congjinruo

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

  6. added
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    and removed
    CLIIssues related to the Codex CLI
    on Feb 8, 2026
  7. nirfse commented on Feb 18, 2026

    @nirfse

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

  8. k4pl3r commented on Feb 25, 2026

    @k4pl3r

    This feature is essential.

  9. pelegm commented on Feb 27, 2026

    @pelegm

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

  10. joshuasp95 commented on Feb 27, 2026

    @joshuasp95

    another one, basic op

  11. cleacos commented on Mar 5, 2026

    @cleacos

    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.

  12. 12 remaining items

  13. radfaraf commented on May 5, 2026

    @radfaraf

    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.

  14. LeeeeTX commented on May 10, 2026

    @LeeeeTX

    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.

  15. 1939869736luosi commented on May 11, 2026

    @1939869736luosi

    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)

  16. cooltzy commented on May 22, 2026

    @cooltzy

    Upvote for it.

  17. self-assigned this
    on May 23, 2026
  18. lulusiyuyu commented on May 24, 2026

    @lulusiyuyu

    Strongly support this.

  19. ylme commented on May 28, 2026

    @ylme

    Particularly desire this feature.

  20. ousmanito commented on Jun 1, 2026

    @ousmanito

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

  21. almeidazs commented on Jun 8, 2026

    @almeidazs

    Liked it

  22. allentc commented on Jun 11, 2026

    @allentc

    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.

  23. etraut-openai commented on Jun 12, 2026

    @etraut-openai
    Contributor

    This feature will be included in the next release.

  24. leaxoy commented on Jul 13, 2026

    @leaxoy

    This feature will be included in the next release.

    @etraut-openai Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions