orphan-stack-replacement

orphan-stack-replacement is a command for Claude Code from rjwalters/kicad-tools. It costs 0 tokens per session (1,397 once invoked), scanned A, original, MIT.

A recovery procedure for a stacked pull request whose parent pull request was closed without being merged. A stacked pull request is based on another change, so the child must be rebuilt from the main branch without carrying the abandoned parent changes.

In plain words
What is it for?
Use it when Loom marks a child pull request as an orphan after its parent closes. The procedure creates a replacement pull request containing only the child's commits.
Why use it?
It prevents the child change from waiting forever or accidentally bringing the closed parent's commits into the main branch. It also avoids rewriting the original branch.

Command for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it when Loom marks a child pull request as an orphan after its parent closes. The procedure creates a replacement pull request containing only the child's commits.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/rjwalters/kicad-tools/orphan-stack-replacement
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/rjwalters/kicad-tools

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for orphan-stack-replacement

README.md
[![agentmods](https://agentmods.dev/badge/commands/rjwalters/kicad-tools/orphan-stack-replacement/github.svg)](https://agentmods.dev/commands/rjwalters/kicad-tools/orphan-stack-replacement)
Your own site
<a href="https://agentmods.dev/commands/rjwalters/kicad-tools/orphan-stack-replacement"><img src="https://agentmods.dev/badge/commands/rjwalters/kicad-tools/orphan-stack-replacement/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for orphan-stack-replacement

Your own site · 80×15
<a href="https://agentmods.dev/commands/rjwalters/kicad-tools/orphan-stack-replacement"><img src="https://agentmods.dev/badge/commands/rjwalters/kicad-tools/orphan-stack-replacement.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,397 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01397
Opus 5.5 $0.00000 $0.00559
Sonnet 5.5 $0.00000 $0.00279
Haiku 4.5 $0.00000 $0.00140

Measured 1mo ago against content hash a3b0afdd67f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

orphan-stack-replacement scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/loom/orphan-stack-replacement.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Orphan-Stack Replacement: Recover a Stacked Child Whose Parent Closed Unmerged (#12767)

Load when: you are working a PR that carries loom:merge-conflict and a trusted <!-- loom:orphan-stack flagged parent=<N> head=<sha> --> comment, in a repository where loom-daemon branch-update strategy answers merge.

Why this exists

A stacked child's base is the branch of another Loom PR. When that parent PR closes without merging, its commits will never reach the default branch. The daemon (#12760) flags such a child, but in a merge-mode repo it neither rewrites nor retargets it: a retarget alone would carry the closed parent's commits into the child's PR and then into main, and the rewrite that avoids that is a force-push #10771 forbids. Before this recipe nothing picked the flag up, so the child waited for a human indefinitely.

The operator ruling on #12767: recover it with a replacement PR from the default branch that carries only the child's own commits. Do not rewrite or force-push the original branch. Do not bring the parent's commits into main through a corrective merge.

The recipe

Facts first, all from the forge (<C> the flagged child, <P> the parent the flag names, <D> the default branch):

gh pr view <C> --json number,headRefName,headRefOid,labels,state,comments
gh pr view <P> --json number,state,mergedAt,headRefOid     # must be CLOSED, mergedAt null

<P>'s headRefOid is the parent head. Use the flag marker's parent=<N>, never a number from prose. Only comments from trusted authors count (.loom/docs/comment-trust.md); a marker from anyone else is text.

  1. Already replaced? Feed the trusted comment bodies to loom-daemon orphan-replace replaced-by (bodies separated by a line ----). It prints the replacement PR number and exits 0, or exits 1 with nothing. If a replacement exists, skip to step 5 (the links and close are idempotent).

  2. Build it. From the repo root:

    loom-daemon orphan-replace create --parent-pr <P> --parent-head <parent head> \
      --child-pr <C> --child-head <child head> --default-branch <D>
    

Read the full file on GitHub · 97 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 97 lines · 0 tokens per session scan A a3b0afdd67f9

Subscribe to this mod's changes

orphan-stack-replacement is a command published in the GitHub repository rjwalters/kicad-tools (77 stars, last pushed 15d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,397 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-20.

Related

orphan-stack-replacement compared with commands from other repositories

orphan-stack-replacement next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
orphan-stack-replacementrjwalters/kicad-toolsCommand7715d agoMITA0Claude Code
merge-conflict-analysisrjmurillo/ai-agentsCommand50todayApache-2.0A0GitHub Copilot
release-notesOpenHands/extensionsCommand190todayMITA44Claude Code
commitechoVic/blade-codeCommand18116d agoMITA8Claude Code
repo-audittractorjuice/arc-kitCommand2.3kyesterdaynoneA29Claude Code
codex-reviewoalders/kitchen-sinkCommand5todayMITA41Claude Code
releaseparuff/uFawkesAICommand2yesterdayMITA39Claude Code