PR: Land

Land an approved PR: merge to main, delete the branch, tag the version, sync the roadmap, clean up

SKILL.md

GitHub

PR: Land

The post-approval sequence as one skill: verify the PR is genuinely ready, merge with a merge commit (granular commits are documentation; they belong on main), then handle everything a merge leaves behind: branch, worktree, version tag, roadbook, changelog and release, each read back before the report says it exists.

Hard rule: the version guard

The 0.x → 1.x boundary is never crossed by this skill, with the one exception named at the end of this paragraph. Tagging v1.0.0 (or {plugin}-v1.0.0) declares that surface's API stable and only a human does that. The guard is programmatic: every tag this skill creates, root or plugin, always comes from safe-version-next.sh (bare for root, --plugin {name} --dir {source} for a plugin), which emits a 0.x minor bump when svu proposes 1.0.0 and passes every other bump through (2.x, 3.x major bumps are fine). Never call svu next directly here, and never hand-compute a tag or a plugin.json version. One exception, decided 2026-11-18: a plugin renamed through the marketplace's renames map whose plugin.json declares 1.0.0 out of a 0.x series; the script itself emits that tag, since the rename PR was the human decision.

The same line holds where CI does the tagging. A repo with .github/release-packages.json runs several tag series at once (one per packages[] entry, each with its own prefix such as api/v), and its CI tags each of them on push to main. Nobody creates or suggests a 1.x tag in a manifest series by hand. Only the repo's Declare Stable workflow, a manual dispatch by a signer listed in the manifest's signers[], moves a package to 1.0.0; this skill neither runs that workflow nor recommends it.

Step 0: One PR or a queue

$ARGUMENTS names one PR, or several separated by spaces (/pr-land 230 233 234; each a number or a URL). One PR: skip this step; everything below is exactly as written. Several: this skill lands them one after another, each through Steps 1 to 4 and 6 in full, with one plan approval up front and every merge keeping its own Step 2 approval; Step 5 runs once after the last landing (item 7). Nothing is skipped, merged or batched into a single command; what the queue adds is the ordering, the plan and the stop rules.

  1. Resolve and check every PR first, read-only. Per PR: gh pr view --json state,reviewDecision,mergeable,statusCheckRollup,headRefName,baseRefName,title,files, stack-status.py {number} and Step 1's readiness test (nothing pushed, nothing rebased: Steps 1.1, 1.5 and 1.6 wait for the PR's own turn). A PR whose only failure is the roadbook's charts stays in the queue marked Step 1.1 candidate, because Step 1.1 handles it in its own turn. Any other failure drops the PR from the queue with its reason, and every queued PR stacked above it goes with it.
  2. Order. A stack is one queue entry: its topmost queued layer, merged once with gh stack merge {top} --merge, which lands every unmerged layer below it (Step 2). Every unmerged layer below that entry, queued or not, is listed in the plan as lands with #{top} and a lower layer that was queued is dropped from the queue, so nothing is merged twice and no landing is missing from the plan. Everything else goes by ascending PR number, so tags and changelog sections read in the order the PRs were opened.
  3. Flag collisions before they happen. Two queued PRs whose diffs touch the same plugin's subtree (Step 1.5's test) both rewrite the version line in its plugin.json, so once the first lands the second's bump conflicts with main. safe-version-next.sh does not warn of this: it takes the highest tag in the series whether or not the branch can reach it, so the second PR proposes the next version up. Name each such pair in the plan. When the second one's turn comes, before Step 1.5 writes or pushes anything, compare git show origin/main:{source}/.claude-plugin/plugin.json with the branch's copy; if main carries a version the branch does not, skip the PR with needs a rebase onto main first and offer /branch-integrate rebase main. It is not rebased here (Step 1.1's one exception does not cover it).
  4. One plan approval. Show a table, one row per PR: order, number, title, head → base, review state, checks, stack verdict, plugins it will bump, collisions and anything dropped with why. Await approval. An edit to the list (remove one, change the order within what the rules allow) is free here; after approval the queue does not change.
  5. Land each PR in turn, Steps 1 to 4 and 6 for that PR before the next one starts: the tag, the plugin version and the changelog section are read back (Step 6) while the next PR still waits, so versions stay ordered and no tag is computed from a main that has not finished absorbing the last. Step 2's own approval comes first for each PR; the plan approval does not stand in for it. Before each later PR starts, re-run Step 1's readiness check on it against the new main (a merge can leave a sibling CONFLICTING or restart its checks).
  6. Stop rules. A merge that fails, a tag that mismatches Step 1.5's version, a failed read-back or a refused approval ends the queue where it stands: the PR in flight is reported as Step 7 reports it, and every PR not yet started is listed untouched with not started and the reason. A PR that merely turned unready (conflict, red check, needs a rebase) is skipped with its reason and the queue carries on with the PRs that do not depend on it. Never retry a PR in the same run.
  7. Roadbook sync once. Step 5's offer is made once after the last landing and covers every landed PR.
  8. One digest. Step 7's report becomes a single table: per PR its result (landed, skipped, not started), tags, the Step 6 read-backs and the reason for anything not landed, then the roadbook and cleanup lines once.

