# Session Compaction And Restore

Use when reasoning about what survives compaction/context-loss/restart/seat-refresh...

- Repository: https://github.com/mvschwarz/openrig (8541 stars)
- Category: Design
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add mvschwarz/openrig --skill session-compaction-and-restore -g -a claude-code -y`
Codex: `npx skills add mvschwarz/openrig --skill session-compaction-and-restore -g -a codex -y`
Cursor: `npx skills add mvschwarz/openrig --skill session-compaction-and-restore -g -a cursor -y`
Gemini CLI: `npx skills add mvschwarz/openrig --skill session-compaction-and-restore -g -a gemini-cli -y`

## Description

Use when reasoning about what survives compaction/context-loss/restart/seat-refresh, designing a high-fidelity restore packet, or distinguishing native runtime resume vs fork vs artifact-backed mental-model rebuild. Covers the 4 failure modes that prevent honest restore (compacted seat drops hot potato; restore packet preserves details but loses product intent; runtime resume mistaken for handover or fork; rebuilt seat starts with stale instructions).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Session Compaction and Restore

Preserving useful working state across **compaction, context loss,
restart, or seat refresh.** Includes Claude compaction restore, Codex
resume/fork mechanics, transcript-based mental-model rebuilds, and
durable handoff packets.

**Long-lived seats are valuable only if they can survive context
pressure.** If compaction turns a senior seat into a cold-started
agent, users will avoid persistent topologies and fall back to
throwaway agents.

## Use this when

- A seat is approaching compaction or just compacted
- Designing a high-fidelity restore packet for an active workflow
- Distinguishing native runtime resume vs fork vs artifact-backed mental-model rebuild
- Reasoning about what should be preserved vs reconstructable
- Auditing a restore for product-intent preservation (not just detail preservation)

## Don't use this when

- The session is fresh and has no working state to preserve
- The intent is to *create* a new seat from a primed source, that's `session-source-fork` or `agent-starters`
- The packet is a one-off snapshot for human review, restore packets are for re-entering active work

## The 5 distinctions (do not collapse)

Per the cross-runtime restore/reentry packet standard:

| Mode | What it means | Outcome literal |
|---|---|---|
| **Native resume** | Continue the same managed seat with native runtime token | `resumed` |
| **Fork** | New managed seat from prior native runtime conversation; new post-fork token | `forked` |
| **Rebuild** | Fresh-launch seeded with operator-declared artifacts in trust-precedence order | `rebuilt` |
| **Artifact-backed mental-model rebuild** | Restored seat derives understanding from a packet rather than native runtime continuity | (case of `rebuilt`) |
| **Fresh launch** | New agent without prior continuity | `fresh` |

These are load-bearing distinctions. **Do NOT collapse `fork` into
artifact-backed reentry; do NOT collapse `rebuild` into fork.**

The rest: https://github.com/mvschwarz/openrig/blob/HEAD/packages/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md
