worktree-agent-isolation

worktree-agent-isolation is a skill for Claude Code, Codex from Arasz/ai-raccoon. It costs 82 tokens per session (4,875 once invoked), scanned C, original, MIT.

A workflow for giving each coding agent its own Git worktree. A worktree is a separate working directory connected to the same Git repository, and agent isolation keeps parallel changes apart.

In plain words
What is it for?
Use it when running independent tasks in parallel or keeping the main checkout unchanged while agents work on branches and pull requests.
Why use it?
It prevents parallel agents from overwriting files or sharing build and test artifacts, which can cause conflicts and unreliable results.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents; $skill-name invocation.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is git worktree add ../project-task-a -b task/<id>-<slug> origin/main.

Good fit Use it when running independent tasks in parallel or keeping the main checkout unchanged while agents work on branches and pull requests.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Arasz/ai-raccoon
agentmods
npx agentmods add skills/arasz/ai-raccoon/worktree-agent-isolation

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-agent-isolation

README.md
[![agentmods](https://agentmods.dev/badge/skills/arasz/ai-raccoon/worktree-agent-isolation/github.svg)](https://agentmods.dev/skills/arasz/ai-raccoon/worktree-agent-isolation)
Your own site
<a href="https://agentmods.dev/skills/arasz/ai-raccoon/worktree-agent-isolation"><img src="https://agentmods.dev/badge/skills/arasz/ai-raccoon/worktree-agent-isolation/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-agent-isolation

Your own site · 80×15
<a href="https://agentmods.dev/skills/arasz/ai-raccoon/worktree-agent-isolation"><img src="https://agentmods.dev/badge/skills/arasz/ai-raccoon/worktree-agent-isolation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,875 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.00082 $0.04875
Opus 5.5 $0.00033 $0.01950
Sonnet 5.5 $0.00016 $0.00975
Haiku 4.5 $0.00008 $0.00487

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

Security

Grade C, and why

worktree-agent-isolation 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 yesterday.

The scan reads SKILL.md. This mod also ships 6 executable files (scripts/badger_store.py, scripts/blast_radius_kill_guard.py, scripts/cross_worktree_dirty_warning.py, …), 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.

Recursive force deletehighDestructive command

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

completely" errors. Workaround is `rm -rf obj/` but it is destructive and racy.
.ai-badger/skills/worktree-agent-isolation/SKILL.md · 260 lines

How it starts

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

Worktree Agent Isolation

Run N independent coding agents in parallel, each in its own git worktree, with zero file conflicts. Integrate via GitHub PRs — the main checkout is read-only.

Why

Two agents in the same directory cause:

  • Build failures: Shared obj/ directories cause MSB3492 or "Building target completely" errors. Workaround is rm -rf obj/ but it is destructive and racy.
  • File modification races: One agent patches stale content.
  • Test corruption: Process-global state (env vars, temp dirs) interferes.

When to Use

  • User says "worktrees only", "don't touch main", "agent isolation"
  • Multiple independent tasks can run in parallel
  • Another agent/session is using the main checkout
  • User wants to see draft PRs for in-flight work visibility

Setup

# Fetch latest main first — ensures worktrees branch from the true HEAD
git fetch origin main

# Create N worktrees from origin/main (not local main, which may be behind)
git worktree add ../project-task-a -b task/<id>-<slug> origin/main
git worktree add ../project-task-b -b task/<id>-<slug> origin/main

Each worktree gets its own branch, own working directory, own build artifacts.

Always use origin/main as the base, not main. Local main may lag behind after another agent merges. Fetching first ensures all worktrees share the same ancestor, reducing rebase conflicts when merging sequentially.

Dispatching Agents

delegate_task(tasks=[
    {"goal": "Implement issue #X: ...",
     "context": """Project: /abs/path/to/project-task-a
     Branch: task/x-slug (already checked out)
     Build: dotnet build
     Test: dotnet test --filter "..."
     DO NOT USE Rider MCP tools. Use terminal, read_file, write_file only.
     TDD MANDATORY: ..."""},
    {"goal": "Implement issue #Y: ...",
     "context": """Project: /abs/path/to/project-task-b
     ..."""},
])

Key: pass the absolute worktree path as Project. Each agent's working directory is isolated — they never see each other's files.

Read the full file on GitHub · 260 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 · 260 lines · 82 tokens per session scan C d9672dd349b9

Subscribe to this mod's changes

worktree-agent-isolation is a skill published in the GitHub repository Arasz/ai-raccoon (7 stars, last pushed today), licensed MIT. It adds 82 tokens to every session and 4,875 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-12-05.

Related

worktree-agent-isolation compared with skills from other repositories

worktree-agent-isolation next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
worktree-agent-isolationArasz/ai-raccoonSkill7todayMITC82Claude Code, Codex
cartographer-kb-conflict-resolveBeppeTemp/cartographerSkill74yesterdayApache-2.0A24Claude Code, Codex
shipariaxhan/kernel-claudeSkill16yesterdayMITA46Claude Code
githubGen-Verse/PAST-BenchSkill404mo agoApache-2.0A44Claude Code, Codex
github-proxyvolcengine/OpenVikingSkill43ktodayAGPL-3.0A94Claude Code, Codex
release-rollbackPrismer-AI/PrismerCloudSkill1.4k1mo agoMITA96Claude Code
evolve-lite:publishAgentToolkit/altk-evolveSkill1435d agoApache-2.0A28Claude Code, Codex