/armory:stacked-prsfrom armory
Builds, publishes, syncs, and validates stacked pull requests with correct parent bases, plus optional GitHub-native stack support.
Ships in armory. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build, publish, synchronize and validate stacked pull requests without corrupting branch topology, and decide the topology, provenance and native membership that landing an existing stack depends on.
The package identity is provider-neutral. Git is the source of truth for branch ancestry; provider PR metadata is the source of truth for review bases. GitHub through gh is the first documented provider adapter.
Landing, post-landing promotion and retargeting, and cleanup of an existing manual or GitHub-native stack have one executable owner: the ship-workflow skill's stack graph run. This skill authors its explicit stack decision packet and delegates to it once (§5); it has no hand-run landing or cleanup procedure of its own.
| File | Contents | Load When |
|---|---|---|
references/stack-model.md | Stack inference, explicit ordering, native detection and the explicit stack decision packet | Inspecting, publishing, validating, or delegating a stack |
references/provider-adapters.md | Provider adapter contract and GitHub gh commands for listing, creating, retargeting and checking PRs | Creating, retargeting or checking PRs |
references/sync-algorithm.md | Slice proof, expected-old leases and the standalone restack procedure | Syncing a stack after a parent or base moves |
references/merge-discipline.md | Parent-first landing rules, landing proofs, retention and endpoints the delegated run enforces | Deciding what to select and what an outcome means |
references/metadata-format.md | Optional metadata schema and validation rules | .stack-prs.yaml exists or inference is ambiguous |
references/provenance.md | Commit-trailer stack identity, stamping, verification, merge-mode coupling | Creating, splitting, syncing, or choosing a merge method |
references/github-native.md | Native detection, linking eligibility, native sync and the native prefix policy | A GitHub-native stack is requested or detected |
| Use this skill | Use another package |
|---|---|
| Multiple dependent branches need PRs against parent branches | ship-workflow for one independent PR |
| A feature branch must be split into reviewable dependent branches | task-decomposer for planning tasks before code exists |
| An existing stack needs rebasing, retargeting to correct parents, validation, or a landing scope decision | pr-review for reviewing one PR diff |
| An existing stack must be landed or cleaned after landing (delegated in §5) | General Git commands for unrelated branch cleanup |
Prefer one cohesive PR unless real dependencies, review boundaries or safe incremental integration justify a stack. Keep the dependency chain shallow; a template or depth ceiling is not a target PR count. Honor an explicitly requested stack without silently widening its scope.
Run git rev-parse --show-toplevel before any workflow.
Run git status --porcelain before rebases, pushes, PR creation and PR retargeting.
Stop on a dirty worktree unless the user explicitly scopes the operation to inspection only.
Prefer existing PR baseRefName values over inferred ancestry.
Resolve <base> from the root PR's baseRefName (gh pr view <root-pr> --json baseRefName --jq .baseRefName), not from origin/HEAD; a stack's trunk need not be the repository's default branch.
Use explicit branch order or .stack-prs.yaml when parent inference is ambiguous.
Never use plain git push --force or a bare --force-with-lease; push rewritten heads with --force-with-lease=refs/heads/<branch>:<expected-old-oid>.
Never delete stack branches by hand; proof-based cleanup belongs to the delegated run (§5).
Stamp Stack-Id and Stack-Position trailers on every commit the skill creates or splits; copy the ID from .stack-prs.yaml or mint it once when absent.
Verify trailers are present and consistent before delegating a landing of a stack the skill created.
Probe every open stack PR for native-stack membership during Inspect (references/stack-model.md § Native Stack Detection) before any landing decision.
Detect the provider's squash message policy (squash_merge_commit_message) before choosing squash as a node's merge method (references/provenance.md § Merge Mode Coupling).
GitHub-native stacks are same-repository-only. They enhance manual Armory stacks; they do not replace provenance trailers, .stack-prs.yaml, or the provider-neutral workflow.
Native-stack membership is a provider-side property of a pull request, not a mode this skill chooses. Detect it for every stack PR during Inspect, before any landing decision, whether or not github-native mode was requested: read .stack from GET repos/{owner}/{repo}/pulls/<number> and the complete ordered membership from GET repos/{owner}/{repo}/stacks/<stack-number> (references/github-native.md § Detecting an already-native stack).
Converting a manual stack to native with gh stack link is a provider mutation. Use it only after these eligibility checks pass:
gh stack --help succeeds; install github/gh-stack when absent.Stack-Id/Stack-Position provenance agree. Stop on disagreement.When the checks fail the stack stays manual. Never convert in either direction automatically or mid-stack.
Once Inspect finds a PR already native, native handling is not a choice: the provider refuses a synchronous merge for a stack member, and the delegated run lands native members only through one guarded asynchronous request on the highest selected member. Conditions 1-4 above still apply as safety checks; condition 5's consent does not, because the provider already registered the stack.
gh stack link, gh stack sync, gh stack rebase and gh stack push (references/github-native.md); re-read gh stack view after every non-interactive sync.references/github-native.md § Choosing a merge method for trailer survival). Under a merge queue the queue's rules choose the method and the packet's method is not sent.references/github-native.md § Landing policy).squash_merge_commit_title: COMMIT_OR_PR_TITLE (GitHub's default), a PR squashing a single commit takes that commit's headline as the base-branch subject, not the PR title, and this cannot be corrected after merge without rewriting pushed history. When the visible subject matters, align an unmerged commit headline with the PR title before delegating (git commit --amend -m "<pr-title>", then git push --force-with-lease=refs/heads/<branch>:<old-head> origin <branch>), and record the new head in the packet.Build a stack model without modifying anything:
git rev-parse --show-toplevel
git status --porcelain
git branch --show-current
git for-each-ref --format='%(refname:short)' refs/heads
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
gh pr list --state open --json number,title,headRefName,headRefOid,baseRefName,state,url
Produce a table with one row per stack branch. Run the native-stack probe (references/stack-model.md § Native Stack Detection) for every PR before recording this table:
| Order | Branch | Parent | PR | State | Checks | Native |
|---|---|---|---|---|---|---|
| 1 | feat/parser-core | main | #101 | open | pending | no |
| 2 | feat/parser-cache | feat/parser-core | #102 | open | pending | no |
Stop when no provider adapter is available, no local branches match the requested stack, or parent order cannot be inferred from PR bases, explicit order, or metadata.
Create missing PRs and retarget wrong bases:
git status --porcelain
git push -u origin <branch>
gh pr create \
--base <parent-branch> \
--head <branch> \
--title "<title>" \
--body-file <generated-body-file>
gh pr edit <number> --base <parent-branch>
Generated PR bodies must include the stack order and validation state:
## Stack
Stack-Id: `auth-refactor-a1b2c3`
Base: `main`
Position: 1/3
1. `feat/parser-core` -> this PR
2. `feat/parser-cache` -> #102
3. `feat/parser-cli` -> #103
Depends on: (none - root)
Upstack: #102
## Validation
- Pending: commands not run yet
For non-root PRs, Depends on: lists the parent PR number. Upstack: lists the immediate child PR number when known.
Stop when a branch has no commits beyond its parent, an existing PR is closed and unmerged, or the provider rejects base retargeting.
Restack open branches after <base> or a parent branch moves, before anything lands, with the standalone procedure in references/sync-algorithm.md: record each child's old head C and fork point F, replay F..C onto the new tip L in a detached scratch worktree, prove the result and publish it with an explicit expected-old lease.
git status --porcelain
git fetch origin
git merge-tree --write-tree --merge-base=<F> <L> <C>
git push --force-with-lease=refs/heads/<branch>:<C> origin <N>:refs/heads/<branch>
Start at the first branch above the base and continue toward the leaf. Stop on conflicts, remote lease failures, or a parent PR that closed without merge. Promoting and retargeting children after their parent landed is part of the delegated lifecycle (§5), not this step.
Validate each slice's changed behavior with focused local checks and one primary review. Use the repository's preflight before coherent pushes; expensive cumulative checks belong on the integration candidate when that repository's policy permits, not automatically on every intermediate edit. The whole-stack check verifies topology, cumulative acceptance and integration rather than repeating every line review. Record exactly what ran; local or leaf success cannot waive a required per-PR gate.
Use the target repository's declared local/PR/integration-candidate/mainline policy and ship-workflow's explicit advisory classification. Provider-required and repository-mandated checks remain blocking; unclassified checks stay strict. Renew affected evidence after promotion or retargeting, but reuse passing evidence only for unchanged covered inputs and context. Do not run Armory package-evaluation commands when operating on another repository's stack.
For this armory package implementation only, use:
uv run python scripts/validate_evals.py
uv run python scripts/generate_manifest.py
uv run python scripts/evaluate_package.py --path skills/stacked-prs
Landing, post-landing promotion and retargeting, post-merge acceptance and cleanup of an existing manual or native stack run once, through the ship-workflow skill's explicit stack graph contract:
Inspect (§1), including native membership, and verify provenance (references/provenance.md § Verifying Trailers).
Author one stack decision packet (references/stack-model.md § Explicit Stack Decision Packet): select: true for exactly the PRs the user authorized, every ancestor of a selected node and every other relevant member as unselected context, each selected node's revision-free decision with its cited sources and merge method, and provenance: {"disposition": "preserve", ...} naming what was inspected. Write it to a private temporary file outside the repository.
Load the registered ship-workflow skill. If the client has no such skill, stop BLOCKED naming ship-workflow; never fall back to hand-run merges, retargets, promotion pushes or deletions.
From a checkout of the target repository, run its executable from the loaded skill's absolute base directory, first read-only, then with the authorized endpoint:
uv run --no-project --python 3.12 python "<ship-workflow-dir>/scripts/ship.py" --stack-plan "/tmp/stack.X/stack.json" --dry-run
uv run --no-project --python 3.12 python "<ship-workflow-dir>/scripts/ship.py" --stack-plan "/tmp/stack.X/stack.json" --gates "/tmp/stack.X/gates.json" --until merged
"Merge the stack" is --until merged; "merge and clean up" is the default clean. "Clean up" alone selects only nodes the provider already reports merged, so the run verifies and cleans them without landing anything new.
Resume with --resume RUN_ID only when the controller returned a saved run; add a refreshed packet of the same topology only for a resolved decision. A pre-journal admission or inspection stop can have run_id: null or no id: resolve its bounded input and repeat the original explicitly scoped invocation, never invent an id or select an unrelated run with bare --resume.
Relay the run's status, confirmed merges, retained dependents, cleanup dispositions and next action. NEEDS_JUDGMENT names a topology, provenance, scope or gate decision that belongs back here; BLOCKED names a missing prerequisite.
The run enforces parent-first order, slice-preserving promotion, expected-old leases, fresh gates per node, open-base retention and landing proofs (references/merge-discipline.md), and lands a native selection with one guarded request (references/github-native.md § Landing policy).
Routine delegated shipping uses the repository's current provider checks, reviews, protections and merge policy. A selected node can request assurance: "high" explicitly; routine nodes do not need pinned checkout logs or renamed CI jobs. Supply --gates when local validation is requested; use per_commit: true for every replayed commit and each gate's own timeout. Validation precedes push and preserves existing hooks. Definite refusals with unchanged inputs reuse the exact verified replay objects; uncertain mutations reconcile before retry. Saved assurance and validation survive resume; incompatible legacy authority stops for an explicit decision.
Where the repository already uses a merge queue, validate the actual candidate through the supported provider path and include merge_group workflows. Queue enrollment is not landing, and one request or one merge-limit setting does not promise one CI build or atomic landing for a whole stack. Broad mainline checks complement pre-merge integration checks. On mainline regression, contain affected landing/release work and prefer a safe revert or focused repair; never weaken gates to restore a green badge.
Use split mode when one source branch contains a feature that needs reviewable dependent PRs. Require the source branch, base branch, and target branch order from the user or from unambiguous commit names.
Inspect first:
git status --porcelain
git fetch origin --prune
git merge-base <base> <source-branch>
git log --oneline --reverse <base>..<source-branch>
git diff --stat <base>...<source-branch>
git diff --name-status <base>...<source-branch>
Select the safest split mode:
| Mode | Use When | Behavior |
|---|---|---|
| Commit-range split | Contiguous commits map cleanly to slices | Create dependent branches and cherry-pick ranges |
| Commit-list split | Non-contiguous commits map cleanly to slices | Cherry-pick explicit commit lists in stack order |
| Patch-guided split | File or hunk boundaries are clear but commits are mixed | Stop for user-approved split map before mutation |
| Refuse automatic split | Changes are tangled across required boundaries | Report why the split is unsafe |
After creating branches, compare the leaf with the source branch before publishing:
git commit --amend --no-edit \
--trailer "Stack-Id: <stack-id>" \
--trailer "Stack-Position: <n>/<total>"
git diff --stat <source-branch>...<leaf-branch>
git diff --exit-code <source-branch>...<leaf-branch>
Stamp trailers on each slice's commits per references/provenance.md before publishing. Stamping amends commit messages but does not change tree content, so the leaf-vs-source comparison remains a tree comparison with git diff and must still pass.
Do not publish if the leaf differs from the source branch.
| Condition | Action |
|---|---|
| Dirty worktree before mutation | Stop and report changed paths |
| Ambiguous parent order | Request explicit branch order or .stack-prs.yaml |
| Existing closed unmerged PR | Stop before creating replacements |
| Closed unmerged child after parent branch deletion | Follow references/merge-discipline.md § Recovery, then delegate the remaining landing |
| Rebase or cherry-pick conflict | Stop, report branch and conflicted files, do not continue children |
| Remote branch changed since fetch | Stop; do not retry without a fresh inspect |
| Failed validation | Record the failed command and stop publish or delegation |
| Top split branch differs from source | Stop before PR creation and report remaining diff |
Commit in a created stack missing Stack-Id trailer | Stop; stamp unpublished commits per references/provenance.md before delegating |
Trailer Stack-Id differs from .stack-prs.yaml | Stop; resolve canonical ID before mutation |
| An open lower native member is outside the authorized prefix | Ask for a scope decision; never widen the selection |
ship-workflow is not installed when landing or cleanup is requested | Stop BLOCKED naming ship-workflow |
Delegation returns NEEDS_JUDGMENT or BLOCKED | Relay actual confirmed facts and resolve the named topology/provenance/scope input here. Resume only its returned saved run; if none exists, repeat the original scoped invocation with the resolved packet, never bare --resume. |
Report:
run_id only when returned and non-null.evals/cases.yaml (opens in a new tab)references/github-native.md (opens in a new tab)references/merge-discipline.md (opens in a new tab)references/metadata-format.md (opens in a new tab)references/provenance.md (opens in a new tab)references/provider-adapters.md (opens in a new tab)references/stack-model.md (opens in a new tab)references/sync-algorithm.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
stacked-prs, git-branches, pull-requests, github-native, branch-topology
npx claudepluginhub mathews-tom/armory --plugin armory94 skills in this plugin
/adr-writerGenerates Architecture Decision Records capturing context, rationale, alternatives, and consequences in numbered status-tracked format. Triggers on: "write an ADR", "document this decision", "architecture decision record", "decision record", "design decision", "ADR for"./agent-builderBuild AI agents and automate Claude Code programmatically via the Claude Agent SDK and headless CLI mode. Covers Python SDK, claude -p, SDK MCP servers, hooks, sessions. Triggers on: "build an agent", "agent SDK", "headless mode", "automate Claude", "programmatic agent"./animateCreate Manim (Python) animated explainers: algorithm step-throughs, math and equation walkthroughs, pipeline and data-flow diagrams, comparisons and timelines, rendered to MP4, WebM or GIF with optional audio overlay. Includes a template path that renders validated config data with no model call, plus output checks (ffprobe duration, fps, dimensions, full decode, sampled-frame review receipt). Use when asked to "create a video", "animate this", "make an explainer", "manim animation", "animate this algorithm", or "motion graphic". NOT for HTML/CSS/GSAP or Hyperframes video, NOT for React or Remotion video, and NOT for a launch or promo video of the user's own project, use launch-video./api-docs-generatorAudits and enhances FastAPI and REST API documentation: missing descriptions, response codes, examples, docstrings, Pydantic models, OpenAPI spec. Triggers on: "generate API docs", "document this API", "OpenAPI for", "FastAPI docs", "document endpoints", "swagger docs"./appraiseEvidence-based competency and seniority appraisal of a software engineer from one or more Git repositories: attributes authorship with git blame, separates fork and upstream code, verifies every cited line, and calibrates technical, scope and overall levels with explicit uncertainty, a development plan and targeted questions. Use this skill when asked to "appraise this developer", "calibrate my seniority", "assess this candidate from their GitHub", "what level am I based on my repos", "review this engineer's contributions", "build a promotion evidence pack", or "how can I grow as an engineer from my code". Covers candidate review, self-appraisal, promotion packs, manager or mentor appraisals with consent, progress over time and recalibration after interview answers. Not for code review of a diff, repository tutorials, or architecture reviews./architecture-diagramGenerate architecture diagrams as fully editable SVG with native AWS, Azure, and GCP icons for cloud diagrams, or hand-drawn generic icons for everything else. Optionally deliver a self-contained editable draw.io mxGraph companion. Deterministic layout computes zone nesting and orthogonal routing instead of hand-placed coordinates. Triggers on: "architecture diagram", "infra diagram", "system diagram", "deployment diagram", "topology diagram", "draw architecture", "AWS diagram", "Azure diagram", "GCP diagram", "cloud infrastructure diagram", "VPC diagram", "draw my AWS setup". Use when a user wants a static architecture diagram they can still edit afterward in Figma, Illustrator, Inkscape, or draw.io. NOT for architecture reviews, use architecture-reviewer.Other plugins' skills for the same job