/git-sweep:git-sweep [base-branch]from git-sweep
Interactively cleans stale git branches and worktrees. Audits local/remote branches, detects squash/rebase merges, frees finished worktrees, and confirms before deleting.
Ships in git-sweep. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Route to the correct cleanup phase based on repo state. The phase files
audit.md and apply.md live in this skill's base directory.
/git-sweep dev;
empty lets the backend resolve the trunk: git config sweep.base,
then origin/HEAD, then main/master/trunk/dev/develop)git branch --show-currentgit rev-parse --show-toplevelgit worktree listtest -f "$(git rev-parse --absolute-git-dir)/git-sweep-manifest.json" && echo "yes" || echo "no"test -x "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-audit.ts" && test -x "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-apply.ts" && echo "ok" || echo "missing"if tools == "missing":
STOP — tell user: git-clean-audit and/or git-clean-apply not executable.
Run: chmod +x "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-audit.ts" "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-apply.ts"
if pending == "yes":
# A previous run left operations unexecuted (partial failure, or an
# interrupted hand-off). The file holds an already-confirmed selection.
AskUserQuestion:
header: "Manifest"
question: "A pending cleanup manifest exists. Apply it, or re-audit?"
options: "Apply pending manifest (Recommended)"
| "Re-audit (overwrites it)"
if "Apply pending manifest":
Read apply.md and follow it
(do not continue below)
Read audit.md and follow it
The audit phase handles all "nothing to clean" detection itself (local branches, remote branches, worktrees). Do not short-circuit here.
sweep.base — trunk to audit against when no argument is givensweep.protect (multi-valued) — extra branches never proposed for deletionsweep.unprotect (multi-valued) — lift names from the default protected
set (main, master, trunk, dev, develop); the audited base stays protectedsweep.agentPrefix / sweep.backupPrefix — classification prefixes
(defaults worktree-agent-, backup/; they must not overlap)sweep.maxAgeDays — age bound for the containment test (default 180)Suggest the right key when a repo needs it (custom trunk name, other branch conventions); never set one without the user asking.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub bengous/claude-code-plugins --plugin git-sweep2 skills in this plugin