Getting it into your agent
This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.
/plugin marketplace add MadAppGang/magus/plugin install devWrote 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/magus/worktree)<a href="https://agentmods.dev/commands/madappgang/magus/worktree"><img src="https://agentmods.dev/badge/commands/madappgang/magus/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/magus/worktree"><img src="https://agentmods.dev/badge/commands/madappgang/magus/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.00031 | $0.02077 |
| Opus 5.5 | $0.00012 | $0.00831 |
| Sonnet 5.5 | $0.00006 | $0.00415 |
| Haiku 4.5 | $0.00003 | $0.00208 |
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 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 use `rm -rf` on worktree directories How it starts
The opening of the file, as written. The whole thing — 270 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 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 3.5: Database Branch (if applicable)
- Detect database provider from .env (neon.tech, turso.io, supabase.co)
- If branchable provider detected, ask user if branch involves schema changes
- If yes: create DB branch, get connection string, patch .env, write .db-branch.json
- Follow `${CLAUDE_PLUGIN_ROOT}/skills/backend/db-branching/SKILL.md` (read the
file) for the provider-specific procedure
7. Execute Phase 4: Setup
- Detect stacks (nodejs, rust, golang, python, ruby)
- Install dependencies for each stack
- If Neon branch created: run schema push command against branch
- Run baseline tests
8. Execute Phase 5: Handoff
- Display worktree information
- Show path, branch, stacks, test results
- If Neon branch: show Neon branch ID and isolation status
Output format:
```
Worktree created successfully!
Path: .worktrees/{slug}
Branch: {branch-name}
Stacks: {detected-stacks}
Tests: {passing} passing, {failing} failing
Neon Branch: {branch-id} (from {parent}) | (none)
Database: Isolated | Shared (production)
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. For each worktree, check for `.db-branch.json` to detect Neon branches
4. Format as table:
```
Active Worktrees:
Path Branch Commit Neon Branch
──────────────────────────────────────────────────────────────────────────
/path/to/project main abc1234 production
/path/to/.worktrees/feature feature/auth def5678 br-dark-sky-a8xyz123
/path/to/.worktrees/hotfix hotfix/login ghi9012 (none)
```
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 the worktree-lifecycle skill's 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
- Check for `.db-branch.json` in worktree root
- If database branch exists, follow the cleanup in
`${CLAUDE_PLUGIN_ROOT}/skills/backend/db-branching/SKILL.md`:
- Ask user about schema migration (apply to production / discard / keep)
- If applying: merge code first, then run schema push in main worktree
- Delete database branch via provider-specific method (MCP or CLI)
- Remove worktree with `git worktree remove`
- 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.
- 2mo ago Changed · -8 lines 77f3f8a11951
- 2mo ago Changed · +1 lines bd5ca10ac85b
- 2mo ago First seen · 277 lines · 31 tokens per session scan C bee041263a37
worktree is a command published in the GitHub repository MadAppGang/magus (16 stars, last pushed today), licensed MIT. It adds 31 tokens to every session and 2,077 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-04.
worktree compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| worktreeMadAppGang/magus | Command | 16 | today | MIT | C | 31 | Claude Code |
| merge-conflict-analysisrjmurillo/ai-agents | Command | 50 | today | Apache-2.0 | A | 0 | GitHub Copilot |
| release-notesOpenHands/extensions | Command | 190 | today | MIT | A | 44 | Claude Code |
| commitechoVic/blade-code | Command | 181 | 15d ago | MIT | A | 8 | Claude Code |
| repo-audittractorjuice/arc-kit | Command | 2.3k | today | none | A | 29 | Claude Code |
| codex-reviewoalders/kitchen-sink | Command | 5 | 2d ago | MIT | A | 41 | Claude Code |
| releaseparuff/uFawkesAI | Command | 2 | today | MIT | A | 39 | Claude Code, Codex |