codex-history-recovery

codex-history-recovery is a skill for Codex from Basic-XYZ/baku-skills. It costs 96 tokens per session (2,300 once invoked), scanned A, original, MIT.

A recovery tool for Codex Desktop conversation history when chats become hidden after changing accounts, API keys, providers, or models.

In plain words
What is it for?
Use it to inspect, back up, synchronize, or restore provider and model metadata, or safely remove archived history after a dry run.
Why use it?
It helps diagnose and restore local history metadata while keeping conversations tied to their original project and avoiding exposure of secrets or chat text.

Skill for Codex

Written for Codex: agents/openai.yaml present. Also seen: mentions Codex.

Good fit Use it to inspect, back up, synchronize, or restore provider and model metadata, or safely remove archived history after a dry run.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/basic-xyz/baku-skills/codex-history-recovery
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Basic-XYZ/baku-skills --skill codex-history-recovery
Clone the repo
git clone --depth 1 https://github.com/Basic-XYZ/baku-skills

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for codex-history-recovery

README.md
[![agentmods](https://agentmods.dev/badge/skills/basic-xyz/baku-skills/codex-history-recovery/github.svg)](https://agentmods.dev/skills/basic-xyz/baku-skills/codex-history-recovery)
Your own site
<a href="https://agentmods.dev/skills/basic-xyz/baku-skills/codex-history-recovery"><img src="https://agentmods.dev/badge/skills/basic-xyz/baku-skills/codex-history-recovery/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for codex-history-recovery

Your own site · 80×15
<a href="https://agentmods.dev/skills/basic-xyz/baku-skills/codex-history-recovery"><img src="https://agentmods.dev/badge/skills/basic-xyz/baku-skills/codex-history-recovery.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,300 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00096 $0.02300
Opus 5 $0.00048 $0.01150
Sonnet 5 $0.00019 $0.00460
Haiku 4.5 $0.00010 $0.00230

Measured 12d ago against content hash 74914e5553cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

codex-history-recovery scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/codex_history_repair.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

codex-history-recovery/SKILL.md · 195 lines

How it starts

The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex History Recovery

用于诊断和修复 Codex Desktop 历史记录可见性问题,尤其是 provider / model 元数据不一致导致的“旧对话还在本地,但侧边栏看不见”。优先使用随 skill 携带的脚本,因为 Codex Desktop 会从 rollout-*.jsonl 重建 state_5.sqlite;只改 SQLite 不可靠。

运行命令时,把 <skill-dir> 替换成当前 skill 的安装目录。常见目录:

  • ~/.agents/skills/codex-history-recovery
  • ~/.codex/skills/codex-history-recovery
  • 项目内 .agents/skills/codex-history-recovery

安全规则

  • 不打印密钥、token、.env 值或对话正文。
  • 除非用户明确要求迁移项目归属,否则不要修改 cwd。默认恢复必须保留每条对话原本所属项目目录。
  • 删除归档历史时,绝不能删除 active history。只处理 SQLite 中 threads.archived 为 true 的记录、对应的归档 rollout JSONL,以及 ~/.codex/archived_sessions/ 下的孤儿文件。
  • 归档删除是破坏性操作。必须先 dry-run,优先使用窄筛选,并依赖脚本自动备份后再 apply。
  • 普通账号 / API / provider 切换恢复,只同步:
    • SQLite threads.model_provider
    • SQLite threads.model
    • JSONL session_meta.payload.model_provider
    • JSONL turn_context.payload.model
  • 如果用户只要求改 provider 或只改 model,使用窄参数,不要同时同步两个字段:
    • --provider-only --from-provider <old> --provider <new>
    • --model-only --from-model <old> --model <new>
  • 重写 rollout JSONL 必须保留文件 mtime;否则 Codex 可能把旧线程显示成最近更新。脚本在 sync 和 restore 中会保留 mtime。
  • 写入前优先让用户完全退出 Codex Desktop。如果当前 agent 正在执行修复,无法关闭 Codex,则必须先说明 app 可能缓存或并发写入元数据,再使用 --allow-running
  • apply 前必须创建或依赖脚本自动备份。

标准恢复流程

  1. 只读检查状态:

    python3 <skill-dir>/scripts/codex_history_repair.py --json status
    
  2. 只用元数据计数解释可能原因:

    • provider / model mismatch:旧对话仍在本地,但被过滤掉。
    • cwd filtering:对话仍属于原项目目录,这是预期行为。
    • archived chats:只在归档视图可见。
    • missing rollout paths:本地历史文件可能已删除或移动。
  3. dry-run 修复:

    python3 <skill-dir>/scripts/codex_history_repair.py --json sync
    

    如果只改 provider:

    python3 <skill-dir>/scripts/codex_history_repair.py --json --provider openai sync --provider-only --from-provider ccswitch
    

    如果只改 model:

    python3 <skill-dir>/scripts/codex_history_repair.py --json --model gpt-5.5 sync --model-only --from-model old-model
    
  4. 用户确认且 Codex Desktop 已关闭后 apply:

    python3 <skill-dir>/scripts/codex_history_repair.py --json sync --apply
    

Read the full file on GitHub · 195 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 195 lines · 96 tokens per session scan A 74914e5553cf

Subscribe to this mod's changes

codex-history-recovery is a skill published in the GitHub repository Basic-XYZ/baku-skills (2 stars, last pushed 1mo ago), licensed MIT. It adds 96 tokens to every session and 2,300 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

clean-claude-memory

Audit, prune, rewrite, or relocate Claude Code project memory. Use when the user asks to review, clean, update, or remove Claude memory files, eliminate stale project memories, or rebuild MEMORY.md.

Heapy/kortex · 47 tokens

amnesia

Use when the user returns to a session and needs to be reoriented, including requests such as "amnesia", "what did I miss", "recap the session", "where were we", "catch me up", "what happened while I was away", or "what was I doing". Reports when the session started, the last user message verbatim, what happened since…

Heapy/kortex · 90 tokens

swarmvault

Use SwarmVault when the user needs a local-first knowledge vault that writes durable markdown, graph, search, dashboard, review, context-pack, task-ledger, retrieval, and MCP artifacts to disk from books, notes, transcripts, exports, datasets, slide decks, files, URLs, code, and recurring source workflows.

anitagraviti-sys/swarmvault · 69 tokens

learning-memory

Use when capturing or restoring a learner's persistent profile to personalize teaching across sessions.

yugash007/edu-agent-skills · 19 tokens

codex-session-history

List and inspect local Codex session history by reading /.codex/sessionindex.jsonl, /.codex/sessions/, and /.codex/archivedsessions/. Default to unarchived sessions in /.codex/sessions/. Use when users ask what Codex sessions exist, want each session's id or title, need to know which project or workspace a session…

Sube-py/awesome-skills · 129 tokens

startup-context

When the user wants to create or update their startup context document. Also use when the user mentions "set up context", "tell you about my startup", or any other skill needs context that doesn't exist yet.

Maudeunfledged834/startup-founder-skills · 45 tokens