worktree-end

worktree-end is a skill for Claude Code, Codex from nirecom/agents. It costs 22 tokens per session (2,487 once invoked), scanned C, original, MIT.

A workflow for finishing a Git worktree task, including checking ignored files, merging the work, and removing the worktree.

In plain words
What is it for?
Completing worktree-based tasks, merging changes, and cleaning up the finished worktree.
Why use it?
It provides a consistent way to close parallel development work without losing required local state.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/nirecom/agents/worktree-end
Any agent
npx skills add nirecom/agents --skill worktree-end
Clone the repo
git clone --depth 1 https://github.com/nirecom/agents

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for worktree-end

README.md
[![agentmods](https://agentmods.dev/badge/skills/nirecom/agents/worktree-end.svg)](https://agentmods.dev/skills/nirecom/agents/worktree-end)
Your own site
<a href="https://agentmods.dev/skills/nirecom/agents/worktree-end"><img src="https://agentmods.dev/badge/skills/nirecom/agents/worktree-end.svg" alt="Measured on agentmods" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,487 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00022 $0.02487
Opus 5 $0.00011 $0.01243
Sonnet 5 $0.00004 $0.00497
Haiku 4.5 $0.00002 $0.00249

Measured yesterday against content hash f7991099065d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

worktree-end 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.

The scan reads SKILL.md. This mod also ships 7 executable files (scripts/bootstrap-complete.sh, scripts/capture-env.sh, scripts/detect-restart.sh, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

- Use `hooks/cleanup-orphan-dir.js` for orphan directory cleanup — never `rm -rf`.
skills/worktree-end/SKILL.md · 109 lines

How it starts

The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Inventory gitignored state, merge the PR, then remove the worktree safely.

Procedure

When a hook blocks a sanctioned command, a fallback path is taken, or any unexpected outcome occurs, report via /supervisor-report (trigger conditions: rules/supervisor-reporting.md).

Read rules/github-issues.md before WE-4 — on-demand-only, never auto-injected; WE-4..WE-8 and WE-11 depend on it. Read rules/mid-workflow-findings.md before WE-10 — on-demand-only, never auto-injected; WE-10 depends on its append CLI and severity tagging. Read rules/coding.md before WE-4 — on-demand-only, never auto-injected; its Public GitHub Rules govern the PR body, issue comments, and history entries written from here on.

Step WE-1 — Resolve <PLANS_DIR>

PLANS_DIR="$(bash "$AGENTS_CONFIG_DIR/bin/workflow-plans-dir")" — run once; reuse. Canonical: skills/_shared/resolve-plans-dir.md.

Step WE-2 — Pre-flight

  • gh --version — abort with installation guidance if not found.
  • Verify linked worktree: git rev-parse --git-common-dir must differ from git rev-parse --git-dir; if equal, abort.

Step WE-3 — Unstaged tracked-file check

Run bash "$AGENTS_CONFIG_DIR/bin/check-unstaged-tracked.sh" "$WORKTREE_PATH". rc=0 → continue. rc=1 → display stdout and abort (git add / git stash push -u / <<WORKFLOW_ENFORCE_WORKFLOW_OFF: {reason}>> to bypass). rc=2/3 → surface stderr and abort. Skip when WORKFLOW_OFF or WORKTREE_OFF session marker is active.

Step WE-4 — PR resolution

Bootstrap probe: PROBE_JSON="$(bash "$AGENTS_CONFIG_DIR/bin/probe-remote-bootstrap.sh" "$WORKTREE_PATH")". preBootstrap === true AND classification === "empty-repo" → WE-4b. Any other classification → normal flow.

Push (git push -u origin <branch>), then gh pr view --json state,url — reuse if OPEN, else gh pr create --fill. Display URL. Capture PR_NUMBER=$(gh pr view --json number --jq .number); abort if empty.

Step WE-4b — Bootstrap mode (empty-repo only)

  1. bash "$AGENTS_CONFIG_DIR/skills/worktree-end/scripts/bootstrap-complete.sh" "$WORKTREE_PATH" "$BRANCH" "$OWNER_REPO" — parse BOOTSTRAP_COMMIT_SHA and DEFAULT_BRANCH_SET. Non-zero → stop.
  2. Set BOOTSTRAP_MODE=1, PR_NUMBER="", PR_STATE="BOOTSTRAP".
  3. Emit <<WORKFLOW_USER_VERIFIED: bootstrap initial commit pushed to main>> via skills/_shared/user-verified.md.
  4. Skip WE-5 through WE-8; continue at WE-9, WE-12 (with BOOTSTRAP_MODE=1 and BOOTSTRAP_COMMIT_SHA), WE-15.

Read the full file on GitHub · 109 lines

Changes

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.

  1. yesterday First seen · 109 lines · 22 tokens per session scan C f7991099065d

Subscribe to this mod's changes

worktree-end is a skill published in the GitHub repository nirecom/agents (3 stars, last pushed today), licensed MIT. It adds 22 tokens to every session and 2,487 once invoked, about $0.0001 per session on Opus 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.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens