codex-s installs the cx CLI, a small tool for listing and deleting local Codex sessions.
It reads the same local thread catalog used by Codex Desktop, supports interactive multi-select deletion, and asks for y/N confirmation before it removes matching session files, database rows, and cached Desktop state.
- Node.js
>=24
codex-s runs on Node.js because it uses Node's runtime-native SQLite support to read the same local catalog used by Codex Desktop.
From npm:
npm install -g codex-sFor local development from this repository:
npm install
npm linkYou can also run the built CLI directly:
npm run build
node ./dist/cli/index.js listcx <command>
Commands:
list, ls List local Codex sessions
delete, d, rm [session..]
Delete Codex sessions after confirmation
cleanup Remove stale temp files and orphaned session data
config <action> [value] Read or write codex-s configuration
help Show CLI help
completion Print a fish completion script
When cx delete is run without arguments, it opens an interactive multi-select picker:
type to filter, Space toggles, ↑/↓ moves, Enter confirms, Ctrl+C cancels
In non-TTY mode, enter numbers and ranges like 1,3,5-8.
To delete explicit sessions:
cx delete 550e8400 "session title"To delete an entire host category (as shown by cx list group headings):
cx delete --host chatgpt
cx delete --host localTo delete every session on every host:
cx delete --allHost labels match the [...] group headings in cx list: local, chatgpt, or an SSH label such as dojo. Every bulk deletion still asks for y/N confirmation and shows the full plan first.
Codex home is resolved in this order:
--home <path>CODEX_S_HOMECODEX_HOMEcodex-s.config.jsonin the current directory~/.config/codex-s/config.json- Auto-detected
.codexhome
To point WSL at a Windows host Codex home for the current repo, write an ignored local config:
cx config set-home /mnt/c/Users/Dylan/.codex --local
cx listYou can also use an explicit one-off path:
cx --home /mnt/c/Users/Dylan/.codex listcodex-s.config.json is gitignored so local host paths are not committed.
If you use Fish, install a completion file into Fish's user completion directory:
mkdir -p ~/.config/fish/completions
cx completion fish > ~/.config/fish/completions/cx.fish- Close Codex before deleting sessions so the running app cannot rewrite cached state.
- Deletion removes rollout files, legacy index entries, Desktop catalog rows, state/cache database rows (
state_5,goals_1,memories_1,queue_1), Desktop state references, andhistory.jsonlentries for the selected sessions. - The CLI backs up every index, database, or Desktop state file that it changes.
- If Codex Desktop crashes after a manual deletion or failed update, run
cx cleanupto clear leftover*.tmpstate files and orphaned rows that reference missing sessions. - No sync, archive, rename, or export features are included yet.