ce-clean-gone-branches
everyinc/compound-engineering-plugin
How to install ce-clean-gone-branches
npx skills add https://github.com/everyinc/compound-engineering-plugin --skill ce-clean-gone-branchesFull instructions (SKILL.md)
Source of truth, from everyinc/compound-engineering-plugin.
name: ce-clean-gone-branches description: Clean up local branches whose remote tracking branch is gone. Use when the user says "clean up branches", "delete gone branches", "prune local branches", "clean gone", or wants to remove stale local branches that no longer exist on the remote. Also handles removing associated worktrees for branches that have them.
Clean Gone Branches
Delete local branches whose remote tracking branch has been deleted, including any associated worktrees.
Workflow
Step 1: Discover gone branches
Run the discovery script to fetch the latest remote state and identify gone branches:
bash scripts/clean-gone
The script runs git fetch --prune first, then parses git branch -vv for branches marked : gone].
If the script outputs __NONE__, report that no stale branches were found and stop.
Step 2: Present branches and ask for confirmation
Show the user the list of branches that will be deleted. Format as a simple list:
These local branches have been deleted from the remote:
- feature/old-thing
- bugfix/resolved-issue
- experiment/abandoned
Delete all of them? (y/n)
Wait for the user's answer using the platform's blocking question tool: AskUserQuestion in Claude Code (call ToolSearch with select:AskUserQuestion first if its schema isn't loaded), request_user_input in Codex, ask_user in Gemini, ask_user in Pi (requires the pi-ask-user extension). Fall back to presenting the list in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes) — not because a schema load is required. Never silently skip the question.
This is a yes-or-no decision on the entire list -- do not offer multi-selection or per-branch choices.
Step 3: Delete confirmed branches
If the user confirms, delete each branch. For each branch:
- Check if it has an associated worktree (
git worktree list | grep "\\[$branch\\]") - If a worktree exists and is not the main repo root, remove it first:
git worktree remove --force "$worktree_path" - Delete the branch:
git branch -D "$branch"
Report results as you go:
Removed worktree: .worktrees/feature/old-thing
Deleted branch: feature/old-thing
Deleted branch: bugfix/resolved-issue
Deleted branch: experiment/abandoned
Cleaned up 3 branches.
If the user declines, acknowledge and stop without deleting anything.
Related skills
More from everyinc/compound-engineering-plugin and the wider catalog.
coding-tutor
Personalized coding tutorials that build on your existing knowledge and use your actual codebase for examples. Creates a persistent learning trail that compounds over time using the power of AI, spaced repetition and quizes.
lfg
Run the full hands-off engineering pipeline from planning through a green PR.
ce-brainstorm
Explore vague or ambitious ideas into a right-sized requirements-only unified plan. Use when the user wants to brainstorm, think through scope, decide what to build, or needs collaborative product framing before planning.
ce-plan
Create structured plans for multi-step work, including software and non-software tasks. Use when asked to plan, break down implementation, plan from requirements, or deepen an existing plan; prefer ce-brainstorm for exploratory framing.
ce-compound
Document a recently solved problem or durable project vocabulary in docs/solutions/ or CONCEPTS.md. Use when capturing a learning after work.
ce-work
Execute a plan or concrete work prompt end-to-end. Use when implementing from docs/plans, a spec path, or a clear build request; use ce-debug for open-ended bugs.