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/jjmartres/ai-coding-agentsWrote 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/jjmartres/ai-coding-agents/worktree.delete)<a href="https://agentmods.dev/commands/jjmartres/ai-coding-agents/worktree.delete"><img src="https://agentmods.dev/badge/commands/jjmartres/ai-coding-agents/worktree.delete/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/jjmartres/ai-coding-agents/worktree.delete"><img src="https://agentmods.dev/badge/commands/jjmartres/ai-coding-agents/worktree.delete.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.00017 | $0.00655 |
| Opus 5.5 | $0.00007 | $0.00262 |
| Sonnet 5.5 | $0.00003 | $0.00131 |
| Haiku 4.5 | $0.00002 | $0.00065 |
Grade A, and why
worktree.delete 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 18d 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 — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Worktree Delete Command
Removes an isolated git worktree from .worktree/ and deletes the associated branch. Supports deleting a specific worktree or auto-cleaning all worktrees whose PRs/MRs have been merged.
Instructions for Agent
-
Parse Arguments:
- Inspect
$ARGUMENTS. - Supported modes:
- Specific branch or folder: e.g.
/worktree.delete feature-author/worktree.delete .worktree/feature-auth. - Merged cleanup:
/worktree.delete --merged,/worktree.delete merged, or no argument if asking to prune merged trees.
- Specific branch or folder: e.g.
- Inspect
-
Handle Merged Worktrees Cleanup (
--merged): When cleaning merged trees:- Identify default branch (e.g.
mainorstaging):DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' || echo "main") - Update remote refs:
git fetch --prune - Get list of merged branches:
- Via git:
git branch --merged origin/$DEFAULT_BRANCH - Via GitLab (if available):
glab mr list --state merged - Via GitHub (if available):
gh pr list --state merged
- Via git:
- For every worktree located in
.worktree/:- If its branch is merged:
-
If active OpenCode session is inside this worktree, move session to repository root first:
await tools.opencode.session_move({ directory: "<repo-root>" }); -
Remove worktree:
git worktree remove "<worktree-path>" --force -
Delete local branch:
git branch -d "<branch>" || git branch -D "<branch>"
-
- If its branch is merged:
- Run
git worktree prune. - Report all deleted worktrees to user.
- Identify default branch (e.g.
-
Handle Specific Worktree Deletion: When targeting a specific branch or directory:
- Determine target path:
.worktree/<branch>(or verify againstgit worktree list). - Check for uncommitted work:
git -C "<worktree-path>" status --porcelain- If uncommitted changes exist, alert user with summary and confirm deletion.
- Session Safety:
- Check if current OpenCode working directory matches the target worktree.
- If yes, MOVE THE SESSION TO REPOSITORY ROOT FIRST:
- Determine target path:
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.
- 18d ago First seen · 72 lines · 17 tokens per session scan A a17c7da0dbc5
worktree.delete is a command published in the GitHub repository jjmartres/ai-coding-agents (49 stars, last pushed 7d ago), licensed MIT. It adds 17 tokens to every session and 655 once invoked, about $0.0001 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-28.
Other commands, from other repositories
resolve-review
Resolve reviewer feedback - from GitHub PRs, chat, or any reviewer.
make-pr
Commit staged changes, create or update a pull request.
publish
Release a new package version — semver bump from commits, tag, registry publish, GitHub Release.
bump
Full dependency and toolchain bump — deps to latest major, Node pins, GitHub Actions, audit, validate, commit.
rebase
Rebase the current branch on main, a local branch, or a remote branch (with fetch).
ship
Commit all changes and push to remote.