/hub:merge — Merge Winner
Merge the winning agent's branch into base, archive losers, and clean up worktrees.
How to use it
Claude Code
- Run the line below. It pulls the whole folder into
~/.claude/skills/merge. - Describe your job in plain words. Claude Code follows the skill from there.
Claude Code — installs the whole folder, not just SKILL.md
npx degit alirezarezvani/claude-skills/engineering/agenthub/skills/merge#main ~/.claude/skills/mergeFor one project only, change the path to .claude/skills/merge.
Claude (web or desktop app)
- On this page open ⋯ → Download .md.
- Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
- Pick the file and Save. Claude shows the name and description and runs a security scan.
- Check the skill is switched on.
- Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
- ChatGPT: make a Project and paste it into Instructions.
- Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
- Check which app you pasted it into — the steps above name the right one.
- Some skills need the paid tier of Claude or ChatGPT.
Paste into Claude, ChatGPT or Cursor.
Source of /hub:merge — Merge Winner
Show the full text95 lines
| name | description | command |
|---|---|---|
| merge | 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. | /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
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 |
Discussion
Browse more free Claude skills.