Codex Sessions Manager

SKILL开发
开发 未标注权限 许可证不明确
安装这个技能

当用户需要检查、搜索、导出、验证、清理、删除、恢复或清除存储在 Codex 根目录下的本地 Codex 会话时,可使用此技能。

累计安装 未标注 本周 未标注
GitHub 星标 未标注 仓库 未标注
下载量 未标注 技能市场下载数
权限级别 未标注权限 安装前请确认风险范围
许可证 许可证不明确 未说明

安装

ClawHub 市场
在支持 Skills 的客户端里执行,装完问一句「你有哪些技能」验证
skillhub install clawhub_1939869736luosi/codex-sessions-manager

技能档案

开发
字段来自技能仓库与公开索引,中文说明由本站标注
作者 / 维护方clawhub_1939869736luosi仓库 未标注 · 版本 未标注
宿主客户端未标注技能可被这些客户端加载
安装方式ClawHub 市场安装包 clawhub
权限级别未标注权限安装前请确认风险范围
许可证未说明许可证不明确,商用前请自行确认条款
仓库可用性available技能仓库当前是否可访问
最近核验未标注上游最后核验时间 · 数据更新 1791737361
正文体量10.0 KBSKILL.md 原文大小,越大说明说明书写得越细

SKILL.md 全文

10.0 KB
模型实际读到的说明书原文,来自技能仓库

Codex Sessions Manager

Overview

This skill manages local Codex sessions through the codex-sessions toolkit.

Use it when the user wants to work with local Codex conversation history instead of the current live conversation.

This repository provides:

  • a Node / TypeScript CLI
  • a local stdio MCP server
  • this Skill entrypoint

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

Setup

Install the CLI before using fallback commands:

npm install -g codex-sessions-manager

This provides:

codex-sessions
codex-sessions-mcp

For local development, build the repository first:

cd <path-to-codex-sessions-repo>
npm install
npm run build

The default Codex root is:

~/.codex

Use --root <path-to-codex-root> when working with another Codex root.

When To Use

Use this skill for requests like:

  • "List my recent Codex sessions"
  • "Find sessions for this project"
  • "Show this session"
  • "Find side conversations for this session"
  • "Export this session"
  • "Preview deleting these sessions"
  • "Move these sessions to trash"
  • "Restore this trash entry"
  • "Purge this trash entry"
  • "Verify whether this session is fully removed"
  • "Inspect the Codex root before deleting or restoring"
  • "Clean stale JSONL indexes"

Do not use this skill for:

  • generic ChatGPT history questions
  • non-Codex chat clients
  • editing the current live conversation
  • automatic cleanup schedules
  • provider or model repair

Preferred Order

1. Prefer MCP first

If the codex-sessions MCP server is available in the current agent session, use these tools:

  • inspect_root
  • list_sessions
  • list_projects
  • get_session
  • export_session_backup
  • preview_delete_sessions
  • delete_sessions (requires confirm=true to execute; pass trash=true for recoverable deletion)
  • list_trash
  • restore_sessions (requires confirm=true)
  • purge_trash (requires confirm=true)
  • cleanup_session_indexes (requires confirm=true to rewrite JSONL indexes)
  • cleanup_stale_indexes (requires confirm=true to rewrite JSONL indexes)
  • verify_sessions

Use MCP tools first. CLI is the fallback when MCP is unavailable or blocked.

For session lookup, narrow in this order:

  1. project
  2. status
  3. updated / created time
  4. preview or get_session

For project-aware listing, pass project to list_sessions or use groupBy="project".

For time filters, pass updatedAfter, updatedBefore, createdAfter, or createdBefore. Date-only filters use the local calendar day. Timezone-less datetime strings must be rejected.

2. Fall back to CLI

Prefer the installed CLI:

codex-sessions doctor --root <path-to-codex-root>
codex-sessions doctor --root <path-to-codex-root> --json
codex-sessions list --root <path-to-codex-root> --limit 20
codex-sessions list --root <path-to-codex-root> --project TEXT
codex-sessions list --root <path-to-codex-root> --group-by project
codex-sessions list --root <path-to-codex-root> --updated-after 2026-04-01 --updated-before 2026-04-30
codex-sessions projects --root <path-to-codex-root>
codex-sessions show <session-id> --root <path-to-codex-root>
codex-sessions export <session-id> --root <path-to-codex-root> --output ./backup.json
codex-sessions delete <session-id...> --root <path-to-codex-root>
codex-sessions delete <session-id...> --root <path-to-codex-root> --yes
codex-sessions delete <session-id...> --root <path-to-codex-root> --trash
codex-sessions delete <session-id...> --root <path-to-codex-root> --trash --yes
codex-sessions trash-list --root <path-to-codex-root>
codex-sessions restore <trash-id-or-session-id> --root <path-to-codex-root>
codex-sessions restore <trash-id-or-session-id> --root <path-to-codex-root> --yes
codex-sessions purge <trash-id-or-session-id> --root <path-to-codex-root>
codex-sessions purge <trash-id-or-session-id> --root <path-to-codex-root> --yes
codex-sessions cleanup-index <session-id...> --root <path-to-codex-root>
codex-sessions cleanup-index <session-id...> --root <path-to-codex-root> --yes
codex-sessions cleanup-stale --root <path-to-codex-root>
codex-sessions cleanup-stale --root <path-to-codex-root> --yes
codex-sessions verify <session-id...> --root <path-to-codex-root>

When working from a cloned repository instead, run commands from the built repository:

cd <path-to-codex-sessions-repo>

Commands:

node dist/cli/index.js doctor --root <path-to-codex-root>
node dist/cli/index.js doctor --root <path-to-codex-root> --json
node dist/cli/index.js list --root <path-to-codex-root> --limit 20
node dist/cli/index.js list --root <path-to-codex-root> --project TEXT
node dist/cli/index.js list --root <path-to-codex-root> --group-by project
node dist/cli/index.js list --root <path-to-codex-root> --updated-after 2026-04-01 --updated-before 2026-04-30
node dist/cli/index.js projects --root <path-to-codex-root>
node dist/cli/index.js show <session-id> --root <path-to-codex-root>
node dist/cli/index.js export <session-id> --root <path-to-codex-root> --output ./backup.json
node dist/cli/index.js delete <session-id...> --root <path-to-codex-root>
node dist/cli/index.js delete <session-id...> --root <path-to-codex-root> --yes
node dist/cli/index.js delete <session-id...> --root <path-to-codex-root> --trash
node dist/cli/index.js delete <session-id...> --root <path-to-codex-root> --trash --yes
node dist/cli/index.js trash-list --root <path-to-codex-root>
node dist/cli/index.js restore <trash-id-or-session-id> --root <path-to-codex-root>
node dist/cli/index.js restore <trash-id-or-session-id> --root <path-to-codex-root> --yes
node dist/cli/index.js purge <trash-id-or-session-id> --root <path-to-codex-root>
node dist/cli/index.js purge <trash-id-or-session-id> --root <path-to-codex-root> --yes
node dist/cli/index.js cleanup-index <session-id...> --root <path-to-codex-root>
node dist/cli/index.js cleanup-index <session-id...> --root <path-to-codex-root> --yes
node dist/cli/index.js cleanup-stale --root <path-to-codex-root>
node dist/cli/index.js cleanup-stale --root <path-to-codex-root> --yes
node dist/cli/index.js verify <session-id...> --root <path-to-codex-root>

Safety Rules

  • Run MCP inspect_root or CLI doctor before delete, restore, purge, or cleanup when Codex storage may have changed.
  • Treat delete, restore, purge, and cleanup as dangerous write paths.
  • Always preview before destructive actions unless the user has already clearly confirmed execution.
  • CLI delete without --yes is preview-only.
  • MCP delete_sessions without confirm=true is preview-only.
  • Permanent delete remains available for compatibility.
  • Prefer recoverable deletion with CLI --trash --yes or MCP trash=true, confirm=true.
  • delete --trash without --yes only previews moving sessions to trash.
  • restore and purge require --yes in CLI mode.
  • MCP restore_sessions and purge_trash require confirm=true.
  • Restore refuses live session conflicts and SQLite key conflicts. There is no force overwrite mode.
  • purge removes only the trash entry and must not touch live sessions.
  • cleanup-index and cleanup-stale rewrite session_index.jsonl and history.jsonl. They do not delete raw files or SQLite rows, but they still require --yes.
  • MCP cleanup_session_indexes and cleanup_stale_indexes require confirm=true to rewrite JSONL indexes.
  • Global-state cleanup is limited to known structured keys.
  • Unknown global-state references are warnings only. Do not edit or delete unknown keys automatically.
  • If verify, doctor, or inspect_root reports warnings, tell the user. Do not claim the root is fully clean.
  • Do not output chat content when reporting doctor, verify, or global-state warnings.

Side Conversations

Codex /side creates an ephemeral side conversation with a separate transcript. In local storage, it can appear as a separate child thread linked to a parent thread.

When a user asks about side conversations:

  • Treat the parent thread and side child thread as separate sessions with separate transcripts.
  • Search, show, export, delete, trash, restore, or verify the child thread by its own session ID.
  • Do not assume deleting, exporting, or summarizing a parent thread also handles its side child threads.
  • If the user wants a parent thread and its side conversations handled together, identify the child thread IDs first, preview all selected IDs together, and only then run any confirmed write operation.
  • Current CLI/MCP behavior does not automatically recurse from parent to side child threads.

Response Style

  • For list requests: show session ID, updated time, size, project, status, and readable title.
  • For project requests: show project name/path, session count, status counts, latest updated time, and total size.
  • For show requests: summarize the session and include key metadata.
  • For side-conversation requests: distinguish parent thread ID and child thread ID, and say whether the requested action covers one or both.
  • For delete requests: explain whether this is preview-only, permanent delete, or recoverable trash delete.
  • For trash requests: distinguish moved to trash, restored, and purged.
  • For restore conflicts: explain that the live session already exists and identify conflicting surfaces when available.
  • For verify requests: report whether files, JSONL rows, SQLite rows, shell snapshots, global-state refs, or warnings remain.
  • For doctor / inspect requests: report OK, missing, and warning states without printing chat content.
  • For unknown global-state refs: report key path and count, not full global state content.

Non-Goals

Do not build or imply support for:

  • UI
  • TUI
  • detail pages
  • incremental project scanning
  • automatic stale cleanup
  • automatic trash purge
  • force overwrite restore
  • automatic editing of unknown global-state keys
  • non-Codex chat cleanup

热门专题

按场景挑技能
全部专题 →

技能内容以作者仓库为准;分类、权限级别与许可证状态的中文说明为中文整理,最近核验 未标注。