Step 1: Verify readiness

Resolve the PR from $ARGUMENTS (the one PR being landed now, when Step 0 is running a queue), then gh pr view --json state,reviewDecision,mergeable,mergeStateStatus,statusCheckRollup,headRefName,baseRefName,title.

Proceed only when: state OPEN, every entry in statusCheckRollup has finished and passed, and mergeable isn't CONFLICTING. Both halves of the rollup are default-deny, so an enum value this text doesn't name still blocks. A check run whose status isn't COMPLETED (QUEUED, IN_PROGRESS, PENDING, WAITING, REQUESTED) counts as not passed, as does a status context whose state isn't SUCCESS (PENDING and EXPECTED are the non-terminal ones); a conclusion or state of FAILURE, ERROR, CANCELLED, TIMED_OUT or ACTION_REQUIRED fails outright. A completed check run passes on a conclusion of SUCCESS, NEUTRAL or SKIPPED; a status context passes only on state SUCCESS. reviewDecision must additionally be APPROVED unless the project is solo: python3 "$HOME"/.claude/marketplace/goblin-warband/scripts/warband.py --json classify from the checkout (the flag goes before the subcommand), whose mode is solo or collaborative (stated in .claude/goblin-warband.json or its gitignored .local twin, else inferred from 90 days of authors and the reviews on merged PRs; a solo project has no reviewer, so APPROVED never appears). Quote the mode and its source in the readiness line. Anything short of that: report exactly what's unmet and stop, with one exception. A failure that comes only from the roadbook's charts goes through Step 1.1 first, because a rebase onto main usually clears it without anyone reading a log. This skill lands ready PRs; it doesn't chase approvals (pr-handle_review) or fix branches. Stack detection (see ~/.claude/library/references/stacked-prs.md): run ~/.claude/library/scripts/stack-status.py {number} and read its verdict, never the base branch alone. linked: the PR is a layer of a GitHub stack and Step 2 uses gh stack merge. chained-unlinked: the bases form a chain GitHub does not know; stop and offer /branch-stack link <bottom> ... <top> first, because gh stack merge cannot land an unlinked chain and gh pr merge would land the layer without retargeting its children. independent: an ordinary merge. A stacked merge is bottom-up and contiguous: merging this PR also merges every unmerged PR below it (the row's chain field lists them), so extend the readiness check to each of those layers too, and note any open children above (they survive the merge and retarget automatically). A layer whose statusCheckRollup is empty has had no CI and does not pass: a workflow that only runs on pull requests into main never reaches the upper layers.

Step 1.1: Chart-only failures

Only when Step 1 blocked and the repo has a rich roadbook (python3 "$HOME"/.claude/marketplace/goblin-scout/scripts/roadbook.py detect exits 0); any other block stops in Step 1 as written. CI tests the merge of the branch with main as main stood when the run started, so a chart check that fails on a branch touching no roadbook file is normally main's stale dashboard, fixed on main minutes later. A rebase onto the current main and a fresh run is all such a PR needs. This step does exactly that once and hands anything else back to Step 1's report.

The roadbook files. Read them from .claude/roadbook.json (.claude/roadmaps.json in a project not yet moved) rather than guessing paths: the JSON itself, every phase's path (its PHASE file), every phase's artefact (its chart, the rendered dashboard; docs/artefacts/chart-{slug}.html when the key is absent, roadmap-{slug}.html in a project from before goblin-scout 3.0.0) and the prose overview (docs/reports/ROADBOOK_OVERVIEW.md, or ROADMAP_OVERVIEW.md in a project from before 3.0.0). Only the dashboard is a pure render (roadbook.py render --phase {name} reproduces it byte for byte); the JSON is the source of truth and the PHASE file and overview are hand-synced by goblin-scout:tend-roadbook. A conflict in a dashboard resolves by re-rendering. A conflict in any of the other three needs judgement and is not this step's business.

