Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

fix(merge): stop instructing agents to merge with --admin (#841)

Aurora Capital5899c7c7f2a3
diff --git a/claude-ops/RELEASE.md b/claude-ops/RELEASE.md
index d400089c..9bf83b93 100644
--- a/claude-ops/RELEASE.md
+++ b/claude-ops/RELEASE.md
@@ -62,5 +62,5 @@ contracts; **minor** = new skill/command/agent or backward-compatible feature;
If `ops-release` is unavailable, do the same by hand in a worktree off
`origin/main`: bump the three JSON `version` fields (plugin.json,
marketplace.json, package.json), add the CHANGELOG section, `commit --no-verify`,
-push, `gh pr create --base main`, `gh pr merge --squash --admin`, `git tag
+push, `gh pr create --base main`, `gh pr merge --squash`, `git tag
vX.Y.Z && git push origin vX.Y.Z`.
diff --git a/claude-ops/bin/ops-ship b/claude-ops/bin/ops-ship
index f702b4a2..b330a41d 100755
--- a/claude-ops/bin/ops-ship
+++ b/claude-ops/bin/ops-ship
@@ -96,16 +96,18 @@ if [ "$dry" = 1 ]; then
exit 0
fi
-# ── Apply: merge each PR (admin override = bypass required checks/reviews) ─────
+# ── Apply: merge each PR (normal merge — never bypass a branch gate) ───────────
merged=0
for row in "${PRS[@]:-}"; do
[ -z "${row:-}" ] && continue
n="${row%% *}"
- echo " merging #$n (admin override)…"
- if gh pr merge "$n" --admin --squash --delete-branch 2>&1 | sed 's/^/ /'; then
+ echo " merging #$n…"
+ if gh pr merge "$n" --squash --delete-branch 2>&1 | sed 's/^/ /'; then
merged=$((merged+1))
else
echo "ops-ship: merge of #$n FAILED — aborting before release (no partial ship)." >&2
+ echo "ops-ship: if the refusal is a required review or unresolved thread, that gate is" >&2
+ echo "ops-ship: intentional. Resolve it or get the approval — do not retry with --admin." >&2
exit 1
fi
done
diff --git a/claude-ops/docs/deploy-fix.md b/claude-ops/docs/deploy-fix.md
index b3e72f01..f7364513 100644
--- a/claude-ops/docs/deploy-fix.md
+++ b/claude-ops/docs/deploy-fix.md
@@ -15,7 +15,7 @@ _Watches every `gh pr merge` and `npm run build:_` you run, verifies the deploy,
## TL;DR
```
-gh pr merge --squash --admin
+gh pr merge --squash
│
▼ PostToolUse:Bash hook
bin/ops-deploy-fix-merge-trigger
diff --git a/claude-ops/skills/ops-merge/SKILL.md b/claude-ops/skills/ops-merge/SKILL.md
index 648fa009..a044e51c 100644
--- a/claude-ops/skills/ops-merge/SKILL.md
+++ b/claude-ops/skills/ops-merge/SKILL.md
@@ -41,7 +41,7 @@ Before executing, load:
| `gh pr list --repo <owner/repo> --json number,title,state,headRefName,statusCheckRollup,reviewDecision,mergeable,isDraft` | List PRs with status | JSON array |
| `gh pr view <n> --repo <repo> --json title,body,state,mergeable,reviews` | PR details | JSON |
| `gh pr checks <n> --repo <repo>` | CI check status | Check list |
-| `gh pr merge <n> --repo <repo> --squash --admin` | Squash merge PR | Merge result |
+| `gh pr merge <n> --repo <repo> --squash` | Squash merge PR | Merge result |
| `gh pr create --repo <repo> --title "<t>" --body "<b>" --base dev` | Create PR | PR URL |
| `gh run list --repo <repo> --limit 5 --json conclusion,name,headBranch` | CI runs | JSON array |
| `gh run view <id> --repo <repo> --log-failed` | Failed CI logs | Log output |
@@ -251,7 +251,7 @@ If user picks "Let me pick", show each PR with `[Merge]` / `[Skip]` options via
For each confirmed PR:
1. Verify CI is still green: `gh pr checks <number> --repo <repo>`
-2. If green: `gh pr merge <number> --repo <repo> --squash --admin`
+2. If green: `gh pr merge <number> --repo <repo> --squash` (never `--admin` — see "Never bypass a branch gate" below)
3. Report: `✓ Merged <repo>#<number> to <base>`
### Phase 3 — Dispatch fixers for PRs that need work
@@ -384,9 +384,12 @@ For each fixer's JSON report:
5. **If all checks pass: orchestrator performs the merge.** The fixer never had merge authority. Run:
```bash
- gh pr merge <pr> --repo <repo> --squash --admin
+ gh pr merge <pr> --repo <repo> --squash
```
+ Never add `--admin`. If the merge is refused, that refusal is the gate doing its
+ job — see "Never bypass a branch gate" below.
+
6. **Verify the merge actually landed.** Immediately after the merge call:
```bash
@@ -443,7 +446,7 @@ For each repo that has separate `dev` and `main` branches:
3. If confirmed: create sync PR: `gh pr create --repo <repo> --base main --head dev --title "chore: sync dev → main"`
4. Wait for CI: `gh pr checks <sync-pr-number> --repo <repo> --watch` (background, max 10 min)
-5. If CI green: `gh pr merge <sync-pr-number> --repo <repo> --merge --admin` (merge commit, not squash)
+5. If CI green: `gh pr merge <sync-pr-number> --repo <repo> --merge` (merge commit, not squash; never `--admin`)
6. Pull main back into dev: `git -C <path> fetch origin && git -C <path> checkout dev && git -C <path> merge origin/main --no-edit`
### Phase 7 — Final report
@@ -514,10 +517,45 @@ During this command's execution, invoke the following superpower skills at the s
- **NEVER bypass review on PRs touching auth, payments, PII, or secrets** — these require `security-reviewer` subagent audit before merge
- **NEVER run `git reset --hard` on shared branches**
- **ALWAYS use worktrees** for fixes (multiple agents may be active)
-- **ALWAYS use `--admin` only for squash merges to dev** (not main, unless `--main` flag)
+- **NEVER bypass a branch gate.** Do not pass `--admin` to `gh pr merge`, and do not
+ widen a ruleset, add yourself to a bypass list, or grant yourself admin to get a merge
+ through. A refused merge is the protection working. See "Never bypass a branch gate" below.
+- **ALWAYS confirm the base branch before merging.** Read `baseRefName` from
+ `gh pr view <n> --json baseRefName` in the same step as the merge. A run scoped to one
+ branch must refuse a PR whose base is a different one — a protected branch typically
+ carries a review gate the scoped branch does not.
- **Max 10 PRs per invocation** to avoid GitHub API throttling
- **If a PR has > 50 files changed**, flag it for manual review instead of auto-merging
+### Never bypass a branch gate
+
+`gh pr merge --admin` merges past branch protection and org rulesets. It is banned in
+this pipeline, in every phase, on every repo. So is any other route to the same outcome:
+editing a ruleset's conditions, adding an actor to a bypass list, or promoting your own
+account to get a merge through.
+
+Why it matters here specifically: a merge queue sweeps many repos at once, and repo
+governance is not uniform. Organisations commonly scope a review gate to a subset of
+repos via a repository custom property, and protect only some branches. The pipeline
+cannot see that policy from the PR alone — but the merge API can, and it enforces it.
+`--admin` throws that enforcement away silently and succeeds, so the violation is only
+discoverable afterwards, from the commit.
+
+Rules:
+
+1. Never pass `--admin` (or `--auto` as a workaround for a refused merge).
+2. Read `baseRefName` in the same step as the merge and refuse any PR whose base is
+ outside the run's declared scope. A default-branch merge and a protected-branch merge
+ are different acts with different approvals.
+3. Treat a refusal as a result, not an obstacle. `mergeStateStatus: BLOCKED` with green
+ checks usually means a required approval or an unresolved review thread. Resolve the
+ findings, request the human reviewer, report the PR as waiting, and move on.
+4. If a merge is genuinely urgent and gated, that is the owner's decision to make, not
+ the pipeline's. Surface it; never route around it.
+
+A merge that landed via bypass cannot be silently undone. Report it immediately, name
+the commit, and say which gate it skipped.
+
### Phase 0 (Salvage) Safety Rails
- **NEVER auto-delete a local branch, worktree, or stash** — even if classified `branch-already-merged`. Always surface to the user via `AskUserQuestion`.
diff --git a/claude-ops/skills/ops-orchestrate/SKILL.md b/claude-ops/skills/ops-orchestrate/SKILL.md
index 04ce4ffe..6570c305 100644
--- a/claude-ops/skills/ops-orchestrate/SKILL.md
+++ b/claude-ops/skills/ops-orchestrate/SKILL.md
@@ -56,7 +56,7 @@ Before orchestrating, load:
| `gh pr list --state open --json number,title,statusCheckRollup,reviewDecision,mergeable,isDraft` | Open PRs with status | JSON array |
| `gh pr view <n> --repo <repo> --json files,additions,deletions` | PR file diff summary | JSON |
| `gh pr checks <n>` | CI check status | Check list |
-| `gh pr merge <n> --squash --admin` | Squash merge PR | Merge result |
+| `gh pr merge <n> --squash` | Squash merge PR | Merge result |
| `gh run list --repo <repo> --workflow "<workflow>" --limit 5 --json conclusion,headBranch` | CI runs for workflow | JSON array |
| `gh run view <id> --repo <repo> --log-failed` | Failed CI logs | Log output |
| `gh issue list --state open` | Open issues | JSON array |
@@ -400,7 +400,7 @@ For each PR that passed audit:
1. **Address review comments**: read via `gh api`, resolve each
2. **CI verification**: `gh pr checks <n>` — wait via `Monitor` if still running
3. **Merge conflict resolution**: check `mergeable` state, resolve if needed
-4. **Merge to dev**: `gh pr merge <n> --squash --admin` (use `AskUserQuestion` to confirm unless `--force`)
+4. **Merge to dev**: `gh pr merge <n> --squash` (use `AskUserQuestion` to confirm unless `--force`). Never pass `--admin`: a refused merge means a branch gate applies, and the gate is the owner's policy, not an obstacle. Confirm `baseRefName` matches the branch this run is scoped to before merging.
5. **Merge dev → main** (if applicable and authorized): create sync PR, wait CI, merge
6. **Post-deploy verification**: health check, Sentry check for new errors
diff --git a/claude-ops/skills/ops-yolo/SKILL.md b/claude-ops/skills/ops-yolo/SKILL.md
index d01e5c9b..9726ef75 100644
--- a/claude-ops/skills/ops-yolo/SKILL.md
+++ b/claude-ops/skills/ops-yolo/SKILL.md
@@ -59,7 +59,7 @@ Before YOLO analysis, load:
| Command | Usage | Output |
| ------------------------------------------------------------------------------------------------------- | -------------------- | ------------ |
| `gh pr list --repo <owner/repo> --json number,title,statusCheckRollup,reviewDecision,mergeable,isDraft` | Open PRs with status | JSON array |
-| `gh pr merge <n> --repo <repo> --squash --admin` | Squash merge PR | Merge result |
+| `gh pr merge <n> --repo <repo> --squash` | Squash merge PR | Merge result |
| `gh run list --limit 20 --json status,conclusion,name,headBranch,createdAt` | Recent CI runs | JSON array |
---