OpenParable
Skip to content
← Back to skills

Session Recovery Codex

Apps & Automation
session-recovery-codex

Session Recovery Codex is an Agent Skill for apps & automation published in the cnfjlhj/ai-collab-playbook repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Use when recovering a Codex session, especially if the user provides a Codex session id or wants recent Codex sessions listed before resuming work.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/cnfjlhj/ai-collab-playbook/blob/HEAD/skills/full/session-recovery-codex/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/session-recovery-codex, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Session Recovery (Codex)

使用流程

分支 A:用户已经提供 session id

当用户消息里已经包含形如 019b6d01-790f-7a32-9d75-932700db98a4 的 session id 时:

  1. 直接运行统一入口脚本:

python3 ~/.codex/skills/session-recovery-codex/scripts/recover-session.py --id "<session_id>" --cwd "$PWD"

  1. 向用户展示脚本输出,并据此复述:
  • 最后的任务请求
  • 未完成事项
  • 涉及文件与关键操作
  • 最近报错或关键工具输出
  1. 询问用户:

我的理解是否正确?你想继续哪部分?

分支 B:用户没有提供 session id

  1. 运行统一入口脚本扫描当前项目最近会话:

python3 ~/.codex/skills/session-recovery-codex/scripts/recover-session.py --cwd "$PWD" --limit 5

  1. 将脚本输出的最近 5 个会话概览展示给用户,并让用户输入要恢复的序号(1–5)。

  2. 用户选择后,拿到对应 session id,再运行统一入口脚本做精确恢复:

python3 ~/.codex/skills/session-recovery-codex/scripts/recover-session.py --id "<session_id>" --cwd "$PWD"

  1. 向用户展示:
  • 最后的任务请求
  • 未完成事项(TODO)(若能从 update_plan 记录恢复)
  • 涉及的文件(若能从工具输出恢复)
  • 关键决策与注意事项(从最后几条 assistant 输出提炼)
  1. 询问用户:“我的理解是否正确?你想继续哪部分?”并在用户确认后继续执行任务。

注意事项

  • 不要使用任何“压缩/精简会话”的方式替代恢复;优先用本 skill 从 ~/.codex/sessions 恢复事实记录。
  • 本 skill 现在同时覆盖“按 id 精确恢复”和“列出最近会话后再选择”两种入口。