pcl

A cleanup procedure for removing local and remote Git branches that have no open pull request and pruning unused worktrees. A dry-run option lists proposed deletions first.

In plain words
What is it for?
Use it to update the main branch, prune remote references, find branches without open pull requests, remove them, and clean up stale worktrees.
Why use it?
It helps reduce stale branches while protecting branches that still have open code reviews.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/openrouterlabs/spawn/pcl
Any agent
npx skills add OpenRouterLabs/spawn --skill pcl
Clone the repo
git clone --depth 1 https://github.com/OpenRouterLabs/spawn

Made for: Claude Code, Codex.

Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 611 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
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 $0.00023 $0.00611
Opus 5 $0.00012 $0.00305
Sonnet 5 $0.00005 $0.00122
Haiku 4.5 $0.00002 $0.00061

Measured 2d ago against content hash a377a5aee966, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

pcl scanned grade C with 1 finding 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 2d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf /tmp/spawn-worktrees 2>/dev/null || true
.claude/skills/pcl/SKILL.md · 108 lines

How it starts

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

Cleanup Stale Branches

Delete local and remote git branches that no longer have an open PR, and prune stale worktrees.

Arguments

  • --dry-run — List what would be deleted without actually deleting anything.

$ARGUMENTS

Procedure

Step 1: Checkout main branch

Switch to main and update to latest:

git checkout main
git pull --rebase origin main

Critical: This ensures we're not on a branch that's about to be deleted, and that we're working from the latest main.

Step 2: Fetch and prune remote refs

git fetch --prune origin

Step 3: Identify stale remote branches

List all remote branches except main and HEAD:

git branch -r --format='%(refname:short) %(committerdate:relative)' | grep -v 'origin/main\|origin/HEAD\|^origin '

Step 4: Get branches with open PRs (protected)

gh pr list --repo OpenRouterLabs/spawn --state open --json headRefName --jq '.[].headRefName'

Any branch with an open PR MUST be skipped. Never delete a branch that has an open PR.

Step 5: Delete stale remote branches

For each remote branch that is NOT in the open PR list:

git push origin --delete BRANCH_NAME

If --dry-run was passed, print [dry-run] would delete origin/BRANCH_NAME instead.

Step 6: Delete stale local branches

List local branches (excluding the current branch and main):

git branch --list | grep -v '^\*' | grep -v '^ *main$' | tr -d ' '

For each, check if it's already merged into main or has no remote:

git branch -d BRANCH_NAME 2>/dev/null || git branch -D BRANCH_NAME

If --dry-run, print [dry-run] would delete local BRANCH_NAME instead.

Step 7: Prune worktrees

git worktree prune

Remove any leftover worktree directories:

rm -rf /tmp/spawn-worktrees 2>/dev/null || true

Step 8: Verify final state

Ensure we're on main branch:

git branch --show-current

Should output: main

Step 9: Summary

Read the full file on GitHub · 108 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. 2d ago First seen · 108 lines · 23 tokens per session scan C a377a5aee966

Subscribe to this mod's changes

pcl is a skill published in the GitHub repository OpenRouterLabs/spawn (233 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 23 tokens to every session and 611 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.