codex-session-restore

codex-session-restore is a skill for Codex from sidiangongyuan/codex-skills-library. It costs 47 tokens per session (1,446 once invoked), scanned A, original, MIT.

A repair tool for Codex Desktop sessions that disappear from the sidebar or stop working after changing model providers. A model provider is the service that supplies the AI model.

In plain words
What is it for?
Use it to scan and repair active sessions after a provider switch or a Desktop system error.
Why use it?
It helps recover active sessions without changing login details or the current provider configuration.

Skill for Codex

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

Good fit Use it to scan and repair active sessions after a provider switch or a Desktop system error.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sidiangongyuan/codex-skills-library/codex-session-restore
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 sidiangongyuan/codex-skills-library --skill codex-session-restore
Clone the repo
git clone --depth 1 https://github.com/sidiangongyuan/codex-skills-library

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-session-restore

README.md
[![agentmods](https://agentmods.dev/badge/skills/sidiangongyuan/codex-skills-library/codex-session-restore/github.svg)](https://agentmods.dev/skills/sidiangongyuan/codex-skills-library/codex-session-restore)
Your own site
<a href="https://agentmods.dev/skills/sidiangongyuan/codex-skills-library/codex-session-restore"><img src="https://agentmods.dev/badge/skills/sidiangongyuan/codex-skills-library/codex-session-restore/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-session-restore

Your own site · 80×15
<a href="https://agentmods.dev/skills/sidiangongyuan/codex-skills-library/codex-session-restore"><img src="https://agentmods.dev/badge/skills/sidiangongyuan/codex-skills-library/codex-session-restore.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,446 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00047 $0.01446
Opus 5.5 $0.00019 $0.00578
Sonnet 5.5 $0.00009 $0.00289
Haiku 4.5 $0.00005 $0.00145

Measured 1mo ago against content hash 413418899843, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

codex-session-restore 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 1mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/restore_codex_sessions.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.

skills/codex-session-restore/SKILL.md · 133 lines

How it starts

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

Codex Session Restore

Use the bundled script first. It is dry-run by default and writes nothing unless --apply is present.

Provider Direction Rule

Set --provider to the provider that Codex Desktop should recognize now, not automatically to the provider that originally created the sessions.

  • If the user switched from krill/custom to official OAuth and wants old active sessions to appear under the current official login, use --provider openai.
  • If the user explicitly wants to switch the environment back to krill and make sessions belong to krill, use --provider krill.
  • Do not edit config.toml, auth.json, or cc-switch's current provider just to restore sidebar visibility. Changing current auth/provider is a separate user request.

Quick Start

Resolve <skill-dir> to the directory containing this SKILL.md; do not assume a particular global skills installation root.

Restore old krill sessions into the current official/OAuth sidebar:

python "<skill-dir>/scripts/restore_codex_sessions.py" scan --provider openai
python "<skill-dir>/scripts/restore_codex_sessions.py" repair-active --provider openai
python "<skill-dir>/scripts/restore_codex_sessions.py" repair-active --provider openai --apply --yes
python "<skill-dir>/scripts/restore_codex_sessions.py" verify --provider openai

Repair one thread:

python "<skill-dir>/scripts/restore_codex_sessions.py" scan-thread --thread-id THREAD_ID --provider openai
python "<skill-dir>/scripts/restore_codex_sessions.py" repair-thread --thread-id THREAD_ID --provider openai
python "<skill-dir>/scripts/restore_codex_sessions.py" repair-thread --thread-id THREAD_ID --provider openai --apply
python "<skill-dir>/scripts/restore_codex_sessions.py" verify --thread-id THREAD_ID --provider openai

Use repair-active --provider PROVIDER --apply --yes only after a dry run confirms the active non-archived session set is correct. Open turns newer than 30 minutes are treated as possibly active and are not closed unless --close-recent-open-turns is explicitly present. Archived sessions stay untouched unless --include-archived is explicitly present.

Read the full file on GitHub · 133 lines

Files

What ships with it

4 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. 1mo ago First seen · 133 lines · 47 tokens per session scan A 413418899843

Subscribe to this mod's changes

codex-session-restore is a skill published in the GitHub repository sidiangongyuan/codex-skills-library (24 stars, last pushed 1mo ago), licensed MIT. It adds 47 tokens to every session and 1,446 once invoked, about $0.0002 per session on Opus 5.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.