What’s in ~/.codex, and what you can safely remove

Most of ~/.codex is screenshots stored inside conversation files. On one developer Mac, 1,231 conversations took 22.83 GB, 71% of it images, while images that appeared only once made up 16%. To get the space back, optimize the conversations you still want to read and delete the ones you’re done with. Archiving frees none of it.

What’s in ~/.codex

Conversations are .jsonl files that Codex calls rollouts. Active ones are in ~/.codex/sessions and archived ones in ~/.codex/archived_sessions. Archiving a conversation in Codex moves its file from one folder to the other, so no space comes back.

Screenshots are written into the file as data. When a long session compacts its context, it writes the same screenshot again, and on the measured Mac a single 1.76 GB conversation carried 1.57 GB of repeats.

The folder also holds thread_history_1.sqlite (1.74 GB on that Mac) and logs_2.sqlite (1.13 GB), plus worktrees and plugins. The two SQLite files are Codex’s own index and logs. They aren’t conversations, and they aren’t meant to be edited by hand.

Freeing space by hand

Go through Codex wherever you can, because it keeps its own index of conversations and expects files to change only through it.

  1. Delete conversations you’re done with from inside Codex so its index stays correct.
  2. Quit Codex before you clear caches or runtimes.
  3. Before editing a rollout file yourself, search the other rollouts’ session_meta for a history_base that names its thread.
  4. If one does, leave that file alone, because the fork reads its history from it by byte position.

What Mint adds

Mint reads each conversation on your Mac and fingerprints the images inside, so the Codex rows in the Disk tab show measured sizes for unarchived conversations, repeated screenshots in archived ones and the rest of the archived history. You pick conversations from a list sorted by size, with a slider for how long they’ve gone unused, and hovering a row shows how much media it holds.

The current version of Mint has three actions for Codex conversations. Optimize shrinks the space that supported repeated screenshots take and keeps the pictures Codex reads when you continue the conversation. It can also store eligible PNG images in less space with the same pixels, and you can undo it as long as the original data and history it needs are still there. Remove media keeps the conversation text and permanently removes embedded images, audio and video, leaving placeholders instead of small previews. Delete permanently removes the whole selected conversation through Codex. Support depends on the tool, the format and the version, so read the action and its confirmation in your installed edition before you go ahead.

Mint won’t rewrite a conversation that another one is forked from. It measures the SQLite files and never edits them.

Watch the demo (0:17): Historical demo: earlier image previews. See the current action descriptions above.

Why old conversations can free less than you expect

Repeated screenshots pile up in recent, long sessions that take a lot of them. On the measured Mac, 92% of them sat in conversations used within the last six days, so picking only conversations older than a week misses most of them.

How much you can recover depends on the action. Optimize only offers supported savings that keep what Codex reads. Remove media can also take images that appear only once, but those images are gone for good. Go by the figure Mint measures for your selection, not the totals from our sample Mac.

Frequently asked questions

Does archiving a Codex conversation free space?

No. It moves the file from sessions to archived_sessions. Optimize or delete the conversation to get the space back.

Is it safe to delete ~/.codex or archived_sessions?

Not in bulk. Removing ~/.codex takes every conversation, your settings and Codex’s local state, so delete individual conversations through Codex or Mint instead.

Can I shrink thread_history_1.sqlite?

Not safely by hand. It’s Codex’s index, and Mint measures it without compacting or editing it.

What does an optimized conversation look like in Codex?

Optimize keeps the pictures Codex reads when you continue a supported conversation, and you can undo it as long as the originals and history it needs are still there. Remove media is a separate, permanent action. It keeps the text and removes images, audio and video, with no small previews left and no Undo.

Look at your Codex conversations with their sizes first

Run a scan and open Codex conversations in the Disk tab. Hover a conversation to see how much media it holds before you press anything.

Scan AI agent storage