Codex Sessions Manager

VerifiedCaution

CLI tool to inspect, search, export, verify, clean up, or delete local Codex sessions under ~/.codex.

Sby Skills Guide Bot
DevOpsIntermediate
7/23/2026
CodexClaude Code
#codex#session-management#cleanup#cli#backup-restore

Recommended for

Automated summary

Command-line tool to list, inspect, export, and clean up (trash, restore, purge) local Codex sessions stored under ~/.codex.

Strengths

  • Clear separation between read-only commands (preview, plan-delete, audit-root, family) and real deletions, which require --yes.
  • Recoverable deletion through a trash store, with restore and purge gated on an exact trash ID.
  • Built-in verification (doctor, verify, recovery-status, recover) to audit residue and resume an interrupted operation.
  • Session family analysis (parent/child/subagent/side/fork) with impact reporting before any action.

Limitations

  • Every confirmed mutation requires full canonical UUIDs, which makes commands tedious to type by hand.
  • There is no recursive deletion: each ID must be listed explicitly, so large cleanups take several passes.
  • Purely CLI with no UI and no automatic cleanup; it does not replace normal task management in Codex.
When to use it

Use it when you need to verify what actually remains under ~/.codex, recover or back up a session, or perform previewable, reversible cleanup of residual sessions.

When not to use it

Do not use it for everyday Codex task management or to permanently delete a live session — use official Codex for that.

Security analysis

Caution
Quality score88/100

The skill is a legitimate local CLI/MCP wrapper for auditing and managing Codex sessions. It does not exfiltrate data, curl-pipe-shell, or disable safety controls, and destructive actions require explicit confirmation. However, it can delete/purge local history and recommends a global package install, so it warrants caution rather than safe.

Findings
  • •Provides destructive local operations (delete, purge, cleanup-stale, cleanup-index) against session data under ~/.codex, though guarded by preview-first guidance and --yes/confirm requirements.
  • •Recommends a global npm install of a third-party package, which carries normal supply-chain risk and is not verified by this skill.
  • •Optional MCP admin profile exposes additional destructive tools; default read-only profile is safer, but users may enable admin mode.
How this analysis is made

Examples

List and inspect recent sessions
List my 20 most recent Codex sessions, filter to the ones from this project, and show me the detail and event timeline of the newest one.
Audit leftover residue
Run a root audit on ~/.codex and show me which session records look like residue from already-deleted sessions — read-only preview only, no deletion.
Preview a recoverable family cleanup
Export session 3f2a1b9c-...-... to ./backup.json, then build a plan-delete for it and its subagents, and show me the preview before anything is trashed.

name: codex-sessions-manager description: Use this skill when the user wants to inspect, search, export, verify, clean up, delete, restore, or purge local Codex sessions stored under ~/.codex. metadata: source: https://github.com/1939869736luosi/codex-sessions-manager

Codex Sessions Manager

Overview

CLI-first local Codex history audit and recovery tool. Use official Codex for normal task management and permanent deletion. Use this tool to verify what remains under ~/.codex, inspect legacy or damaged state, and perform previewable recoverable cleanup for confirmed residual IDs.

This is not a UI product, TUI, detail page, incremental scanner, or automatic cleanup service.

Setup

npm install -g codex-sessions-manager
codex-sessions --version

The default Codex root is ~/.codex. Use --root <path> for a different root.

For official Codex Skill discovery, place this Skill directory at either:

  • project scope: .agents/skills/codex-sessions-manager
  • user scope: $HOME/.agents/skills/codex-sessions-manager

The distributed Skill includes agents/openai.yaml inside the Skill directory.

When To Use

  • List/filter/search sessions (by project, time, status, source)
  • Show session detail or timeline
  • Inspect session family (parent/child/subagent/side/fork)
  • Audit and verify what remains locally after official deletion
  • Scan root for likely residue candidates
  • Preview batch delete scope without executing
  • Build explicit-ID delete plans
  • Export session backup
  • Delete sessions (permanent or recoverable trash)
  • Restore or purge trash entries
  • Verify post-delete cleanliness
  • Clean stale JSONL indexes

CLI Quick Reference

