Backup-first cleanup and recovery for local Codex session artifacts.
Name-wise: think Codex cleaner, with a small CLI wink.
- Inspect active sessions in
sessions/ - Inspect archived sessions in
archived_sessions/ - Find stale
session_index.jsonlandhistory.jsonlentries - Delete or prune with automatic backups outside Codex-owned storage
- Restore full backup runs or selected files from a run
- Browse everything through an Ink terminal UI or helper commands
Warning
codex-cliner modifies local Codex session files and index files. It is designed to be recoverable, not harmless. Review destructive actions before confirming them.
Important
The tool does not store app-owned state inside Codex directories and does not mutate Codex SQLite databases in v0.1.0.
Codex keeps useful local history, but local cleanup is still awkward when you want to remove old sessions, prune archived runs, or clean index drift without manually editing storage.
codex-cliner treats Codex paths as target data only. Backups, catalog state, and app-owned metadata live outside Codex storage.
Requirements:
- Node.js
20+
Run from the npm registry:
npx codex-clinerRun from this repo:
bun install
bun run dev -- --codex-home ~/.codexThe default UI now starts with a dedicated Codex home selection screen.
Once you select a Codex home, codex-cliner saves that choice in app-owned config outside Codex paths and reuses it on the next launch when it is still valid. The picker now labels saved, recent, and autodetected homes separately.
Current interactive surfaces:
- Codex home picker with autodetected paths and manual path entry
- Active sessions browser
- Archived sessions browser
- Stale index browser
- Project grouping browser
- Backup browser
- Backup detail view with selective file restore
- Diagnostics view
Current keybindings:
Enter: open or confirm the focused itemq: back or quit/: filter the current listSpace: toggle selection in list viewsa: select all visible rowsA: clear selectiond: delete selected sessions or selected projectp: prune selected archived rows or backup runsc: clean stale index rowsr: restore selected backup items or refresh the current viewR: restore a full backup run from backup detail viewm: enter a custom Codex home path on the home picker?orh: open the interactive help screen
Most users only need the interactive mode:
codex-clinerCLI help is always available:
codex-cliner --help
codex-cliner <command> --helpApp config:
codex-cliner config show
codex-cliner config resetRead-only inspection:
codex-cliner scan --codex-home ~/.codex
codex-cliner doctor --codex-home ~/.codex
codex-cliner backupsBackup inspection and restore:
codex-cliner backups
codex-cliner restore --run-id <run-id>
codex-cliner restore --run-id <run-id> --source-path /abs/path/one --source-path /abs/path/twoCleanup actions:
codex-cliner cleanup-stale --codex-home ~/.codex
codex-cliner prune-archived --older-than 30 --codex-home ~/.codex
codex-cliner delete --session <session-id> --codex-home ~/.codex
codex-cliner delete --project <project-name-or-path> --codex-home ~/.codexWhat the tool guarantees:
- Backups are created before destructive actions
- Backups live outside Codex-owned paths
- Per-run
manifest.jsonfiles are canonical catalog.jsonis rebuildable cache onlysession_index.jsonlandhistory.jsonlare rewritten atomically- Restore works even if the backup catalog is missing or corrupt
- Security issues: report privately via GitHub private vulnerability reporting if available, or email
gdhdev@protonmail.com - General maintenance contact:
gdhdev@protonmail.com - Response target: within 14 days
For security reports, do not open a public issue with exploit details first.
Public issue reporting:
- Use the bug report template for reproducible product problems
- Use the feature request template for focused improvements
- Keep security reports private
See SUPPORT.md for the support path in one place.
Repository guardrails:
- CI runs lint, tests, package checks, and the repository security check
- a dedicated security workflow runs CodeQL, dependency review, and the repository security check
- the repository security check fails on unexpected use of high-risk patterns such as
child_process,eval,new Function, sync shell execution,rm -rf,sudo, and recursivefs.rm(...)outside an allowlist
This is not an airtight guarantee. It reduces risk; it does not eliminate it.
What 0.1.0 does not do:
- Codex SQLite mutation
- Worktree cleanup as a primary surface
- Claims about undocumented internal Codex state beyond scanned session artifacts
Codex paths are target data only.
The tool may:
- Read from Codex paths
- Delete session or archive files from Codex paths
- Rewrite
session_index.jsonlandhistory.jsonl - Restore backed-up files into their original Codex paths
The tool does not:
- Store its own backups or metadata inside Codex directories
- Use Codex directories as a cache for app-owned state
Backup data lives outside Codex storage:
- macOS:
~/Library/Application Support/codex-cliner/ - Linux:
~/.local/share/codex-cliner/ - Windows:
%APPDATA%/codex-cliner/
Backup structure:
<app-data-root>/backups/
catalog.json
<run-id>/
manifest.json
files/
Run id format:
- UTC timestamp
- short random suffix
- example:
2026-04-09T16-05-12Z_k4m8qx
Project grouping is heuristic, not canonical.
Current inference order:
- nearest Git root from discovered session cwd
- nearest project marker root such as
package.json,bun.lock,turbo.json,pyproject.toml,Cargo.toml, orgo.mod - nested
cwddiscovery from session JSONL payloads - raw cwd basename fallback
Duplicate session files are collapsed in inventory views, but destructive actions still retain every backing file path so prune and delete do not silently miss duplicates.
- Ink for the interactive terminal UI
- Commander for the CLI command surface
- github/copilot-sdk as a reference for slim public repo hygiene and security-policy structure
- Maintainer:
gdhdev - Contact:
gdhdev@protonmail.com - Response target: within 14 days
Use public issues for reproducible bugs and focused feature requests. Use private contact for security reports or when public issue filing is not appropriate.
Developer setup and validation
Requirements:
- Bun
1.3.11+ - Node.js
20+
Editor defaults for this repo are defined in .editorconfig:
- spaces, not tabs
- width
4
Install dependencies:
bun installValidate locally:
bun run format:check
bun run security:check
bun run release:check
bun run typecheck
bun run lint
bun run test
bun run build
bun run package:checkBefore publishing 0.1.0:
- Update
CHANGELOG.md - Confirm
package.jsonversion matches the release tag - Run
bun run release:check - Run the full validation suite locally
- Confirm
NPM_TOKENis configured for GitHub Actions - Push a
v0.1.0tag or run the release workflow manually
The release workflow validates the package before publish and checks tag/version alignment.
See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
See SECURITY.md.
MIT. See LICENSE.