Land origin/[default branch] in the primary checkout and this worktree, delete local branches whose work is already in it, and remove idle agent worktrees. Use after a merge (the user says a PR is merged); the merge-pr skill runs it for you. Session-start cleanup is automatic (SessionStart hook). `--dry-run` previews.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Sync?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ivan-ii-tech-digital-sync)
---
name: sync
description: Land origin/[default branch] in the primary checkout and this worktree, delete local branches whose work is already in it, and remove idle agent worktrees. Use after a merge (the user says a PR is merged); the merge-pr skill runs it for you. Session-start cleanup is automatic (SessionStart hook). `--dry-run` previews.
model: haiku
argument-hint: "[--dry-run]"
---
## Mode
```text
$ARGUMENTS
```
## Step 0: Confirm the trigger
Runs only on the user's `/sync`, from the merge-pr skill's Step 6, or when the user's message says a PR is merged. Never on your own initiative.
## Run
Run the sync script (on PATH from this plugin) and relay its report. Pass `--dry-run` through when `$ARGUMENTS` contains it; ignore anything else.
```bash
ak-git-sync --dry-run # when $ARGUMENTS contains --dry-run
ak-git-sync # otherwise
```
The script lands the working branch, then removes only clean, landed, unlocked, idle worktrees and branches (never protected or `release/*`); each `kept:` line says why something stayed. The rules live in `bin/ak-git-sync` and the plugin README.
## Report
Print the script output as is: `done:` lines, then `kept:` lines. Every `kept:` line is something the script refused to touch and why; do not act on those yourself, the user decides. `warning:` lines close the report; never drop them: `plugins changed: run /reload-plugins` is the user's to type (until then the session's hooks point at the old plugin files), and a squashed-promotion warning names its fix for the user to approve. Non-zero exit → quote the error and stop.
## What this skill deliberately does NOT do
- Never deletes a branch or worktree with commits or changes not in the default branch, and never touches a locked worktree or one with a live process or recent file activity.
- Never stashes, never switches the primary checkout's branch, never resolves merge conflicts (aborts and reports), never pushes.