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/skills/madappgang/magus/worktree-lifecycle)<a href="https://agentmods.dev/skills/madappgang/magus/worktree-lifecycle"><img src="https://agentmods.dev/badge/skills/madappgang/magus/worktree-lifecycle/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/madappgang/magus/worktree-lifecycle"><img src="https://agentmods.dev/badge/skills/madappgang/magus/worktree-lifecycle.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.00039 | $0.03695 |
| Opus 5.5 | $0.00016 | $0.01478 |
| Sonnet 5.5 | $0.00008 | $0.00739 |
| Haiku 4.5 | $0.00004 | $0.00369 |
Grade C, and why
worktree-lifecycle 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 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.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
- [ ] Manually deleting worktree with `rm -rf` (use `git worktree remove`) This is a copy
86% identical to worktree-lifecycle — 47 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 443 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Worktree Lifecycle
Purpose: Manage git worktrees for isolated feature work with safety checks, multi-stack setup, and clean lifecycle management.
When to Use
This skill applies whenever you:
- Start a new feature that requires isolated workspace
- Execute risky or experimental changes
- Need to keep current work untouched while testing alternatives
- Coordinate parallel agent work (each agent in separate worktree)
- Follow an implementation plan requiring clean environment
- Preserve long-running feature work across sessions
Trigger keywords: experiment, prototype, risky, breaking, parallel, isolate, worktree, workspace
Red Flags (Anti-Patterns)
- Creating worktree without checking if branch already exists
- Creating worktree without checking if directory path is available
- Forgetting to add worktree directory to .gitignore
- Manually deleting worktree with
rm -rf(usegit worktree remove) - Removing worktree with uncommitted changes without user confirmation
- Using same branch in multiple worktrees simultaneously
- Working in worktree after returning to main directory (stale CWD)
- Not storing original CWD before entering worktree
- Skipping dependency installation in new worktree
- Not running baseline tests before starting work
6-Phase Lifecycle
Phase 1: Pre-flight Checks
Purpose: Verify all prerequisites before creating anything.
Required checks (all must pass):
# 1. Verify git repository
git rev-parse --git-dir &>/dev/null
if [ $? -ne 0 ]; then
ERROR: "Not a git repository"
RECOVERY: Abort with clear error message
fi
# 2. Detect detached HEAD state
if ! git symbolic-ref HEAD &>/dev/null; then
WARNING: "Currently in detached HEAD state"
RECOVERY: Ask user if they want to create branch from current commit
fi
# 3. Check if branch already in a worktree
if git worktree list | grep -q "$BRANCH"; then
ERROR: "Branch $BRANCH already checked out in a worktree"
RECOVERY: Ask user - reuse existing, rename branch, or cancel
fi
# 4. Check if branch exists (but not in worktree)
if git branch --list "$BRANCH" | grep -q .; then
WARNING: "Branch $BRANCH already exists"
RECOVERY: Ask user - use existing branch or create new with different name
fi
# 5. Check if target path is available
# IMPORTANT: Create directory first before checking (git check-ignore needs path to exist)
mkdir -p "$WORKTREE_DIR"
if [ -d "$WORKTREE_PATH" ]; then
ERROR: "Directory $WORKTREE_PATH already exists"
RECOVERY: Ask user - choose different path or remove existing
fi
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 Changed · +1 lines 9474bd7c7779
- 2mo ago Changed · -12 lines scan D → C 345dbaa6aed4
- 3mo ago First seen · 454 lines · 39 tokens per session scan D 6f69614ab232
worktree-lifecycle is a skill published in the GitHub repository MadAppGang/magus (16 stars, last pushed yesterday), licensed MIT. It adds 39 tokens to every session and 3,695 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). It is 86% identical to worktree-lifecycle, differing in 47 lines, and is treated as a copy.
worktree-lifecycle compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| worktree-lifecycleMadAppGang/magus | Skill | 16 | yesterday | MIT | C | 39 | Claude Code |
| merge-batchdiegosouzapw/OmniRoute | Skill | 91k | 5d ago | MIT | A | 46 | Claude Code |
| prowler-commitprowler-cloud/prowler | Skill | 15k | yesterday | Apache-2.0 | A | 44 | Claude Code, Codex |
| gh-auth-isolationgithub/gh-aw | Skill | 5.8k | today | MIT | A | 20 | Claude Code, Codex |
| github-skillzeenie-ai/OpenCompany | Skill | 1.1k | 3d ago | MIT | A | 51 | Claude Code |
| comet-githubrpamis/comet | Skill | 3.3k | yesterday | MIT | A | 72 | Claude Code, Codex |
| re0-mergeLilMGenius/paperthin | Skill | 1.5k | today | MIT | A | 51 | Claude Code, Codex |