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.
| Path | What it is | Verdict | What you lose |
|---|---|---|---|
sessions/YYYY/MM/DD/ | Your conversations, one rollout-*.jsonl file per session | Review | Those conversations can no longer be resumed with codex resume. Your project files are not modified. |
archived_sessions/ | Conversations you archived | Review | They can no longer be resumed |
thread_history*.sqlite | The list of your past threads | Review (Risky while Codex is running) | The list of old threads is empty. Your projects are not modified. |
logs*.sqlite, log/ | Internal logs | Safe | Nothing visible |
cache/, tmp/, shell_snapshots/ | Temporary files | Safe | Nothing visible: Codex recreates them |
packages/ | Installed Codex versions, one folder per release | Review | Old versions only; the one in use stays |
plugins/, computer-use/ | Downloaded plugins and add-ons | Review | Downloaded again when needed |
attachments/ | Copies of files you attached | Review | Nothing: the originals stay where they are |
generated_images/, visualizations/ | Files Codex created for you | Review | Check you no longer need them |
config.toml, AGENTS.md, skills/, hooks/ | Your configuration and instructions | Never delete | Your setup |
memories* | What Codex remembers across sessions | Never delete | Its memory |
history.jsonl | Your prompt history | Never delete | Your prompt history |
auth.json | Your sign-in | Never delete | You 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 -12The 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/logOld 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 2026Old versions in packages/: each package has a current link that points to the release in use. Keep that one.
ls -l ~/.codex/packages/*/currentWhat 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.