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/fmflurry/settings-opencodeWrote 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/rules/fmflurry/settings-opencode/worktree-destruction-safety)<a href="https://agentmods.dev/rules/fmflurry/settings-opencode/worktree-destruction-safety"><img src="https://agentmods.dev/badge/rules/fmflurry/settings-opencode/worktree-destruction-safety/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/rules/fmflurry/settings-opencode/worktree-destruction-safety"><img src="https://agentmods.dev/badge/rules/fmflurry/settings-opencode/worktree-destruction-safety.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.01975 | $0.01975 |
| Opus 5.5 | $0.00790 | $0.00790 |
| Sonnet 5.5 | $0.00395 | $0.00395 |
| Haiku 4.5 | $0.00198 | $0.00198 |
Grade C, and why
worktree-destruction-safety 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 yesterday.
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.
A worktree directory is the **only copy** of any uncommitted work inside it. Removing one is a destructive data operation, not bookkeeping — treat it with the same caution as `rm -rf`, never like `git branch -d`. How it starts
The opening of the file, as written. The whole thing — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Worktree Destruction Safety (mandatory)
A worktree directory is the only copy of any uncommitted work inside it. Removing one is a destructive data operation, not bookkeeping — treat it with the same caution as rm -rf, never like git branch -d.
Boundary with worktree-switching: that rule (where configured) governs entering, creating, and switching between worktrees. This rule governs their destruction — git worktree remove, git worktree prune, git worktree move, orca worktree rm, or any raw filesystem delete of a worktree directory. Read both; they do not overlap.
Why this exists
Two incidents shaped this rule. A raw git worktree remove --force + git worktree prune run outside Orca's pipeline destroyed a worktree with no trash step, so the content was not recoverable. Later, orca worktree rm returned before the removal finished ("removing": true). Orca always runs git worktree remove --force internally, whatever CLI flags are passed. During that background removal, the repo's main checkout received reset --hard and pull, which destroyed an uncommitted tracked edit and an untracked file. The actor is unknown. The old checks inspected only the worktree being removed, not the other checkouts of the repo.
Orca-managed detection (read-only, portable)
A repo is Orca-managed when either is true:
- it appears in
orca repo list - the target path is enumerated by
orca worktree list --json
If the orca CLI is not installed or not on PATH, the Orca routing below does not apply — say so explicitly. The mandatory pre-removal checks further down apply regardless of Orca's presence; they are plain git and are always in scope.
Mandatory: route worktree lifecycle through Orca when Orca-managed
Inside an Orca-managed repo, creation goes through orca worktree create .... Removal goes through agent-harness worktree-rm (below), which routes to Orca itself.
Forbidden by default in an Orca-managed repo: raw git worktree remove, git worktree prune, git worktree move, a direct orca worktree rm call, and rm -rf <worktree-dir>. These bypass the checks and the trash step (~/orca/workspaces/<repo>/.orca-worktree-trash/).
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.
- yesterday Changed · +55 lines · +923 tokens per session f7436e088f77
- 8d ago First seen · 58 lines · 1,052 tokens per session scan C bb582dc9a919
worktree-destruction-safety is a cursor rule published in the GitHub repository fmflurry/settings-opencode (171 stars, last pushed yesterday), licensed MIT. It adds 1,975 tokens to every session, about $0.0079 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-10-08.
Other cursor rules, from other repositories
rebase-only-merged-agents
When rebasing after a merge, only rebase the agents whose branches you just merged. Do not rebase agents that are still running.
iris
GitHub operations specialist — branches, pull requests, issues, releases, tags. Called by zeus after review. Never pushes or merges without explicit human approval. Integrates with VS Code GitHub Pull Requests extension.
git-workflow
Rules for git operations, commit strategy, and GitHub CLI usage.
release-checklist
What to update with each code change or version release.
git-workflow
Git commit format and PR process - conventional commits.
branching-merging-strategy
This is a set of instructions to the AI Assistant for branching and merging strategy.