Agent skill

Restack

by imbue-ai in imbue-ai/sculptor

Propagate a branch's changes down its stacked children by merging the updated parent into each stacked branch, in order from base to tip.

MITAuto-check passedDevelopment

Install Restack

skills CLI
$ npx skills add imbue-ai/sculptor --skill restack -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install imbue-ai/sculptor restack --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/imbue-ai/sculptor.git skills-src && mkdir -p .claude/skills && cp -r skills-src/sculptor/sculptor-experimental/skills/restack .claude/skills/restack && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
restack
GitHub stars
238
Token cost
~1.8k tokens
SKILL.md length
930 words
Files
1
Skills in repo
29
Repo updated
First seen
Licence
MIT

At a glance

Propagate a branch's changes down its stacked children by merging the updated parent into each stacked branch, in order from base to tip.

  • Works in 5 steps: Refuse if not in a worktree workspace → Discover the stack → Pre-flight → …
  • Tasks that involve Git worktrees
  • SKILL.md covers Step 0 — Refuse if not in a…, Step 1 — Discover the stack, Step 2 — Pre-flight and Step 3 — Merge top-down, plus 1 more section
  • Calls git and jq

What it does

Restack is an agent skill from imbue-ai/sculptor. Propagate a branch's changes down its stacked children by merging the updated parent into each stacked branch, in order from base to tip.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Git worktrees. It works with Git. The repository describes itself as: Build product with grounded, parallel coding agents. The licence is MIT.

When your agent uses it

  • Tasks that involve Git worktrees

Example prompts

  • “/restack”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Refuse if not in a worktree workspace
  2. Discover the stack
  3. Pre-flight
  4. Merge top-down
  5. Report

What it can do on your machine

Read from SKILL.md and the folder at commit f847102. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • jq

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Restack loads about 1.8k tokens when it runs. Until then it costs about 36 tokens; SKILL.md has 930 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~36
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from imbue-ai/sculptor at commit f847102, republished under its MIT licence (© imbue-ai). 930 words, ~1,825 tokens.

Download SKILL.mdSave it as .claude/skills/restack/SKILL.md (or your agent's skills folder).
name
restack
description
Propagate a branch's changes down its stacked children by merging the updated parent into each stacked branch, in order from base to tip.
when_to_use
Invoke when you've changed an earlier branch in a stack (created via /sculptor-experimental:stack) and want those commits to flow into the branches stacked on…
user_invocable
true

Restack

ARGUMENTS: $ARGUMENTS

Propagate the current branch's changes into the branches stacked on top of it. Each stacked branch was created off — and targets — its parent (that's what /sculptor-experimental:stack sets up), so "propagating" means merging each parent's updated tip into its child, in order from base to tip.

This is a merge-based restack: it brings the parent's new commits into each child with a merge commit. It does not rewrite history, so no force-push is needed and open MRs/PRs keep their commits and review threads. The merge also keeps each child's scoped diff correct — after merging parent P into child C, the diff of C against P is exactly C's own changes.

This skill uses the sculpt CLI and operates directly on the shared on-disk git repo. The agent shell already has SCULPT_WORKSPACE_ID (current workspace) and SCULPT_PROJECT_ID set.

$ARGUMENTS is optional. It may name a different root branch to propagate from; if empty, propagate from the current branch.

Step 0 — Refuse if not in a worktree workspace

Restacking only works in worktree workspaces. Every branch in the stack lives in its own git worktree sharing one on-disk .git, which is what lets this skill resolve and merge them locally. From a clone or in-place workspace the stacked branches aren't locally resolvable.

bash
sculpt workspace show "$SCULPT_WORKSPACE_ID" --json | jq -r .strategy

If the result is not WORKTREE, stop and tell the user (using their strategy name):

Restacking isn't supported from a <strategy> workspace — the stacked branches aren't locally resolvable. Restack from a worktree workspace instead.

Only proceed if the strategy is WORKTREE.

