Pr merge

From the-agency-ai/the-agency · View interactive version

Pr merge is an AI agent skill from the GitHub repository the-agency-ai/the-agency. Merge a PR safely — true merge commit (never squash, never rebase), branch protection respected, --principal-approved gate for --admin override.

How to use this skill

Skill file

<!--

Flag #62/#63: allowed-tools removed. Inherits Bash(*) from

.claude/settings.json. Restricting to specific subcommand patterns at the

skill level silently blocks agents on permission prompts the agent cannot

see — see dispatch #171 for the devex incident that surfaced this trap.

-->

PR Merge

Safe wrapper for merging PRs. Always uses true merge commit (never squash,

never rebase). Respects branch protection by default. Requires explicit

principal authorization for --admin override.

This skill exists because raw gh pr merge is too easy to misuse:

When to use

in chat), ready to land.

pushing the resolution.

When NOT to use

Arguments

OK'd the merge. ONLY way to enable --admin override. Logged for audit.

Steps

Step 1: Pre-flight

  1. Confirm the PR number (ask if missing).
  2. Confirm you're not on the PR's branch — captain merges from main or any

non-PR branch.

  1. If you're going to use --principal-approved, confirm the principal

has authorized in this conversation. Don't infer authorization.

Step 2: Invoke the tool

./agency/tools/pr-merge <N>

Or with explicit principal approval (only if they verbally OK'd):

./agency/tools/pr-merge <N> --principal-approved

Step 3: Handle the outcome

On success: report the merge URL and the next-steps (sync local main via

./agency/tools/_sync-main-ref or wait for next captain /post-merge).

On branch-protection block (exit 3): the tool prints the gate that's

blocking. Two paths:

re-run.

but not in GitHub UI, re-run with --principal-approved.

On merge conflict (exit 1): resolve locally first:

gh pr checkout <N>
./agency/tools/git-safe merge-from-master --remote
# resolve conflicts in working tree
./agency/tools/git-safe add <files>
./agency/tools/git-captain merge-continue
./agency/tools/git-push <branch>
# then retry
./agency/tools/pr-merge <N>

Step 4: Post-merge

After a successful merge:

What this skill does NOT do

commit.

Why never squash, never rebase

Both rewrite history. The framework is built on visible, append-only history:

The cost is heavier git log output. The benefit is you can SEE what

happened and WHY, which is essential when fleet agents and adopters all

have to read the same history.

Reference

OFFENDERS WILL BE FED TO THE — CUTE — ATTACK KITTENS!

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.