Merge

alirezarezvani/claude-skills/engineering/agenthub/skills/merge

by alirezarezvani19392f7a0826No license27K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 5 weeks ago

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.

Instructions onlyDevOps & CloudAI & Agents
AI-generated overview

Merges the winning agent branch into the base branch, archives losing branches as tags, and cleans up worktrees.

What it does
This skill handles the final step of an AgentHub session: it identifies the winning agent (explicitly via --agent or from the latest evaluation ranking), merges that agent's branch into the base branch with a no-fast-forward merge, and archives each losing agent's branch as a git tag before deleting the branch reference. It then cleans up session worktrees and writes a merge summary to .agenthub/board/results/merge-summary.md, updating the session state to merged. It is invoked through the /hub:merge command.
When to use it
Use it when the user runs /hub:merge or asks to land the winning AgentHub result and tidy up the session. It fits after an evaluation has ranked competing agents and a winner needs to be merged and the remaining branches archived.
Requirements
Requires a git repository with the AgentHub branch and worktree layout, plus Python to run scripts/session_manager.py for worktree cleanup and state updates. The skill is instructions only and ships no scripts itself, though it references that script path.

/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: coordinatortimestamp: {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

Source and attribution

Source:alirezarezvani/claude-skillsinengineering/agenthub/skills/mergeat commit19392f7

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal