
Merge
Merge the winning parallel-agent branch from an Agent Hub session into base, tag archived loser branches, and tear down worktrees after evaluation.
Overview
Merge is an agent skill most often used in Ship (also Build, Operate) that merges the winning Agent Hub agent branch, archives losers with git tags, and cleans up worktrees after a session.
Install
npx skills add https://github.com/alirezarezvani/claude-skills --skill mergeWhat is this skill?
- Runs `/hub:merge` with optional session id and `--agent` to override eval ranking
- Non-fast-forward merge of `hub/{session}/{winner}/attempt-1` onto the base branch with structured commit message
- Archives losing agent branches via `hub/archive/{session}/{agent}` tags then deletes branch refs
- Invokes session_manager.py cleanup for worktrees after merge
- Writes `.agenthub/board/results/merge-summary.md` for coordinator visibility
- Five-step flow: identify winner, merge winner, archive losers, clean worktrees, post merge summary
Adoption & trust: 1.4k installs on skills.sh; 17.5k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You ran multiple agents on parallel hub branches and need one authoritative merge into base without losing loser commits or leaving worktrees behind.
Who is it for?
Solo builders using Agent Hub parallel agents who already completed `/hub:eval` and want a repeatable winner merge ritual.
Skip if: Standard single-branch PR workflows without hub session branches, or repos that forbid non-ff merges without team policy review.
When should I use this skill?
After Agent Hub evaluation when you are ready to integrate the winning agent branch and tear down the session worktrees.
What do I get? / Deliverables
The eval-ranked (or explicitly chosen) winner is merged to base, loser refs are archived and removed, worktrees are cleaned, and a merge summary is recorded—then you continue normal development on the integrated branch.
- Winner merged into base branch with documented merge commit
- Archive tags for non-winning agents and merge-summary.md on the results board
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Canonical shelf is Ship review because the skill finalizes which agent attempt lands on the base branch after competitive runs—git merge and branch hygiene at delivery time. Merge winner, archive losers with tags, and post a merge summary aligns with code review and integration of the chosen implementation.
Where it fits
After three agents finish the same feature task on hub branches, you merge the top-ranked attempt into main and tag the others for later comparison.
You accept eval results and run `/hub:merge` with a no-ff merge message that documents task, winner, and session id for release notes.
You reclaim local machine resources by cleaning session worktrees once the winning branch is integrated and archives are tagged.
How it compares
Use instead of hand-merging mystery agent branches when Agent Hub already names sessions, winners, and archive tags consistently.
Common Questions / FAQ
Who is merge for?
Developers coordinating multi-agent Agent Hub sessions who need git-safe winner integration and preserved archives of losing attempts.
When should I use merge?
After Ship review when `/hub:eval` has picked a winner; in Build when closing a multi-agent implementation spike; in Operate when finalizing a session and reclaiming disk from worktrees.
Is merge safe to install?
It performs destructive git operations (branch deletes, merges); confirm backups and policy, and review the Security Audits panel on this Prism page before enabling the skill.
SKILL.md
READMESKILL.md - 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 ```bash 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: ```bash # 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 ```bash python {skill_path}/scripts/session_manager.py --cleanup {session-id} ``` ### 5. Post Merge Summary Write `.agenthub/board/results/merge-summary.md`: ```markdown --- 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 ```bash 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`