prune

prune is a command for Claude Code from dork-labs/dorkos. It costs 10 tokens per session (966 once invoked), scanned A, original, MIT.

A Git worktree cleanup command that finds finished worktrees and their local branches. It reports what is safe to remove and can remove those items when asked.

In plain words
What is it for?
Use it to review and clean up Git worktrees after completed changes have been merged.
Why use it?
It clears leftover checkouts and branches without deleting the current worktree, protected branches, or work with uncommitted changes.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is Bash(scripts/worktree-janitor.sh:*), Bash(bash scripts/worktree-janitor.sh:*).

Part of the flow plugin — 32 skills, 43 commands, 5 agents, 4 hooks shipped together

Good fit Use it to review and clean up Git worktrees after completed changes have been merged.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/dork-labs/dorkos
agentmods
npx agentmods add commands/dork-labs/dorkos/prune

Made for: Claude Code.

Or install flow, the plugin that ships this one along with the rest of its 32 skills, 43 commands, 5 agents, 4 hooks.

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 prune

README.md
[![agentmods](https://agentmods.dev/badge/commands/dork-labs/dorkos/prune/github.svg)](https://agentmods.dev/commands/dork-labs/dorkos/prune)
Your own site
<a href="https://agentmods.dev/commands/dork-labs/dorkos/prune"><img src="https://agentmods.dev/badge/commands/dork-labs/dorkos/prune/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 prune

Your own site · 80×15
<a href="https://agentmods.dev/commands/dork-labs/dorkos/prune"><img src="https://agentmods.dev/badge/commands/dork-labs/dorkos/prune.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 966 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.00010 $0.00966
Opus 5 $0.00005 $0.00483
Sonnet 5 $0.00002 $0.00193
Haiku 4.5 $0.00001 $0.00097

Measured 6d ago against content hash bc50bf515299, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

prune 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 6d 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/worktree/prune.md · 87 lines

How it starts

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

Worktree Prune

Delete the worktrees and local branches that finished work left behind. Reports by default and writes only when asked.

Arguments

Argument Effect
(none) Show what would be removed and why. Writes nothing.
--fix Actually remove them.

Task

Step 1: Report

Run the janitor from the repo root:

bash scripts/worktree-janitor.sh

It prints one line per worktree and local branch: REAP for the ones it can prove are safe to delete, or KEEP <reason> with a machine-readable slug for everything else.

Step 2: Show the user the plan

Present the plan as-is. Do not re-derive it, argue with it, or delete anything the script listed as KEEP — the decision lives in scripts/should-reap-worktree.sh, every refusal it makes is pinned by fixtures, and the slugs mean what they say:

Slug Meaning
protected-branch The default branch, or the primary checkout.
current-worktree The one this session is standing in.
uncommitted-changes Tracked or untracked work exists only in that working tree.
ignored-content Ignored files git would delete that are not regenerable — a .temp/ handoff, the dev database under apps/server/.temp/.dork/.
pr-open Someone is still reviewing it.
pr-closed-unmerged A human stopped this work; the branch is its only record.
commits-after-merge Pushed after the merge, so main has never seen those commits.
pushed-no-pr On origin but never proposed — work in flight.
unpushed-commits Commits that exist nowhere else.
pr-state-unknown GitHub could not be asked, or the PR listing may have been truncated. Not the same as "no PR".
unreadable-payload A field the gate needs was missing, mistyped, or unmeasurable.

Read the full file on GitHub · 87 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. 6d ago First seen · 87 lines · 10 tokens per session scan A bc50bf515299

Subscribe to this mod's changes

prune is a command published in the GitHub repository dork-labs/dorkos (9 stars, last pushed today), licensed MIT. It adds 10 tokens to every session and 966 once invoked, about $0.0001 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-09-03.