worktree

worktree is a skill for Claude Code, Codex from ulises-jeremias/agent-toolkit. It costs 25 tokens per session (1,178 once invoked), scanned A, original, MIT.

A Git worktree manager for agent swarms, where a worktree is a separate working copy of a repository tied to its own branch.

In plain words
What is it for?
It helps create, inspect, promote, and clean up isolated worktrees for implementers, reviewers, and integrators.
Why use it?
It keeps several agent roles from editing the same files at once and supports handing completed work between them.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Part of the agent-toolkit-complete plugin — 116 skills shipped together

Good fit It helps create, inspect, promote, and clean up isolated worktrees for implementers, reviewers, and integrators.

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

Made for: Claude Code, Codex.

Or install agent-toolkit-complete, the plugin that ships this one along with the rest of its 116 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/ulises-jeremias/agent-toolkit/worktree/github.svg)](https://agentmods.dev/skills/ulises-jeremias/agent-toolkit/worktree)
Your own site
<a href="https://agentmods.dev/skills/ulises-jeremias/agent-toolkit/worktree"><img src="https://agentmods.dev/badge/skills/ulises-jeremias/agent-toolkit/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/ulises-jeremias/agent-toolkit/worktree"><img src="https://agentmods.dev/badge/skills/ulises-jeremias/agent-toolkit/worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,178 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00025 $0.01178
Opus 5 $0.00013 $0.00589
Sonnet 5 $0.00005 $0.00236
Haiku 4.5 $0.00003 $0.00118

Measured 5d ago against content hash 7303ece6d351, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 5d 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/agent-toolkit-complete/.github/skills/worktree/SKILL.md · 114 lines

How it starts

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

Worktree

Create and maintain worktree-per-writer isolation for agent-toolkit swarm so each role works on its own branch without stepping on others. Integrates with swarm-handoff promotion and github-cli-workflow for PRs.

When to use

  • Swarm needs isolated writes: implementer, reviewer, integrator each own a worktree/branch.
  • worktree_failed trace or find_repo_root error on .git file worktrees.
  • Before swarm promote — ensure the handoff's worktree is clean and pushable.
  • Cleanup after a run is promoted or abandoned.

Prerequisites

  • Repo is Git with git worktree available (git worktree --help).
  • Swarm run exists: .agent-toolkit/swarm/runs/<run-id>/state.json; worktrees live under .agent-toolkit/swarm/runs/<run-id>/worktrees/<role>-<short>/.
  • find_repo_root uses git rev-parse --git-common-dir to handle worktree .git files (not directories).

Workflow

1. Inspect current worktrees

git worktree list
agent-toolkit swarm status --run-id <run-id> --json | jq '.worktrees'
# Expected: {implementer: {path, branch, commit}, reviewer: {path, branch}, ...}
cat .agent-toolkit/swarm/runs/<run-id>/state.json | jq '.trace | map(select(.event | contains("worktree")))'

2. How swarm creates them (automatic)

On handoff create --from X --to Y for a writer role Y, swarm:

  1. Resolves repo root via find_repo_root (git rev-parse --git-common-dir fallback).
  2. Creates branch swarm/<run-id>/<role> if missing.
  3. Runs git worktree add <run-dir>/worktrees/<role>-<short> <branch>.
  4. Exports AGENT_TOOLKIT_SWARM_RUN_ID/RUN_DIR/REPO SWARMFORGE_ROLE and cd <worktree> && exec <runner> "$(cat prompt)" via _user_shell() (/usr/bin/zsh -lc on this host).

Do not create worktrees by hand for swarm roles — let handoff create do it so state.json stays authoritative.

3. Manual recovery

If worktree_failed:

git rev-parse --git-common-dir  # from worktree dir — should succeed
AGENT_TOOLKIT_SWARM_RUN_ID=<run-id> agent-toolkit swarm handoff create --type artifact --from implementer --to reviewer --artifact artifacts/retry.md --run-id <run-id>
# Re-triggers provisioning with fixed repo-root logic

Read the full file on GitHub · 114 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. 5d ago First seen · 114 lines · 25 tokens per session scan A 7303ece6d351

Subscribe to this mod's changes

worktree is a skill published in the GitHub repository ulises-jeremias/agent-toolkit (16 stars, last pushed today), licensed MIT. It adds 25 tokens to every session and 1,178 once invoked, about $0.0001 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

github-navigator

GitHub operations via gh CLI. CRITICAL: Use instead of WebFetch for any github.com URL or GitHub repo path like owner/repo. Use when the user asks to inspect repositories, files, issues, pull requests, releases, Actions runs, or repository structure. Use when the user says 'show README', 'list issues', 'check PR'…

arvindand/agent-skills · 107 tokens

active-review

Use when the user wants to prepare for a manual PR code review and asks for help targeting it — a terse PR summary, ranked files to read first, and paste-ready inline comment drafts with GitHub deep-links. Triggers: "active review this PR", "walk me through this PR", "help me review this", "give me inline comments to…

paultyng/skill-issue · 157 tokens

bisect

Use when hunting a regression, phrases like "bisect", "find the commit that broke X", "this used to work", "regression in test Y", "when did start". Also use when escalated from ci-debug-loop because log analysis can't pinpoint the offending change, or when a previously-passing test/build/behavior is now failing and…

paultyng/skill-issue · 121 tokens

analyze-knowledge

Use when the user asks who knows specific code, who should review a PR or files, what the lottery factor is, whether knowledge is concentrated or spread, who to talk to about a code area, or when suggesting reviewers beyond GitHub's built-in suggestions.

paultyng/skill-issue · 57 tokens

fix-pr-conflict

Resolve merge conflicts on a pull request by rebasing onto the base branch. Use when a PR is not mergeable, has merge conflicts, or the user asks to fix conflicts on a PR.

paultyng/skill-issue · 44 tokens

ship-it

End-to-end shipping workflow. Formats, lints, tests, creates a changelog entry, commits with conventional commits, pushes, updates PR description, and suggests reviewers. Use when the user says "ship it", "commit and push", "fmt lint test commit push", or similar shipping commands.

paultyng/skill-issue · 63 tokens