worktrees

worktrees is a skill for Claude Code from agallardol/zcode-git-worktrees. It costs 75 tokens per session (1,096 once invoked), scanned A, original, MIT.

A workflow for using Git worktrees, which are separate folders and branches for the same repository.

In plain words
What is it for?
Use it to create, inspect, snapshot, clean up, and remove isolated work areas for feature work, experiments, or code reviews.
Why use it?
It lets several tasks or agents work in parallel without repeatedly switching branches or stashing changes.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter.

Good fit Use it to create, inspect, snapshot, clean up, and remove isolated work areas for feature work, experiments, or code reviews.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agallardol/zcode-git-worktrees/worktrees
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 agallardol/zcode-git-worktrees --skill worktrees
Clone the repo
git clone --depth 1 https://github.com/agallardol/zcode-git-worktrees

Made for: Claude Code.

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 worktrees

README.md
[![agentmods](https://agentmods.dev/badge/skills/agallardol/zcode-git-worktrees/worktrees/github.svg)](https://agentmods.dev/skills/agallardol/zcode-git-worktrees/worktrees)
Your own site
<a href="https://agentmods.dev/skills/agallardol/zcode-git-worktrees/worktrees"><img src="https://agentmods.dev/badge/skills/agallardol/zcode-git-worktrees/worktrees/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 worktrees

Your own site · 80×15
<a href="https://agentmods.dev/skills/agallardol/zcode-git-worktrees/worktrees"><img src="https://agentmods.dev/badge/skills/agallardol/zcode-git-worktrees/worktrees.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,096 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00075 $0.01096
Opus 5.5 $0.00030 $0.00438
Sonnet 5.5 $0.00015 $0.00219
Haiku 4.5 $0.00007 $0.00110

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

Security

Grade A, and why

worktrees 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 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.

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/git-worktrees/skills/worktrees/SKILL.md · 50 lines

How it starts

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

Git worktrees for ZCode

Worktrees give every task its own directory + branch sharing one git object store — parallel agents or humans can work on the same repo without stashing, branch switching, or stepping on each other.

Always use the MCP tools (mcp__git-worktrees__*), never raw git worktree commands — the tools add validation, safety checks, snapshots, and state tracking that raw git lacks.

Tools

Tool Use
worktrees_create {name?, baseRef?, task?, carryDirty?} Create worktree at <store>/<project>/<name>, branch zcode/<name>, base fresh (origin/HEAD) by default
worktrees_list All worktrees: branch, dirty, locked, agent, size, activity
worktrees_status {name} Detail: diff stat, unpushed, snapshots
worktrees_remove {name, force?, deleteBranch?} Safe removal; snapshots uncommitted work first; branch kept by default
worktrees_cleanup {dryRun?, maxAgeDays?, maxCount?} Retention sweep (dry-run by default)
worktrees_prune Sync git + state after manual deletion
worktrees_snapshot {name} Snapshot uncommitted work on demand
worktrees_set_task {name, task?, agentId?, clearAgent?} Link a running agent to its worktree (locks it)
worktrees_auto_session {enabled?} Get/toggle auto-session mode (each new session in a main checkout gets its own worktree)

Slash commands /worktree, /worktree:new, /worktree:list, /worktree:status, /worktree:remove, /worktree:cleanup, /worktree:pr, /worktree:end, /worktree:auto drive the same tools with the full UX.

Auto-session mode (on by default)

Every NEW session started in a repo's main checkout is assigned its own worktree (branch zcode/sess-<id>, based on current HEAD). Resuming a session returns to its worktree; edits to the main checkout are blocked (PreToolUse guard) and redirected to the session worktree; /worktree:end commits everything and removes the worktree. Since sessions there run with cwd still in the main checkout, agents must use absolute paths into the worktree and git -C — the injected SessionStart context explains this. Escape hatches: Settings → Plugins → Git Worktrees or /worktree:auto off (machine-wide, most recent change wins), or per-repo .zcode/worktree.json {"autoSession": false}.

Read the full file on GitHub · 50 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 First seen · 50 lines · 0 tokens per session scan A bf9d4327c49a

Subscribe to this mod's changes

worktrees is a skill published in the GitHub repository agallardol/zcode-git-worktrees (4 stars, last pushed 1mo ago), licensed MIT. It adds 75 tokens to every session and 1,096 once invoked, about $0.0003 per session on Opus 5.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.