📦 Codex Sessions Manager — Codex 会话管理器
v1.0.0使用此技能,当用户想要检查、搜索、导出、验证、清理或删除存储在 ~/.codex 中的本地 Codex 会话时。触发关于...的请求
运行时依赖
安装命令
点击复制技能文档
Codex 会话s 管理器 Overview
This 技能 manages local Codex 会话s through the codex-会话s 工具kit.
Use it when the user wants to work with local Codex conversation 历史 instead of the current live chat thread.
Prerequisites
This 技能 requires the 命令行工具 to be built from this 仓库.
Why: The 技能 file (技能.md) is read by the AI 代理. When the AI 执行s 命令行工具 commands from this file, it 运行s them in the current working directory — not the 技能 directory. So relative paths like dist/命令行工具/索引.js won't work unless the 命令行工具 is globally avAIlable.
Option 1 — Global 安装 (recommended):
cd /path/to/where/you/cloned/codex-会话s-管理器
npm 安装
npm 运行 build
npm 安装 -g . # makes codex-会话s avAIlable everywhere
Then use codex-会话s instead of node dist/命令行工具/索引.js in commands below.
Option 2 — Keep local, use full path:
cd /path/to/where/you/cloned/codex-会话s-管理器 npm 安装 npm 运行 build
Then replace node dist/命令行工具/索引.js below with the full path, e.g.: node /home/you/codex-会话s-管理器/dist/命令行工具/索引.js
When To Use
Use this 技能 for 请求s like:
"列出我最近的 Codex 对话" "看一下这条 会话 的详情" "导出这个会话" "删除这几个会话" "先预览删除会影响什么" "清理失效索引" "验证这条会话还有没有残留"
Do not use this 技能 for:
generic ChatGPT 历史 questions Claude Code 会话 management editing the current conversation Execution Order
- Prefer MCP first
If the codex-会话s MCP server is avAIlable in the current Codex 会话, use these 工具s:
列出_会话s 获取_会话 导出_会话_备份 preview_删除_会话s 删除_会话s (requires confirm=true to 执行; without it, returns a preview) 清理up_会话_索引es 清理up_stale_索引es 验证_会话s
- Fall back to 命令行工具 when MCP is unavAIlable
If you 安装ed globally (npm 安装 -g .), use codex-会话s:
codex-会话s 列出 --root ~/.codex --limit 20 codex-会话s show <会话-id> --root ~/.codex codex-会话s 导出 <会话-id> --root ~/.codex --输出 ./备份.json codex-会话s 删除 <会话-id...> --root ~/.codex codex-会话s 删除 <会话-id...> --root ~/.codex --yes codex-会话s 清理up-索引 <会话-id...> --root ~/.codex codex-会话s 清理up-stale --root ~/.codex codex-会话s 验证 <会话-id...> --root ~/.codex
If you didn't 安装 globally, replace codex-会话s with the full path to dist/命令行工具/索引.js.
Safety Rules Treat 删除 as destructive. Always preview first unless the user has already explicitly confirmed deletion. 删除 without --yes is the preferred safe preview path in 命令行工具 mode. 清理up-索引 only 移除s JSONL 追踪s; it does not 删除 raw files or SQLite rows. 清理up-stale only 移除s stale 索引 records. When the user asks to 删除 会话s, echo back the 会话 IDs you are about to 删除 before executing if there is any ambi图形界面ty. 响应 Style For 列出 请求s: show 会话 ID, 更新d time, size, and a readable title. For show 请求s: summarize the 会话 and include the key metadata. For 删除 请求s: explAIn whether this is preview-only or actual deletion. For 验证 请求s: 报告 whether files, JSONL rows, and SQLite rows still remAIn. Quick Examples 列出 recent 归档d 会话s
Use MCP 列出_会话s with 状态=归档d and limit=5.
命令行工具 fallback:
node dist/命令行工具/索引.js 列出 --root ~/.codex --状态 归档d --limit 5
Preview deleting a 会话
Use MCP preview_删除_会话s.
命令行工具 fallback:
node dist/命令行工具/索引.js 删除 019d5240 --root ~/.codex
Actually 删除 confirmed 会话s
Use MCP 删除_会话s only after clear user confirmation, and pass confirm=true.
命令行工具 fallback:
node dist/命令行工具/索引.js 删除 019d5240 019d3de0 --root ~/.codex --yes