Agent skill

Worktree

by iii-hq in iii-hq/workers

Mint isolated git worktrees for parallel agent work, track ownership in a cross-agent registry, and land finished branches back onto a target with a queued rebase, test gate, and atomic fast-forward…

Apache-2.0Auto-check: notesAgent Workflows

Install Worktree

skills CLI
$ npx skills add iii-hq/workers --skill worktree -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install iii-hq/workers worktree --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/iii-hq/workers.git skills-src && mkdir -p .claude/skills && cp -r skills-src/worktree/skills .claude/skills/worktree && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
worktree
GitHub stars
113
Token cost
~1.8k tokens
SKILL.md length
920 words
Files
1
Skills in repo
19
Repo updated
First seen
Licence
Apache-2.0

At a glance

Mint isolated git worktrees for parallel agent work, track ownership in a cross-agent registry, and land finished branches back onto a target with a queued rebase, test gate, and atomic fast-forward…

  • Works in 2 steps: Register a handler:… → Register the trigger
  • Tasks that involve Git worktrees
  • SKILL.md covers When to Use, Boundaries, Functions and Reactive triggers
  • Calls git

What it does

Worktree is an agent skill from iii-hq/workers. Mint isolated git worktrees for parallel agent work, track ownership in a cross-agent registry, and land finished branches back onto a target with a queued rebase, test gate, and atomic fast-forward merge.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Git worktrees and Subagents. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Git worktrees
  • Tasks that involve Subagents

Example prompts

  • “/worktree”

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Register a handler: registerFunction('notify::on-land', handler).
  2. Register the trigger

What it can do on your machine

Read from SKILL.md and the folder at commit 72ae6ab. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Worktree loads about 1.8k tokens when it runs. Until then it costs about 54 tokens; SKILL.md has 920 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~54
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:98
    ates the source repo's gitignored files (.env files, caches) into

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from iii-hq/workers at commit 72ae6ab, republished under its Apache-2.0 licence (© iii-hq). 920 words, ~1,791 tokens.

