rig-worktree

A worktree manager for Git, where a worktree is a separate working copy of a repository linked to the same history. It creates development-ready worktrees, lists them with pull-request status, and removes merged ones.

In plain words
What is it for?
Use it when starting isolated feature work, experiments, or spikes, checking existing worktrees, or safely cleaning up merged worktrees.
Why use it?
It prevents parallel changes from interfering with each other and handles setup details such as fetching the base branch, sharing environment files, and installing dependencies.

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/agent-rig/rig/rig-worktree
Any agent
npx skills add agent-rig/rig --skill rig-worktree
Clone the repo
git clone --depth 1 https://github.com/agent-rig/rig

Made for: Claude Code, Codex.

Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,149 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.00103 $0.02149
Opus 5 $0.00051 $0.01074
Sonnet 5 $0.00021 $0.00430
Haiku 4.5 $0.00010 $0.00215

Measured yesterday against content hash 8ba3ac18b499, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rig-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 yesterday.

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/rig-worktree/SKILL.md · 169 lines

How it starts

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

Worktree — isolated dev checkout lifecycle

Create / list / remove isolated git worktrees under .claude/worktrees/. Creation produces a worktree that's actually ready to run: fetched from origin, branched from the right base, env files symlinked, dependencies installed. This is a shared bootstrap you can call directly (spikes, ad-hoc branches, parallel experiments) and that implement-style flows and prune/rig-tidy steps can delegate to.

The logic lives in two scripts so the invariants live in one place: .claude/scripts/setup-worktree.sh (create) and .claude/scripts/remove-worktree.sh (teardown). Creation encodes three invariants that bite if skipped — fetch-before-branch (stale local refs silently start you on a pre-merge tip), env symlinks (missing secrets read as flaky/timeout test failures, not "config not found"), and a per-worktree dependency install (installed deps don't carry across worktrees → Cannot find package '...'). Don't reimplement these inline; call the scripts.

Configuration

Reads .rig/config.json (missing keys → defaults):

Key Default Used for
vcs.baseRef origin/main Default --base the worktree branches from.
vcs.branchConvention {user}/{ticket}-{slug} Template when inferring a branch name from a ticket ID.
vcs.defaultBranch main The trunk (informational; the main worktree).
runtime.installCommand derived from packageManager Passed to the setup script as --install-cmd.
runtime.packageManager npm Derives the install command when installCommand is unset (bunbun install, pnpmpnpm install, yarnyarn, npmnpm install, none→skip install).
tracker.ticketPrefix Recognizing a ticket ID (e.g. ABC-521) to slot into the branch template.

If .rig/config.json is absent, run unconfigured: base origin/main, install npm install, branch template {user}/{ticket}-{slug}, and say so.

Subcommands

$ARGUMENTS routes to one of:

Read the full file on GitHub · 169 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. yesterday First seen · 169 lines · 103 tokens per session scan A 8ba3ac18b499

Subscribe to this mod's changes

rig-worktree is a skill published in the GitHub repository agent-rig/rig (2 stars, last pushed 14d ago), licensed MIT. It adds 103 tokens to every session and 2,149 once invoked, about $0.0005 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-08-31.

Related

Other skills, from other repositories

audit-onboarding-proposal

Independently audit a brownfield onboarding transcript, operational map, or exact proposed documentation patch before application. Use when a fresh reviewer must verify an $onboard-repository first pass, distinguish environment-caused Unknowns from reasoning defects, score its safety and evidence gates, or run a…

hoangnb24/repository-harness · 104 tokens

engineering-wisdom

Provide an explicitly requested, repository-grounded engineering review using contextual heuristics for code clarity, SOLID and design, testing, refactoring, architecture, and professional practice. Use only when the user invokes $engineering-wisdom or explicitly asks for this installed engineering-wisdom pack; do not…

hoangnb24/repository-harness · 78 tokens

red-team-adversarial

Adversarial security and resilience analysis — auto-triggered during /review and /test based on task classification. Provides attack surface analysis, boundary testing, auth bypass attempts, dependency chain attacks, and Beast Mode stress testing.

KbWen/agentic-os · 50 tokens

product-decision-agent

中文产品决策 Agent。用于中国大陆互联网产品、运营、增长、商业化、数据、项目推进和组织协作场景:产品规划、需求分析、PRD、需求优先级、排期、版本规划、Roadmap、MVP、灰度、上线、迭代、增长停滞、拉新、投放、渠道、裂变、CAC、LTV、ROI、留存、转化、DAU/MAU、GMV、漏斗、社区运营、内容供给、创作者、用户运营、活动运营、私域、会员、定价、指标异常、数据口径、埋点、A/B…

mxyhi/ok-skills · 265 tokens

marketing-copy

Write outbound promotional copy for a product or project: launch and update posts for community platforms and social media, store page descriptions and short blurbs, landing page headlines and calls to action, press-style announcements, and the naming of a product for another language or market. Covers what may be…

scarletkc/agents · 121 tokens

repo-health-check

Use when auditing a repo before changes to find the smallest safe PR, quality risks, stale docs, missing tests, ignored-file gaps, or agent setup issues. Best first skill for unfamiliar codebases.

DominikTobureto/awesome-grok-build · 44 tokens