Branch Merge Manager
/hub:merge — Merge Winner

Merge the winning agent's branch into base, archive losers, and clean up worktrees. Use when the user runs /hub:merge or asks to land the winning AgentHub result and tidy the session.
--- name: "merge" description: "Merge the winning agent's branch into base, archive losers, and clean up worktrees. Use when the user runs /hub:merge or asks to land the winning AgentHub result and tidy the session." command: /hub:merge --- # /hub:merge — Merge Winner Merge the best agent's branch into the base branch, archive losing branches via git tags, and clean up worktrees. ## Usage ``` /hub:merge # Merge winner of latest session /hub:merge 20260317-143022 # Merge winner of specific session /hub:merge 20260317-143022 --agent agent-2 # Explicitly choose winner ```
Overview
Merge the best agent's branch into the base branch, archive losing branches via git tags, and clean up worktrees.
Manual install (npx, ZIP)
Claude Code
npx skills add alirezarezvani/claude-skills --skill merge -g -a claude-codeClaude Code (manual)
mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/alirezarezvani/claude-skills/tar.gz/19392f7a0826 \
| tar -xz -C ~/.claude/skills --strip-components=4 claude-skills-19392f7a0826/engineering/agenthub/skills/mergeWindows (PowerShell)
New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/e2e7506403ec8add0b56/merge.zip" -OutFile "$env:TEMP\merge.zip"; Expand-Archive "$env:TEMP\merge.zip" -DestinationPath "$HOME\.claude\skills" -ForceClaude.ai / desktop
Codex, Cursor, other agents
Connects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md2.3 KB
Read the files here
alirezarezvani/
Shared references1SKILL.md reads these from elsewhere in the repo. Not in the ZIP.
Get them on GitHub ↗SKILL.md
Show the full text95 lines
/hub:merge — Merge Winner
Merge the best agent's branch into the base branch, archive losing branches via git tags, and clean up worktrees.
Usage
/hub:merge # Merge winner of latest session
/hub:merge 20260317-143022 # Merge winner of specific session
/hub:merge 20260317-143022 --agent agent-2 # Explicitly choose winner
What It Does
1. Identify Winner
If --agent specified, use that. Otherwise, use the #1 ranked agent from the most recent /hub:eval.
2. Merge Winner
git checkout {base_branch}
git merge --no-ff hub/{session-id}/{winner}/attempt-1 \
-m "hub: merge {winner} from session {session-id}
Task: {task}
Winner: {winner}
Session: {session-id}"
3. Archive Losers
For each non-winning agent:
# Create archive tag (preserves commits forever)
git tag hub/archive/{session-id}/{agent-id} hub/{session-id}/{agent-id}/attempt-1
# Delete branch ref (commits preserved via tag)
git branch -D hub/{session-id}/{agent-id}/attempt-1
4. Clean Up Worktrees
python {skill_path}/scripts/session_manager.py --cleanup {session-id}
5. Post Merge Summary
Write .agenthub/board/results/merge-summary.md:
---
author: coordinator
timestamp: {now}
channel: results
---
## Merge Summary
- **Session**: {session-id}
- **Winner**: {winner}
- **Merged into**: {base_branch}
- **Archived**: {loser-1}, {loser-2}, ...
- **Worktrees cleaned**: {count}
6. Update State
python {skill_path}/scripts/session_manager.py --update {session-id} --state merged
Safety
- Confirm with user before merging — show the diff summary first
- Never force-push — merge is always
--no-fffor clear history - Archive, don't delete — losing agents' commits are preserved via tags
- Clean worktrees — don't leave orphan directories on disk
After Merge
Tell the user:
- Winner merged into
{base_branch} - Losers archived with tags
hub/archive/{session-id}/agent-{N} - Worktrees cleaned up
- Session state:
merged
| 1 | |
| 2 | name "merge" |
| 3 | description "Merge the winning agent's branch into base, archive losers, and clean up worktrees. Use when the user runs /hub:merge or asks to land the winning AgentHub result and tidy the session." |
| 4 | command /hub:merge |
| 5 | |
| 6 | |
| 7 | # /hub:merge — Merge Winner |
| 8 | |
| 9 | Merge the best agent's branch into the base branch, archive losing branches via git tags, and clean up worktrees. |
| 10 | |
| 11 | ## Usage |
| 12 | |
| 13 | |
| 14 | /hub:merge # Merge winner of latest session |
| 15 | /hub:merge 20260317-143022 # Merge winner of specific session |
| 16 | /hub:merge 20260317-143022 --agent agent-2 # Explicitly choose winner |
| 17 | |
| 18 | |
| 19 | ## What It Does |
| 20 | |
| 21 | ### 1. Identify Winner |
| 22 | |
| 23 | If `--agent` specified, use that. Otherwise, use the #1 ranked agent from the most recent `/hub:eval`. |
| 24 | |
| 25 | ### 2. Merge Winner |
| 26 | |
| 27 | |
| 28 | git checkout {base_branch} |
| 29 | git merge --no-ff hub/{session-id}/{winner}/attempt-1 \ |
| 30 | -m "hub: merge {winner} from session {session-id} |
| 31 | |
| 32 | Task: {task} |
| 33 | Winner: {winner} |
| 34 | Session: {session-id}" |
| 35 | |
| 36 | |
| 37 | ### 3. Archive Losers |
| 38 | |
| 39 | For each non-winning agent: |
| 40 | |
| 41 | |
| 42 | # Create archive tag (preserves commits forever) |
| 43 | git tag hub/archive/{session-id}/{agent-id} hub/{session-id}/{agent-id}/attempt-1 |
| 44 | |
| 45 | # Delete branch ref (commits preserved via tag) |
| 46 | git branch -D hub/{session-id}/{agent-id}/attempt-1 |
| 47 | |
| 48 | |
| 49 | ### 4. Clean Up Worktrees |
| 50 | |
| 51 | |
| 52 | python {skill_path}/scripts/session_manager.py --cleanup {session-id} |
| 53 | |
| 54 | |
| 55 | ### 5. Post Merge Summary |
| 56 | |
| 57 | Write `.agenthub/board/results/merge-summary.md`: |
| 58 | |
| 59 | |
| 60 | |
| 61 | author: coordinator |
| 62 | timestamp: {now} |
| 63 | channel: results |
| 64 | |
| 65 | |
| 66 | ## Merge Summary |
| 67 | |
| 68 | - **Session**: {session-id} |
| 69 | - **Winner**: {winner} |
| 70 | - **Merged into**: {base_branch} |
| 71 | - **Archived**: {loser-1}, {loser-2}, ... |
| 72 | - **Worktrees cleaned**: {count} |
| 73 | |
| 74 | |
| 75 | ### 6. Update State |
| 76 | |
| 77 | |
| 78 | python {skill_path}/scripts/session_manager.py --update {session-id} --state merged |
| 79 | |
| 80 | |
| 81 | ## Safety |
| 82 | |
| 83 | **Confirm with user** before merging — show the diff summary first |
| 84 | **Never force-push** — merge is always `--no-ff` for clear history |
| 85 | **Archive, don't delete** — losing agents' commits are preserved via tags |
| 86 | **Clean worktrees** — don't leave orphan directories on disk |
| 87 | |
| 88 | ## After Merge |
| 89 | |
| 90 | Tell the user: |
| 91 | Winner merged into `{base_branch}` |
| 92 | Losers archived with tags `hub/archive/{session-id}/agent-{N}` |
| 93 | Worktrees cleaned up |
| 94 | Session state: `merged` |
| 95 |
Details
- Updated
- Aug 30, 2026
- License
- MIT
- Stars on the repo
- ★ 26,349
- Checked
- Source
- alirezarezvani/claude-skills ↗
- Creator
- alirezarezvani · 363 listings
Similar skills
See all →
SkillCI/CD Pipeline Setup
SkillSemantic Release Automation
SkillOrca CLI
SkillWorker Coordination Engine
SkillVercel Deployment Tool
SkillPull Request ManagerMore from alirezarezvani
SkillExperiment Resume Tool
SkillExperiment Dashboard Viewer
SkillAutonomous Experiment Runner
SkillSingle Experiment Iterator
SkillAutoresearch Experiment Setup
SkillExecutive Boardroom Deliberator