Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/phuonghx/aim-clinpx agentmods add skills/phuonghx/aim-cli/using-git-worktreesWrote 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/phuonghx/aim-cli/using-git-worktrees)<a href="https://agentmods.dev/skills/phuonghx/aim-cli/using-git-worktrees"><img src="https://agentmods.dev/badge/skills/phuonghx/aim-cli/using-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/phuonghx/aim-cli/using-git-worktrees"><img src="https://agentmods.dev/badge/skills/phuonghx/aim-cli/using-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.00077 | $0.01111 |
| Opus 5.5 | $0.00031 | $0.00444 |
| Sonnet 5.5 | $0.00015 | $0.00222 |
| Haiku 4.5 | $0.00008 | $0.00111 |
Grade A, and why
using-git-worktrees 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 3mo 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.
How it starts
The opening of the file, as written. The whole thing — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Using Git Worktrees
One repo, many checkouts — parallel branches without stashing or cloning.
A worktree is a second working directory backed by the same .git. Each tree
has its own branch, index, and files, so agents never fight over one checkout.
When to Use
✅ Good for:
- Parallel agents each owning a branch (build, refactor, docs at once)
- Urgent hotfix while a feature is half-done — no
git stashdance - Reviewing/testing branch B without disturbing branch A
- Long builds: keep working in tree A while tree B compiles
❌ Not for:
- A single linear branch (just use the main checkout)
- Editing the same branch from two trees (Git forbids it anyway)
- Throwaway one-liners where switching is faster
Core Commands
# Create a new tree + branch in one step (sibling dir, NOT nested in repo)
git worktree add ../proj-feature -b feature/login
# Attach an existing branch
git worktree add ../proj-hotfix hotfix/crash
# Detached checkout of a tag/commit for inspection
git worktree add --detach ../proj-v1 v1.2.0
# See every tree, its branch, and HEAD
git worktree list
# Remove a tree when done (must be clean, or add --force)
git worktree remove ../proj-feature
# Drop bookkeeping for trees deleted manually from disk
git worktree prune
Conventions
| Rule | Why |
|---|---|
Put trees as siblings (../proj-feature), never inside the repo |
A nested tree gets swept into Git status and ignore rules |
| One branch per tree | Git refuses to check out the same branch twice; keeps ownership clear |
Name the dir after the branch (proj-<slug>) |
git worktree list becomes self-documenting |
| One agent ↔ one tree | Isolates state; merge happens only at the end |
Branch off the same base (-b feat origin/main) |
Predictable, conflict-light merges |
Workflow Example
# 0. Start from an up-to-date main
git -C ./proj fetch origin
# 1. Spin up two isolated trees for two agents
git -C ./proj worktree add ../proj-api -b feat/api origin/main
git -C ./proj worktree add ../proj-ui -b feat/ui origin/main
# 2. Each tree installs its OWN deps (not shared — see pitfalls)
( cd ../proj-api && npm ci )
( cd ../proj-ui && npm ci )
# 3. Agents work in parallel, commit on their branches...
# 4. Merge back from the canonical tree
git -C ./proj merge --no-ff feat/api
git -C ./proj merge --no-ff feat/ui # resolve conflicts once, here
# 5. Tear down
git -C ./proj worktree remove ../proj-api
git -C ./proj worktree remove ../proj-ui
git -C ./proj worktree prune
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.
- 3mo ago First seen · 127 lines · 77 tokens per session scan A 741f1099ad7b
using-git-worktrees is a skill published in the GitHub repository phuonghx/aim-cli (1 stars, last pushed 5mo ago), licensed MIT. It adds 77 tokens to every session and 1,111 once invoked, about $0.0003 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-03.
using-git-worktrees compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| using-git-worktreesphuonghx/aim-cli | Skill | 1 | 5mo ago | MIT | A | 77 | Claude Code |
| about-thinkrailJetBrains/thinkrail | Skill | 8.5k | today | Apache-2.0 | A | 153 | Claude Code, Codex |
| session-wrapmattmre/EVOKORE-MCP-PUBLIC | Skill | 4 | 6mo ago | MIT | A | 35 | Claude Code, Codex |
| session-checkpointmattmre/EVOKORE-MCP-PUBLIC | Skill | 4 | 6mo ago | MIT | A | 38 | Claude Code, Codex |
| todosJetBrains/thinkrail | Skill | 8.5k | today | Apache-2.0 | A | 58 | Claude Code, Codex |
| upgrading-core-dependenciesJetBrains/thinkrail | Skill | 8.5k | today | Apache-2.0 | A | 59 | Claude Code, Codex |
| reviewing-a-prJetBrains/thinkrail | Skill | 8.5k | today | Apache-2.0 | A | 56 | Claude Code, Codex |