restore

restore is a command for coding agents from ruizrica/toolkit. It costs 0 tokens per session (848 once invoked), scanned A, original, MIT.

A restore command that reloads saved session state and recent daily notes after a session was compacted or ended.

In plain words
What is it for?
Use it to continue unfinished coding work across sessions, recover the previous task list, and resume from the saved continuation instructions.
Why use it?
It removes the need to explain the previous work again or manually rebuild the task list. If the main state file is missing, it also checks a backup location.

Command

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 commands/ruizrica/toolkit/restore
Clone the repo
git clone --depth 1 https://github.com/ruizrica/toolkit
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 848 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.00000 $0.00848
Opus 5 $0.00000 $0.00424
Sonnet 5 $0.00000 $0.00170
Haiku 4.5 $0.00000 $0.00085

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

Security

Grade A, and why

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 3d 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.

docs/commands/restore.md · 130 lines

How it starts

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

/restore

Restore a compacted session and immediately continue working. This command reads the session state saved by /compact, loads daily log context for cross-session continuity, and resumes work without asking what to do next.

Usage

/restore

Arguments

This command takes no arguments. It automatically reads from .context/session-state.json.

How It Works

  1. Read - Load session state from .context/session-state.json
  2. Handle Missing - If not found, check for backups in ~/.claude/session-states/
  3. Daily Log Bootstrap - Read today's and yesterday's daily logs from ~/.claude/agent-memory/daily-logs/ for cross-session context
  4. Parse - Detect schema version and extract fields
  5. Restore Todos - Recreate the task list if present
  6. Continue - Immediately resume work based on continuation prompt

Memory Bootstrap

On restore, the agent reads:

  • ~/.claude/agent-memory/daily-logs/{today}.md — what happened earlier today
  • ~/.claude/agent-memory/daily-logs/{yesterday}.md — what happened yesterday

This provides continuity across sessions. The agent internalizes this context silently — it won't dump the full log to you, but it knows what was done in prior sessions.

Schema Support

The command supports two schema versions:

V2 Format (Current)

{
  "$schema": "session-state-v2",
  "continue": "continuation prompt",
  "task": "overall task",
  "todos": [{"t": "task description", "done": false}],
  "files": ["path/to/file.ts"]
}

V1 Format (Legacy)

{
  "tier1_brief": {
    "continuation_prompt": "...",
    "status": "in_progress"
  },
  "tier2_context": {
    "todo_list": [{"task": "...", "status": "completed"}]
  }
}

Missing File Handling

If .context/session-state.json is not found, the command:

  1. Checks for backups in ~/.claude/session-states/
  2. Lists available backup files
  3. Asks user to choose:
    • Use latest backup - Restore from most recent global backup
    • Start fresh - Begin without restoration
    • Cancel - Do nothing

Read the full file on GitHub · 130 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. 3d ago First seen · 130 lines · 0 tokens per session scan A 960e9b52de97

Subscribe to this mod's changes

restore is a command published in the GitHub repository ruizrica/toolkit (5 stars, last pushed 18d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 848 tokens. 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.