codex-sessions doctor [--json] [--details]
codex-sessions list [--limit N] [--project TEXT] [--status S] [--source-kind K]
codex-sessions sources [--json]
codex-sessions projects
codex-sessions show <id> [--json]
codex-sessions events <exact-id> [--output FILE]
codex-sessions family <id> [--children|--parents|--subagents|--impact|--full]
codex-sessions audit <id> [--json]
codex-sessions audit-root [--limit 50] [--status S...] [--source S...]
codex-sessions preview-root [--limit 50] [--status S...] [--source S...]
codex-sessions monthly-review [--limit 50] [--status S...] [--source S...] [--details]
codex-sessions export <id> [--output ./backup.json]
codex-sessions plan-delete <id...> [--include-children] [--include-family] [--json]
codex-sessions plan-delete --source-kind K --limit N [--json]
codex-sessions preview-plan <file> [--json]
codex-sessions delete <full-uuid...> [--trash] [--yes] [--allow-active]
codex-sessions trash-list
codex-sessions restore <exact-trash-id> --yes
codex-sessions purge <exact-trash-id> --yes
codex-sessions cleanup-index <full-uuid...> [--yes] [--allow-active]
codex-sessions cleanup-stale [--yes]
codex-sessions verify <id...>
codex-sessions recovery-status [--json]
codex-sessions recover <exact-operation-id> --yes

Safety Rules

  • All destructive commands require --yes (CLI) or confirm=true (MCP); without it you get preview only.
  • Always run a separate preview before any destructive action, then require explicit user confirmation.
  • preview, plan-delete, family, impact, audit-root, preview-root, monthly-review are read-only. They are never deletion authorization.
  • Permanent delete removes only exact thread-linked logs. Trash retains them; restore leaves them unchanged; final purge removes them unless that ID is live again. Memory is always retained.
  • Delete never recursively adds parent, child, or family sessions. List every intended ID explicitly.
  • Allowlisted exact-key global-state refs are removable only through explicit-ID confirmed delete.
  • Unknown global-state refs are warnings only; do not delete them automatically.
  • Confirmed session mutations require full canonical UUIDs. Active-session deletion also requires --allow-active / allowActive=true.
  • An interrupted write keeps an exclusive lock and durable recovery record. Inspect it before running the exact confirmed recovery operation.
  • A committed operation with partial or failed verification remains committed and must be reported that way.

MCP (Optional, Advanced)

codex-sessions-mcp                       # default: read-only profile (16 bounded tools)
codex-sessions-mcp --profile admin       # all 22 tools including destructive ops

Invalid --profile values exit with code 1. Default is read-only for safety.

get_session defaults to detail=compact (20 items / 64 KiB / 1 MiB source read). detail=full is still bounded (200 items / 256 KiB / 8 MiB source read). Session metadata is bounded too. Both return explicit completeness metadata; sourceCompleteness preserves parse/unsupported status when the MCP envelope is also truncated_limit, and itemsKnown=null means the reader stopped before EOF. list_sessions defaults to 50 concise records, accepts at most 200, and caps the response at 256 KiB. Use CLI JSON for complete local result sets and export for a JSON recovery bundle whose embedded text or base64 data can reconstruct source-file bytes.

All other MCP structured responses also have a final 256 KiB / 200-items-per-collection cap. Explicit session operations accept at most 50 IDs; list_trash defaults to 50 entries. Limit hits return responseCompleteness and responseOmittedReason. Exact backup export is CLI-only.

Detailed References

For full CLI/MCP parameter reference, safety model, and advanced rules:

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/codex-sessions-manager-mrx3y0ql' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/codex-sessions-manager-mrx3y0ql/download' --output '.skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md.part' && mv '.skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md.part' '.skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Setup
npm install -g codex-sessions-manager
codex-sessions --version

The default Codex root is ~/.codex. Use --root <path> for a different root.

For official Codex Skill discovery, place this Skill directory at either:

  • project scope: .agents/skills/codex-sessions-manager
  • user scope: $HOME/.agents/skills/codex-sessions-manager

The distributed Skill includes agents/openai.yaml inside the Skill directory.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md' && test -s '.skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/codex-sessions-manager' && cp -R '.skill-downloads/codex-sessions-manager-mrx3y0ql' '.claude/skills/codex-sessions-manager'

Codex
test -f '.skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md' && test -s '.skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/codex-sessions-manager' && cp -R '.skill-downloads/codex-sessions-manager-mrx3y0ql' '.agents/skills/codex-sessions-manager'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/codex-sessions-manager-mrx3y0ql'

openskills read 'codex-sessions-manager-mrx3y0ql'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/codex-sessions-manager-mrx3y0ql/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills