worktree

worktree is a skill for Claude Code, Codex from shibing624/agentica. It costs 61 tokens per session (632 once invoked), scanned A, original, Apache-2.0.

A tool for moving a coding session into its own Git worktree. A worktree is a separate directory and branch linked to the same repository, allowing tasks to be edited independently.

In plain words
What is it for?
It is for isolating parallel tasks, switching to a named task checkout, checking worktree status, merging changes, and removing finished worktrees.
Why use it?
Multiple sessions working in one directory can overwrite files or compete for Git’s index. Separate worktrees reduce those conflicts while keeping work ready to merge later.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit It is for isolating parallel tasks, switching to a named task checkout, checking worktree status, merging changes, and removing finished worktrees.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/shibing624/agentica/worktree/github.svg)](https://agentmods.dev/skills/shibing624/agentica/worktree)
Your own site
<a href="https://agentmods.dev/skills/shibing624/agentica/worktree"><img src="https://agentmods.dev/badge/skills/shibing624/agentica/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/shibing624/agentica/worktree"><img src="https://agentmods.dev/badge/skills/shibing624/agentica/worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 632 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.00061 $0.00632
Opus 5.5 $0.00024 $0.00253
Sonnet 5.5 $0.00012 $0.00126
Haiku 4.5 $0.00006 $0.00063

Measured 1mo ago against content hash eb4bcaff37b1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 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.

agentica/skills/bundled/worktree/SKILL.md · 59 lines

How it starts

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

Isolate work in a worktree

Several sessions in one checkout overwrite each other and contend for git's index. A worktree is one directory + one branch per task, sharing the repository.

This session does not move. worktree(action="new") returns a path. Pass that path as work_dir on read_file / write_file / apply_patch / execute. On glob / grep, pass it as path. Omit those arguments and the call stays in this session's directory.

Do not cd and expect later calls to follow — each call is independent. Do not execute git worktree add: that only makes a directory, and later calls still use this session unless you pass work_dir / path. Use worktree(action="new").

When

  • list_agents shows another session in this directory (dirty files, same branch) and you are about to edit.
  • A change should not land on the shared working tree.

Not this: a read-only task subagent (it does not write). A second CLI that should start already inside a tree is agentica --worktree <task>.

How

Name the task, not yourself. Reused while the checkout is healthy; gone after merge. A registration that is no longer a checkout is refused — remove it first, or pick another name. The tool does not delete leftover files to make room.

  • worktree(action="new", name="<task>") — create or reuse; returns the path
  • worktree(action="status") — every worktree of this repo
  • worktree(action="merge", name="<task>") — land on local main (conflicts stay in that worktree, then fast-forward on main), delete the checkout
  • worktree(action="remove", name="<task>") — drop a wt/* checkout git will allow (dirty is refused; an unmerged branch is left in place)

new(name="main") is refused: main is the repository root, not a task.

For a chunk of work big enough for its own process, delegate(task=..., work_dir=<path>) already takes the same path.

If a directory goes missing, status labels it (directory gone) or (not a checkout). Say so; do not rebuild it by destroying what sits there. remove the name, then new if you still want it.

Read the full file on GitHub · 59 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. 1mo ago Changed · -3 lines · -14 tokens per session scan C → A eb4bcaff37b1
  2. 1mo ago Changed · +14 lines · +2 tokens per session scan A → C 7c85b27b4cee
  3. 1mo ago First seen · 48 lines · 73 tokens per session scan A 08c1215cdb23

Subscribe to this mod's changes

worktree is a skill published in the GitHub repository shibing624/agentica (357 stars, last pushed today), licensed Apache-2.0. It adds 61 tokens to every session and 632 once invoked, about $0.0002 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-09-05.