codex - 💡(How to fix) Fix Add a first-class workflow for reviewing and clearing old CLI sessions [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20230Fetched 2026-04-30 06:31:23
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4cross-referenced ×1unlabeled ×1

Root Cause

Over time, ~/.codex/sessions accumulates many old session transcripts. Some are valuable because they preserve context for active work, but many are one-off experiments, abandoned attempts, or sessions tied to branches and directories that no longer matter. Right now, deciding what is safe to delete seems to require manually inspecting raw JSONL files, grepping for repo paths or branch names, and then deleting files by hand. That feels fragile and easy to get wrong.

RAW_BUFFERClick to expand / collapse

What variant of Codex are you using?

CLI

What feature would you like to see?

Add a first-class workflow for reviewing and clearing old CLI sessions

Codex CLI currently makes it easy to resume previous sessions, but there does not appear to be an equally clear workflow for clearing out sessions that are no longer useful.

Over time, ~/.codex/sessions accumulates many old session transcripts. Some are valuable because they preserve context for active work, but many are one-off experiments, abandoned attempts, or sessions tied to branches and directories that no longer matter. Right now, deciding what is safe to delete seems to require manually inspecting raw JSONL files, grepping for repo paths or branch names, and then deleting files by hand. That feels fragile and easy to get wrong.

The main problem is not disk usage alone. It is that old sessions become operational clutter:

  • codex resume --all becomes harder to scan.
  • It is difficult to distinguish active, useful sessions from stale ones.
  • There is no obvious way to tell which sessions are tied to current work versus obsolete branches or temporary directories.
  • Users who want to clean up must reason about internal storage layout rather than using the CLI.
  • Deleting raw files directly feels unsupported, even if it works in practice.

It would be helpful for Codex CLI to provide an intentional workflow for session cleanup, comparable in polish to the resume workflow. Ideally, a user should be able to review old sessions with enough context to decide whether they are still useful, then remove the ones they no longer care about without manually operating on files under ~/.codex.

The workflow should support the core user question: “Which of these sessions are still relevant to active work, and which can I safely remove?”

Useful context during review would include things like the working directory, last activity date and time, session summary/title if available, session size, git repository and branch the session was running on, etc. The important part is not the exact UI, but that users should not have to open raw transcripts to answer basic cleanup questions.

This would make long-term CLI usage feel much healthier. Session history is valuable when it is curated, but without a cleanup path it gradually turns into noise. A first-class cleanup workflow would also make users more comfortable relying on session persistence, because they would know there is a supported way to manage it later.

Additional information

No response

extent analysis

TL;DR

Implement a session cleanup workflow in Codex CLI to review and remove old sessions based on relevant context such as working directory, last activity date, and git repository.

Guidance

  • Identify the key information needed to determine session relevance, such as working directory, last activity date, and git repository.
  • Design a user-friendly interface to display this information for each session, allowing users to easily review and select sessions for removal.
  • Consider implementing a filtering or sorting mechanism to help users prioritize sessions based on relevance or age.
  • Develop a safe removal process that prevents accidental deletion of important sessions and provides confirmation prompts as needed.

Example

No specific code example can be provided without more context, but a potential approach could involve creating a codex cleanup command that lists sessions with relevant metadata and allows users to select sessions for removal.

Notes

The exact implementation details will depend on the specific requirements and constraints of the Codex CLI project. It's essential to balance the need for a user-friendly cleanup workflow with the potential risks of accidental data loss.

Recommendation

Apply a workaround by implementing a basic session cleanup script or tool that provides a temporary solution until a first-class workflow can be integrated into the Codex CLI. This will help mitigate the issue and provide a stopgap measure for users.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Add a first-class workflow for reviewing and clearing old CLI sessions [1 participants]