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.
npx skills add jnPiyush/AgentX --skill git-worktreesgit clone --depth 1 https://github.com/jnPiyush/AgentXWrote 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.
[](https://agentmods.dev/skills/jnpiyush/agentx/git-worktrees)<a href="https://agentmods.dev/skills/jnpiyush/agentx/git-worktrees"><img src="https://agentmods.dev/badge/skills/jnpiyush/agentx/git-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.
<a href="https://agentmods.dev/skills/jnpiyush/agentx/git-worktrees"><img src="https://agentmods.dev/badge/skills/jnpiyush/agentx/git-worktrees.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00062 | $0.01793 |
| Opus 5.5 | $0.00025 | $0.00717 |
| Sonnet 5.5 | $0.00012 | $0.00359 |
| Haiku 4.5 | $0.00006 | $0.00179 |
Grade C, and why
git-worktrees scanned grade C with 1 finding 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 2mo 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.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
Never `rm -rf` a worktree directory without `git worktree remove` first; orphaned worktree metadata produces confusing errors later. How it starts
The opening of the file, as written. The whole thing — 163 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Git Worktrees
WHEN: An agent (or two agents) needs an isolated working directory on the same repository -- for a parallel branch, a deploy-prototype run, an experimentation-loop attempt, or a long investigation that should not touch the primary checkout's working tree.
When to Use This Skill
Load this skill when:
- Two agents need to operate on the same repository in parallel
- An experimentation-loop attempt needs its own working tree so the main checkout stays clean
- A deploy / prototype build needs an isolated
dist/andnode_moduleswithout polluting the primary tree - A long debugging session needs to compare two branches side-by-side without stashing
Skip when:
- The change is a single in-place edit on the current branch
- The user has explicitly asked you to operate only inside the primary checkout
- The repo contains active submodules that have not been audited for worktree safety
Prerequisites
git2.5+ (worktree command), 2.20+ recommended forworktree remove- Write access to the worktrees parent directory
- Knowledge of whether the repo uses submodules (worktrees + submodules need extra care)
Rationalization Table
Why agents reach for the wrong primitive.
| Rationalization | Reality |
|---|---|
"I'll just git stash and switch branches." |
Stash loses untracked files, hides reproduction state, and conflicts when both agents want different branches at once. Worktree is cheaper. |
| "I'll clone the repo a second time." | A second clone duplicates the entire object database, loses shared refs, and drifts from the primary remote config. Worktree shares the object store. |
"I'll cd into a temp dir and create a sandbox." |
A copy is not a checkout. You lose history, hooks, and the ability to rebase / push. Use a worktree. |
| "Worktrees are scary, I'll just work on master." | The fear is that a worktree corrupts the primary. It does not, if Step 0 is followed. The opposite -- working on the primary for everything -- is what actually corrupts state. |
| "I'll skip Step 0, this repo doesn't have submodules." | Step 0 is one command. Run it. Future-you debugging an "I am already inside a worktree" failure will thank present-you. |
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.
- 2mo ago Changed d7af6aaba700
- 2mo ago Changed · -1 tokens per session 52e861e449d8
- 2mo ago First seen · 163 lines · 63 tokens per session scan C 511bebfd87d0
git-worktrees is a skill published in the GitHub repository jnPiyush/AgentX (19 stars, last pushed today), licensed Apache-2.0. It adds 62 tokens to every session and 1,793 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
git-worktrees compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| git-worktreesjnPiyush/AgentX | Skill | 19 | today | Apache-2.0 | C | 62 | Claude Code, Codex |
| merge-batchdiegosouzapw/OmniRoute | Skill | 91k | 2d ago | MIT | A | 46 | Claude Code |
| prowler-commitprowler-cloud/prowler | Skill | 15k | today | Apache-2.0 | A | 44 | Claude Code, Codex |
| gh-auth-isolationgithub/gh-aw | Skill | 5.7k | today | MIT | A | 20 | Claude Code, Codex |
| comet-githubrpamis/comet | Skill | 3.3k | today | MIT | A | 72 | Claude Code, Codex |
| github-skillzeenie-ai/OpenCompany | Skill | 1.1k | 4d ago | MIT | A | 51 | Claude Code |
| codex-autoresearchleo-lilinxiao/codex-autoresearch | Skill | 3.3k | 12d ago | MIT | A | 39 | Codex |