claude-sdk-rs: Command for Claude Code

.claude/commands/clean-worktree.md

clean-worktree is a command for Claude Code from bredmond1019/claude-sdk-rs. It costs 0 tokens per session (3,483 once invoked), scanned A, original, Apache-2.0.

A Git worktree cleanup command that merges a finished task branch into the main branch and removes the worktree. A worktree is a separate working directory linked to the same Git repository.

In plain words
What is it for?
Use it after completing a task in a worktree, providing the task slug or exact worktree name.
Why use it?
It removes the manual steps and reduces the chance of merging or deleting the wrong task directory.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

This is bredmond1019/claude-sdk-rs's own configuration. It tells Claude Code how to work on claude-sdk-rs itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-sdk-rs configures →

Reuse

Borrowing it

Nothing to install: this file belongs to bredmond1019/claude-sdk-rs. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/bredmond1019/claude-sdk-rs/main/.claude/commands/clean-worktree.md
Clone the repo
git clone --depth 1 https://github.com/bredmond1019/claude-sdk-rs

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 clean-worktree

README.md
[![agentmods](https://agentmods.dev/badge/commands/bredmond1019/claude-sdk-rs/clean-worktree/github.svg)](https://agentmods.dev/commands/bredmond1019/claude-sdk-rs/clean-worktree)
Your own site
<a href="https://agentmods.dev/commands/bredmond1019/claude-sdk-rs/clean-worktree"><img src="https://agentmods.dev/badge/commands/bredmond1019/claude-sdk-rs/clean-worktree/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 clean-worktree

Your own site · 80×15
<a href="https://agentmods.dev/commands/bredmond1019/claude-sdk-rs/clean-worktree"><img src="https://agentmods.dev/badge/commands/bredmond1019/claude-sdk-rs/clean-worktree.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 3,483 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.03483
Opus 5.5 $0.00000 $0.01393
Sonnet 5.5 $0.00000 $0.00697
Haiku 4.5 $0.00000 $0.00348

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

Security

Grade A, and why

clean-worktree 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 11d 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/clean-worktree.md · 245 lines

How it starts

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

Clean Worktree — Merge a completed SDLC worktree branch into main and remove it.

Variables

$ARGUMENTS — one of:

  • <spec-slug> → worktree name: <spec-slug>
  • <spec-slug> 3 → worktree name: <spec-slug>-task3
  • <spec-slug>-task8 → literal worktree name (already lowercased, single token)
  • <spec-slug>-task8-2 → literal worktree name with suffix (from sdlc-task auto-increment)

The literal single-token form is output by /sdlc-task when it creates a suffixed worktree (e.g. -2, -3). Pass it exactly as printed.

Instructions

  1. If $ARGUMENTS is not provided, stop and print usage:

    Usage: /clean-worktree <spec-slug> [task-N]
           /clean-worktree <literal-worktree-name>
    Examples:
      /clean-worktree <spec-slug>
      /clean-worktree <spec-slug> 3
      /clean-worktree <spec-slug>-task8
      /clean-worktree <spec-slug>-task8-2
    
  2. Parse arguments:

    • If $ARGUMENTS is a single token with no spaces that is already lowercase and contains only letters, digits, dots, and hyphens → treat it as the literal worktreeName directly. (Spec slugs carry a phase-dotted prefix, e.g. <spec-slug>-task8.)
    • Otherwise, apply the same transform as /init-worktree: lowercase specSlug, append -task<taskNum> if a second token is a number. Derive worktreeName.
    • Always: worktreePath = trees/<worktreeName>
    • Extract taskNum from worktreeName for use in the task log step:
      • Pattern: <spec-slug>-task<N> or <spec-slug>-task<N>-<suffix>
      • Extract taskNum as the integer after the last -task in the name.
      • logFile = planning/<spec-slug-placeholder>/sdlc/reports/task<taskNum>-log.md
      • Note: the actual specSlug (with original casing) is read from the log file itself (**Spec:** <spec-slug>) rather than derived from the lowercased branch name. Use the branch name only to locate the approximate path; then read the log's **Spec:** field and use that value as the authoritative spec slug for all status.md path lookups.

Read the full file on GitHub · 245 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. 11d ago First seen · 245 lines · 0 tokens per session scan A f1b6292371a7

Subscribe to this mod's changes

clean-worktree is a command published in the GitHub repository bredmond1019/claude-sdk-rs (23 stars, last pushed 1mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 3,483 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-26.

Related

clean-worktree compared with commands from other repositories

clean-worktree next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
clean-worktreebredmond1019/claude-sdk-rsCommand231mo agoApache-2.0A0Claude Code
red-teammohitagw15856/pm-claude-skillsCommand1.5kyesterdayMITB23Claude Code
instinct-importmycelium-hq/ai-brain-starterCommand50yesterdayMITA16Claude Code
acos-checkpointfrankxai/agentic-creator-osCommand12yesterdayApache-2.0A0Claude Code
approve-proposedMozurok/fhorja.devCommand1028d agoMITA107Claude Code
hygiene-statusMSApps-Mobile/claude-pluginsCommand10todayMITA19Claude Code
release-flowcoo1white/cool-workflowCommand22d agoBSD-2-ClauseA20Claude Code