worktree

worktree is a skill for Claude Code, Codex from shibing624/agentica. It costs 73 tokens per session (493 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.

agentmods
npx agentmods add skills/shibing624/agentica/worktree
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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 493 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00073 $0.00493
Opus 5 $0.00036 $0.00246
Sonnet 5 $0.00015 $0.00099
Haiku 4.5 $0.00007 $0.00049

Measured yesterday against content hash 08c1215cdb23, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 yesterday.

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 · 48 lines

What it actually says

Isolate this session

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.

Do not create one with execute (git worktree add, cd). That only adds a directory; this session's file tools stay in the old checkout. Call the worktree tool — it moves process cwd, sandbox, peer record and the status bar together. The transcript stays where it already was.

When

  • list_agents shows another session in this directory (dirty files, same branch) and you are about to edit.
  • The user or a peer names a task checkout ("切到 gateway-peers").
  • A change should not land on the shared working tree.

Not this: a read-only task subagent (it does not write). A second CLI the human should watch is multi-agent — start that process with --worktree or its own -c.

How

Name the task, not yourself. Reused while the task is in progress; gone after merge. The tool schema lists the actions; do not invent paths.

  • worktree(action="use", name="<task>") — create or reuse, then move here
  • worktree(action="status") — where you are, every worktree of this repo
  • worktree(action="merge") — land on local main, delete the checkout, return
  • worktree(action="remove") — drop one with no unique work

The human's surfaces: agentica --worktree <task> at start (see agentica --help), /worktree mid-session. You cannot type slash commands; use the tool. Tell the user which slash to type when they want to drive.

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 · 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 (351 stars, last pushed today), licensed Apache-2.0. It adds 73 tokens to every session and 493 once invoked, about $0.0004 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-05.

Related

Other skills, from other repositories

chinese-git-workflow

国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.

xbsheng/atguigu-note · 69 tokens

chinese-commit-conventions

中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.

xbsheng/atguigu-note · 65 tokens

finishing-a-development-branch

Skill "finishing-a-development-branch" from xbsheng/atguigu-note, covering 完成开发分支, 概述, 流程, 步骤 1:验证测试 and 运行项目的测试套件.

xbsheng/atguigu-note · 45 tokens

using-git-worktrees

当需要开始与当前工作区隔离的功能开发,或在执行实现计划之前使用——通过原生工具或 git worktree 回退机制确保隔离工作区存在.

xbsheng/atguigu-note · 44 tokens

release-prep

Prepare release documentation including CHANGELOG entry, announcement text, and validation. Run before tagging a new release.

massgen/MassGen · 25 tokens

massgen-release-documenter

Guide for following MassGen's release documentation workflow. This skill should be used when preparing release documentation, updating changelogs, writing case studies, or maintaining project documentation across releases.

massgen/MassGen · 42 tokens