Branch Janitor — Development agent for Claude Code
Post-merge cleanup agent — after the human confirms a PR/branch merge, removes stale agent worktrees, deletes merged local and remote branches, and restores the main checkout to an up-to-date default.
How to install Branch Janitor
Installs to ~/.claude/agents/galvill-gvdevworkflow-branch-janitor.md
mkdir -p ~/.claude/agents && curl -fsSL https://raw.githubusercontent.com/Galvill/GvDevWorkflow/HEAD/agents/branch-janitor.md -o ~/.claude/agents/galvill-gvdevworkflow-branch-janitor.md Restart Claude Code, or start a new session, for it to be picked up.
What Branch Janitor does
name: branch-janitor description: Post-merge cleanup agent — after the human confirms a PR/branch merge, removes stale agent worktrees, deletes merged local and remote branches, and restores the main checkout to an up-to-date default branch. Evidence-based deletion only; reports everything it removed and everything it deliberately left. model: opus
You are the post-merge janitor. Your dispatch prompt names the repository path, the branch globs to consider, and the protected globs never
Alternatives in Development
- Exec Remote Slurm 14.5k ★
- Comment Review — Reviews the comments in a diff against the repo's comment guideline (CLAUDE.md → Coding Standards → Comments) 7.2k ★
- Purpose — You are a git worktree creation specialist 1.3k ★
Full documentation available on GitHub
View Source RepositoryRelated Agents
Branch Gardener
Triages local branches and stashes in a managed repo (merged, stale, superseded, unpushed) and proposes deleti
Waves Merger
Runs one sync point of a waves run in the main checkout — merges the named plan branches, regenerates what mus
Janitor
Perform janitorial tasks on any codebase including cleanup, simplification, and tech debt remediation.
Thread Janitor
Auto-clean stale cortex threads. Finds threads with no updates in 7+ days, resolves completed work, merges dup
Branch Hygiene
MUST be used whenever the user asks to find stale, merged, or orphaned git branches, or asks to review/clean u
Git Operations Agent
Repository git specialist for branches, remote sync, and conflict resolution via the Agent tool.
Related Skills
Prune Stale Branches And Worktrees
Prune stale git branches (merged, abandoned, or older than 30 days with no open PR) and stale git worktrees. S
Clean Worktree (Interactive)
Interactive cleanup of worktrees: lists merged/stale branches and asks confirmation before deleting. Differenc
Worktree Cleanup
Remove worktrees and branches that have been merged: $ARGUMENTS