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/DJRHails/dotfilesnpx agentmods add skills/djrhails/dotfiles/worktreeWrote 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/djrhails/dotfiles/worktree)<a href="https://agentmods.dev/skills/djrhails/dotfiles/worktree"><img src="https://agentmods.dev/badge/skills/djrhails/dotfiles/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.
<a href="https://agentmods.dev/skills/djrhails/dotfiles/worktree"><img src="https://agentmods.dev/badge/skills/djrhails/dotfiles/worktree.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.00109 | $0.01718 |
| Opus 5.5 | $0.00044 | $0.00687 |
| Sonnet 5.5 | $0.00022 | $0.00344 |
| Haiku 4.5 | $0.00011 | $0.00172 |
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.
How it starts
The opening of the file, as written. The whole thing — 193 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Worktree Management
A single workflow that keeps worktrees in sync with open PRs: removes stale ones, creates missing ones, and ensures every worktree has working tooling.
When to use
- "clean up / prune worktrees"
- "create worktrees for my PRs"
- "set up worktrees"
- Periodic housekeeping after a batch of merges
Procedure
Run all steps in order. Each step feeds into the next.
Step 1 — Inventory
Collect current state in parallel:
# All worktrees (skip main — first line)
git worktree list
# All open PRs for current user
gh pr list --state open --author "@me" --json number,title,headRefName,url
# All merged PRs (to cross-reference stale worktrees)
gh pr list --state merged --author "@me" --json number,headRefName --limit 50
Derive MAIN path:
MAIN=$(git worktree list | head -1 | awk '{print $1}')
Step 2 — Identify stale worktrees
A worktree is stale (safe to remove) if either:
- Its branch HEAD is an ancestor of
main:git merge-base --is-ancestor <commit> main - Its associated PR is
MERGEDorCLOSED
Never remove a worktree whose PR is still OPEN.
Step 3 — Identify missing worktrees
A worktree is missing if an open PR's branch has no corresponding entry in
git worktree list.
Step 4 — Report and confirm
Show one combined table before making any changes:
| Branch | Worktree path | PR | Action |
|---|---|---|---|
feat/foo |
.data/worktrees/feat-foo |
#123 MERGED | Remove |
fix/bar |
(none) | #456 OPEN | Create |
feat/baz |
.data/worktrees/feat-baz |
#789 OPEN | Keep |
Ask the user to confirm before proceeding.
Step 5 — Remove stale worktrees
git worktree remove --force <path>
Use --force — worktrees often have untracked files (build artifacts, .env).
Offer to delete the local branch too:
git branch -d <branch>
Step 6 — Create missing worktrees
Use the worktree::create script which handles the full flow: checkout the
branch, copy-on-write node_modules, and copy untracked config files.
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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 · 193 lines · 109 tokens per session scan A 354d487289ed
worktree is a skill published in the GitHub repository DJRHails/dotfiles (2 stars, last pushed yesterday), licensed MIT. It adds 109 tokens to every session and 1,718 once invoked, about $0.0004 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
autopilot
Carry a well-scoped GitHub issue through the full dev loop autonomously, stopping at a per-run tier boundary (PR-ready, or merge+deploy for small reversible changes).
autopilot-triage
Vet open issues for autonomous resolution and queue the qualifying ones with the autopilot-queued label — the start-of-day "fill the queue" half of the triage → run split.
create-pr
Create a pull request with auto-generated description, issue linking, ROADMAP updates, and PR-metadata validation.
merge-pr
Merge a pull request with status checks, squash merge, and branch cleanup. Handles worktree contexts.
verify-behavior
Verify or reproduce visible product behavior by driving the real UI with pi-computer-use's checked tools, requiring verified expect postconditions and durable state evidence for meaningful UI flows. Use when triage needs visual reproduction, implementation needs behavioral proof, review needs interactive confirmation…
typesafe-ai
Build AI-powered software with TypeSafe: small units of AI intelligence you can use like programming primitives. Its System One models, including Jev, turn natural language and application state into typed judgments and probabilities that code can combine. Use when a feature needs programmable common sense, when…