$npx -y skills add mvschwarz/openrig --skill claude-compaction-restoreUse when a Claude Code session has just compacted, is about to compact, reached context limit, resumed after /compact, or needs to rebuild its working mental model from Claude JSONL transcripts and touched files.
| 1 | # Claude Compaction Restore |
| 2 | |
| 3 | Use this skill to preserve continuity before Claude Code compacts and to |
| 4 | restore continuity after compaction. Do the work described here; do not merely |
| 5 | explain the protocol. |
| 6 | |
| 7 | ## If You Are About To Compact |
| 8 | |
| 9 | Prepare durable continuity before the context boundary. |
| 10 | |
| 11 | 1. Identify the active task, queue item, mission/slice, branch or commit, and |
| 12 | current working directory. |
| 13 | 2. Record the current state: decisions made, files changed, commands/tests run, |
| 14 | evidence produced, blockers, caveats, and the next concrete step. |
| 15 | 3. Create or update a durable mental-model restore map. This map is the main |
| 16 | artifact future-you will use to rebuild context after compaction. |
| 17 | 4. In the restore map, write an ASCII file/folder tree of every path that |
| 18 | mattered to your working mental model during this session. Include: |
| 19 | - the active queue item or mission packet; |
| 20 | - mission notes, progress, decisions, and evidence files; |
| 21 | - Claude memory/project notes you used or wrote, especially when the memory |
| 22 | folder is shared by many agents; |
| 23 | - files with active edits or recently inspected source; |
| 24 | - root instructions such as `AGENTS.md`, `CLAUDE.md`, or `README.md`; |
| 25 | - as-built docs, codemaps, conventions, skills, and product docs needed |
| 26 | before code/review work; |
| 27 | - source files, tests, scripts, UI evidence, screenshots, logs, or reports |
| 28 | that shaped your current state. |
| 29 | 5. For every file or folder in the tree, add a short note explaining why it |
| 30 | matters and whether it is required reading after compaction. |
| 31 | 6. Write any important glue context that is not already on disk into the |
| 32 | handoff/restore map. This includes assumptions, partial conclusions, failed |
| 33 | paths, and why the listed files fit together. |
| 34 | 7. In the compaction summary, include the restore map path and the top required |
| 35 | reading paths from that map. |
| 36 | |
| 37 | ## If You Just Compacted |
| 38 | |
| 39 | Treat your memory as unreliable until you restore from durable evidence. |
| 40 | Restoration is your current task. Do not wait for a future user request or a |
| 41 | new task assignment before reading the required files. |
| 42 | |
| 43 | 1. Read any restore prompt, marker path, packet path, transcript path, restore |
| 44 | map, or extra instruction file named by the operator or OpenRig. |
| 45 | 2. Run the restore script from this skill: |
| 46 | |
| 47 | ```bash |
| 48 | node ~/.claude/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs --out /tmp/claude-compaction-restore |
| 49 | ``` |
| 50 | |
| 51 | If the prompt names a specific Claude JSONL transcript, pass it explicitly: |
| 52 | |
| 53 | ```bash |
| 54 | node ~/.claude/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs /path/to/session.jsonl --out /tmp/claude-compaction-restore |
| 55 | ``` |
| 56 | |
| 57 | 3. Read the generated `restore-instructions.md`. |
| 58 | 4. Read the generated `touched-files.md`. |
| 59 | 5. Find and read the mental-model restore map if one exists. Treat it as the |
| 60 | highest-value guide to which memory files, mission files, source files, and |
| 61 | docs mattered before compaction. |
| 62 | 6. Identify the important files for the active task. The touched-file list is |
| 63 | a triage aid, not a complete inventory. |
| 64 | 7. Read every important file in full. Prioritize the restore map, Claude memory |
| 65 | files named in the map, Markdown state/planning files, queue/mission packets, |
| 66 | source files with active edits, root instruction files, and as-built or |
| 67 | codemap docs. |
| 68 | 8. After the required reads are complete, state: |
| 69 | |
| 70 | ```text |
| 71 | restored from packet at <path>; resumed at step <X> |
| 72 | ``` |
| 73 | |
| 74 | Include the main files you read in full when you make that statement. |
| 75 | |
| 76 | ## Required Read-Depth Audit |
| 77 | |
| 78 | After the first restore pass, audit yourself before continuing. |
| 79 | |
| 80 | 1. List every file, packet, marker, restore map, instruction file, and source |
| 81 | document you were asked to read during restore. |
| 82 | 2. Mark each item as `FULL`, `PARTIAL`, or `NOT_READ`. |
| 83 | 3. You will be given a task where all of these files are required reading in |
| 84 | order to understand the task. |
| 85 | 4. Do not optimize for token conservation. |
| 86 | 5. Read every `PARTIAL` or `NOT_READ` item in full now. |
| 87 | 6. Report the final read-depth table before doing any substantive task work. |
| 88 | |
| 89 | ## Guardrails |
| 90 | |
| 91 | - Do not silently launch fresh after compaction. |
| 92 | - Do not continue from memory when restore evidence exists. |
| 93 | - Do not defer required restore reading until a later user task. The restore is |
| 94 | t |