claude-sdk-rs: Command for Claude Code

.claude/commands/init-worktree.md

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

A command for creating an isolated Git worktree for a project specification or one of its tasks. A Git worktree is a separate working directory connected to the same repository, so work can proceed without changing the main checkout.

In plain words
What is it for?
Use it before implementing a specification or task when you need a separate directory for that work.
Why use it?
Isolation reduces conflicts between parallel tasks and makes it easier to clean up or merge work later. The naming matches the other workflow commands so they can find the worktree.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions CLAUDE.md; mentions Claude Code.

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/init-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 init-worktree

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/bredmond1019/claude-sdk-rs/init-worktree"><img src="https://agentmods.dev/badge/commands/bredmond1019/claude-sdk-rs/init-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 2,340 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.02340
Opus 5.5 $0.00000 $0.00936
Sonnet 5.5 $0.00000 $0.00468
Haiku 4.5 $0.00000 $0.00234

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

Security

Grade A, and why

init-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/init-worktree.md · 157 lines

How it starts

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

Init Worktree — Create an isolated git worktree for an SDLC spec or task.

Variables

$ARGUMENTS — spec slug with optional task number.

Examples:

  • <spec-slug> → worktree name: <spec-slug> at trees/<spec-slug>/
  • <spec-slug> 3 → worktree name: <spec-slug>-task3 at trees/<spec-slug>-task3/

The spec slug is the directory name under planning/ (e.g. <spec-slug>, 2.2-learn-paths-accuracy-refresh). This matches the worktree naming /sdlc-task uses, so /clean-worktree can find and merge whatever this command (or /sdlc-task) created.

Instructions

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

    Usage: /init-worktree <spec-slug> [task-N]
    Examples:
      /init-worktree <spec-slug>
      /init-worktree <spec-slug> 3
    
  2. Parse arguments: split $ARGUMENTS on whitespace. First token is specSlug. If a second token exists and is a number, it is taskNum; otherwise no task number.

  3. Derive worktree name: lowercase specSlug, append -task<taskNum> if taskNum is set.

    • <spec-slug> → <spec-slug>
    • <spec-slug> 3 → <spec-slug>-task3
  4. Verify CWD is repo root:

    git rev-parse --show-toplevel
    

    If the output does not match the current directory, stop with: "Run this command from the repo root, not from inside a subdirectory."

  5. Check for name collision:

    git worktree list
    git branch --list <worktreeName>
    
    • If trees/<worktreeName> appears in worktree list → stop: "Worktree '' already exists. Run /clean-worktree <args> first."
    • If branch <worktreeName> exists but worktree directory does not → stop: "Branch '' exists as an orphan. Delete it first with: git branch -D <worktreeName>"
  6. Create the trees directory:

    mkdir -p trees
    
  7. Create the worktree without checkout:

    git worktree add --no-checkout trees/<worktreeName> -b <worktreeName>
    
  8. Configure sparse checkout (cone mode):

    git -C trees/<worktreeName> sparse-checkout init --cone
    # Cone ALL tracked top-level directories — stack-agnostic, no project layout assumptions.
    git -C trees/<worktreeName> sparse-checkout set $(git ls-tree HEAD --name-only -d | tr '\n' ' ')
    git -C trees/<worktreeName> checkout
    

    git ls-tree HEAD --name-only -d lists every tracked top-level directory, so the cone set adapts to whatever trees the project has (source, tests, docs/, planning/, .claude/, …) without naming any one stack's layout. Root-level files (CLAUDE.md, manifests/lockfiles, build/config files, etc.) are included automatically by cone mode.

Read the full file on GitHub · 157 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 · 157 lines · 0 tokens per session scan A d04d934ffe73

Subscribe to this mod's changes

init-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 2,340 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

init-worktree compared with commands from other repositories

init-worktree next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
init-worktreebredmond1019/claude-sdk-rsCommand231mo agoApache-2.0A0Claude Code
merge-conflict-analysisrjmurillo/ai-agentsCommand49yesterdayMITA0GitHub Copilot
release-notesOpenHands/extensionsCommand176yesterdayMITA44Claude Code
commitechoVic/blade-codeCommand18124d agoMITA8Claude Code
repo-audittractorjuice/arc-kitCommand2.3k2d agononeA29Claude Code
propsmill/infrahub-mcpCommand10yesterdayApache-2.0A18Claude Code
codex-reviewoalders/kitchen-sinkCommand53d agoMITA41Claude Code