Agent Native

restack

This skill propagates changes from a parent branch down through stacked child branches by merging each parent's updates into its children in order.

by ImbueOfficial publisher

Identity proven by GitHub's verified organisation badge (imbue-ai)

Agents
Claude Code
License
MIT (permissive)
Pin
f847102pinned Oct 9, 2026
Context cost
about 1,700 tokenswhen the skill loads
GitHub stars
236on imbue-ai/sculptor
Scripts
None found

What it does

“Propagate a branch's changes down its stacked children by merging the updated parent into each stacked branch, in order from base to tip.”
The author's description, from SKILL.md

Generated summary from the skill's own text

This skill propagates changes from a parent branch down through stacked child branches by merging each parent's updates into its children in order. It works only in worktree workspaces and uses the sculpt CLI to maintain proper stack relationships without rewriting history or requiring force-pushes.

When to use it

  • After modifying an earlier branch in a stack and needing changes to flow downstream
  • When a base branch receives fixes that dependent branches should include
  • To synchronize a branch stack after committing changes to a parent branch
  • To resolve dependencies between logically related branches in a stacked workflow

When not to

  • In clone or in-place workspaces where stacked branches cannot be locally resolved
  • When branches have uncommitted changes and the user declines to stash or commit them
  • If the parent branch has uncommitted work that needs to stay local

Install

These commands install from the publisher's repository and need no account.

skills CLI

npx skills add imbue-ai/sculptor --skill restack

Installs from the repository's default branch, which may have changed since the commit we checked.

GitHub CLI 2.90 or later

gh skill install imbue-ai/sculptor restack@f847102ada1d6896bf6a3a5eccde996760526d9e

Installs the commit we checked (f847102).

Copy by hand

Download the folder at f847102 and put it in .claude/skills/restack for Claude Code and in .agents/skills/restack for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.

Skill folder on GitHub at f847102

Copy for your agent

A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.

Prompt

Install the agent skill "restack" by Imbue.

Source, pinned to commit f847102ada1d6896bf6a3a5eccde996760526d9e:
https://github.com/imbue-ai/sculptor/tree/f847102ada1d6896bf6a3a5eccde996760526d9e/sculptor/sculptor-experimental/skills/restack

1. Download that folder at exactly this commit. Do not use the default branch.
2. Copy every file unchanged, keeping the folder structure, into .claude/skills/restack/ for Claude Code and .agents/skills/restack/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist.
3. Do not edit the files, and do not run any script in the folder unless I ask you to.
4. When you are done, list the files you copied and where you put them.

Listing and checks: https://www.agentnative.dev/skills/imbue/restack

SKILL.md at the pin

---
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 top of it — e.g. "update the stack", "restack", "propagate my
  changes up the stack", or after committing a fix on a base branch that the
  later branches build on. It merges each parent's new commits into its children
  so every branch in the stack ends up with the proper state.
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.

## 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.

From imbue-ai/sculptor at f847102, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.md.

View SKILL.md on GitHub at f847102

Files

1 file, 7.4 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.

Skill folder on GitHub at f847102
All 50 skills from Imbue

More from Imbue

  • architect

    Generates an architecture document for a feature by reading the existing spec, analyzing the codebase deeply, and conducting guided Q&A with the user to…

    Claude Code · about 4K tokens · pinned 7 days ago

  • build

    This skill executes a multi-step implementation plan by working through task files sequentially.

    Claude Code · about 1.1K tokens · pinned 7 days ago

  • build-sculptor-extension

    Build or modify Sculptor extensions, which are runtime ES modules that add panels, overlays, widgets, home views, or settings UI to the Sculptor frontend.

    Contains scripts

    Claude Code, Codex, Cursor +3 · about 3.3K tokens · pinned 7 days ago

  • fix-bug

    Fixes bugs using test-driven development with an interactive or autonomous workflow.

    Claude Code · about 9.8K tokens · pinned 7 days ago

  • handoff

    This skill hands off ongoing work to a fresh agent, either in the same workspace or a new isolated workspace, while preserving context through a synthesized…

    Claude Code · about 1.1K tokens · pinned 7 days ago

  • help

    This skill fetches the latest Sculptor documentation from GitHub and answers user questions about how to use Sculptor's features, including workspaces…

    Claude Code · about 880 tokens · pinned 7 days ago

All Coding workflow skills
  • planning

    This skill orchestrates multi-workflow projects with dependencies and shared data tables by creating a task graph in the orchestrator via the create-tasks tool.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +3 · about 2.4K tokens · pinned 7 days ago

  • progressive-building

    This skill implements incremental workflow development for agents building or extending workflows.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +3 · about 1.4K tokens · pinned 7 days ago

  • workflow-builder

    Builds and edits n8n workflows using the TypeScript SDK.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +3 · about 14.2K tokens · pinned 7 days ago

  • remotion-upgrade

    This skill upgrades Remotion and its related packages to the latest stable version.

    by RemotionOfficial publisher

    Claude Code, Codex, Cursor +3 · about 460 tokens · pinned 7 days ago

  • remotion-upgrade

    This skill upgrades Remotion and related packages across a project, automatically detecting the package manager and workspaces.

    by RemotionOfficial publisher

    Claude Code, Codex, Cursor +3 · about 460 tokens · pinned 7 days ago

  • final-release-review

    Audits Python SDK release candidates or plans against the previous release, comparing diffs for regressions, API changes, and version compatibility.

    by OpenAIOfficial publisher

    Contains scripts

    Claude Code, Codex, Cursor +3 · about 5.4K tokens · pinned 7 days ago

Open roles at Imbue

No open roles at Imbue on the Agent Native jobs board right now.

Browse the jobs board

The skills listed here are third-party software, collected from public GitHub repositories as a catalog of recent skills and provided as is. Agent Native does not write or control them and is not responsible for any harm, loss or damage caused by installing or using them. Labels and checks describe what we saw at one commit and are not a guarantee. Read a skill's files before you run it. Terms of use