worktree

worktree is a skill for Claude Code, Codex from OutlineDriven/odin-claude-plugin. It costs 59 tokens per session (1,043 once invoked), scanned A, 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

Part of the odin-code plugin — 52 skills shipped together

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/outlinedriven/odin-claude-plugin/worktree
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-code, the plugin that ships this one along with the rest of its 52 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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,043 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.00059 $0.01043
Opus 5 $0.00030 $0.00522
Sonnet 5 $0.00012 $0.00209
Haiku 4.5 $0.00006 $0.00104

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

Security

Grade A, and why

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.

plugins/odin-code/skills/worktree/SKILL.md · 42 lines

How it starts

The opening of the file, as written. The whole thing — 42 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, or an existing ref or PR needs isolation.
Authority reversible-local: write only the worktree directory and a .worktrees/ gitignore entry; rollback by removing the worktree and reverting that entry.
Side effect Local write: creates or attaches an isolated git worktree and reports its exact path and status.
Done An isolated workspace exists that the harness can see and manage, with no phantom state.

Inputs

  1. Ref to isolate (optional): a PR head, branch, or commit for isolate-existing-ref mode. Omit for new-work mode.
  2. New branch name (optional): derived from the work description when omitted.
  3. Base branch (optional): defaults to origin's default branch, else main.

Procedure

  1. Determine the mode: if the caller named a ref (PR head, branch, or commit), this is isolate-existing-ref mode; otherwise new-work mode. Do not create a worktree for single-task work that can happen on a branch in the current checkout. Done when: the mode is decided and single-task work is ruled out.
  2. Detect existing isolation before creating anything. Compare the resolved absolute git dir against the resolved absolute common git dir: run git rev-parse --absolute-git-dir and (cd "$(git rev-parse --git-common-dir)" && pwd -P). If they are equal, this is a normal checkout; continue to step 3. Done when: the isolation state is known (normal checkout, submodule, or already isolated).
  3. If the two paths differ, run git rev-parse --show-superproject-working-tree. Non-empty output means a submodule; treat it as a normal checkout and continue to step 4. Empty output means the run is already in an isolated worktree: report the worktree path (git rev-parse --show-toplevel) and current branch. In new-work mode, proceed in place and stop. In isolate-existing-ref mode, check the named ref out here unless it is already the current branch, then stop. Do not create another worktree. Done when: either already-isolated is handled and stopped, or the normal-checkout/submodule path continues to step 4.
  4. Prefer the harness's native worktree primitive (for example Claude Code's EnterWorktree, a /worktree command, or a --worktree flag). Use it and stop. A behind-the-back git worktree add creates phantom state the harness cannot see, navigate to, or clean up. Done when: a native tool created the worktree, or no native tool exists and the git fallback is the next step.
  5. If no native tool exists and step 2 or 3 found no existing isolation, fall back to manual git worktree creation following references/git-fallback.md. Done when: the worktree exists under .worktrees/ and the harness can see it via the tracked convention.
  6. Report the worktree's absolute path and current branch, and confirm the harness can see it (native tool) or that it lives under the tracked .worktrees/ convention (git fallback). Done when: the path, branch, mode, and creation method are reported.

Read the full file on GitHub · 42 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. yesterday 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 (35 stars, last pushed yesterday), licensed Apache-2.0. It adds 59 tokens to every session and 1,043 once invoked, about $0.0003 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-04.

Related

Other skills, from other repositories

java-clean-arch

Reviews or implements Clean Architecture / Hexagonal Architecture (Ports & Adapters) and DDD tactical patterns for Java projects. Use when user asks to "apply clean architecture", "implement hexagonal architecture", "add ports and adapters", "apply DDD", "refactor to clean arch", "review architecture", or "add value…

ducpm2303/claude-java-plugins · 68 tokens

java-adr

Creates, lists, and manages Architecture Decision Records for Java projects. Use when user asks to "create an ADR", "document this decision", "write an architecture decision", "add ADR", "list decisions", "show ADRs", or "record this architectural choice".

ducpm2303/claude-java-plugins · 54 tokens

java-test

Generates JUnit 5 and Mockito unit tests or Testcontainers integration tests, auto-detecting project setup. Use when user asks to "write tests", "generate tests", "add unit tests", "create test class", "test this service", or "write integration tests".

ducpm2303/claude-java-plugins · 57 tokens

java-jpa

Reviews Spring Data JPA for N+1 queries, fetch strategies, projections, and Specifications. Use when user asks to "review JPA", "check for N+1", "JPA performance", "review my entities", "check fetch strategy", or "review my repositories".

ducpm2303/claude-java-plugins · 57 tokens

java-logging

Reviews Java logging for SLF4J best practices, MDC context, structured logging, and PII safety. Use when user asks to "review logging", "check my logs", "logging review", "is my logging correct", "MDC setup", or "check for PII in logs".

ducpm2303/claude-java-plugins · 60 tokens

java-security

Reviews or implements Spring Security configuration — JWT authentication, OAuth2, method-level security, CORS, and CSRF. Use when user asks to "add authentication", "secure this API", "implement JWT", "configure Spring Security", "add OAuth2 login", "protect endpoints", or "review security config".

ducpm2303/claude-java-plugins · 63 tokens