mcp-cli: Command for Claude Code

.claude/commands/worktree.md

worktree is a command for Claude Code from theshadow27/mcp-cli. It costs 0 tokens per session (1,854 once invoked), scanned A, original, MIT.

A command that gives separate Git worktrees to agents working on GitHub issues. A worktree is an additional working copy of the same repository, so several tasks can be developed independently at once.

In plain words
What is it for?
Use it to implement one or more GitHub issues in parallel, with each task handled, tested, and verified in its own worktree.
Why use it?
It reduces clashes between parallel changes and keeps each issue's files and tests isolated. It also checks the repository before work begins and requires confirmation after showing the planned tasks.

Command for Claude Code

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

This is theshadow27/mcp-cli's own configuration. It tells Claude Code how to work on mcp-cli 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 mcp-cli configures →

Reuse

Borrowing it

Nothing to install: this file belongs to theshadow27/mcp-cli. 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/theshadow27/mcp-cli/main/.claude/commands/worktree.md
Clone the repo
git clone --depth 1 https://github.com/theshadow27/mcp-cli

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 worktree

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/theshadow27/mcp-cli/worktree"><img src="https://agentmods.dev/badge/commands/theshadow27/mcp-cli/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 1,854 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.01854
Opus 5.5 $0.00000 $0.00742
Sonnet 5.5 $0.00000 $0.00371
Haiku 4.5 $0.00000 $0.00185

Measured 2mo ago against content hash 14cb87599f1f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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 2mo 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.md · 203 lines

How it starts

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

Worktree: Parallel Issue Orchestrator

Orchestrate implementation of one or more GitHub issues in parallel using worktree-isolated agents. Each issue gets its own git worktree, its own agent, and is independently implemented, tested, and verified.

Input

One or more GitHub issue numbers or descriptions, space-separated. Parse from: $ARGUMENTS

Examples:

  • /worktree 14 — single issue
  • /worktree 14 15 16 — parallel batch
  • /worktree "add shell completions" — free-text task

Workflow

Step 1: Gather Issues

For each issue number provided:

gh issue view <number> --json number,title,body,labels

For free-text descriptions, treat each as a standalone task.

Present a summary table to the user:

# Title Labels Approach
14 Add shell completions enhancement feat
15 Daemon crashes on bad config bug fix

Ask the user to confirm before proceeding. This is the last checkpoint — after confirmation, agents run autonomously.

Step 2: Check Preconditions

git rev-parse --is-inside-work-tree
git branch --show-current
git status --short
  • Must be in a git repo
  • Warn if not on main branch (agents branch from HEAD)
  • Warn if there are uncommitted changes — agents will branch from current HEAD, so uncommitted work won't be in their worktrees
  • Verify bun install works (agents will need deps)

Step 3: Implement in Parallel

For EACH issue, spawn an Agent with isolation: "worktree" running in the background. Each agent gets a detailed prompt that includes:

  1. The full issue context (number, title, body, labels)
  2. The complete /implement workflow instructions (inline — don't reference the command)
  3. Project conventions from CLAUDE.md

Use the Agent tool like this for each issue (all launched in a single message for true parallelism):

Agent(
  subagent_type: "general-purpose",
  isolation: "worktree",
  run_in_background: true,
  description: "Implement issue #<N>",
  prompt: "<detailed prompt with full issue context and implement workflow>"
)

Read the full file on GitHub · 203 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. 2mo ago First seen · 203 lines · 0 tokens per session scan A 14cb87599f1f

Subscribe to this mod's changes

worktree is a command published in the GitHub repository theshadow27/mcp-cli (2 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,854 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-08-31.