session-restore

Register non-main git worktrees into the current Codex session.

1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/SeoJaeWan/try-claude-code --skill session-restore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: session-restore
Source: https://github.com/SeoJaeWan/try-claude-code/tree/main/plugin/develop/skills/session-restore
Command: npx skills add https://github.com/SeoJaeWan/try-claude-code --skill session-restore

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Restore the context of a coding session by re-attaching existing git worktrees to the current session so the stop-review gate can monitor them.

Core Features & Use Cases

  • Automatically scan for non-main worktrees on disk and register them to the current Codex session.
  • Prevent loss of work context after an unexpected close by preserving worktree associations.
  • Use case: after a crash, resume a workflow by reattaching all worktrees with their branches and last commits.

Quick Start

Run the restore script to reattach non-main worktrees to the current session.

Frequently Asked Questions about session-restore

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I restore git worktree context after a session crash?

Restoring git worktree context involves re-attaching existing non-main worktrees on disk to the current Codex session. This Skill scans for them automatically and outputs a JSON array containing the path, branch, and last commit of each registered worktree.

How does registering existing git worktrees into a Codex session work?

Registering existing git worktrees works by reading the CODEX_COMPANION_SESSION_ID and scanning disk for non-main worktrees. It then attaches these worktrees to the active session so the stop-review gate can continue monitoring them after an interruption.

What is the best way to resume a workflow with multiple git worktrees after an unexpected close?

The best way to resume a workflow with multiple git worktrees after an unexpected close is to run a restore script that automatically reattaches all non-main worktrees. This preserves your branch associations and last commits without manual lookup.

Do I need a specific environment variable to re-attach worktrees to a current session?

Yes, you need the CODEX_COMPANION_SESSION_ID environment variable to re-attach worktrees. The Skill reads this variable to identify the active Codex session and successfully register the detected non-main worktrees back into it.

What limitations exist when restoring worktree context across sessions?

A limitation when restoring worktree context is that the Skill only targets non-main worktrees currently existing on disk. If a worktree was deleted before the session resumed, it cannot be registered or recovered by the restore script.