speckit.spex-worktrees.worktree

speckit.spex-worktrees.worktree is a command for Claude Code from rhuss/cc-spex. It costs 31 tokens per session (5,591 once invoked), scanned B, original, Apache-2.0.

A Git worktree manager for keeping feature development in separate working folders and branches. Git worktrees let you work on multiple branches without constantly switching one folder.

In plain words
What is it for?
Use it to create, verify, list, finish, or clean up feature worktrees around specification and implementation tasks.
Why use it?
It isolates feature changes and helps clean up or merge the related branch when development ends.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: mentions Claude Code; mentions Codex; mentions OpenCode.

Good fit Use it to create, verify, list, finish, or clean up feature worktrees around specification and implementation tasks.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/rhuss/cc-spex/speckit.spex-worktrees.manage
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.

Clone the repo
git clone --depth 1 https://github.com/rhuss/cc-spex

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 speckit.spex-worktrees.worktree

README.md
[![agentmods](https://agentmods.dev/badge/commands/rhuss/cc-spex/speckit.spex-worktrees.manage/github.svg)](https://agentmods.dev/commands/rhuss/cc-spex/speckit.spex-worktrees.manage)
Your own site
<a href="https://agentmods.dev/commands/rhuss/cc-spex/speckit.spex-worktrees.manage"><img src="https://agentmods.dev/badge/commands/rhuss/cc-spex/speckit.spex-worktrees.manage/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 speckit.spex-worktrees.worktree

Your own site · 80×15
<a href="https://agentmods.dev/commands/rhuss/cc-spex/speckit.spex-worktrees.manage"><img src="https://agentmods.dev/badge/commands/rhuss/cc-spex/speckit.spex-worktrees.manage.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,591 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00031 $0.05591
Opus 5 $0.00015 $0.02795
Sonnet 5 $0.00006 $0.01118
Haiku 4.5 $0.00003 $0.00559

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

Security

Grade B, and why

speckit.spex-worktrees.worktree scanned grade B with 1 finding 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 9d 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.

Asks the agent to reveal its instructionsmediumSystem prompt leakage

Directions to print, repeat or translate the system prompt extract configuration the operator did not intend to expose.

Then print instructions for the user. For inside-project worktrees, show the relative path (e.g., `.claude/worktrees/032-feature`). For external worktrees, show the absolute path.
specs/038-neutral-command-vocab/pre-rewrite-snapshot/spex-worktrees/commands/speckit.spex-worktrees.manage.md · 611 lines

How it starts

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

Git Worktree Management for spex

Overview

This command manages git worktrees to isolate feature development. It supports four actions:

  • create: Called by the after_specify hook after speckit-specify completes. Creates a worktree, restores main, and prints switch instructions.
  • ensure: Called by the before_implement hook. Verifies worktree isolation exists. If already in a worktree, proceeds silently. If not, creates one (same as create).
  • list: Shows all active feature worktrees with path, branch, and feature name.
  • finish: Merges the current worktree's branch into the default branch and removes the worktree. Use when implementation is complete.
  • cleanup: Detects worktrees whose branches are merged and offers removal.

Action Routing

Determine the action from the argument:

  • If invoked with argument create (from the after_specify hook): the action is create. Execute immediately, no confirmation needed.
  • If invoked with argument ensure (from the before_implement hook): the action is ensure. See Action: Ensure below.
  • If invoked with argument finish: the action is finish.
  • If invoked with argument cleanup: the action is cleanup.
  • Otherwise (no args, list, or invoked directly): the action is list.

Prerequisites

The project must be a git repository.

git rev-parse --git-dir >/dev/null 2>&1 || { echo "ERROR: Not a git repository"; exit 1; }

Action: Create

This action runs after speckit-specify has created a feature branch and spec files.

Step 1: Read Configuration

Read base_path from the worktrees extension config (or default to .claude/worktrees):

WORKTREE_CONFIG=".specify/extensions/spex-worktrees/worktree-config.yml"
BASE_PATH=$(yq -r '.worktrees.base_path // ".claude/worktrees"' "$WORKTREE_CONFIG" 2>/dev/null || echo ".claude/worktrees")

Default: .claude/worktrees (inside the project directory, keeps CWD stable in Claude Code).

Step 2: Get Current Branch

Read the full file on GitHub · 611 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. 9d ago First seen · 611 lines · 31 tokens per session scan B 296770248e06

Subscribe to this mod's changes

speckit.spex-worktrees.worktree is a command published in the GitHub repository rhuss/cc-spex (116 stars, last pushed 20d ago), licensed Apache-2.0. It adds 31 tokens to every session and 5,591 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (asks the agent to reveal its instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.