Download SKILL.mdSave it as .claude/skills/worktree/SKILL.md (or your agent's skills folder).
name
worktree
description
Mint isolated git worktrees for parallel agent work, track ownership in a cross-agent registry, and land finished branches back onto a target with a queued rebase, test gate, and atomic fast-forward merge.
tags
git, worktree, parallel, land, merge, rebase

worktree

The worktree worker gives every agent its own isolated checkout of a shared repository. Instead of two sessions fighting over one working tree, worktree::create mints a locked git worktree on a fresh branch, records who owns it, and returns a path to use as the agent's working directory. When the work is done, worktree::land automates the merge-back: rebase onto the target branch, run an optional test command, fast-forward the target atomically, and clean the worktree up. Lands are serialized per repository through an engine FIFO queue, so parallel agents never race a merge.

The land test gate delegates to shell::exec, so the shell worker must be installed and worktree_root must sit inside its fs.host_roots jail. Landing never pushes to remotes; it moves local branches only.

Destructive surfaces are gated by configuration: every mutating function checks its gate first, the force paths (claim takeover, forced removal, land force_restart) ship closed, and a denial names the exact config key to flip. The path worktree::create returns doubles as the turn's filesystem scope root (metadata.fs_scope.root), so file access inside the worktree is fenced by the shell worker while the gates cover the lifecycle door the scope cannot see (remove, prune, branch deletion, landing).

When to Use

  • A task should run in isolation from the primary checkout or from other agents working on the same repo (worktree::create, then use the returned path as the agent's working directory).
  • You need to see which worktrees exist, who owns them, and whether they carry uncommitted or unlanded work (worktree::list, worktree::status).
  • A GitHub pull request should be reviewed or exercised in isolation (worktree::create with pr: <number> fetches refs/pull/<n>/head from origin and branches at it).
  • A finished branch should merge back into main (or any target) with tests enforced first (worktree::land with test_cmd).
  • A land was blocked on conflicts and the agent resolved them in place: finish the rebase, then rerun worktree::land; pass force_restart to abort and start over instead.
  • Hand a worktree between sessions (worktree::claim, worktree::release) or clean up abandoned ones (worktree::remove, worktree::prune).

Boundaries

  • Not a PR or code-review tool: landing fast-forwards a local branch; it never pushes, opens pull requests, or talks to a forge.
  • Worktrees created out of band are reported as unmanaged and never adopted; only worktrees minted by worktree::create are managed.
  • One worker instance per engine: the registry has no compare-and-set, so multi-instance deployments must shard by repository.
  • Merges are fast-forward only (after the rebase); there is no merge-commit or squash strategy.
  • For running commands or editing files inside a worktree, use the shell worker with the worktree path as cwd; this worker only manages the worktrees themselves.
Show full SKILL.md (486 more words)Show less

Functions

  • worktree::create — mint a locked, isolated worktree off a base ref or a pull request head (pr); auto-claims for session_id when given, names the branch by id or deterministic codename per config, and returns an advisory dev_port derived from the id (never reserved anywhere).
  • worktree::list — registry view, filterable by repo or session, with optional git status per worktree.
  • worktree::get — one worktree with status.
  • worktree::validate — check a path is a live managed worktree; reconciles records whose directories were removed by hand.
  • worktree::claim — take session ownership (force to take over).
  • worktree::release — release ownership (force to override).
  • worktree::status — clean flag, ahead/behind, staged/unstaged/untracked counts, diffstat, rebase-in-progress, and integrated with an integration_reason, so squash- or rebase-landed branches read as merged even while ahead of their base.
  • worktree::remove — remove a worktree; refuses dirty or unlanded work unless forced, and refuses while running processes hold files open under it (W222); the directory leaves its path instantly (staged into a trash area, deleted in the background); can delete the branch.
  • worktree::prune — sweep: drop records whose directories are gone and remove clean, unclaimed, expired worktrees, including integrated ones whose work already landed (cron-bound, {} payload).
  • worktree::land — queue the rebase / test / fast-forward / cleanup pipeline; returns a job_id immediately.
  • worktree::land-step — internal queue consumer that executes land phases; never call it directly (denied to agents).

With provision.copy_ignored enabled in config, every create also replicates the source repo's gitignored files (.env files, caches) into the new worktree in the background; the create response never waits on it.

Errors carry stable W### codes; the ones worth branching on are W210 (already claimed), W220 (dirty), W221 (unmerged work), W222 (files held open by running processes), W401 (land already queued), W402 (unresolved rebase from a previous land), and the land-block reasons carried on events (W410 conflict, W411 tests, W412 target kept moving, W413 target checked out dirty). W5xx means configuration denied the operation, not that it failed: W500 gate off, W501 force disabled, W502 land target not in gates.land_targets, W503 repository not in gates.repos, W504 per-repo worktree budget hit. The message names the exact key; do not retry, surface that key to the operator (or drop the force flag) instead.

Reactive triggers

Register a worktree::* trigger when a different worker should react to lifecycle changes without polling worktree::list — announce lands in chat, start a follow-up agent when a sibling's branch merges, or alert on blocked lands.

Reach for it when:

  • A land's outcome should drive the next step (worktree::landed, worktree::land-blocked with reason and conflict_files).
  • Ownership changes matter to an orchestrator (worktree::claimed, worktree::released).
  • Cleanup should cascade (worktree::removed).

The caller of worktree::land gets only { job_id, queued } back; the outcome arrives on these triggers, so a landing workflow should always bind one instead of polling.

How to bind
  1. Register a handler: registerFunction('notify::on-land', handler).
  2. Register the trigger:
typescript
iii.registerTrigger({
  type: 'worktree::landed',
  function_id: 'notify::on-land',
  config: {
    // optional equality filters:
    // repo_path, worktree_id, session_id
  },
})

All six types accept the same three optional filters; unknown config keys are rejected at registration. For event payload shapes, call get function info on the trigger type.

© iii-hq, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in worktree/skills of iii-hq/workers.

Open the folder on GitHubat commit 72ae6ab

Compare with similar skills

Worktree next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Worktree compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Worktree this skilliii-hq/workers113—~1.8kAutomated safety check: NotesApache-2.0
Vspawnvlinx-io/VelaTerm270—~2.5kAutomated safety check: PassMIT
Spec-Driven Development v2LichAmnesia/lich-skills234—~3.1kAutomated safety check: PassMIT
Subagent Coordinatorflyxl/datazen114—~908Automated safety check: PassGPL-3.0
PmApra-Labs/apra-fleet101—~5.4kAutomated safety check: PassCustom licence
Batch Orchestrationrohitg00/pro-workflow2.9k—~1.2kAutomated safety check: PassNone

Similar skills

  • Vspawn

    vlinx-io/VelaTerm

    Explicitly spawn a standalone child session under the current vlx-term session, passing the task in as its first message (mirrors spawntask).

    270 GitHub stars~2.5k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Spec-Driven Development v2

    LichAmnesia/lich-skills

    Organizes long-running agent work into a Project, Sprint and Task hierarchy with per-task state files, isolated worktrees, review loops and script-checked rules.

    234 GitHub stars~3.1k tokensUpdated 4 mo ago
    Agent WorkflowsAuto-check passed
  • Orchestrate multi-track parallel feature development with subagents and git worktrees.

    114 GitHub stars~908 tokensUpdated 8 days ago
    Agent WorkflowsAuto-check passed
  • Pm

    Apra-Labs/apra-fleet

    Project Manager skill. An agent skill from Apra-Labs/apra-fleet.

    101 GitHub stars~5.4k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Batch Orchestration

    rohitg00/pro-workflow

    Decompose large-scale changes into independent units and spawn parallel agents in isolated worktrees.

    2.9k GitHub stars~1.2k tokensUpdated 8 days ago
    Agent WorkflowsAuto-check passed
  • Codex CLI

    kortix-ai/suna

    Drive OpenAI's Codex CLI (codex exec) as a non-interactive coding sub-agent from inside Claude Code.

    20k GitHub stars~1.6k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from iii-hq/workers

All 19 skills in this repo
  • Cron

    iii-hq/workers

    Schedule any registered function on a 6- or 7-field cron expression with the standalone cron worker.

    113 GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Email

    iii-hq/workers

    Send and read email from the iii engine — SMTP send, IMAP read, and real-time IDLE push as a subscribable trigger type.

    113 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • HTTP

    iii-hq/workers

    Expose registered functions as HTTP endpoints with the standalone http worker.

    113 GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Kanban

    iii-hq/workers

    File-backed kanban board: create, read, move and comment on tickets by key or uuid, assign agent profiles, and wake on comments through the kanban:comment trigger instead of polling.

    113 GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Pubsub

    iii-hq/workers

    Fire-and-forget topic pub/sub: broadcast an event with publish and every matching subscribe trigger receives it.

    113 GitHub stars~989 tokensUpdated today
    Auto-check passed
  • Release Sync

    iii-hq/workers

    Organize worker release tags into Linear release waves — one team document plus one release/<date label per same-day batch of worker releases, with shipped MOT issues labeled and linked.

    113 GitHub stars~1.1k tokensUpdated today
    Auto-check passed

Questions about Worktree

What does Worktree do?

Mint isolated git worktrees for parallel agent work, track ownership in a cross-agent registry, and land finished branches back onto a target with a queued rebase, test gate, and atomic fast-forward…. Worktree is an agent skill from iii-hq/workers. Mint isolated git worktrees for parallel agent work, track ownership in a cross-agent registry, and land finished branches back onto a target with a queued rebase, test gate, and atomic fast-forward merge.

When should I use Worktree?

Worktree fits situations like: tasks that involve Git worktrees; tasks that involve Subagents.

How do I install Worktree in Claude Code?

Run `npx skills add iii-hq/workers --skill worktree -a claude-code`. Or copy the skill folder (worktree/skills in iii-hq/workers) into .claude/skills/worktree in your project. Claude Code loads it when a task matches its description.

How do I install Worktree in Codex?

Run `npx skills add iii-hq/workers --skill worktree -a codex`. Or copy the skill folder (worktree/skills in iii-hq/workers) into .agents/skills/worktree in your project. Codex loads it when a task matches its description.

Can I use Worktree in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add iii-hq/workers --skill worktree -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/worktree, .gemini/skills/worktree, .github/skills/worktree and .opencode/skills/worktree in your project.

What does Worktree need to run?

Going by SKILL.md and its folder, Worktree needs the command-line tools its instructions call (git).

Does Worktree access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Worktree safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Worktree use?

Worktree is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Worktree use?

About 1.8k tokens (SKILL.md is roughly 7.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Worktree?

Skills that share tags, products or a category with Worktree: Vspawn (vlinx-io/VelaTerm, 270 stars), Spec-Driven Development v2 (LichAmnesia/lich-skills, 234 stars), Subagent Coordinator (flyxl/datazen, 114 stars) and Pm (Apra-Labs/apra-fleet, 101 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Worktree?

iii-hq (a GitHub organization) maintains it in iii-hq/workers, which has 113 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 8, 2026.

Source: iii-hq/workers on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.