worktree

worktree is a skill for Claude Code, Codex from OutlineDriven/odin-claude-plugin. It costs 73 tokens per session (4,094 once invoked), scanned C, original, Apache-2.0.

A workflow for creating or attaching an isolated Git worktree, which is a separate working directory for a branch or existing change.

In plain words
What is it for?
Use it to isolate a new task, branch, commit, or pull request while reporting the directory and its status.
Why use it?
It keeps separate work from interfering with the current checkout.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present. Also seen: mentions Claude Code.

Part of the odin-git plugin — 46 skills shipped together

Good fit Use it to isolate a new task, branch, commit, or pull request while reporting the directory and its status.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/outlinedriven/odin-claude-plugin/worktree
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 OutlineDriven/odin-claude-plugin --skill worktree
Clone the repo
git clone --depth 1 https://github.com/OutlineDriven/odin-claude-plugin

Made for: Claude Code, Codex.

Or install odin-git, the plugin that ships this one along with the rest of its 46 skills.

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/skills/outlinedriven/odin-claude-plugin/worktree/github.svg)](https://agentmods.dev/skills/outlinedriven/odin-claude-plugin/worktree)
Your own site
<a href="https://agentmods.dev/skills/outlinedriven/odin-claude-plugin/worktree"><img src="https://agentmods.dev/badge/skills/outlinedriven/odin-claude-plugin/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/skills/outlinedriven/odin-claude-plugin/worktree"><img src="https://agentmods.dev/badge/skills/outlinedriven/odin-claude-plugin/worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,094 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 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.00073 $0.04094
Opus 5.5 $0.00029 $0.01638
Sonnet 5.5 $0.00015 $0.00819
Haiku 4.5 $0.00007 $0.00409

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

Security

Grade C, and why

worktree scanned grade C 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 1mo 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

f. Reconcile: list git worktrees with `git worktree list --porcelain` and compare paths under `.loop-worktrees/` against the manifest. Worktrees registered with git but missing from the manifest are orphans: report them,
plugins/odin-git/skills/worktree/SKILL.md · 87 lines

How it starts

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

Worktree isolation

Contract

Field Bound contract
Trigger A new isolated worktree or branch is requested, an existing ref or PR needs isolation, feature work needs a gated workspace with setup and baseline tests (feature-gate mode), a run needs a manifest-tracked worktree (loop-run mode), or a candidate patch must be captured from an ephemeral worktree without touching the current checkout (capture-isolated-patch mode).
Authority Reversible local: writes only the worktree directory, .worktrees/ or .loop-worktrees/ entries, a gitignore entry, symlinked hooks, manifest bookkeeping, or (capture-isolated-patch mode) a fresh temporary worktree and binary-safe patch under its parent temporary directory; rollback is removing the worktree and reverting those entries. Capture-isolated-patch mode never writes the original checkout. Loop-run mode never passes --force to git worktree remove. No remote mutation.
Side effect Local write: creates or attaches an isolated git worktree and reports its exact path and status. Feature-gate mode also runs setup and the baseline test suite. Loop-run mode also maintains a status manifest under .loop-worktrees/. Capture-isolated-patch mode runs the command in an ephemeral worktree, captures stdout/stderr/exit code, and writes and returns a binary-safe patch file path or preserves the worktree on extraction failure.
Done new-work and isolate-existing-ref modes have an isolated workspace the harness can see and manage, with no phantom state. feature-gate adds a green baseline suite or surfaces a failure. loop-run adds a manifest where every worktree has a legal status and no removal used --force. capture-isolated-patch writes and returns a binary-safe patch file path and command results, removes its temporary worktree after successful extraction, or preserves it and reports extraction failure; the original checkout is unchanged either way.

Inputs

  1. Mode (required): one of new-work, isolate-existing-ref, feature-gate, loop-run, capture-isolated-patch. Default new-work when no ref is named and no gate, lifecycle, or patch capture is requested.
  2. Ref to isolate (isolate-existing-ref only): a PR head, branch, or commit.
  3. New branch name (optional): derived from the work description when omitted.
  4. Base branch (optional): defaults to origin's default branch, else main.
  5. Setup command (feature-gate, optional): project setup to run inside the worktree, for example pnpm install --frozen-lockfile. When omitted, no setup step runs.
  6. runId (loop-run, required): unique run identifier used verbatim as a path segment and branch suffix; a single path segment (no /, not . or ..).
  7. pattern (loop-run, required at create): short work-pattern label kept on the manifest entry for audit.
  8. Status for mark (loop-run, required): exactly one of active, rejected, escalated, merged, stale.
  9. Cleanup set (loop-run, optional): status CSV, default rejected,escalated, plus an optional age cutoff <n> + s|m|h|d (for example 24h).
  10. Command (capture-isolated-patch, required): shell command that produces the candidate change; run it inside the ephemeral worktree with that worktree as its working directory.
  11. Base ref (capture-isolated-patch, optional): git ref used to create the detached worktree; defaults to the current HEAD.
  12. Repo path (capture-isolated-patch, optional): repository path for validation and worktree creation; defaults to the current working directory.

Read the full file on GitHub · 87 lines

Files

What ships with it

2 files 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. 1mo ago Changed · +10 lines · +27 tokens per session 5e6eef3c32d5
  2. 1mo ago Changed · +35 lines · -13 tokens per session scan A → C 6fbf77903531
  3. 1mo ago First seen · 42 lines · 59 tokens per session scan A f5489f035196

Subscribe to this mod's changes

worktree is a skill published in the GitHub repository OutlineDriven/odin-claude-plugin (38 stars, last pushed 24d ago), licensed Apache-2.0. It adds 73 tokens to every session and 4,094 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

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

systematic-debugging

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

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 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

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens