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 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.
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.
- 1mo 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 3mo 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.
Other skills, from other repositories
session-wrap
Wrap up the current coding session by creating PRs, updating the session log, preparing the next session md, and updating the claude md with learnings.
session-checkpoint
Use when you want to save a timestamped snapshot of current session state (tasks, evidence, purpose) to docs/session-logs/ for crash recovery or handoff.
todos
Use when the user asks for a shared plan, a task needs at least three substantive execution steps, or a loose TODO is pending. Without an explicit plan request, not for one-shot answers or checks, or one- to two-step work that is not already in the list.
shipping-a-pr
Use when finished work needs to ship as a pull request, or when creating, syncing, updating metadata, checking status, monitoring CI, or addressing review comments on a PR. Not for reviewing a PR you are not shipping.
git-flow
Use this skill when committing, branching, opening a pull request, resolving conflicts, or recovering from a git mistake in any repository. Triggers: user mentions "commit", "branch", "PR", "pull request", "merge", "rebase", "conflict", "stash", "cherry-pick", "revert", "bisect", "reflog", "force push".
codebase-navigation
Use this skill when starting work in an unfamiliar codebase or area — finding where something is implemented, how a request flows, what depends on a piece of code, or where a change should go — before reading files one by one. Triggers: user says "where is", "how does this work", "find the code that", "explain this…