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.
git clone --depth 1 https://github.com/MadAppGang/claude-codeWrote 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/commands/madappgang/claude-code/worktree)<a href="https://agentmods.dev/commands/madappgang/claude-code/worktree"><img src="https://agentmods.dev/badge/commands/madappgang/claude-code/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/commands/madappgang/claude-code/worktree"><img src="https://agentmods.dev/badge/commands/madappgang/claude-code/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.00021 | $0.01770 |
| Opus 5.5 | $0.00008 | $0.00708 |
| Sonnet 5.5 | $0.00004 | $0.00354 |
| Haiku 4.5 | $0.00002 | $0.00177 |
Grade C, and why
worktree 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 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.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
- NEVER use `rm -rf` on worktree directories How it starts
The opening of the file, as written. The whole thing — 256 lines — stays where its author put it; the contents beside it link to each section on GitHub.
<user_request> $ARGUMENTS </user_request>
Create a new worktree following the dev:worktree-lifecycle skill phases 1-5.
Steps:
1. If branch-name not provided, ask user for branch name
2. Use AskUserQuestion to ask for worktree directory (or use .worktrees/ default)
3. Execute Phase 1: Pre-flight Checks
- Verify git repository
- Check branch availability
- Check path availability
4. Execute Phase 2: Directory Selection (use provided or ask)
5. Execute Phase 3: Creation
- Verify .gitignore
- Create worktree with `git worktree add`
- Store original CWD
6. Execute Phase 4: Setup
- Detect stacks (nodejs, rust, golang, python, ruby)
- Install dependencies for each stack
- Run baseline tests
7. Execute Phase 5: Handoff
- Display worktree information
- Show path, branch, stacks, test results
8. Write worktree context marker for statusline persistence
- Get Claude Code session ID (if available from environment or session context)
- Write marker file to `~/.claude/.statusline-worktree-{SESSION_ID}`:
```json
{
"worktree_path": ".worktrees/{slug}",
"branch": "{branch-name}",
"worktree_name": "{slug}"
}
```
- This marker survives context compaction and ensures the statusline
continues showing worktree info after long-running operations
Output format:
```
Worktree created successfully!
Path: .worktrees/{slug}
Branch: {branch-name}
Stacks: {detected-stacks}
Tests: {passing} passing, {failing} failing
To work in this worktree:
cd .worktrees/{slug}
To clean up later:
/dev:worktree cleanup .worktrees/{slug}
```
Show all active worktrees in this repository.
Steps:
1. Run `git worktree list --porcelain`
2. Parse output to extract:
- Worktree path
- Branch name
- HEAD commit
- Locked status
3. Format as table:
```
Active Worktrees:
Path Branch Commit
────────────────────────────────────────────────────────────
/path/to/project main abc1234
/path/to/.worktrees/feature feature/auth def5678
/path/to/.worktrees/hotfix hotfix/login ghi9012
```
If no worktrees besides main:
```
No additional worktrees found.
Only main worktree is active.
Create a worktree with: /dev:worktree create [branch-name]
```
Remove a worktree following dev:worktree-lifecycle Phase 6.
Steps:
1. If path not provided, list available worktrees and ask which to clean up
2. Execute Phase 6 cleanup:
- Return to original CWD if currently in worktree
- Check for uncommitted changes
- If uncommitted changes:
Use AskUserQuestion:
question: "Uncommitted changes found. How to proceed?"
options:
- Commit now
- Stash changes
- Discard changes
- Abort cleanup
- Remove worktree with `git worktree remove`
- Remove statusline worktree marker: `rm -f ~/.claude/.statusline-worktree-*`
(clean all markers for this project to avoid stale files)
- Optionally delete branch (only if merged)
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 · 256 lines · 21 tokens per session scan C 310488fb6600
worktree is a command published in the GitHub repository MadAppGang/claude-code (291 stars, last pushed 8mo ago), licensed MIT. It adds 21 tokens to every session and 1,770 once invoked, about $0.0001 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.
worktree compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| worktreeMadAppGang/claude-code | Command | 291 | 8mo ago | MIT | C | 21 | Claude Code |
| merge-conflict-analysisrjmurillo/ai-agents | Command | 50 | today | Apache-2.0 | A | 0 | GitHub Copilot |
| release-notesOpenHands/extensions | Command | 191 | yesterday | MIT | A | 44 | Claude Code |
| commitechoVic/blade-code | Command | 181 | 18d ago | MIT | A | 8 | Claude Code |
| repo-audittractorjuice/arc-kit | Command | 2.3k | yesterday | none | A | 29 | Claude Code |
| codex-reviewoalders/kitchen-sink | Command | 5 | yesterday | MIT | A | 41 | Claude Code |
| releaseparuff/uFawkesAI | Command | 2 | 3d ago | MIT | A | 39 | Claude Code |