session-compaction-and-restore
できること
このスキルは、AIエージェントが、コンテキストが圧縮、再起動、更新されたときに、役立つ作業状態を保つ方法を説明します。リセット後に冷え切らないように、長期的に動く席を運用する運用者やエージェント向けです。
使う場面
- ✓席が圧縮に近づいているか、ちょうど圧縮されたとき。
- ✓進行中の作業のための復元パケットを設計するとき。
- ✓ネイティブの再開、フォーク、アーティファクトからの再構築のどれにするかを選ぶとき。
スキルのリンク
https://github.com/mvschwarz/openrig/blob/main/packages/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私たちのプランナーの席がもうすぐ圧縮されます。ファイル名だけでなく、プロダクトの意図を保てる復元パケットを設計してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、復元のモードと、よくある失敗のパターンを説明します。そのため、エージェントは詳細だけでなく、プロダクトの意図と次の手順も保つことができます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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-forkoragent-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 three mechanisms — who owns each (verified vs main d37a08ad, 2026-07-21)
The outcomes above ride on three DISTINCT mechanisms; keep them separate:
- Claude built-in
/compact— a Claude Code HARNESS feature, not OpenRig code. OpenRig only emits the literal/compacttoward the pane after a prep turn; there is no compaction algorithm in the OpenRig repo. Provider-owned. - OpenRig-managed restore — the enforcer + hook bridge: a precompact hook
WRITES a restore packet; a bridge READER injects exactly ONE restore directive
back via the harness hook channel (
hookSpecificOutput.additionalContext), seat-isolated. The OpenRig-owned half. - Codex session continuity — resume/rollout tokens (
codex resume <token>), a separate path from the Claude mechanisms. Never conflate with Claude restore.
Safety boundary (ties to native-session-file-lab-boundary): no supported
OpenRig path EDITS provider-owned native session / auth / transcript files to
inject context. Context enters ONLY through sanctioned channels: the hook
additionalContext, a normal user message via rig send, or Codex resume tokens.
Precise nuance: OpenRig does write ~/.codex/config.toml — but only to install
OpenRig activity hooks and [features], never session or auth state. So the
rule is "never edits native session/auth/transcript files," NOT "never touches any
provider-owned file."
Claude's own idle compaction while managed compaction is on
While policies.claude_compaction.enabled is true with a valid threshold (the enforcer treats any other
threshold as off), every Claude session OpenRig launches (fresh, fork, resume and restore; ordinary, kernel,
team-default and full-bypass seats) carries idleCompaction: false in its one --settings value. Claude Code then
doesn't compact an idle session on its own, so managed seats compact through OpenRig's sequence (restore map, then
/compact at the threshold).
- Version boundary: Claude Code supports the key from 2.1.290. Earlier versions ignore it, so idle compaction stays possible there.
- Precedence: it overrides a lower-precedence
idleCompaction: truein user or project settings for those launches. Claude's managed settings still win. - Native threshold auto-compaction is untouched (
autoCompactEnabled,DISABLE_AUTO_COMPACT). Where the enforcer has no fresh status-line usage sample for a seat, it doesn't compact that seat, and native auto-compaction is then the only compaction. Nothi
よくある質問
復元パケットとは何ですか?
リセットの後に、主要な文脈を持って進行中の作業に再び入れるようにする文書です。
ネイティブの再開は引き継ぎと同じですか?
いいえ。ランタイムの再開を、引き継ぎと取り違えるべきではないとスキルは述べています。
Codexにも対応していますか?
はい。Claudeの圧縮後の復元とあわせて、CodexのresumeとforkのCodexの仕組みも扱います。
詳細
作者による元の説明
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).
repo: mvschwarz/openrig
人気
- GitHubのスター
- 8.6k
- ランキング
- #12398
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
agent-operated-software
8.6kエージェントが、AIエージェントを稼働中のバックエンドに含む継続的なアプリを設計、構築、デバッグできるよう支援します。MarkdownやJSONのエージェント制御層を含みます。
agent-operated-workflows
8.6kエージェントが、限定された定型の手順をAIエージェントが動かすべきか通常のコードが動かすべきかを判断し、検証済みの証拠から再開する方法を決められるよう支援します。
applying-a-permission-policy
8.6kエージェントが、チームの設定時に使うコマンドの許可を設定し、通常のコマンドが承認の確認を何度も求めないよう支援します。
claude-compaction-restore
8.6kClaude Codeのエージェントが、コンテキストが圧縮された後に、保存された復元用のマップ、トランスクリプト、触れたファイルを使い、作業の全体像を組み直せるよう支援します。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。