Skip to content
Skillpedia
Agents29k · #9534

merge

What it does

This skill lands the best result from a multi-agent session and tidies up the rest. It is for people who want the winning code in their project without leftover branches.

When to use it

  • ✓When a multi-agent session has finished and you want to keep the winning result.
  • ✓When you want to keep the losing attempts without cluttering your branches.
  • ✓When you want to clean up the temporary worktrees from a session.

Skill link

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/agenthub/skills/merge/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/agenthub/skills/merge/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Merge the winning agent from the latest session and archive the other attempts.”

5 new skills a week. 1 minute to read.

How it works

The agent picks the winner, merges its branch into the base branch, saves each losing branch as a tag and removes the temporary worktrees. It also writes a merge summary to the results channel.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

/agenthub:merge — Merge Winner

Merge the best agent's branch into the base branch, archive losing branches via git tags, and clean up worktrees.

Usage

/agenthub:merge                                       # Merge winner of latest session
/agenthub:merge 20260317-143022                       # Merge winner of specific session
/agenthub: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 /agenthub: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
FAQ

Are the losing attempts deleted?

Their branches are removed, but their commits are kept in archive tags.

Can I choose the winner myself?

Yes. You can name a specific agent to merge instead of the top-ranked one.

Where is the merge summary saved?

It is written to the results channel on the agent message board.

Details

Original description by the author

Use to land the winning AgentHub branch, archive the others and clean up worktrees.

repo: alirezarezvani/claude-skills

Popularity

GitHub stars
29k
Ranking position
#9534
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills