# Merge Review

Reviews pending fleet worktree merges before they're accepted.

- Repository: https://github.com/SethGammon/Citadel (927 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add SethGammon/Citadel --skill merge-review -g -a claude-code -y`
Codex: `npx skills add SethGammon/Citadel --skill merge-review -g -a codex -y`
Cursor: `npx skills add SethGammon/Citadel --skill merge-review -g -a cursor -y`
Gemini CLI: `npx skills add SethGammon/Citadel --skill merge-review -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add SethGammon/Citadel`

## Description

Reviews pending fleet worktree merges before they're accepted. Reads the merge-check queue, detects file-level conflicts between branches, proposes a safe merge order, and surfaces reconciliation plans for overlapping changes.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# /merge-review, Fleet Merge Arbitration

## Orientation

**Use when:** reviewing pending fleet worktree merges before accepting them into the main branch.
**Don't use when:** reviewing general code quality (use /review); checking CI status before merging (use /pr-watch).

## When to Route Here

- "check merges"
- "any conflicts"
- "what do the fleet agents want to merge"
- "review the pending branches"
- "is it safe to merge fleet output"
- "arbitrate the worktrees"
- worktree-remove.js has queued items and the user wants to process them

## Invocation Forms

```
/merge-review              # Process the full queue
/merge-review {branch}     # Review a specific branch only
```

## Protocol

### Step 1: Read the Queue

Read `.planning/telemetry/merge-check-queue.jsonl`. Each line is a JSON object:
```json
{"branch": "fleet/task-abc", "worktree": "/path/to/worktree", "queuedAt": "ISO"}
```

If the file doesn't exist or is empty:
> "No pending merge reviews. Fleet agents haven't completed any worktrees recently."
Stop here.

If invoked with a specific branch (`/merge-review {branch}`): filter to that branch only.

### Step 2: For Each Branch, Gather Diff Data

Run `git diff main..{branch} --name-only`, `--stat`, and `git branch --list {branch}`.

If the branch no longer exists: mark `status: "merged"`, note "likely already merged. Skipped.", continue.

### Step 3: Detect Overlapping Files

Compare changed file sets pairwise. For each pair sharing files, read `git diff main..{branch} -- {file}` for both and classify:
- **Additive**: both add to the file (low risk, likely auto-mergeable)
- **Overlapping edits**: both modify the same function/section (medium risk)
- **Contradictory**: one adds, the other removes the same code (high risk)

### Step 4: Assess Risk Per Branch

The rest: https://github.com/SethGammon/Citadel/blob/HEAD/skills/merge-review/SKILL.md
