isolate-work-in-worktree

isolate-work-in-worktree is a skill for Claude Code, Codex from OutlineDriven/odin-claude-plugin. It costs 59 tokens per session (1,622 once invoked), scanned C, original, Apache-2.0.

A workflow for giving a run its own Git branch and worktree, or separate working copy, so concurrent work does not collide.

In plain words
What is it for?
Use it when an automated or parallel run needs an independent checkout and controlled cleanup.
Why use it?
It keeps simultaneous runs isolated and records their lifecycle so only finished worktrees can be removed.

Skill for Claude CodeCodex

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

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

Good fit Use it when an automated or parallel run needs an independent checkout and controlled cleanup.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/outlinedriven/odin-claude-plugin/isolate-work-in-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 isolate-work-in-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 60 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 isolate-work-in-worktree

README.md
[![agentmods](https://agentmods.dev/badge/skills/outlinedriven/odin-claude-plugin/isolate-work-in-worktree.svg)](https://agentmods.dev/skills/outlinedriven/odin-claude-plugin/isolate-work-in-worktree)
Your own site
<a href="https://agentmods.dev/skills/outlinedriven/odin-claude-plugin/isolate-work-in-worktree"><img src="https://agentmods.dev/badge/skills/outlinedriven/odin-claude-plugin/isolate-work-in-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,622 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.00059 $0.01622
Opus 5 $0.00030 $0.00811
Sonnet 5 $0.00012 $0.00324
Haiku 4.5 $0.00006 $0.00162

Measured 4d ago against content hash 98118564e1dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade C, and why

isolate-work-in-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 4d 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.

6. Reconcile manifest and disk. 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 orp
plugins/odin-code/skills/isolate-work-in-worktree/SKILL.md · 53 lines

How it starts

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

Isolate work in worktree

Contract

Field Bound contract
Trigger A run needs its own branch and checkout so concurrent work cannot collide.
Authority vcs-reversible-destructive. Destructive operations touch only VCS-recoverable state — git branches and git-registered worktrees. Show the exact branch-and-path set before any removal and treat git as the recovery path. Never pass --force to git worktree remove. The manifest, mutex, and worktree files under the gitignored .loop-worktrees/ are local bookkeeping, not deliverables.
Side effect Creates branch loop/<runId> plus worktree .loop-worktrees/<runId>, transitions its manifest status (active, rejected, escalated, merged, stale) via atomic manifest writes, and removes only terminal-status worktrees without --force; git refusals are surfaced instead of forced.
Done Every worktree is registered in the manifest with a legal status, cleanup never sweeps an active worktree, and no removal used --force.

Inputs

  • runId (required): unique identifier for the run, used verbatim as a path segment and branch suffix; it must be a single path segment (no /, not . or ..).
  • pattern (required at create): short label of the work pattern, kept on the manifest entry for audit.
  • Base branch (optional, default main) and repo root (optional, default cwd; must be inside a git repository).
  • Status for mark (required): exactly one of active, rejected, escalated, merged, stale.
  • Cleanup set (optional): status CSV, default rejected,escalated, plus an age cutoff in the form <n> + s|m|h|d (for example 24h).

Procedure

  1. Bind the root. Run git rev-parse --is-inside-work-tree; on failure stop without mutating. All state lives under .loop-worktrees/: the manifest at .loop-worktrees/manifest.json shaped exactly {"version":1,"worktrees":[]}, and the mutex at .loop-worktrees/.manifest.mutex. If the manifest exists in any other shape, stop — never rewrite a manifest that was not validated. Add .loop-worktrees/ to .gitignore so worktree contents never enter the index.
  2. Serialize manifest mutations with the mutex. Before each read-modify-write, create .loop-worktrees/.manifest.mutex with exclusive create; if it exists and its mtime is older than 30 seconds, remove it and retry; otherwise retry after a short backoff until a 30-second deadline, then fail naming the mutex path. Delete the mutex when the mutation ends, success or failure. Pure reads take no mutex.
  3. Create. Refuse a runId that is not a single path segment. Under the mutex, read the manifest: if an entry with the same id has status active, refuse and name its existing path. Otherwise run git worktree add -b loop/<runId> .loop-worktrees/<runId> <base>, which creates the branch and checks it out in one step. Replace any prior entry with the same id and append {"id":<runId>,"path":".loop-worktrees/<runId>","branch":"loop/<runId>","baseBranch":<base>,"pattern":<pattern>,"createdAt":<ISO-8601 UTC>,"status":"active"}. Write the manifest atomically: write a temp file in the same directory, then rename it over manifest.json.
  4. Mark outcomes; never delete entries to record them. Under the mutex: reject any status outside the five-value set; find the entry by id or fail naming the id; set its status; write the manifest atomically as in step 3. Marking preserves the audit trail; removal happens only in cleanup.
  5. Clean up terminal worktrees. Under the mutex: select entries whose status is in the requested set — default rejected and escalated; active is never selected, so mark a finished run terminal first — and, when a cutoff is given, whose createdAt is older than now minus the cutoff. For each selected entry run git worktree remove .loop-worktrees/<id> without --force; a git refusal, typically uncommitted or untracked files, is recorded as skipped with its reason and the entry stays in the manifest. Rewrite the manifest without the removed ids, atomically.
  6. Reconcile manifest and disk. 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, and remove one only on explicit instruction, still without --force. Drop manifest entries whose directory no longer exists with an atomic manifest write. Treat a missing path as absent, not an error, since rm -rf, a crash mid-cleanup, or a container wipe can leave git listing a prunable entry.

Read the full file on GitHub · 53 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. 4d ago First seen · 53 lines · 59 tokens per session scan C 98118564e1dc

Subscribe to this mod's changes

isolate-work-in-worktree is a skill published in the GitHub repository OutlineDriven/odin-claude-plugin (35 stars, last pushed today), licensed Apache-2.0. It adds 59 tokens to every session and 1,622 once invoked, about $0.0003 per session on Opus 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

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

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

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

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