Skip to content
How it worksSafetyPricingQuestions
FR · Français Download
← Where AI coding agents store data on your Mac, and what is safe to delete

What is in ~/.codex, and what is safe to delete

Last checked 12 October 2026

~/.codex grows mainly from conversations in sessions/, stored by date, and from old versions in packages/. Caches, temporary files and logs are safe to delete. Old sessions are safe if you won't resume them. Never delete config.toml, AGENTS.md, memories or auth.json.

What is in ~/.codex

Codex keeps its data in ~/.codex, unless you moved it with the CODEX_HOME environment variable. The CLI and the app share it.

PathWhat it isVerdictWhat you lose
sessions/YYYY/MM/DD/Your conversations, one rollout-*.jsonl file per sessionReviewThose conversations can no longer be resumed with codex resume. Your project files are not modified.
archived_sessions/Conversations you archivedReviewThey can no longer be resumed
thread_history*.sqliteThe list of your past threadsReview (Risky while Codex is running)The list of old threads is empty. Your projects are not modified.
logs*.sqlite, log/Internal logsSafeNothing visible
cache/, tmp/, shell_snapshots/Temporary filesSafeNothing visible: Codex recreates them
packages/Installed Codex versions, one folder per releaseReviewOld versions only; the one in use stays
plugins/, computer-use/Downloaded plugins and add-onsReviewDownloaded again when needed
attachments/Copies of files you attachedReviewNothing: the originals stay where they are
generated_images/, visualizations/Files Codex created for youReviewCheck you no longer need them
config.toml, AGENTS.md, skills/, hooks/Your configuration and instructionsNever deleteYour setup
memories*What Codex remembers across sessionsNever deleteIts memory
history.jsonlYour prompt historyNever deleteYour prompt history
auth.jsonYour sign-inNever deleteYou are signed out

What grows the most

Conversations in sessions/ are almost always the largest item: Codex writes one file per session, organized by date. The second is old versions in packages/ when several releases have accumulated.

du -sh ~/.codex/* 2>/dev/null | sort -h | tail -10
du -sh ~/.codex/sessions/*/* 2>/dev/null | sort -h | tail -12

The second command shows the size month by month. Nothing above deletes anything.

How to clean it by hand

Quit Codex (CLI and app) first: it writes to sessions/ and to the thread history while it runs.

Safe items:

rm -rf ~/.codex/cache ~/.codex/tmp ~/.codex/shell_snapshots ~/.codex/log

Old conversations: delete whole months you no longer need to resume.

ls ~/.codex/sessions/2026          # months kept for 2026
rm -rf ~/.codex/sessions/2026/06   # example: June 2026

Old versions in packages/: each package has a current link that points to the release in use. Keep that one.

ls -l ~/.codex/packages/*/current

What you should never delete

config.toml, AGENTS.md, skills/, hooks/, memories*, history.jsonl and auth.json. Deleting ~/.codex as a whole signs you out and erases your setup and memory along with the conversations.

Doing it with Ouste

Ouste groups Codex conversations by project, shows which ones are still active, deletes the safe items, and puts conversations in a 7-day quarantine you can restore in one click. Old versions are listed separately, and the version in use is never offered.

Questions

Can I delete ~/.codex/sessions?

Yes, month by month, for conversations you no longer need to resume. Quit Codex first. Your project files are not modified.

What is thread_history.sqlite?

The list of your past Codex threads. Deleting it empties that list; it does not touch your projects. Never delete it while Codex is running.

Will deleting ~/.codex sign me out?

Only if you delete auth.json, which is why you should never delete the whole folder.

Ouste does this for you. It finds what your agents leave behind, says what each item is and what you lose, and puts anything you might regret in a 7-day quarantine. Free to scan and clean.

Download Ouste

macOS 14 or later · Apple Silicon

Less noise. More control.

Product

  • How it works
  • Safety
  • Pricing
  • Questions

Information

  • Legal notice and terms
  • Privacy
  • Guides
  • contact@ouste.space

Language

  • Français
  • English
© 2026 Ouste. Published by Adeo Consulting, Paris. macOS 14 or later · Apple Silicon