worktree-start

worktree-start is a skill for Claude Code, Codex from nirecom/agents. It costs 21 tokens per session (1,880 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 CodeCodex

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.

agentmods
npx agentmods add skills/nirecom/agents/worktree-start
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, Codex.

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.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.svg" alt="Measured on agentmods" 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,880 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00021 $0.01880
Opus 5 $0.00010 $0.00940
Sonnet 5 $0.00004 $0.00376
Haiku 4.5 $0.00002 $0.00188

Measured yesterday against content hash 3a07eba8168f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 yesterday.

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_CONFIG_DIR/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 step 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. yesterday 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,880 once invoked, about $0.0001 per session on Opus 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.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

chronicle

Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting…

microsoft/vscode · 72 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens