agentleFS
bordenetbordenet/superpowers-plus/skills/engineering/merge-authorization-gate/skill.md

merge-authorization-gate

Skill8 starsChanged 6 months agoMITView on GitHub

Hard stop before gh pr merge, glab mr merge, or any forge REST merge endpoint. These call the forge API directly -- git hooks and pre-push gates never fire. Requires an explicit human merge utterance in the current conversation, distinct from PR/MR web-UI approval and distinct from push approval.

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Ask: Has the human in THIS conversation explicitly said to merge?

    line 55
  2. Distinctive:

    Do NOT infer approval from context ("the orchestrator asked me to finish the branch", "the PR was open", "CI passed").

    line 102
  3. Distinctive:

    Do NOT call the merge command without explicit authorization.

    line 103
  4. Very specific:

    If you are an orchestrator: do NOT delegate merge execution to a sub-agent unless the sub-agent's task prompt contains the human approval …

    line 106

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

Merge Authorization Gate

Wrong skill? For git merge (local, no API -- hooks fire normally) during finishing-a-development-branch Option 1, this gate does NOT apply. For git push -- use push-authorization-gate. This gate covers gh pr merge, glab mr merge, and raw gh api / glab api calls to a merge endpoint.

Announce at start: "I'm using the merge-authorization-gate skill to verify explicit human approval before running an API-level merge."

Why This Exists

gh pr merge and glab mr merge (and gh api .../merges, glab api .../merge) call the forge REST API directly. Git hooks never fire. pre-tool-use-red-autonomy.sh gates git push but not API merges. So an API-level merge is the one integration action with no mechanical gate at all -- this skill is the gate.

An API merge lands code on a protected branch, can trigger a deploy pipeline, and on a squash/rebase merge rewrites history. Treat it as at least as sensitive as a push.

Gate Check (run this before ANY API-level merge command)

Sub-agent context: If you are executing from a task prompt with no live human conversation, skip to Sub-agent Rules below.

Ask: Has the human in THIS conversation explicitly said to merge?

Valid approval phrases (word-bounded, case-insensitive): "merge it", "go ahead and merge", "approve the merge", "run the merge", "you may merge".

Self-trigger note: The phrase that triggered this skill does NOT count as approval -- it is the trigger, not the authorization. The human must confirm after the gate states its requirements. If the human's reply directly to this gate's stop message is "merge it", treat that second utterance as approval; the gate does not re-fire on a direct response to its own requirements statement.

SituationAction
Human said an approval phrase in this conversationState the approval, run the merge, confirm the PR/MR status changed to merged
No explicit approval foundState the gate fired, present the PR/MR URL, STOP -- do not run the merge
gh api / glab api call targets a non-merge endpoint (e.g. gh api user, glab api projects/:id)Gate does not apply -- proceed

A revoke phrase ("do not merge", "cancel the merge", "hold the merge") in a later message overrides an earlier approval.

What Does NOT Count as Merge Authorization

This is NOT approvalWhy
Approval granted in a prior sessionDoes not transfer -- requires fresh approval per conversation
Human approved the PR/MR in the forge web UICode-review authorization -- separate from merge-execution authorization
"push approved" / "push it"Push and merge are independent authorizations
Human chose "merge locally" in finishing-a-development-branch Option 1That approves git merge (local, hooks fire) -- NOT an API merge
CI green / required checks passedQuality signal, not authorization
"looks good" / "lgtm" on the diffReview feedback, not a merge instruction

Permitted Merge Flow

1. git push origin <branch>            (push-authorization-gate applies)
2. gh pr create --fill  /  glab mr create --fill
3. Present the PR/MR URL -- STOP AND WAIT for the human
4. Human approves the PR/MR in the forge web UI       (code-review authorization)
5. Human says "merge it" in this conversation         (merge-execution authorization)
6. gh pr merge <n>  /  glab mr merge <iid>            -- only after step 5

Steps 4 and 5 are independent. Neither substitutes for the other.

dev -> main promotions need explicit human instruction plus a batch review (see AGENTS.md). This gate does not lower those bars.

Sub-agent Rules

Sub-agents are the highest-risk context for this gate -- a sub-agent has no human conversation history and cannot verify approval by scanning the chat.

If you are a sub-agent:

  1. Your task prompt MUST contain explicit text authorizing the merge, attributed to the human -- canonical form Human said: merge it. A bare task verb ("finish the branch and merge it") is NOT sufficient; the approval must be attributed to the human.
  2. Do NOT infer approval from context ("the orchestrator asked me to finish the branch", "the PR was open", "CI passed"). None of those are authorization.
  3. Do NOT call the merge command without explicit authorization. Attempting the call is itself the violation, even if it errors.
  4. Surface the block with: "Merge gate: no explicit human approval found in the task prompt. Stopping. The human must authorize in their conversation before this can proceed."

If you are an orchestrator: do NOT delegate merge execution to a sub-agent unless the sub-agent's task prompt contains the human approval utterance verbatim in the canonical form (Human said: <utterance>). Approval granted to you does not transfer automatically.

Failure Modes

FailureFix
Trigger phrase ("merge it") counted as approval for itselfApproval must be a distinct human utterance after the gate states its requirements; re-read the Self-trigger note
Sub-agent infers approval from CI passing or the PR being openNeither is authorization -- see Sub-agent Rules; surface the block to the orchestrator
Agent uses gh api -X PUT .../merge or glab api ... /merge directly; gate never firesAny gh api / glab api call targeting a merge endpoint is in scope -- treat it as gh pr merge for gate purposes
Confusing the forge "Approved" badge with agent merge permissionUI approval is code-review auth; agent merge needs a separate human utterance in this conversation
Treating finishing-a-development-branch Option 1 (merge locally) as API-merge approvalOption 1 uses git merge locally -- hooks fire; it does not authorize an API merge
Prior-session approval carried forwardApproval is conversation-scoped; a new session resets the gate

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.