claude-compaction-restore

claude-compaction-restore is a skill for Claude Code from mvschwarz/openrig. It costs 49 tokens per session (2,091 once invoked), scanned A, original, Apache-2.0.

A procedure for restoring an AI coding session after its conversation history has been shortened, or compacted. It rebuilds the task context from saved transcripts and files.

In plain words
What is it for?
Use it to record a durable progress map before compaction and recover the working state afterward.
Why use it?
It helps prevent lost decisions, unfinished work, changed files, and next steps when a session reaches its context limit or resumes later.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

Part of the openrig-core plugin — 19 skills shipped together

Good fit Use it to record a durable progress map before compaction and recover the working state afterward.

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

Made for: Claude Code.

Or install openrig-core, the plugin that ships this one along with the rest of its 19 skills.

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 claude-compaction-restore

README.md
[![agentmods](https://agentmods.dev/badge/skills/mvschwarz/openrig/claude-compaction-restore.svg)](https://agentmods.dev/skills/mvschwarz/openrig/claude-compaction-restore)
Your own site
<a href="https://agentmods.dev/skills/mvschwarz/openrig/claude-compaction-restore"><img src="https://agentmods.dev/badge/skills/mvschwarz/openrig/claude-compaction-restore.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,091 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 warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 34
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
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.00049 $0.02091
Opus 5 $0.00024 $0.01045
Sonnet 5 $0.00010 $0.00418
Haiku 4.5 $0.00005 $0.00209

Measured 8d ago against content hash 6f64609f32bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

claude-compaction-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 8d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/precompact-hook.mjs, scripts/restore-from-jsonl.mjs), 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.

packages/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md · 167 lines

How it starts

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

Claude Compaction Restore

Use this skill to preserve continuity before Claude Code compacts and to restore continuity after compaction. Do the work described here; do not merely explain the protocol.

If You Are About To Compact

Prepare durable continuity before the context boundary.

  1. Identify the active task, queue item, mission/slice, branch or commit, and current working directory.
  2. Record the current state: decisions made, files changed, commands/tests run, evidence produced, blockers, caveats, and the next concrete step.
  3. Create or update a durable mental-model restore map. This map is the main artifact future-you will use to rebuild context after compaction.
  4. In the restore map, write an ASCII file/folder tree of every path that mattered to your working mental model during this session. Include:
    • the active queue item or mission packet;
    • mission notes, progress, decisions, and evidence files;
    • Claude memory/project notes you used or wrote, especially when the memory folder is shared by many agents;
    • files with active edits or recently inspected source;
    • root instructions such as AGENTS.md, CLAUDE.md, or README.md;
    • as-built docs, codemaps, conventions, skills, and product docs needed before code/review work;
    • source files, tests, scripts, UI evidence, screenshots, logs, or reports that shaped your current state.
  5. For every file or folder in the tree, add a short note explaining why it matters and whether it is required reading after compaction.
  6. Write any important glue context that is not already on disk into the handoff/restore map. This includes assumptions, partial conclusions, failed paths, and why the listed files fit together.
  7. In the compaction summary, include the restore map path and the top required reading paths from that map.

If You Just Compacted

Treat your memory as unreliable until you restore from durable evidence. Restoration is your current task. Do not wait for a future user request or a new task assignment before reading the required files.

Read the full file on GitHub · 167 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. 8d ago First seen · 167 lines · 49 tokens per session scan A 6f64609f32bc

Subscribe to this mod's changes

claude-compaction-restore is a skill published in the GitHub repository mvschwarz/openrig (66 stars, last pushed yesterday), licensed Apache-2.0. It adds 49 tokens to every session and 2,091 once invoked, about $0.0002 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

handoff

Write a compact, decision-ready handoff so the next session (or the user) can continue without reconstructing the current one. Use when the session is ending, context is running low, the user asks for a handoff / "pass the baton" / "hand off", or a long-running operation needs a durable state checkpoint.

Hmbown/CodeWhale · 70 tokens

durable-session-state

Persist plans, scope decisions, evidence, and reviewer/critic verdicts to durable files during long or multi-phase tasks so work survives context compaction, session resumes, and handoffs. Use for swarm-mode tasks, before context grows large, when recording approval gates, and when resuming after compaction or a…

ZaxbyHub/opencode-swarm · 70 tokens

semantix

Install and use the semantix memory kernel as a middleware in your agent: extract user preferences / workflows / experience from past sessions, retrieve and inject them on demand. One binary + your agent's own tools.

Gnosil/semantix · 47 tokens

compact-now

Operator-triggered proactive compaction — Chrono externalizes load-bearing state (active decisions, open tasks, next action) to a snapshot + a durable Vault learning note before invoking Claude Code's native /compact, then resumes from the snapshot. Use when the operator says "/compact-now" / "compact now" or when…

mtarcure/claude-vibe-squad · 82 tokens

continuous-learning

Use when a mistake, correction, or surprise taught the workspace something that must stick — a retro or postmortem, the same agent error corrected twice, a resolved bug's root cause, scattered notes-to-self — and route that lesson to the durable surface that fires next time. NOT a forward choice with alternatives…

ericrisco/rsc-harness · 73 tokens

init

Turn on Rekal memory in the current repository by running rekal init. Use when the user asks to initialize or set up Rekal here, or when a rekal command reported the repository is not initialized. Once per repository. Do not offer this merely because a repo lacks a .rekal/ store — most repos do not want one.

rekal-dev/rekal-cli · 75 tokens