land-stack
Skill1 starsChanged 57 days agoMITView on GitHub
Merge a finished ticket pull request stack oldest first, close each ticket, and retire each ticket worktree after its merge. Use when the user asks to land, merge, or ship a finished stack, or to clean up worktrees after merging.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- huntie/skillstheir own version, first seen Nov 1, 2026
- Neko-Catpital-Labs/Invokertheir own version, first seen Mar 23, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Neko-Catpital-Labs/Invoker★ 20same name
- huntie/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- bb-worker-protocolSkill
- codebase-docs-cleanupSkill
- orchestrate-implementationSkill
- review-fix-loopSkill
- run-statusSkill
- show-meSkill
- verify-landingSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Stop at the first PR that cannot merge.
- Very specific: line 40
Read the run ledger: the attached path, else $BB_THREAD_STORAGE/orchestrate-implementation/run.json.
- Very specific: line 49
Verify authenticated gh, push access, and the tracker workflow in docs/agents/issue-tracker.md.
- Very specific: line 113
Write tickets.<id>.state: merged, then continue with the next ticket.
≈ “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.
Files
Land Stack
Take a finished orchestrate-implementation run from "every ticket has a
draft PR" to "every PR is merged and every issue is closed". Each ticket keeps
its own chained worktree until its merge is confirmed on the remote, then its
environment is retired. Landing is one-way, so each step proves its precondition before acting.
Contract
- Land oldest first. A PR merges only when it targets the target branch, its head equals the ledger's accepted head, and its checks are green.
- Human approval is optional. Without
--require-approvals, the loop gate and green checks are the review. Say so in the report. - Stop at the first PR that cannot merge. Merged tickets stay merged; the run
pauses with the ledger and evidence, and
resumecontinues from the next. The order is mechanical, not policy: no one's authority over the repository makes a later PR safe to land while an earlier one is red. - Archive a ticket environment only after its merge is confirmed on the remote.
- Work from the ledger: read
run.json, write every transition.
References
This skill spawns no workers. It needs
../bb-worker-protocol/references/run-lifecycle.md to carry it between turns
and ../bb-worker-protocol/references/github.md to decide how the gh
commands below actually run. Use
../bb-worker-protocol/references/pr-stack.md to bring each child onto the
target branch. The ledger schema is
../bb-worker-protocol/references/run-ledger.md; landing fills
tickets.<id>.landing and the top-level landing object.
Prepare
- Read the run ledger: the attached path, else
$BB_THREAD_STORAGE/orchestrate-implementation/run.json. Requirestate: finished, orlandingalready present forresume. Reconcile every PR withgh pr viewbefore the first transition. - Pick the merge method:
--methodwhen given, else the first allowed of merge, squash, rebase fromgh api repos/{owner}/{repo} --jq '[.allow_merge_commit,.allow_squash_merge,.allow_rebase_merge]'. A merge commit keeps children retargetable; squash and rebase need the rebase path for every child. - Verify authenticated
gh, push access, and the tracker workflow indocs/agents/issue-tracker.md. Recordlandingin the ledger.
Land one ticket
For the oldest unmerged ticket in order:
- Bring it onto the target with the parent-merge procedure in
pr-stack.md(direct retarget or rebase). Its PR must now target<target>. The first ticket of a run already does, so it needs neither. Gate:
gh pr view "$URL" --json state,isDraft,baseRefName,headRefOid,mergeable,mergeStateStatus,reviewDecision gh pr checks "$URL" --watch --fail-fastRequire
baseRefNameequal to the target,headRefOidequal toaccepted_head,mergeable: MERGEABLE, and no failing check outside the run'sci_baselineor the loop quarantine. A check that already failed on the target branch when the run started is inherited, not caused: report it and merge. A failure matching a quarantined entry is reported with its ticket and merges the same way. A run whose ledger has noci_baselinemeasures one now against the target branch rather than treating a red repository as a blocked stack. With--require-approvals, also requirereviewDecision: APPROVEDand zero unresolved review threads:gh api graphql -F o=<owner> -F r=<repo> -F n=<number> -f query='query($o:String!,$r:String!,$n:Int!){repository(owner:$o,name:$r){pullRequest(number:$n){reviewThreads(first:100){nodes{isResolved}}}}}'Unresolved threads without
--require-approvalsare findings: run/review-fix-loop <target> <ticket> --from-pr <url>, refresh the PR body withgh pr edit --body-file, then gate again.Merge:
gh pr ready "$URL" gh pr merge "$URL" --<method> --match-head-commit "$ACCEPTED_HEAD" --delete-branch gh pr view "$URL" --json state,mergeCommit,mergedAtstatemust beMERGED. Recordmerge_commitandmerged_at.bb environment pull-request mergetakes only--method, so it cannot assert the head or delete the branch; keepgh pr mergehere.Close the ticket through the tracker workflow with a comment that links the PR. GitHub closes issues named by
Fixes #non its own, so check first:gh issue view <n> --json state gh issue close <n> --reason completed --comment "Landed in $URL"Clean up unless
--keep-environments:bb environment archive-threads "$ENV" bb environment show "$ENV" --json # .status becomes destroying, then destroyedArchiving every live thread of a managed worktree destroys that worktree and its local branch. Confirm both the environment status and the missing worktree path before recording
environment_state: archived.- Write
tickets.<id>.state: merged, then continue with the next ticket. Its parent is now merged, so step 1 retargets or rebases it.
Pause
A failing check, a conflict, a head that moved, a non-mergeable PR, or a
review decision that blocks pauses the landing. Nothing merged is undone.
resume reconciles the ledger and starts at the first unmerged ticket.
Rationalizations
| Excuse | Reality |
| "#14 is green and #13 is stuck, merge #14 first" | #14's base is #13's branch. Out of order it merges #13's diff too. Stop at the first blocker. |
| "The head moved by one trivial commit, still fine" | --match-head-commit exists because the reviewed head is the approved head. A new commit is unreviewed. |
| "Merge succeeded, archive the worktree" | Confirm the merge on the remote first. Archiving destroys the worktree and its local branch; there is no undo. |
| "One ticket broke, roll the stack back" | Nothing merged is undone. Pause, record evidence, and resume from the next unmerged ticket. |
"bb environment pull-request merge is right here" | It takes only --method. It cannot assert the head or delete the branch. gh pr merge stays authoritative. |
| "Checks are red, so the stack is blocked" | Not if the failures are in ci_baseline or the loop quarantine. Inherited red is reported and merged. |
| "No approvals configured, so nothing reviewed this" | Without --require-approvals the loop gate and green checks are the review. Say exactly that in the report. |
| "They own the repo, read both diffs, and take the blame" | Blame is not the constraint; dependency order is. Relay the risk and hold the order. An override is an instruction to change the plan, not cover for skipping a gate. |
| "I'll rebase #14 onto main instead of retargeting, so it can't carry #13's diff" | A clean rebase fixes the diff, not the dependency. T-3 was built, reviewed, and validated on top of T-2; landing it while T-2 is red ships code whose base never passed. |
| "#14's files don't overlap #13's" | Non-overlapping files are not independence. #13's fix can change what #14 relies on, and nothing re-reviewed #14 against the fixed base. |
Red flags — stop
- About to merge a PR whose
baseRefNameis not the target branch - About to merge without
--match-head-commit - About to archive an environment before
gh pr viewsaysMERGED - About to skip a blocked ticket and land a later one
- About to close a ticket whose PR did not merge
- About to reorder the stack because the person asking outranks you
- About to rebase past a blocked ticket rather than stopping at it
Finish
Report each ticket with its PR, merge commit, issue state, and environment
state, plus the merge method and whether approvals were required. Set
state: landed in the ledger. Then invoke /verify-landing <ledger path>:
landing proves the merges, verification proves the target.
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
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.