Step 1 — Discover the stack

  1. Resolve the root branch — the branch whose changes you're propagating down. Use $ARGUMENTS if it names a branch; otherwise the current branch:

    bash
    git rev-parse --abbrev-ref HEAD
  2. List the project's workspaces (stdout is clean JSON; the human-readable preamble goes to stderr):

    bash
    sculpt workspace list --json

    Each item has id, strategy, source_branch, target_branch, requested_branch_name, and is_deleted.

  3. Build the stack graph. A workspace C is a stacked child of branch P when all of:

    • C.is_deleted is false and C.strategy == "WORKTREE",
    • C.requested_branch_name is set (this is C's own branch), and
    • C.target_branch, with any leading remote prefix stripped, equals P.

    The target may be stored either bare (my-branch) or remote-qualified (origin/my-branch) — strip a leading origin/ (or other remote) before comparing. Starting from the root branch, collect its children, then their children, and so on, recording edges (parent_branch, child_branch) in base→tip order (parents before children). Guard against cycles and against a branch listing itself as its own parent.

  4. Map each branch in the stack to its on-disk worktree path:

    bash
    git worktree list --porcelain

    Match on branch name (strip the refs/heads/ prefix). Skip — with a warning — any stacked branch that has no live worktree (e.g. its workspace was deleted); also skip its descendants, since their parent can't be resolved.

  5. If the root has no stacked children, report that nothing is stacked on it and stop.

Show the user the discovered stack as a tree (root at the bottom of the stack, descendants above) before changing anything.

Show full SKILL.md (447 more words)Show less

Step 2 — Pre-flight

Root branch must be committed. Only committed work propagates. In the current worktree:

bash
git status --porcelain

If non-empty, list the affected paths and ask via the AskUserQuestion tool (mcp__sculptor__ask_user_question) whether to commit them first (infer a concise message and run git add -A && git commit -m "<msg>", surfacing the message), or proceed propagating only the already-committed work, or abort.

Dirty stacked branches. A merge won't run cleanly on a dirty tree. Check each child's worktree:

bash
git -C "<child-worktree>" status --porcelain

If any stacked branch is dirty, do not pick a policy yourself — list the dirty branches and ask the user how to resolve via the AskUserQuestion tool (mcp__sculptor__ask_user_question), offering at least:

  • Stash & re-apply — git -C <wt> stash push -u before that branch's merge, git -C <wt> stash pop after (warn that the pop can itself conflict).
  • Skip dirty branches — leave each dirty branch (and its descendants) untouched and report them.
  • Abort — stop the whole restack so the user can clean up first.

Note any stacked workspace with an actively-running agent: merging under a busy agent can disrupt its working tree. The dirty check guards uncommitted work, but flag busy agents so the user can pause them if needed.

Step 3 — Merge top-down

Process edges in base→tip order, so each parent is finalized before its children. For each edge (P, C) (where <C-worktree> is C's worktree path), merge the parent's current tip into the child:

bash
git -C "<C-worktree>" merge --no-edit "<P>"

Because edges are processed top-down, by the time you merge P into C the parent P has already received everything below it, so C transitively gets the whole chain's changes. git merge brings in only what C doesn't already have (it merges from the current merge-base), so there's no duplication.

  • Already up to date — git reports "Already up to date."; record C as unchanged (nothing new below it).

  • Merged — record C's new merge-commit SHA.

  • Conflict — abort and don't leave a half-finished merge:

    bash
    git -C "<C-worktree>" merge --abort

    Mark C as conflicted, skip all of C's descendants (their parent didn't update), and continue with branches not under C.

If "Stash & re-apply" was chosen for a dirty branch, stash before its merge and pop after (report if the pop conflicts).

Step 4 — Report

Summarize the result as a tree, with per-branch status:

  • ✅ merged — show the new merge-commit short SHA.
  • ➖ up to date — already contained its parent's changes.
  • ⏭️ skipped — dirty/declined/no worktree (give the reason).
  • ❌ conflict — needs a manual merge; suggest the command (git -C <wt> merge <P>) so the user can resolve it.

Merging does not rewrite history, so the updated branches need no force-push — a normal git push from each branch's workspace adds the new merge commit to its MR/PR when the user is ready. Leave pushing to them.

© imbue-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in sculptor/sculptor-experimental/skills/restack of imbue-ai/sculptor.

Open the folder on GitHubat commit f847102

Compare with similar skills

Restack next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Restack compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Restack this skillimbue-ai/sculptor238—~1.8kAutomated safety check: PassMIT
Finishing a Development Branchobra/superpowers297k5 repos~1.9kAutomated safety check: PassMIT
Finishing A Development Branchfarm-fe/farm5.6k34 repos~1.8kAutomated safety check: PassMIT
Git Worktree Cleanuplobehub/lobehub83k—~2.8kAutomated safety check: PassCustom licence
Pre-Release PR Triagejamiepine/voicebox57k—~3.1kAutomated safety check: PassMIT
Ccmanager Configkbwo/ccmanager1.3k—~1.5kAutomated safety check: PassMIT

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    297k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • A skill your agent uses when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for…

    5.6k GitHub starsUsed in 34 repos~1.8k tokens
    DevelopmentAuto-check passed
  • Git Worktree Cleanup

    lobehub/lobehub

    Audits stale Git worktrees and branches with a bundled script, classifies each one, and deletes only after you approve the exact candidates.

    83k GitHub stars~2.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Pre-Release PR Triage

    jamiepine/voicebox

    Sorts a backlog of open pull requests into must-merge, candidate, superseded and deferred, writes a triage doc and works the merge loop before a release.

    57k GitHub stars~3.1k tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • Ccmanager Config

    kbwo/ccmanager

    Set up, review, or repair a CCManager config — .ccmanager.json at a git repository root, or the global ~/.config/ccmanager/config.json.

    1.3k GitHub stars~1.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Builds a Cap feature in an isolated Git worktree with disposable dev resources, verification, a recorded demo and a neutral pull request, started with /building.

    23k GitHub stars~2.5k tokensUpdated today
    DevelopmentAuto-check: warnings

More from imbue-ai/sculptor

All 29 skills in this repo
  • Auto QA Iphone

    imbue-ai/sculptor

    QA the Sculptor mobile web UI on a real iOS Simulator, driven headlessly from a Mac.

    238 GitHub stars~3.1k tokensUpdated today
    Auto-check passed
  • Measure React Renders

    imbue-ai/sculptor

    Compare React component render counts between origin/main and the current branch during a user-defined UI scenario (e.g.

    238 GitHub stars~603 tokensUpdated today
    Auto-check passed
  • Post PR To Slack

    imbue-ai/sculptor

    Post a one-line PR announcement to a Slack channel, and mark it :merged: when the PR merges.

    238 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Batch Claude Runner

    imbue-ai/sculptor

    Run Claude programmatically against collections of files in the codebase.

    238 GitHub stars~308 tokensUpdated today
    Auto-check passed
  • Build Sculptor Extension

    imbue-ai/sculptor

    Build or modify a Sculptor extension — a runtime ESM module loaded into the Sculptor UI.

    238 GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Code Review Checklist

    imbue-ai/sculptor

    Review a set of code changes against Sculptor's review categories and produce a markdown findings table.

    238 GitHub stars~3.6k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Restack

What does Restack do?

Propagate a branch's changes down its stacked children by merging the updated parent into each stacked branch, in order from base to tip. Restack is an agent skill from imbue-ai/sculptor. Propagate a branch's changes down its stacked children by merging the updated parent into each stacked branch, in order from base to tip.

When should I use Restack?

Restack fits situations like: tasks that involve Git worktrees.

How do I install Restack in Claude Code?

Run `npx skills add imbue-ai/sculptor --skill restack -a claude-code`. Or copy the skill folder (sculptor/sculptor-experimental/skills/restack in imbue-ai/sculptor) into .claude/skills/restack in your project. Claude Code loads it when a task matches its description.

How do I install Restack in Codex?

Run `npx skills add imbue-ai/sculptor --skill restack -a codex`. Or copy the skill folder (sculptor/sculptor-experimental/skills/restack in imbue-ai/sculptor) into .agents/skills/restack in your project. Codex loads it when a task matches its description.

Can I use Restack in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add imbue-ai/sculptor --skill restack -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/restack, .gemini/skills/restack, .github/skills/restack and .opencode/skills/restack in your project.

What does Restack need to run?

Going by SKILL.md and its folder, Restack needs the command-line tools its instructions call (git and jq).

Does Restack access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Restack safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Restack use?

Restack is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Restack use?

About 1.8k tokens (SKILL.md is roughly 7.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Restack?

Skills that share tags, products or a category with Restack: Finishing a Development Branch (obra/superpowers, 297k stars), Finishing A Development Branch (farm-fe/farm, 5.6k stars), Git Worktree Cleanup (lobehub/lobehub, 83k stars) and Pre-Release PR Triage (jamiepine/voicebox, 57k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Restack?

imbue-ai (a GitHub organization) maintains it in imbue-ai/sculptor, which has 238 GitHub stars. The repository holds 29 skills in this directory. The repository was last updated on October 9, 2026.

Source: imbue-ai/sculptor on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.