Skip to content

Claude Compaction Restore

Helps a Claude Code agent rebuild its working picture after its context is compacted.

Stars
8,553
Licence
Apache-2.0
Files
6 files

What it does

When a long Claude Code session is about to be compacted (its memory summarized to free space), this skill makes the agent write a 'restore map' first: a summary plus the connections between files, decisions and next steps that a plain summary tends to lose. After compaction, the agent reads that map and its saved transcript to rebuild its understanding before acting. It is aimed at orchestrator-style agents in the OpenRig multi-agent system and is not a general-purpose feature for ordinary users.

Great for

  • Developers running long-lived Claude Code agents inside the OpenRig multi-agent setup
  • Teams whose planner, reviewer or orchestrator seats must keep a wide project picture across many compactions

Skip it if

  • Short, one-off chats where compaction rarely happens; the workflow adds overhead without benefit
  • Users outside OpenRig, since it depends on OpenRig commands (rig whoami, rig context recap-write, rig compact-plan) and its file layout
  • Shared machines where restore packets in /tmp or private restore maps could expose working context to other users

Try asking

  • “Before compacting, write a restore map for this orchestrator seat so the next window can continue the mission”
  • “After a compaction, read my restore map and rebuild the project picture before taking the next step”
  • “Summarize this window's decisions and open threads into a seat recap and restore map”
Step-by-step guide: how to use Claude Compaction RestoreInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 6 original files, the Apache-2.0 licence and an attribution note.

    claude-compaction-restore.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip claude-compaction-restore.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip claude-compaction-restore.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Use it only inside an OpenRig rig; without the rig commands the preparation and recap steps will not work as written.
  • Check the restore packet and map contents before sharing them, since they hold private working context and may be written to /tmp by default.
  • Run the PreCompact hook only after reviewing scripts/precompact-hook.mjs, since it executes the restore script and writes files.

What's inside

  • reference/SKILL-v1.md
  • scripts/precompact-hook.mjs
  • scripts/restore-from-jsonl.mjs
  • SKILL.md
  • templates/compact-instruction.md
  • templates/post-compact-restore-instruction.md

Redistributed unmodified from mvschwarz/openrig under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.