One shape qualifies, nothing else does: a stale dashboard check. mergeable isn't CONFLICTING (a conflicted PR changed whatever it conflicts on, dashboards included, so it stops in Step 1 and /branch-integrate rebase main is the route), and the failed rollup entries are all the repo's chart check (CHIRPdb's is the Roadmap dashboards job running .github/scripts/check-roadmap-artefacts.py; go by the log, never the name, since another repo names its check differently). Each failed entry's detailsUrl ends /actions/runs/{runId}/job/{jobId}; read gh run view {runId} --job {jobId} --log-failed and confirm every error: line names one of the roadbook files above and nothing else. Entries still running are tolerated, since the push below restarts them anyway. Any other entry that finished without passing: stop in Step 1.

Then confirm the rebase can only help. All three must hold:

  • The branch is behind main: git fetch origin main {head}, then git rev-list --count origin/{head}..origin/main is above zero. Zero means the branch already holds main's tip, the rebase would change nothing and the failure is the branch's own: stop and report it as Step 1 would.
  • Main's own tip passes the check that failed. CI tested the branch merged into main as main stood when the run's merge ref was made (the job's checkout log names it: Merge {head} into {base}), so being behind main alone shows nothing: if main has not fixed its dashboard since, a rebase reproduces the failure and spends the push for a diagnosis available without one. Name the failed run's workflow (gh run view {runId} --json workflowName --jq .workflowName), then find main's run for its current tip (gh run list --branch main --commit "$(git rev-parse origin/main)" --workflow "{workflowName}" --limit 1 --json databaseId,status,conclusion) and read the same-named job from gh api repos/{owner}/{repo}/actions/runs/{databaseId}/jobs --jq '.jobs[] | [.name, .status, .conclusion] | @tsv'. The job's conclusion is the signal, never the run's: a main run can fail elsewhere while this job passes. success means the rebase can only help. Anything else (failed, still running, no run for that tip) means main itself is stale or unproven: stop, say so and point at goblin-scout:tend-roadbook on main, with nothing rebased or pushed. A workflow that triggers only on pull_request never runs on main, so an empty lookup there says nothing about main's health: report it as unprovable rather than stale, and have goblin-scout:tend-roadbook check main's dashboards directly. (git log --since on main's dashboards is not a substitute: a fix committed days earlier and merged later carries the older committer date, and path-limited history skips the merge that brought it in.)
  • The PR's own diff leaves the roadbook files alone: gh pr diff {number} --name-only matches none of them. The one allowed match is the roadbook JSON (.claude/roadbook.json, or .claude/roadmaps.json not yet moved) when every commit touching it is this skill's own Step 1.6 commit: git log --no-merges --format=%s origin/main..origin/{head} -- .claude/roadbook.json .claude/roadmaps.json prints only subjects starting chore(roadbook): end (or chore(roadmap): end from before goblin-scout 3.0.0; those commits set ended dates the dashboard never renders; --no-merges keeps a merge of main into the branch out of the list). Any other subject there, or any other roadbook file in the diff, is roadbook work the PR carries, so the failure is its own: stop.

Where to rebase. git worktree list --porcelain says whether a worktree already holds {head}:

  • It does: run ~/.claude/library/scripts/checkout-occupied.sh {path}. Exit 1 means another live session is working there and a rebase under it would collide with its next commit; stop and name the session, so the user can run /branch-integrate rebase main from inside it. Exit 0 with dirty_files above 0 stops too (uncommitted work would block the rebase and is not yours to stash). Exit 0 and clean: rebase in that worktree.
  • Nothing holds it: git worktree add "${TMPDIR:-/tmp}/pr-land-{repo}-{number}-rebase" {head} and rebase there. A local {head} that already exists is checked out as it stands, however far behind the remote it sits, which is why the rebase below starts with a fast-forward. Leave the worktree in place afterwards: Steps 1.5 and 1.6 need a checkout of the head branch and Step 4 removes it with the rest.

The main checkout is never switched for this, as Step 3 says.

Ask before pushing when an approval is at stake. A force-push can dismiss an existing approval on a repo that requires reviews, which costs a reviewer another pass. On a repo where reviewDecision applies, show the plan (head, how far behind, the failing check and the worktree; for a linked layer, also every active layer gh stack sync will force-push, listed as in the Rebase section below) and await approval before rebasing. On a solo project (Step 1's classify said solo) proceed, and record the pre-rebase SHA of every branch the push will move (git rev-parse origin/{head}, or origin/{layer} for each active layer of a stack) in the report so the old history is one git reset away. This rebase is the second exemption to pr-handle_review's rule against rewriting reviewed commits (the stack cascade is the first): it re-parents the PR's own commits onto main without rewording, squashing or dropping any, so reviewed content survives apart from dashboard hunks replaced by main's copy below.

Rebase. For an independent PR, from the chosen checkout:

git merge --ff-only origin/{head} &&
test "$(git rev-list --count origin/{head}..HEAD)" -eq 0 &&
git rebase origin/main

The fast-forward comes first because the fetch refreshed origin/{head} without moving the local branch, and a local branch behind the remote (a review suggestion committed in the GitHub UI exists only there) would otherwise rebase without that commit and then push over it: --force-with-lease compares against the refreshed remote, so the lease passes and the commit is gone. --ff-only refusing means local and remote have diverged: stop and report it as Step 1 would, without guessing which side wins. The count guards the other direction. A local branch ahead of the remote (a committed but unpushed WIP commit, which checkout-occupied.sh cannot see because it counts uncommitted files only) fast-forwards with Already up to date., and the rebase then carries that commit onto the PR, where --force-if-includes lets it through because the remote tip is in local history. Steps 1.5 and 1.6 push every commit they make, so a non-zero count never comes from this skill: stop as Step 1 would and name the commits (git log --oneline origin/{head}..HEAD). The three lines are chained with && so the call stops, with a non-zero exit, at the first one that fails; run as separate statements, a refused fast-forward or a non-zero count prints its message and the rebase runs anyway, reporting exit 0. Read the exit before going on.

A conflict in a dashboard can still appear mid-rebase when an intermediate commit edited it and a later one reverted it (the PR's net diff is clean, so the gate above let it through). Resolve by taking main's copy (git checkout --ours -- {path}, where --ours is main during a rebase), git add and git rebase --continue, once per commit that conflicts. A conflict anywhere else: git rebase --abort and stop as Step 1 would, naming the paths. Once the rebase completes, re-render each phase whose dashboard conflicted (roadbook.py render --phase {name}) and, if git status --short shows a change, commit it as chore(roadbook): re-render chart after rebase; a render that changes nothing confirms main's copy was already current. Then, after the gate run described under Step 1.5's "Gated pushes", git push --force-with-lease --force-if-includes: the second flag refuses the push unless the remote tip is in the local branch's history, which is the backstop should the fast-forward above ever be skipped. For a linked stack layer the rebase is gh stack sync from the stack's checkout instead (the worktree rules above apply to that checkout). Sync pushes every active layer of the stack, above this PR as well as below, so the count guard runs per layer first: git fetch origin, then for each branch in gh stack view --json | jq -r '.branches[] | select((.isMerged or .isQueued) | not) | .name' check git rev-list --count origin/{layer}..{layer} and stop on any non-zero, naming the layer and its commits. A layer with commits on both sides is unsafe too: sync skips its fast-forward silently, and the rebase that follows pushes over the remote-only commit. Sync's output must be read: it prints Sync aborted and still exits 0 when the local and remote stacks have diverged (membership or order), which says nothing about a single layer's commits.

Wait, then re-check. Straight after the push the rollup is empty while Actions registers the new commit's suites, and gh pr checks --watch exits at once with no checks reported rather than waiting (gh 2.94.0 returns that error before its watch loop starts); an empty rollup is never a pass. Nor is a non-empty one enough: the watch ends when every check it can see has finished, so a quick workflow that registers and completes before the chart one is listed would end it with the one check this step exists to re-run still absent. Poll gh pr view {number} --json statusCheckRollup until the rollup lists the chart check that failed, by the name read in the qualification above, for at most five minutes; if it never appears, stop and report it as Step 1 would. Then gh pr checks {number} --watch until every check finishes, then re-run Step 1's readiness check against the pushed commit. A chart failure that survives the rebase means main's own run was wrong about its tip or main moved again underneath: stop, say so and point at goblin-scout:tend-roadbook on main; this step runs once per landing, never in a loop. Any other failure after the rebase is reported as Step 1 reports it.

Step 1.5: Bump any touched plugin

Only when .claude-plugin/marketplace.json exists (most repos don't ship plugins; skip this step entirely when it's absent). For each plugin entry (name, source), check whether this PR's diff touches that subtree: gh pr diff {number} --name-only | grep -q "^${source#./}/". A stacked merge checks every layer's diff, not just this PR's own.

Run every command in this step from a checkout of the PR's own head branch, not main: safe-version-next.sh --dir (svu's --log.directory underneath) scans commits from HEAD, so running it from main (the common case, since Step 1 doesn't require checking the branch out) scans the wrong history and either misses the bump or, once a plugin tag exists, silently scans zero relevant commits. gh pr checkout {number} first (or cd into the worktree that already holds it, which after Step 1.1 is the rebase worktree), exactly as Step 4's cleanup later expects a checkout to exist.

For each touched plugin, run ~/.claude/library/scripts/safe-version-next.sh --plugin {name} --dir {source}:

  • Exit 0 (a real bump): note the tag it printed ({name}-v{X.Y.Z}, not created yet, just computed) and the bare version ({X.Y.Z}) for the manifest. A hand-maintained plugin (every plugin in this repo) keeps its version in {source}/.claude-plugin/plugin.json's version field. A plugin generated by a build script keeps it in that script's version source instead, found by reading the plugin's own docs rather than assumed. Read the current value first: if it already equals {X.Y.Z} (someone bumped it by hand, or this step already ran once on this branch), skip the commit rather than trying to commit a no-op. Otherwise write the bare version there (and rerun the build script, for a generated plugin), then commit onto the PR branch: git commit -m "chore({name}): bump plugin version to {X.Y.Z}" and push. This becomes part of what gets merged; it is no exception to the "never amend or rebase reviewed commits" rule (whose only exemptions are the stack cascade and Step 1.1's rebase), because it is a brand new commit, not a rewrite of one the reviewer already saw. For a generated plugin, git status --short its output directory after the build and commit any diff, since the version alone changing isn't the only reason the build could differ.
  • Exit 3 (nothing to release): the touching commits were all docs/chore/refactor-type, nothing version-worthy. Leave the plugin's version untouched; note this in the Step 2 summary so it's not mistaken for an oversight.
  • Exit 2 (environment error): stop and report; don't guess a version by hand.

A plugin's own bump commit is scoped to that plugin's subtree only (the version bump, plus the rebuild output for a generated plugin); never bundle unrelated changes into it. Multiple touched plugins in one PR each get their own bump commit, pushed in the same batch before Step 2's confirmation.

Gated pushes. Where the repo sets push_gate in its goblin-warband config, the PreToolUse hook refuses a git push of a HEAD with no green record, and the pushes in Steps 1.1, 1.5 and 1.6 are all of that kind (tag pushes and deletions pass). Before each of them run python3 "$HOME"/.claude/marketplace/goblin-warband/scripts/warband.py gate from the checkout that holds the new commit and wait for green; in a queue that is one suite run for every PR that gets a commit. A red gate stops that PR as any other failed readiness does. Where the repo sets no push_gate, skip this.

Pushing restarts checks. A push here can dismiss an existing approval or re-queue CI on a repo that has either; re-run Step 1's readiness check against the pushed commit before proceeding to Step 2, rather than trusting the state Step 1 read before this step existed.

Step 1.6: Stamp end dates

Only when the repo has a rich roadbook (python3 "$HOME"/.claude/marketplace/goblin-scout/scripts/roadbook.py detect exits 0); otherwise skip silently. It runs on the PR's head branch, in the same checkout as Step 1.5, because the roadbook it edits is the branch's own and the date has to merge with the work. Never commit it to main afterwards: Step 3's rule stands.

  1. Preview: python3 "$HOME"/.claude/marketplace/goblin-scout/scripts/roadbook.py stamp-ended --base origin/{default branch} --pr {number} --dry-run --json. The set is every done task that was not done at the branch's merge-base with the default branch, plus any done task whose pr is this PR's number, minus tasks that already have ended. Using the default branch as the base, even for a stacked PR, makes the set span every layer this merge lands.
  2. Non-zero exit: the CLI prints a plain ✗ line, not JSON; relay it word for word. If it says the roadbook JSON is not in canonical form, say that a write would reformat the whole file and rerun the preview with --reformat solely when the user agrees, keeping the flag on the write. On a refusal or any other failure (no merge-base with origin/{default branch}, a phase the merge-base cannot read, a bad --date, an unreadable roadbook on exit 2), skip this step, say in the Step 2 summary that no end dates were stamped and carry on; goblin-scout:tend-roadbook in Step 4 backfills them.
  3. Empty tasks: nothing to do, move on. Otherwise rerun without --dry-run, then git commit -m "chore(roadbook): end {IDs}" -- .claude/roadbook.json (the roadbook file only), run the gate as Step 1.5's "Gated pushes" describes, then push. On a branch still holding .claude/roadmaps.json, that write is goblin-scout's first and moves the file (its one line of notice on stderr says so): stage the new file and commit both paths, git add .claude/roadbook.json && git commit -m "chore(roadbook): end {IDs}" -- .claude/roadmaps.json .claude/roadbook.json, since committing the old path alone records only its deletion.
  4. The date is today, which is the landing day. If the PR sits waiting past midnight, pass --date with the day the approval to merge is given.

A task the PR finished but that is not marked done on the branch is not stamped; say so in the Step 2 summary so it is not mistaken for an oversight (goblin-scout:tend-roadbook fixes the status and backfills the date later). Like Step 1.5, this push restarts checks: re-run Step 1's readiness check against the pushed commit before Step 2.

Step 2: Confirm and merge

Show a one-line summary (title, head → base, review state, checks) and await approval; merging is irreversible in practice. For a stacked PR the summary must list every layer the merge will land (this PR plus all unmerged PRs below it): the approval covers the lot. If Step 1.5 bumped any plugin, list each one's new version and the commit that carries it, so the approval covers that too. If Step 1.6 stamped end dates, list the task IDs and the date. Then, for an ordinary PR:

gh pr merge {number} --merge --delete-branch

For a stacked PR:

gh stack merge {number} --merge

Do not run plain gh pr merge on a stack (the docs say the legacy merge endpoint can't merge stacks). Always name the PR: gh stack merge {number} --merge, never a bare gh stack merge, a stack number or --yes alone. In Claude's shell, which has no terminal, gh stack merge merges everything it names without prompting, so a bare invocation lands every layer including those above the PR just approved. Stack numbers and PR numbers never overlap (gh stack link --help), so there is no collision to work around; before running, confirm the layers gh stack merge {number} would land match the approved summary. It lands that PR and every unmerged layer below it, all or nothing, bottom-up (whether each layer gets its own merge commit is unverified: check git log --first-parent after the first real stacked landing); open PRs above retarget main via GitHub's server-side rebase, which produces unsigned commits. gh stack merge has no --delete-branch, so afterwards delete each merged layer's remote branch (git push origin --delete {branch}), but only after confirming no open PR still targets it (gh pr list --base {branch}; retargeting is normally immediate).

Merge commit, never squash or rebase: the branch's atomic commits are the history. --delete-branch removes the remote branch and, where the local branch isn't checked out elsewhere, the local one too.

If child PRs remain open above the merge point, run gh stack sync --prune from a checkout of the stack so the surviving local branches rebase onto the new main and stale refs go; /branch-stack sync is that command with its checks. Once every layer has landed, the stack's entry in local tracking is stale: /branch-stack tidy.

Step 3: Tag the version

The main checkout is never switched, pulled or committed to here. Another session may be working in it, and a branch change under that session sends its next commits to the wrong branch. Everything after the merge runs in a detached landing worktree on origin/main, created from wherever the shell is:

git fetch origin main --tags \
  && git worktree add --detach "${TMPDIR:-/tmp}/pr-land-{repo}-{number}" origin/main \
  && cd "${TMPDIR:-/tmp}/pr-land-{repo}-{number}"

The path is built from the repo name and PR number because shell variables don't survive between commands; later steps rebuild the same string.

Then find out whether CI tags this repo. Look on the default branch for a workflow that creates tags on push:

git grep -lE 'git tag|svu|semantic-release|release-please|tag-action' origin/main -- .github/workflows

Read each hit (git show origin/main:{path}) to confirm it runs on a push to the default branch and pushes a tag for this series. A repo with .github/release-packages.json on the default branch tags one series per packages[] entry, so one landing may produce several tags; read the manifest (git show origin/main:.github/release-packages.json) so the prefixes are known before the run finishes.

A tagging workflow exists: defer to it and create no tag. Find its run for the merge commit and wait for it:

gh run list --workflow {file} --commit {mergeSha} --json databaseId,status,conclusion
gh run watch {databaseId} --exit-status
git fetch origin --tags && git tag --points-at {mergeSha}

Report every tag that git tag --points-at {mergeSha} returns, one line each, not just the first: a manifest repo tags each touched package separately (api/v0.2.0 and db/v0.1.1 from one merge, say). An empty list means CI found nothing to release; say so. A failed or missing run gets reported as it stands and tagging stops there: a hand-made tag on a repo whose CI tags is how tag and changelog drift apart. If any CI tag crossed 0.x → 1.x, say so plainly in the report; in a manifest series that can only have come from the Declare Stable workflow, never from this landing, so an unexpected 1.0.0 is worth a sentence to the user.

No tagging workflow: tag from the landing worktree.

TAG="$("$HOME"/.claude/library/scripts/safe-version-next.sh)" \
  && { git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1 \
       && echo "$TAG already on origin, leaving it alone." \
       || { git tag "$TAG" && git push origin "$TAG"; }; }

The ls-remote check is a backstop for a tag source the grep missed; it costs one no-op round-trip everywhere else. A multi-layer stack merge is one landing event: tag once for the lot, never once per layer. Push the single tag, never git push --tags (that publishes every local tag, strays included). Script exit 3 means nothing to release: no version-bumping commits since the current tag (a docs-only or chore-only PR); say so and skip to Step 4. Script exit 4 means the repository's versioning policy omits this target from tagging (root is in omit-gh-tag in .claude/versioning.json; project-versioning_policy shows and sets it): no root tag, no root release and no new root changelog section, because a section is keyed on a tag. The landing's changes stay under [Unreleased] (latestTag..HEAD), so nothing is lost; Step 6 skips root, and /doc-changelog root md brings [Unreleased] up to date whenever it should read current. Say so in the report and carry on with any plugin tags. If the script printed its 0.x guard note to stderr, relay it: the user should know a major bump was requested and deliberately held at 0.x.

Any plugin Step 1.5 bumped gets tagged here too (unless the CI workflow covers that plugin's tag series as well), same landing event, same ls-remote-before-push pattern, with --plugin {name} --dir {source} on safe-version-next.sh and {name}-v{X.Y.Z} as the tag. Since the version was already computed and committed pre-merge, this recomputes the same value from the now-merged commit (the tag anchors to the merge commit, not the pre-merge bump commit) rather than reusing the Step 1.5 string outright: if something else landed on main between Step 1.5 and the merge, this is the check that catches drift. A mismatch here (the script proposes something other than what Step 1.5 bumped to) means main moved under you; stop and report rather than tagging something that no longer matches plugin.json. Exit 4 for a plugin reads as it does for the root: the policy omits that plugin's tag series, so it gets no tag, no release and no new changelog section (its changes wait under [Unreleased]); its plugin.json version still advanced in Step 1.5 as the manifest's own record.

Step 4: Clean up the checkout

Steps 1 and 2 run from the landing worktree: it sits outside the branch's own worktree, and its HEAD holds the merge, which is what git branch -d checks against.

  1. If a worktree held this branch (git worktree list), remove it, from outside it, never while the shell is inside. A stack merge may have landed several branches; clean up each merged layer's worktree, but leave the worktrees of still-open child PRs alone (post-sync they're live work, not leftovers).
  2. If the local branch survived (it was checked out somewhere), git branch -d {branch}: only -d; a refusal means unmerged commits and stops the line, not -D.
  3. Remove the landing worktree last, standing in the main checkout without touching its branch: cd "$(git rev-parse --path-format=absolute --git-common-dir)/.." && git worktree remove "${TMPDIR:-/tmp}/pr-land-{repo}-{number}" && git worktree prune.
  4. Bring the main checkout up to date only when that is safe. Run ~/.claude/library/scripts/checkout-occupied.sh there: fast-forward with git pull --ff-only when it exits 0 and its JSON shows branch as main and dirty_files as 0. Anything else (another live session, a different branch, uncommitted files), leave the checkout exactly as it is and name the reason in the Step 7 report.

Step 5: Roadbook sync

If the repo has a rich roadbook (python3 "$HOME"/.claude/marketplace/goblin-scout/scripts/roadbook.py detect exits 0), offer to run the goblin-scout:tend-roadbook skill so the merged work's waypoint lands as done and the projections refresh; it also backfills any done waypoint whose ended Step 1.6 missed. Offer, don't assume; the PR may not map to a waypoint.

Step 6: Changelog and release

Every tag Step 3 produced gets its changelog section now, in this session, rather than as an offer the user has to take up: the landing is not finished until the changelog says what landed. Skip this step only when the repo has no CHANGELOG.md and the user has not asked for one.

Map each tag to a doc-changelog scope: the root v* tag is root; a plugin tag {name}-v{X.Y.Z} from Step 1.5 is plugin:{name}; on a manifest repo a CI tag whose prefix matches a packages[] entry's prefix is pkg:{name} (api/v0.2.0 pairs with the entry whose prefix is api/v, so pkg:api), and a tag matching no entry is reported in Step 7 and gets no run.

A target whose Step 3 script exited 4 produced no tag, so it has no section to write here.

The policy first. Step 4 leaves the shell in the main checkout, which may be on any branch, so every policy call in this step passes --ref origin/main (Step 3 already fetched it): the tracked policy is read as main committed it, which is what Step 3's landing worktree read, and the local twin is read from the repository's git directory as always. python3 "$HOME"/.claude/library/scripts/versioning-policy.py check changelog {target} --ref origin/main (the target is root or the plugin's name) exits 0 when the repository omits that target's changelog: skip the scope entirely and say so in Step 7. Otherwise check release {target} --ref origin/main exiting 0 means the changelog section is written and no release is made, whatever releases the series carries from before; the one-word reason in Step 7 is omitted by policy. The policy file is .claude/versioning.json, set through project-versioning_policy.

Then, release only where the series already publishes releases. For each scope the policy did not settle, gh release list --limit 100 --json tagName -q '.[].tagName' and look for any tag in the same series: v followed by a digit for root, {name}-v for a plugin, the manifest prefix for a package. A series with at least one release gets /doc-changelog {scope} md release {tag}; a series with none gets /doc-changelog {scope} md {tag} and no release is created, since starting a release series is the user's decision, not a landing's side effect. doc-changelog's own approval gate on the draft applies as normal, and its Step 3 commits the section straight to main from its own worktree, so the landing worktree removed in Step 4 is not needed here.

Then verify by reading back, one line each in Step 7:

  • Tag: git ls-remote --tags origin "refs/tags/{tag}^{}" (or without ^{} for a lightweight tag) resolves to the merge commit from Step 2, or to the commit CI tagged. A tag on any other commit is reported as drift and not corrected here (a hand-moved tag is how tag and changelog diverge).
  • Plugin version: git show origin/main:{source}/.claude-plugin/plugin.json carries the version Step 1.5 bumped to.
  • Changelog: git show origin/main:{changelog-path} has a ## [{version}] heading for the tag.
  • Release, only where one was made: gh release view {tag} --json tagName,body -q .body is non-empty. doc-changelog already compared it with the section; an empty body here means that comparison was skipped and the release is repaired with gh release edit {tag} --notes-file from the section, then read back again.

Step 7: Report

A queue (Step 0) reports once, as the table Step 0 item 8 describes, with the lines below filled per PR.

PR merged (URL), every tag created (root, any bumped plugin and each tag CI returned in Step 3), branch/worktree state after cleanup, roadbook synced or skipped, the task IDs given an end date by Step 1.6, and the Step 6 read-backs: changelog section per tag, release created or deliberately skipped (and why) per series, each verification line. Offer /goblin-seneschal:proclaim-changes {previousTag} so the user sees what they can now do that they couldn't before this landing.

Red flags

Never: cross 0.x → 1.x on any tag series, root or plugin, except where safe-version-next.sh emits it for a renamed plugin (the guard script is the only tag source); create or suggest a 1.x tag in a release-packages.json series (only the Declare Stable workflow, dispatched by a listed signer, does that); squash or rebase-merge; merge with failing or pending checks "because they'll pass"; rebase a branch for any failure other than the roadbook chart check, rebase it twice in one landing or rebase it in a worktree another session holds; hand-merge a conflicted dashboard instead of re-rendering it; run git checkout, git switch or a bare git pull in the main checkout; create a tag on a repo whose CI tags; remove a worktree from inside it; use git branch -D; tag before the merge has actually landed on main; run plain gh pr merge on a stacked PR, or run gh stack merge with no PR number, with a stack number or with --yes alone (use gh stack merge {number} --merge); delete a branch that is still the base of an open PR; hand-edit a plugin's version field or its build output instead of running safe-version-next.sh and the plugin's own build script; in a queue, merge a PR the approved plan did not list, treat the plan approval as Step 2's approval, start the next PR before the last one's tag and changelog are read back, rebase a queued PR to clear a version collision or carry on past a failed merge, tag mismatch or read-back.

<raw-arguments value="$ARGUMENTS" />