claude-compaction-restore
What it does
This skill helps an AI coding agent keep its understanding of a long task when its memory is compressed. It is for agents running long sessions, such as planners or reviewers in a team.
When to use it
- ✓When a Claude Code session is about to compact or has just compacted.
- ✓When an agent resumes after /compact and must recover its working picture.
- ✓When a long-running agent seat must keep the connections between files and decisions.
Skill link
https://github.com/mvschwarz/openrig/blob/main/packages/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“My Claude session just compacted and I lost track of the plan. Help me rebuild it from my restore notes and transcript.”
5 new skills a week. 1 minute to read.
How it works
Before compaction it saves a short map of what matters and how things connect, then after compaction it reads that map and the transcript to restore the picture before acting.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Claude Compaction Restore
Compaction keeps facts and loses connections. After a compaction you still know file names, row ids and decisions as items. What you lose is the web between them: why a file matters, what depends on what, which decision produced which artifact, what you were about to do next, and how this window relates to the ones before it. Seats whose value is a wide, long-running picture (planners, orchestrators, reviewers holding a standard) lose the most.
This skill keeps that picture alive across compactions. Before compacting, you write a restore map: a short summary plus the connections between things that already exist on disk. After compacting, you re-enter the world, read your own map, and rebuild the picture before acting. Over several compactions the maps chain into one continuous record: a global context window that outlives any single session.
The previous version of this skill is kept at reference/SKILL-v1.md for comparison.
What survives, and what you write
Already on disk; point to it, don't copy it:
- your session JSONL at
~/.claude/projects/<cwd-slug>/<session-uuid>.jsonl(the post-compaction restore request names the exact path). It holds every message and tool call you made, in order. It does not hold your reasoning; - the restore packet the PreCompact hook writes (transcript extract, touched-file triage);
- queue rows and their transitions, mission files (
SPEC.md,NOTES.md,PROGRESS.md), your seat'sLEARNED.md, evidence folders, branches and PRs.
Only in your head; write it down:
- why each important thing matters, and to whom;
- how things relate: depends on, supersedes, answers, contradicts, was produced by, is owned by;
- decisions and the reasons for them, options you rejected, judgment and taste you applied;
- where you were in time: what earlier windows established, what this window did, what comes next and who authorizes it;
- where to look deeper: which JSONL range or file answers which question.
The map is the second list, pinned to the first.
Two restore classes
Every restored seat must come back competent. It should understand the OpenRig world and its command surface, the project, its own role, and where it stands in time. Some seats also need the global picture.
Both classes read the same thing: the ranked reading list in your own map, in order. They differ only in how far down the list they go.
| Class | Who | Reads |
|---|---|---|
| Default | drivers, builders, reviewers, QA, and any seat not listed below | Tier 1: the top of the list, to about 100k of real context |
| High-context | orchestrators, planners, advisors, leads: any seat that makes product, scope or routing decisions | Tier 1 and Tier 2, to about 200k of real context |
The tiers are real context added by the restore, on top of what the compaction summary leaves (about 60k).
These budgets assume a context window of about 1M tokens; on a smaller window, scale them to about 10% and
20% of it. File size is a poor guide to that cost: in OpenRig's own runs, real context grew 1.7 to 2 times the bytes ÷ 4 estimate,
because of line numbers on reads, tool output and your own reasoning. So rank to about 50k of bytes ÷ 4 for
Tier 1 and about 100k for Tier 2, and check real usage at each checkpoint with
rig compact-plan --json (your seat's estimatedUsedTokens).
Tier 2 buys width, not depth: more sources, more connections, more of the mission's history and the wider
worlds, not the same files read more fully. Choose your class from your role (rig whoami --json). A per-seat
instruction file or your own map can name the class explicitly, and that overrides the role default. In both
classes, transcripts and the session JSONL appear only as targeted line ranges, never as whole files.
If there is no ranked list (no preparation turn happened), use this default order. Default seats stop at about 100k of real context:
- the post-compaction world profile;
- the mission or slice
SPEC.mdandNOTES.md; - rows you hold.
High-context seats then add, to about 200k:
- the full System World install;
- the full Project World, public and private;
- the mission's
PROGRESS.mdand recent returns; - previous maps and
RESTOREDnotes; LEARNED.md.
If You Are About To Compact
You are about to lose every connection you have built. Spend this turn making them durable.
- Think back before writing. Walk the session and, throu
FAQ
What does compaction lose?
It keeps facts such as file names and decisions, but loses the connections between them, such as why a file matters.
Where is the restore map kept?
It is written to disk, and the skill points to the existing session transcript rather than copying it.
Who benefits most?
Long-running agents such as planners, orchestrators and reviewers that hold a wide view of the work.
Details
Original description by the author
Use when a Claude Code session is about to compact, has just compacted, reached its context limit, resumed after /compact, or must rebuild its working picture of a long-running seat from its own restore map, its JSONL transcript and the files it touched.
repo: mvschwarz/openrig
Popularity
- GitHub stars
- 8.6k
- Ranking position
- #12385
- License
- Apache-2.0
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
agent-operated-software
8.6kHelps your agent design, build or debug an ongoing app whose live backend includes AI agents, such as a Markdown or JSON agent control plane.
agent-operated-workflows
8.6kHelps your agent decide whether a bounded procedure should be run by an AI agent or by ordinary code, and how to resume it from verified evidence.
applying-a-permission-policy
8.6kHelps your agent set up the command permissions an AI coding agent uses during team setup, so routine commands run with fewer approval prompts.
delegating-work
8.6kHelps your agent decide who should do a task, itself, a subagent or a teammate who already holds the context, and how to brief that worker.
Similar skills
add-model-provider
394kLets your agent connect a new AI model provider to OpenClaw using safe setup commands, keep API keys out of plain text, and run a live test.
acp-router
394kHelps your agent send a task to a coding assistant such as Claude Code or Cursor through OpenClaw, so the work runs in that tool.
browser-automation
394kTeaches your agent to control web pages step by step, including logins, tabs, and recovery when a page stops responding.