worktree-merger

worktree-merger is a skill for Claude Code from PenguinMiaou/claude-hive. It costs 37 tokens per session (1,766 once invoked), scanned C, original, MIT.

A set of instructions for managing code changes from several AI agents and merging them into the main branch, the project's primary shared branch.

In plain words
What is it for?
It is for checking repository readiness, reviewing open GitHub pull requests, resolving conflicts, and verifying changes before merging.
Why use it?
It creates a review and verification process so changes from different branches are checked before they enter the main codebase.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md; mentions Codex.

Part of the claude-hive plugin — 2 skills, 3 commands shipped together

Good fit It is for checking repository readiness, reviewing open GitHub pull requests, resolving conflicts, and verifying changes before merging.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/penguinmiaou/claude-hive/worktree-merger
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add PenguinMiaou/claude-hive --skill worktree-merger
Clone the repo
git clone --depth 1 https://github.com/PenguinMiaou/claude-hive

Made for: Claude Code.

Or install claude-hive, the plugin that ships this one along with the rest of its 2 skills, 3 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for worktree-merger

README.md
[![agentmods](https://agentmods.dev/badge/skills/penguinmiaou/claude-hive/worktree-merger/github.svg)](https://agentmods.dev/skills/penguinmiaou/claude-hive/worktree-merger)
Your own site
<a href="https://agentmods.dev/skills/penguinmiaou/claude-hive/worktree-merger"><img src="https://agentmods.dev/badge/skills/penguinmiaou/claude-hive/worktree-merger/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for worktree-merger

Your own site · 80×15
<a href="https://agentmods.dev/skills/penguinmiaou/claude-hive/worktree-merger"><img src="https://agentmods.dev/badge/skills/penguinmiaou/claude-hive/worktree-merger.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,766 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.01766
Opus 5 $0.00018 $0.00883
Sonnet 5 $0.00007 $0.00353
Haiku 4.5 $0.00004 $0.00177

Measured 10d ago against content hash 1029a512921b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade C, and why

worktree-merger scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf apps/web/.next

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

if curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 2>/dev/null | grep -q "200"; then
skills/worktree-merger/SKILL.md · 247 lines

How it starts

The opening of the file, as written. The whole thing — 247 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Worktree Merger

Overview

Mode-switch skill for multi-agent collaboration. Activates merger role at window start — immediately presents situational awareness and is ready to merge on command.

Core principle: You are the sole gatekeeper of main. Nothing enters without full verification and one final audit against the latest main.

Announce at start: Display situational awareness (see Activation Sequence).

Prerequisites Check

On activation, verify:

# GitHub remote is required
git remote -v | grep -q "github" || echo "ERROR: No GitHub remote."

# gh CLI must be authenticated
gh auth status 2>/dev/null || echo "ERROR: gh CLI not authenticated."

# Must be on main branch
[ "$(git branch --show-current)" = "main" ] || git checkout main

Activation Sequence

/worktree-merger
  → Run prerequisites check
  → git checkout main && git pull
  → Read COORDINATION.md
  → Read CLAUDE.md
  → Run /coordination-audit mindset over current queue
  → gh pr list --state open
  → Present situational awareness:
    "Merger role activated.

     Ready to merge:
     1. feat/table-v2 #12 — ready (scope: lib/table/*)
     2. feat/chart-export #13 — ready (scope: lib/export/*)

     Conflict warnings:
     ⚠️ #12 × #13 → lib/types/presentation.ts

     Suggested order: #12 → #13 (#13 depends on #12's type changes)

     Which branch to merge?"

Hard Constraints

  • ✅ ONLY role that can merge to main
  • ✅ MUST pass full verification before marking merged
  • ✅ MUST run one final audit before merging
  • ❌ NEVER skip verification steps
  • ❌ NEVER auto-resolve logical conflicts (must present to user)

Merge Workflow

When user says "merge feat/xxx" or "merge #12":

Step 1: Pre-merge check

git checkout main
git pull origin main
# Verify branch exists and PR is ready
gh pr view <number> --json state,mergeable,reviewDecision,isDraft

Block merge if:

  • PR is still draft
  • PR has blocking review state such as CHANGES_REQUESTED
  • Queue ordering says another dependency should merge first

Read the full file on GitHub · 247 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 247 lines · 37 tokens per session scan C 1029a512921b

Subscribe to this mod's changes

worktree-merger is a skill published in the GitHub repository PenguinMiaou/claude-hive (1 stars, last pushed 5mo ago), licensed MIT. It adds 37 tokens to every session and 1,766 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

pr-from-stale-branch-silently-reverts-newer-main-files

Trap: merging a PR whose branch carries an OLD TREE silently DELETES (reverts) files that landed on main after that tree was built — with NO merge conflict to warn you, because a deletion your own commit records is not a conflict. Use when: (1) about to gh pr create or squash-merge from a long-lived / earlier-branched…

wan-huiyan/agent-traffic-control · 387 tokens

parallel-pr-scope-overlap-tiebreaker-delta-check

Before applying a handoff prompt's tiebreaker default ("merge the first-mover", "the clean-against-main one", "the one with reviewer APPROVE") to pick a winner between two parallel PRs that implemented the SAME scope, run gh pr diff on BOTH and audit for substantive deltas. Use when: (1) a session prompt or handoff…

wan-huiyan/agent-traffic-control · 384 tokens

stacked-pr-review-per-base-diff-and-attach

Reviewing a stack of dependent pull requests: diff each one against ITS OWN base rather than against main, and attach the reports to the bottom branch.

wan-huiyan/agent-traffic-control · 43 tokens

subagent-reports-complete-but-pr-unmerged

Catch the systematic gap between sub-agent "completed" status and the actual end state of a PR-merge orchestration task. Use when: (1) you've dispatched multiple parallel sub-agents (general-purpose or specialist) to open + review + merge PRs, (2) the parent receives with status: completed but the sub-agent's last…

wan-huiyan/agent-traffic-control · 372 tokens

working-tree-edits-stranded-on-squash-merge

Diagnose and prevent "I made the fix but it's not on main" cases where the fix was applied in the working tree via Edit / Write but never git added before the squash-merge. Use when: (1) you squash-merged a PR and the user reports the issue is back, (2) git status after the merge shows uncommitted changes for files…

wan-huiyan/agent-traffic-control · 236 tokens

babysit

Watch a pull request or review cycle until it is ready to merge. Use when asked to babysit, monitor, or keep checking PR comments, reviews, and CI until all actionable issues are resolved.

thedotmack/claude-mem · 44 tokens