worktree-start

worktree-start is a skill for Claude Code from nirecom/agents. It costs 21 tokens per session (1,868 once invoked), scanned A, original, MIT.

A workflow for creating a linked Git worktree for a parallel task and copying required local configuration into it. A worktree is a separate working directory connected to the same Git repository.

In plain words
What is it for?
Starting parallel Git work, creating an isolated worktree, and initializing its ignored configuration.
Why use it?
It lets separate tasks be worked on independently while preserving the local setup they need.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: mentions subagents; names the AskUserQuestion tool.

Good fit Starting parallel Git work, creating an isolated worktree, and initializing its ignored configuration.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nirecom/agents/worktree-start
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.

Any agent
npx skills add nirecom/agents --skill worktree-start
Clone the repo
git clone --depth 1 https://github.com/nirecom/agents

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-start

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/nirecom/agents/worktree-start"><img src="https://agentmods.dev/badge/skills/nirecom/agents/worktree-start.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,868 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.00021 $0.01868
Opus 5.5 $0.00008 $0.00747
Sonnet 5.5 $0.00004 $0.00374
Haiku 4.5 $0.00002 $0.00187

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

Security

Grade A, and why

worktree-start 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.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/derive-worktree-name.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/worktree-start/SKILL.md · 96 lines

How it starts

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

Set up a new linked worktree and initialize its gitignored state before starting work.

Personal config: Set WORKTREE_BASE_DIR in your agents config to customize the worktree base path. Default: ~/git/worktrees. Windows example: WORKTREE_BASE_DIR=C:\git\worktrees.

Procedure

Read rules/branch.md and rules/worktree.md before WS-1 — both on-demand-only, never auto-injected; WS-1 needs the worktree criteria and WS-2 derives the branch name and type from the naming convention. Read rules/ops.md before WS-5 — on-demand-only, never auto-injected; it owns the recovery-options-first decision path any directory or worktree removal a path collision tempts must pass through.

WS-1. Verify the task fits the worktree criteria in rules/worktree.md (fit table). If it does not fit, report why and stop — set ENFORCE_WORKTREE=off in agents config and work on main directly instead.

WS-2. Derive the task name and branch type — always automatic, never asked of the user: Run bash "$AGENTS_MAIN_ROOT/skills/worktree-start/scripts/derive-worktree-name.sh", adding --headless <label> when the caller cannot present AskUserQuestion (running as a subagent or forked execution context) or when no workflow session hosts this run. Read TASK_NAME=, BRANCH_TYPE=, and REPO_NAME= from its stdout — REPO_NAME is the validated <REPO_NAME> path component; never infer it yourself. Non-zero exit → surface its stderr and stop; never substitute a name of your own and never ask the user for one. Reuse-safety check: run git worktree list --porcelain and find the entry whose worktree line equals <WORKTREE_BASE_DIR>/<TASK_NAME>/<REPO_NAME> — normalize both sides before comparing: convert every backslash to a forward slash and every MSYS-style /c/<rest> path to its C:/<rest> form (or vice versa), then strip any trailing slash, then lowercase both sides when the filesystem is case-insensitive (Windows, and default macOS). No entry → continue to WS-3. An entry exists → an existing path is not proof it is safe to attach to, so reuse only when all three hold:

  • Its branch line equals refs/heads/<BRANCH_TYPE>/<TASK_NAME>; a different branch is a naming collision, not a reusable worktree — surface both paths and branches to the user and stop.
  • It carries neither a locked nor a prunable line; either means another process or a stale registration owns it — surface the reason and stop.
  • git -C "<path>" status --porcelain (standalone command, no chaining) prints nothing; non-empty output is another session's in-flight work — never delete or reset it; report the dirty path and stop. The derived task name is deterministic, so resolving the collision requires manual intervention outside this skill (wait for the other session, or remove/relocate that worktree by hand). A non-zero exit from git worktree list --porcelain or git -C "<path>" status --porcelain means ownership cannot be verified — treat it the same as the three failing conditions above: surface the command's stderr and stop.

All three pass → print the path and branch to stdout, skip WS-3–WS-6 (already exists — do not run git worktree add), and continue at WS-7.

WS-3. Worktree path: <WORKTREE_BASE_DIR>/<TASK_NAME>/<REPO_NAME>. Branch name: <BRANCH_TYPE>/<TASK_NAME>. Report both in chat — do not ask for approval.

WS-4. Check for conflicts:

git worktree list --porcelain

Report any existing worktrees at the same path or on the same branch.

WS-5. Create the parent directory (platform-aware):

  • POSIX: mkdir -p "<WORKTREE_BASE_DIR>/<TASK_NAME>"
  • PowerShell: New-Item -ItemType Directory -Force -Path "<WORKTREE_BASE_DIR>\<TASK_NAME>"

Do NOT chain or pipe this command (no ;, &&, ||, |, $(), backticks). enforce-worktree.js only grants its New-Item -ItemType Directory exemption to isolated commands — any shell operator removes the exemption and the command is rejected as a write from the main worktree. Run it as its own Bash call. The same rule applies to WS-6 (git worktree add).

Read the full file on GitHub · 96 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 Changed 14aeaea56d04
  2. 17d ago Changed 03ea97050b94
  3. 21d ago Changed 527c130d1e30
  4. 1mo ago First seen · 96 lines · 21 tokens per session scan A 3a07eba8168f

Subscribe to this mod's changes

worktree-start is a skill published in the GitHub repository nirecom/agents (3 stars, last pushed today), licensed MIT. It adds 21 tokens to every session and 1,868 once invoked, about $0.0001 per session on Opus 5.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.