Context Restore context-restore
Restore working context from /context-save.
Use it when resume where i left off, restore context, where was i. (gstack)
- Our test
- 8/10✓ Verified
- tested Dec 6, 2026
- GitHub stars
- 143k
- garrytan/gstack
- Added by
- 0
- members
- Updated
- Dec 6
- commit d08eb76
- Content
- 5 files
- no scripts · 29 KB
- License
- MIT
- free to use
What our test found
Le skill propose une procédure détaillée et prudente pour restaurer le contexte, gérer les divergences et éviter les modifications non autorisées, malgré une complexité assez élevée.
Limits spotted
- The procedure is long and depends on gstack/Claude Code-specific tools and paths.
- Reconstructing context without a checkpoint may involve reading transcripts containing private data, even though minimization and redaction instructions are included.
- The example response assumes a checkpoint and its contents; in a real situation, the search must first be run before summarizing.
name: context-restore preamble-tier: 0 version: 1.0.0 description: "Restore working context from /context-save. Use for: resume where i left off, restore context, where was i. (gstack)" allowed-tools: - Bash - Read - Glob - Grep - AskUserQuestion triggers: - resume where i left off - restore context - where was i - pick up where i left off - context restore
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly --> <!-- Regenerate: bun run gen:skill-docs -->
/context-restore — Restore Saved Working Context
Load the latest checkpoint in one fast call, honor active decisions and reversals immediately, and get straight to work without verification loops or verbose banners.
HARD GATE: Do NOT implement code changes during /context-restore.
Detect command
/context-restore→ load latest (current branch first, cross-branch fallback for Conductor handoff; never hard-filter other branches out)/context-restore <title-fragment-or-number>→ pass the argument via--fragment-stdinwith a quoted heredoc whose delimiter is absent from the argument (default<<'GSTACK_FRAGMENT_END'; never shell-interpolate)/context-restore list→ reply"Use /context-save list — listing lives on the save side"and exit.
Section index — Read each section when its situation applies
This skill is a decision-tree skeleton. The steps below point to on-demand sections. Read a section in full before doing its step; do not work from memory.
| When | Read this section | |------|-------------------| | rebuilding context after Step 1 printed NO_CHECKPOINTS with no BELOW_CWD or POINTER line (nothing saved to restore) | sections/transcripts.md | ---
Restore flow
Step 1: Find saved contexts
Run one command (for a title fragment or 1-based number from /context-save list, append --fragment-stdin with a quoted heredoc whose delimiter is absent from the argument, e.g. <<'GSTACK_FRAGMENT_END'):
~/.claude/skills/gstack/bin/gstack-context-checkpoint restoreThe helper verifies project identity (canonical remote, else physical root), ranks current branch first by YYYYMMDD-HHMMSS filename prefix (not mtime), checks head: drift, and outputs SELECTED_FILE:, HEAD_STATUS:, and the checkpoint body in one shot when unambiguous.
Handle sentinel lines before any summary:
NO_CHECKPOINTS(and noBELOW_CWD/POINTER) → go to## If no saved contexts exist.SELECTED_FILE:takes precedence (apply anySELECTED_IDENTITY:banner below).NO_VERIFIED_CHECKPOINTS/IDENTITY_CHECK_FAILED(noSELECTED_FILE:) → never present any file as latest; say"No checkpoint in this directory is verified as this project's", listFOREIGN/UNVERIFIEDtitles +remote:/project_root:, and ask viaAskUserQuestion.AMBIGUOUS:(newer-task,below-cwd-or-pointer,no-branch-discriminator,multiple-fragment-matches) → show options (title, branch, timestamp; forBELOW_CWD/POINTERsay"Saved in {project_root}, below this directory."), recommend newest, ask viaAskUserQuestion, then pass the chosen path via~/.claude/skills/gstack/bin/gstack-context-checkpoint restore --file-stdinwith a unique quoted heredoc delimiter absent from the path.FRAGMENT_NOT_FOUND:/FILE_NOT_FOUND:→ say none matched, list candidates, and ask; never load another file.SELECTED_IDENTITY: BELOW→ note"Saved in {project_root}, below this directory."(not a project mismatch).SELECTED_IDENTITY: FOREIGN,UNVERIFIED, orIDENTITY_CHECK_FAILED→ open with"PROJECT MISMATCH: this checkpoint was saved by {remote/project_root or 'an unknown project'}, not this project ({PROJECT_IDENTITY})."- Relay
SHARED_BUCKET,LEGACY_BUCKET, andROOT_DIFFERS("Saved from another checkout at {project_root}.") concisely if printed.
Step 2: Apply state and present compactly
- Backward compatible: Reads both the lean format (
Active Decisions,Reversals / Do-Not-Repeat,Open Promises / Next Step,Workspace) and older checkpoints (Summary,Decisions Made,Remaining Work,Notes, pre-stamp/pre-head/pre-provenance). - Reversal hygiene: Honor
Active Decisions(or legacyDecisions Made) as binding and treatReversals / Do-Not-Repeatas hard constraints — never revert to or re-propose a superseded approach. - Prior open context: If Step 1 printed
--- PRIOR OPEN CONTEXT ---(when the newest checkpoint is a sparse stub), include those prior open decisions, reversals, and open promises in the restored summary. - No verification loops: Skip
git log,git diff, and re-reading checkpointed files. Rungit status -sbonly if workspace drift matters for the next step (e.g.,HEAD_MOVED, branch mismatch, dirty files). - Commit drift (`HEAD_STATUS:`):
HEAD_UNCHANGED/HEAD_NOT_CHECKED: nothing to add.HEAD_MOVED <n>: print<n> commit(s) landed since this save:+ commits; put every item under Verify first.HEAD_DIVERGED/HEAD_UNKNOWN: printThis checkpoint was saved at {first 7 chars of head}, which is not in this checkout's history (saved on another branch, rebased, reset, or not fetched).and put every item under Verify first.HEAD_UNTRACKED: printThis checkpoint predates commit tracking; restore cannot tell whether work landed after it.and sort normally.- Sort Remaining Work by provenance (keep original text & saved order; drop nothing; on
HEAD_MOVED/HEAD_DIVERGED/HEAD_UNKNOWNevery item goes under Verify first): - Verify first:
(path assumed),(code read), failed(path run), unknown/translated marker, or unmarked write/concrete path. - Next steps: successful
(path run),(path read),(target state checked), or unmarked abstract items. - Pre-provenance file (zero markers): print
This checkpoint predates provenance markers; items naming commands, paths or writes are listed under Verify first.
Present compactly (no ASCII box walls):
**RESUMING CONTEXT** — {title} (`{branch}`, saved {timestamp}, {status})
{branch-mismatch / identity / commit-tracking / legacy lines, if any}
### Active Decisions
{Active Decisions, or legacy Summary + Decisions Made}
### Reversals / Do-Not-Repeat
{Reversals / dropped approaches, if any}
### Remaining Work
Next steps
{Next steps items, saved order}
Verify first (inspect read-only before executing anything)
{Verify first items, saved order}If current branch differs from frontmatter branch:, add: "Saved on branch {branch}; currently on {current branch}."
Step 3: Resume or offer next step
- If the user explicitly asked to continue working on a task: start from the first Remaining Work item in saved order — if it is under Verify first, inspect read-only before executing it or any later item.
- If the user only asked for context (or `AskUserQuestion` is unavailable without an explicit request to continue): return the compact restored summary and stop — do not execute saved steps without authorization.
- Otherwise (interactive standalone `/context-restore`): ask once via
AskUserQuestion:A) Continue working/B) Show full file/C) Done. On A, follow the same first-item saved-order rule (verify read-only first if under Verify first).
If no saved contexts exist
If Step 1 printed NO_CHECKPOINTS with no BELOW_CWD or POINTER line, state in one line that nothing was saved with /context-save, then rebuild from workspace records:
STOP. Before rebuilding context after Step 1 printedNO_CHECKPOINTSwith noBELOW_CWDorPOINTERline (nothing saved to restore), Read~/.claude/skills/gstack/context-restore/sections/transcripts.mdand execute it in full. Do not work from memory — that section is the source of truth for this step.
If LEGACY_BUCKET was printed, relay that earlier checkpoints can be copied with gstack-slug --adopt-legacy.
Important Rules
- Never modify code. Read checkpoints, transcripts, and minimal git state only.
- Current branch first, cross-branch fallback; never present another project's checkpoint as latest.
- Respect commit drift and provenance: verify first on HEAD drift or unverified markers; never jump ahead of an unverified first item.
- "Most recent" means `YYYYMMDD-HHMMSS` filename prefix, not mtime.
- Invoke via Skill tool —
/context-restoreis a gstack skill, not a built-in.