/hub:merge — Merge Winner

Merge the winning agent's branch into base, archive losers, and clean up worktrees.

How to use it

Claude Code
  1. Run the line below. It pulls the whole folder into ~/.claude/skills/merge.
  2. 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/merge

For one project only, change the path to .claude/skills/merge.

Claude (web or desktop app)
  1. On this page open ⋯ → Download .md.
  2. Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
  3. Pick the file and Save. Claude shows the name and description and runs a security scan.
  4. Check the skill is switched on.
  5. Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
  1. ChatGPT: make a Project and paste it into Instructions.
  2. 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.
Step-by-step guide with screenshots · Ask in the forum

Paste into Claude, ChatGPT or Cursor.

Source of /hub:merge — Merge Winner

Show the full text95 lines
namedescriptioncommand
mergeMerge 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-ff for 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---
2name: "merge"
3description: "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."
4command: /hub:merge
5---
6 
7# /hub:merge — Merge Winner
8 
9Merge 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 
23If `--agent` specified, use that. Otherwise, use the #1 ranked agent from the most recent `/hub:eval`.
24 
25### 2. Merge Winner
26 
27```bash
28git checkout {base_branch}
29git merge --no-ff hub/{session-id}/{winner}/attempt-1 \
30 -m "hub: merge {winner} from session {session-id}
31 
32Task: {task}
33Winner: {winner}
34Session: {session-id}"
35```
36 
37### 3. Archive Losers
38 
39For each non-winning agent:
40 
41```bash
42# Create archive tag (preserves commits forever)
43git tag hub/archive/{session-id}/{agent-id} hub/{session-id}/{agent-id}/attempt-1
44 
45# Delete branch ref (commits preserved via tag)
46git branch -D hub/{session-id}/{agent-id}/attempt-1
47```
48 
49### 4. Clean Up Worktrees
50 
51```bash
52python {skill_path}/scripts/session_manager.py --cleanup {session-id}
53```
54 
55### 5. Post Merge Summary
56 
57Write `.agenthub/board/results/merge-summary.md`:
58 
59```markdown
60---
61author: coordinator
62timestamp: {now}
63channel: 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```bash
78python {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 
90Tell 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