session-restore

session-restore is a skill for Claude Code, Codex from IlyaGorsky/memory-toolkit. It costs 25 tokens per session (1,309 once invoked), scanned A, original, MIT.

A tool for restoring context from saved Claude Code session backups stored as JSONL files, a text format with one JSON object per line. It reads session history, reconstructs its timeline, and records important decisions.

In plain words
What is it for?
Use it to list saved sessions, restore a recent or selected session, review user and assistant messages, and recover key decisions.
Why use it?
It helps resume work when a coding session was compacted, interrupted, or needs to be revisited without reading the entire raw backup.

Skill for Claude CodeCodex

Part of the memory-toolkit plugin — 11 skills, 5 hooks shipped together

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.

agentmods
npx agentmods add skills/ilyagorsky/memory-toolkit/session-restore
Any agent
npx skills add IlyaGorsky/memory-toolkit --skill session-restore
Clone the repo
git clone --depth 1 https://github.com/IlyaGorsky/memory-toolkit

Made for: Claude Code, Codex.

Or install memory-toolkit, the plugin that ships this one along with the rest of its 11 skills, 5 hooks.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/ilyagorsky/memory-toolkit/session-restore.svg)](https://agentmods.dev/skills/ilyagorsky/memory-toolkit/session-restore)
Your own site
<a href="https://agentmods.dev/skills/ilyagorsky/memory-toolkit/session-restore"><img src="https://agentmods.dev/badge/skills/ilyagorsky/memory-toolkit/session-restore.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,309 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00025 $0.01309
Opus 5 $0.00013 $0.00655
Sonnet 5 $0.00005 $0.00262
Haiku 4.5 $0.00003 $0.00131

Measured 4d ago against content hash 0bb1fd21d374, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

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 4d ago.

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/session-restore/SKILL.md · 177 lines

How it starts

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

Session Restore — backup and context restoration

Parses .jsonl files of Claude Code sessions, extracts chronology and key decisions.

Where data is stored

~/.claude/projects/-<project-key>/
├── <UUID>.jsonl          # current session (or completed)
├── <UUID>.jsonl.bak      # backup before last compact
└── <UUID>/
    └── subagents/        # subagent logs

Commands

/session-restore list

Show all sessions with dates and sizes:

SESSIONS_DIR=~/.claude/projects/-$(pwd | tr '/.' '-' | sed 's/^-//')
ls -lat "$SESSIONS_DIR"/*.jsonl 2>/dev/null | head -20

Output a table: | File | Date | Size | .bak |

/session-restore restore

Restore context from the latest (or specified) session:

  1. Find the file — by default the most recent .jsonl, or by UUID from the argument
  2. Parse — extract USER and CLAUDE messages using python3:
import json, sys

path = sys.argv[1]
with open(path) as f:
    lines = f.readlines()

for i, line in enumerate(lines):
    try:
        obj = json.loads(line.strip())
        role = obj.get('role', '?')
        msg_type = obj.get('type', '?')
        c = obj.get('message', {}).get('content', obj.get('content', ''))

        if isinstance(c, list):
            for item in c:
                if isinstance(item, dict):
                    tp = item.get('type', '')
                    if tp == 'text':
                        text = item.get('text', '').strip()
                        if role == '?' and msg_type == 'user':
                            if text and not text.startswith('<ide_') and not text.startswith('<system') and not text.startswith('<local-command') and not text.startswith('<command-') and len(text) > 5:
                                print(f'USER [{i}]: {text[:200]}')
                        elif role == '?' and msg_type == 'assistant':
                            if text and len(text) > 20:
                                print(f'  CLAUDE [{i}]: {text.split(chr(10))[0][:200]}')
        elif isinstance(c, str):
            clean = c.strip()
            if role == '?' and msg_type == 'user' and clean and not clean.startswith('<') and len(clean) > 3:
                print(f'USER [{i}]: {clean[:200]}')
            elif role == '?' and msg_type == 'assistant' and clean and len(clean) > 20:
                print(f'  CLAUDE [{i}]: {clean.split(chr(10))[0][:200]}')
    except:
        pass

Read the full file on GitHub · 177 lines

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. 4d ago First seen · 177 lines · 25 tokens per session scan A 0bb1fd21d374

Subscribe to this mod's changes

session-restore is a skill published in the GitHub repository IlyaGorsky/memory-toolkit (13 stars, last pushed 4mo ago), licensed MIT. It adds 25 tokens to every session and 1,309 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

acontext-installer

Install Acontext, Login & Init Acontext Project, Add Skill Memory to Agent.

memodb-io/Acontext · 22 tokens

init

Initialize structured context for this project. Scaffolds .scs/ with all 11 concern bundles, scans the project, and recommends where to start.

tim-mccrimmon/structured-context-spec · 33 tokens

context-ingest

The single entry point for getting anything new into your context architecture. Takes any input (documents, URLs, YouTube, meeting notes, pasted content) and triages it: dump to inbox, park in planned, or integrate into active docs. WHEN TO USE: "Here's a document — integrate it into my context" "Save this for later"…

walm00/business-context-os · 150 tokens

context-audit

Audits context architecture for CLEAR compliance, boundary enforcement, and consistency. WHEN TO USE: User says "audit context for CLEAR" User asks "check for duplication across data points" User requests "find boundary violations in [area]" Planning restructuring work Before adding new data points (cleanup existing…

walm00/business-context-os · 115 tokens

context-routing

Cross-zone retrieval and task-driven bundle resolution for BCOS. /context search ranks docs across every zone in one shared schema; /context bundle (P5) returns a curated, freshness-flagged, source-of-truth-aware context bundle for a declared task. Mechanical-first; LLM is opt-in via --semantic / --resolve-conflicts /…

walm00/business-context-os · 85 tokens

context-mine

Extracts structured context from conversation exports (Slack, meeting transcripts, chat logs) into inbox for processing.

walm00/business-context-os · 27 tokens