Problem
Codex session data can grow quietly over time, but the dashboard currently does not show where that storage is going or offer a guided way to reclaim space.
On one active Windows setup, the largest Codex-related storage buckets were roughly:
- archived sessions: ~3.1 GB
- active sessions: ~1.3 GB
- logs sqlite: ~1.1 GB
- attachments / remote attachments / deletion manifests: smaller, but still useful to surface
The exact numbers will vary by user, but the important part is that storage is split across multiple Codex-owned areas. Users often only notice the problem after disk space has already dropped sharply.
Proposal
Add a dashboard Storage page that starts with read-only diagnostics, then grows into cleanup controls if the direction makes sense.
Phase 1: storage diagnostics
Show a compact breakdown for:
- active sessions
- archived sessions
- logs database / WAL files
- attachments
- remote attachments
- deletion manifests
- total tracked size
Useful fields:
- size
- count
- oldest item
- newest item
- largest few items, capped to avoid rendering a huge table
Phase 2: manual archived cleanup
Add an archived-session cleanup flow with preview first:
- slider for deleting the oldest archived conversations by percentage
- quick presets such as 10%, 25%, 50%
- preview button before any deletion
- confirmation modal showing estimated count and bytes to remove
- optional checkbox for immediate permanent deletion
- safer default can be quarantine/trash if preferred by the project
Active sessions should probably stay read-only at first.
Phase 3: optional auto-cleanup policy
Add an opt-in policy for users who want storage to stay bounded:
- default off
- threshold such as "archived sessions exceed N GB"
- cleanup target such as "reduce to N GB" or "delete oldest N%"
- schedule such as startup / daily / weekly / manual
- deletion mode: quarantine/trash or permanent delete
- last run, next run, and freed bytes summary
This should run as a batch policy, not delete one item every time a new session appears.
Implementation concerns
Deleting Codex history is not just a simple filesystem delete. The implementation may need to account for:
- rollout JSONL files
state_5.sqlite thread rows and rollout paths
- attachments linked to removed sessions
- deletion manifests / audit trail if quarantine is used
- database locks while Codex is active
Because of that, I think the first PR should probably be read-only diagnostics plus cleanup preview, with actual deletion added only after the data model is clear.
Open questions
- Should opencodex directly manage Codex session deletion, or only expose diagnostics?
- Should
logs_2.sqlite be shown on the Storage page, cleaned separately, or left as diagnostics only?
- Should permanent deletion be supported behind an explicit checkbox, or should quarantine be the only supported cleanup mode?
- If you agree with this direction, would you prefer to implement it yourself, or should I prepare a phased PR starting with read-only diagnostics?
Problem
Codex session data can grow quietly over time, but the dashboard currently does not show where that storage is going or offer a guided way to reclaim space.
On one active Windows setup, the largest Codex-related storage buckets were roughly:
The exact numbers will vary by user, but the important part is that storage is split across multiple Codex-owned areas. Users often only notice the problem after disk space has already dropped sharply.
Proposal
Add a dashboard Storage page that starts with read-only diagnostics, then grows into cleanup controls if the direction makes sense.
Phase 1: storage diagnostics
Show a compact breakdown for:
Useful fields:
Phase 2: manual archived cleanup
Add an archived-session cleanup flow with preview first:
Active sessions should probably stay read-only at first.
Phase 3: optional auto-cleanup policy
Add an opt-in policy for users who want storage to stay bounded:
This should run as a batch policy, not delete one item every time a new session appears.
Implementation concerns
Deleting Codex history is not just a simple filesystem delete. The implementation may need to account for:
state_5.sqlitethread rows and rollout pathsBecause of that, I think the first PR should probably be read-only diagnostics plus cleanup preview, with actual deletion added only after the data model is clear.
Open questions
logs_2.sqlitebe shown on the Storage page, cleaned separately, or left as diagnostics only?