pm-clean

A cleanup checker for GitHub issues and the local Git workspace. It finds issues and worktrees or branches that may be outdated, duplicated, or already dealt with.

In plain words
What is it for?
Use it to review solved, inactive, superseded, or duplicate issues, plus stale worktrees and local or remote branches.
Why use it?
It helps identify clutter without closing issues or deleting branches automatically. You review the findings and confirm any cleanup first.

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/auerbachb/claude-code-config/pm-clean
Any agent
npx skills add auerbachb/claude-code-config --skill pm-clean
Clone the repo
git clone --depth 1 https://github.com/auerbachb/claude-code-config

Made for: Claude Code, Codex.

Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,041 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00103 $0.05041
Opus 5 $0.00051 $0.02521
Sonnet 5 $0.00021 $0.01008
Haiku 4.5 $0.00010 $0.00504

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

Security

Grade A, and why

pm-clean 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 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.

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/skills/pm-clean/SKILL.md · 254 lines

How it starts

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

/pm-clean is the repo's single janitor. It runs two independent staleness scans and presents one recommend-then-confirm report:

  1. Open GitHub issues — solved-by-merged-PR, inactive, superseded, potential duplicates.
  2. On-disk workspace — stale worktrees and stale local/remote branches, via stale-cleanup.sh (the exact script /pm-update Step 8 calls — one implementation, no divergence).

The two scans never gate each other: one finding nothing does not suppress the other, and the summary always reports both. Nothing is closed or deleted without explicit confirmation.

Resolve both scan engines before Step 0:

resolve_script() {
  local name="$1" candidate
  for candidate in \
    "$HOME/.claude/skills-worktree/.claude/scripts/$name" \
    "$HOME/.claude/scripts/$name" \
    ".claude/scripts/$name"; do
    if [[ -x "$candidate" ]]; then echo "$candidate"; return 0; fi
  done
  return 1
}
BACKLOG_STALENESS_SH=$(resolve_script backlog-staleness.sh || true)
STALE_CLEANUP_SH=$(resolve_script stale-cleanup.sh || true)
[[ -n "$BACKLOG_STALENESS_SH" ]] || { echo "ERROR: backlog-staleness.sh not found (checked all three paths) — issue scan unavailable" >&2; exit 1; }
[[ -n "$STALE_CLEANUP_SH" ]] || { echo "ERROR: stale-cleanup.sh not found (checked all three paths) — workspace scan unavailable" >&2; exit 1; }

Invoking-repo scope (issue #687). Both scans stay in the invoking repo's lane: the issue scan (backlog-staleness.sh) runs gh issue list cwd-repo-scoped, and the workspace sweep (stale-cleanup.sh) enumerates worktrees/branches via git -C "$ROOT" where $ROOT is this repo's root — never another project's worktrees. /pm-clean therefore never offers to close an issue or delete a worktree/branch outside the invoking repo, whether run directly or inline from /pm.

Step 0: Parse arguments

Parse $ARGUMENTS:

  • [days] — the first bare (non-flag) token. If it is a positive number, use it as the issue-inactivity threshold and the default worktree/branch age. If empty, non-numeric, or non-positive (zero or negative), default to 30 days:
    • Warn if non-numeric: "Invalid argument '{value}', defaulting to 30 days"
    • Warn if non-positive: "Threshold must be positive, defaulting to 30 days"
  • --worktree-days N — optional flag. If present and a positive integer, it overrides the worktree/branch age only (the issue scan still uses [days]). If present but invalid (non-numeric or non-positive), warn ("Invalid --worktree-days '{value}', reusing the [days] threshold of {DAYS}") and fall back to [days]. If the flag is absent, the worktree/branch age reuses [days].

Record two values for the rest of the run: DAYS (issue-inactivity threshold) and WORKTREE_DAYS (workspace threshold — equal to DAYS unless --worktree-days overrode it).

Threshold note. Reusing [days] means /pm-clean defaults the workspace age to 30 days (its issue default), whereas /pm-update Step 8 keeps its own STALE_DAYS=7 default. That is intentional: the two skills share the implementation (stale-cleanup.sh), not the threshold. Use --worktree-days 7 for the aggressive sweep.

Read the full file on GitHub · 254 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 · 254 lines · 103 tokens per session scan A 7296bb589979

Subscribe to this mod's changes

pm-clean is a skill published in the GitHub repository auerbachb/claude-code-config (5 stars, last pushed 3d ago), licensed MIT. It adds 103 tokens to every session and 5,041 once invoked, about $0.0005 per session on Opus 5. 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-08-31.

Related

Other skills, from other repositories

fixer

Surgical code fixer for Bug Hunter. Implements minimal, precise fixes for verified bugs. Uses doc-lookup (Context Hub + Context7) to verify correct API usage in patches. Respects fix strategy classifications (safe-autofix vs manual-review vs larger-refactor).

codexstar69/bug-hunter · 57 tokens

referee

Final arbiter for Bug Hunter. Receives Hunter findings and Skeptic challenges, independently re-reads code, and delivers authoritative verdicts with CVSS scoring and proof-of-concept generation for security findings.

codexstar69/bug-hunter · 44 tokens

commit-security-scan

Scan code changes for security vulnerabilities using Bug Hunter-native artifacts and STRIDE context. Use whenever the user asks for PR security review, commit-diff scanning, staged-change security checks, branch-comparison security review, or pre-merge security analysis of changed code.

codexstar69/bug-hunter · 57 tokens

decompose

Decompose project or track into modules with dependency mapping. Project scope updates architecture.md and derives .ai-context.md. Track scope generates hld.md (always) and lld.md (when --lld or High-complexity module triggers it) — design-mandated artifacts that drive implement, deploy-checklist, and upload sign-off.

drafthq/draft · 71 tokens

adr

Create and manage Architecture Decision Records. Documents significant technical decisions with context, alternatives, and consequences. Also supports evaluate (assess proposals) and design (system design) modes.

drafthq/draft · 37 tokens

deploy-checklist

Pre-deployment verification checklist. Generates customized checklists based on tech-stack with rollback triggers. Auto-invoked by /draft:upload.

drafthq/draft · 32 tokens