agentleFS
manastalukdarmanastalukdar/ai-devstudio/skills/context-restore/SKILL.md

context-restore

Skill1 starsChanged 7 months agoMITView on GitHub

Restore work-in-progress context saved by /context-save — finds the most recent WIP commit on the current branch and unpacks it back to the working tree so you can resume exactly where you left off. Inspired by gstack's context-restore skill.

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ios-clean, ios-fix and 6 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Saqlain-811Skill

    ios-clean

    Remove the DebugBridge SPM package and all #if DEBUG wiring from an iOS app. (gstack)

    Also in 5 projects that use this

  • Saqlain-811Skill

    ios-fix

    Autonomous iOS bug fixer. (gstack)

    Also in 5 projects that use this

  • timurgaleevSkill

    document-generate

    Generate missing docs for a feature, module or project as tutorials, how-tos, reference and explanation.

    Also in 7 projects that use this

  • bastosSkill

    ios-design-review

    Review iOS app UI/UX design quality using Apple's design principles and the Liquid Glass-era design language from WWDC25/26. Use when asked for a design review, UX critique, visual design assessment, or evaluation of an app's interface quality, design intent, alignment with the new Apple design system, or usability. Triggers: "design review", "UX review", "visual design critique", "review the UI", "does this design work", "evaluate this interface", "design feedback", "Liquid Glass review".

    Also in 5 projects that use this

  • johnlindquistSkill

    diagram

    Maintain and synchronize Unified Impact Diagrams following Diagram Driven Development (DDD) methodology. Create, update, and manage diagrams that connect user value to technical implementation.

    Also in 4 projects that use this

  • SentrySkill

    spec

    Produce a verified spec — problem, desired outcome, and acceptance criteria — before building. Use when given a GitHub/Linear issue link, when starting from a fuzzy in-conversation idea, or asked to "figure out what to do" / "scope this" / "what should I build" — whenever the *what* isn't yet pinned down. Grills the ambiguities, checks the premise against the code, and produces acceptance criteria you sign off on — then hands to design-first.

    Also in 8 projects that use this

  • +2 more from Saqlain-811

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Early exit: If no WIP commit exists on the current branch, report clearly and stop.

    line 17
  2. Distinctive:

    After selection, switch to the relevant branch if needed, then restore.

    line 117
  3. Distinctive:

    WIP commit not at HEAD: if HEAD is not the WIP commit (other commits were added after), warn and show the distance.

    line 121
  4. Distinctive:

    Conflicts on restore: if the working tree changes conflict with the WIP commit, show the conflict and guide resolution

    line 122
  5. Distinctive:

    Wrong branch: if the WIP commit is for a different branch, warn and ask before switching branches

    line 124
  6. Distinctive:

    Detached HEAD: if HEAD is detached, suggest creating a branch before restoring

    line 125
  7. Very specific:

    Use /context-save to save your current work before switching tasks.

    line 129

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Context Restore

I'll find the most recent WIP commit on this branch and unpack it back to your working tree so you can resume right where you left off. Inspired by gstack's context-restore skill.

Token Optimization

Expected range: 100–250 tokens

Patterns used: Bash git commands, early exit (no WIP commit found)

Early exit: If no WIP commit exists on the current branch, report clearly and stop.

Usage

/context-restore                  # restore most recent WIP on current branch
/context-restore --list           # show all WIP commits across all branches
/context-restore --pick           # choose from a list of WIP commits

Step 1 — Find WIP Commits

BRANCH=$(git rev-parse --abbrev-ref HEAD)

# Find the most recent WIP commit on this branch
WIP_SHA=$(git log --oneline | grep "^[a-f0-9]* wip:" | head -1 | cut -d' ' -f1)

if [ -z "$WIP_SHA" ]; then
    echo "No WIP commits found on branch: $BRANCH"
    echo ""
    echo "All WIP commits across all branches:"
    git log --all --oneline | grep "wip:" | head -10
    exit 0
fi

# Show what will be restored
WIP_MSG=$(git log --oneline -1 "$WIP_SHA")
echo "Found WIP commit: $WIP_MSG"

Step 2 — Check Working Tree Safety

# Warn if current working tree has unsaved changes
if ! git diff --quiet || ! git diff --cached --quiet; then
    echo "⚠ Warning: You have uncommitted changes that will be overwritten."
    echo ""
    git status --short
    echo ""
    echo "Save them first? Run /context-save to preserve them."
    echo "Continue anyway? [y/N]"
    # Wait for confirmation
fi

Step 3 — Restore the WIP Commit

# Unpack the WIP commit back to the working tree (mixed reset — keeps files)
git reset HEAD~1 --mixed

echo "✓ Context restored"
echo ""
git status --short

--mixed reset:

  • Moves HEAD back one commit (removes the WIP commit from history)
  • Leaves all changes in the working tree (unstaged)
  • Staged files from the original context-save become unstaged

Step 4 — Confirm Restoration

Context restored — wip: halfway through auth [feature/oauth] 2026-04-27 14:32

  3 files restored to working tree:
    M  src/auth/oauth.ts
    M  src/auth/session.ts
    A  src/auth/providers/github.ts

Resume where you left off. Use /context-save when switching again.

--list Mode

# Show all WIP commits across all branches
git log --all --oneline --decorate | grep "wip:" | head -20

Output format:

abc1234 (feature/oauth) wip: halfway through auth [feature/oauth] 2026-04-27 14:32
def5678 (feature/billing) wip: stripe integration [feature/billing] 2026-04-26 09:15

--pick Mode

Show the list and prompt for selection:

WIP commits available:
  [1] abc1234 — halfway through auth (feature/oauth, 2026-04-27 14:32)
  [2] def5678 — stripe integration (feature/billing, 2026-04-26 09:15)

Select a WIP commit to restore [1]:

After selection, switch to the relevant branch if needed, then restore.

Edge Cases

  • WIP commit not at HEAD: if HEAD is not the WIP commit (other commits were added after), warn and show the distance; offer to cherry-pick the diff instead
  • Conflicts on restore: if the working tree changes conflict with the WIP commit, show the conflict and guide resolution
  • Multiple WIP commits stacked: detect consecutive wip: commits and warn before restoring only the top one
  • Wrong branch: if the WIP commit is for a different branch, warn and ask before switching branches
  • Detached HEAD: if HEAD is detached, suggest creating a branch before restoring

Paired Skill

Use /context-save to save your current work before switching tasks. /context-restore is always the inverse operation.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.