Agent skill

Worktree Retry Cleanup

by ZaxbyHub in ZaxbyHub/opencode-swarm

Protocol for cleaning parallel-coder worktree lanes before retry.

MITAuto-check passedDevelopment

Install Worktree Retry Cleanup

skills CLI
$ npx skills add ZaxbyHub/opencode-swarm --skill worktree-retry-cleanup -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ZaxbyHub/opencode-swarm worktree-retry-cleanup --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ZaxbyHub/opencode-swarm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.opencode/skills/worktree-retry-cleanup .claude/skills/worktree-retry-cleanup && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
worktree-retry-cleanup
GitHub stars
494
Token cost
~466 tokens
SKILL.md length
215 words
Files
1
Skills in repo
91
Repo updated
First seen
Licence
MIT

At a glance

Protocol for cleaning parallel-coder worktree lanes before retry.

  • Works in 6 steps: Prefer built-in provisioning cleanup.… → If provisioning blocks: Treat the error… → If manual cleanup is explicitly… → …
  • Tasks that involve Git worktrees
  • SKILL.md covers Trigger, Protocol and Root cause
  • Calls git

What it does

Worktree Retry Cleanup is an agent skill from ZaxbyHub/opencode-swarm. Protocol for cleaning parallel-coder worktree lanes before retry. Triggered before re-dispatching any task that already has a lane (completed, denied, cancelled, or failed).

Its SKILL.md is about 470 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Git worktrees. The repository describes itself as: Architect-centric agentic swarm plugin for OpenCode. Hub-and-spoke orchestration with SME consultation, code generation, and QA review. The licence is MIT.

When your agent uses it

  • Tasks that involve Git worktrees

Example prompts

  • “/worktree-retry-cleanup”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Prefer built-in provisioning cleanup. Re-dispatch normally through the standard coder/worktree path. Provisioning pre-cleans stale…
  2. If provisioning blocks: Treat the error as signal. Dirty lanes, lanes active in another worktree, and lanes owned by another active…
  3. If manual cleanup is explicitly required: Do the ownership check FIRST. Confirm the lane is not owned by another ACTIVE session: read…
  4. Remove only the specific lane. Target .swarm-worktrees//, never the session parent. Prefer git worktree remove .swarm-worktrees// and then…
  5. Delete only confirmed stale branches. git branch -d swarm/lane// is allowed after confirming the branch is not checked out and contains no…
  6. Verify: git branch --list "swarm/lane//" returns empty before retrying.

What it can do on your machine

Read from SKILL.md and the folder at commit b63a4bd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Worktree Retry Cleanup loads about 466 tokens when it runs. Until then it costs about 49 tokens; SKILL.md has 215 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~49
When it runs · the whole SKILL.md, loaded when a task matches
~466

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ZaxbyHub/opencode-swarm at commit b63a4bd, republished under its MIT licence (© ZaxbyHub). 215 words, ~466 tokens.

Download SKILL.mdSave it as .claude/skills/worktree-retry-cleanup/SKILL.md (or your agent's skills folder).
name
worktree-retry-cleanup
description
Protocol for cleaning parallel-coder worktree lanes before retry. Triggered before re-dispatching any task that already has a lane (completed, denied, cancelled, or failed).
audience
swarm-plugin

Worktree Retry Cleanup

Trigger

Before re-dispatching a coder for a task that already has a lane (any prior dispatch status).

Protocol

  1. Prefer built-in provisioning cleanup. Re-dispatch normally through the standard coder/worktree path. Provisioning pre-cleans stale same-lane worktrees/branches when ownership is safe and the existing lane is clean.
  2. If provisioning blocks: Treat the error as signal. Dirty lanes, lanes active in another worktree, and lanes owned by another active session must be surfaced to the user instead of deleted.
  3. If manual cleanup is explicitly required: Do the ownership check FIRST. Confirm the lane is not owned by another ACTIVE session: read .swarm/session/state.json and verify no other session's delegationChains reference <session>/<task>. If another active session owns it, STOP.
  4. Remove only the specific lane. Target .swarm-worktrees/<session>/<task>, never the session parent. Prefer git worktree remove .swarm-worktrees/<session>/<task> and then git worktree prune.
  5. Delete only confirmed stale branches. git branch -d swarm/lane/<session>/<task> is allowed after confirming the branch is not checked out and contains no needed commits. Use force deletion only with explicit human approval.
  6. Verify: git branch --list "swarm/lane/<session>/<task>" returns empty before retrying.

Root cause

Stale same-lane worktrees and branches used to require manual cleanup before retry. Provisioning now handles the safe clean/stale cases automatically and fails closed for dirty, active, or cross-session-owned lanes.

© ZaxbyHub, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .opencode/skills/worktree-retry-cleanup of ZaxbyHub/opencode-swarm.

Open the folder on GitHubat commit b63a4bd

Compare with similar skills

Worktree Retry Cleanup next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Worktree Retry Cleanup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Worktree Retry Cleanup this skillZaxbyHub/opencode-swarm494—~466Automated safety check: PassMIT
Finishing a Development Branchobra/superpowers297k5 repos~1.9kAutomated safety check: PassMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0
Finishing A Development Branchfarm-fe/farm5.6k35 repos~1.8kAutomated safety check: PassMIT
Git Worktree Cleanuplobehub/lobehub83k—~2.8kAutomated safety check: PassCustom licence
Keep Codex Fastvibeforge1111/keep-codex-fast1.6k—~3.1kAutomated safety check: PassMIT

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    297k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    42k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • A skill your agent uses when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for…

    5.6k GitHub starsUsed in 35 repos~1.8k tokens
    DevelopmentAuto-check passed
  • Git Worktree Cleanup

    lobehub/lobehub

    Audits stale Git worktrees and branches with a bundled script, classifies each one, and deletes only after you approve the exact candidates.

    83k GitHub stars~2.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Keep Codex Fast

    vibeforge1111/keep-codex-fast

    A skill your agent uses when Codex feels slow or bloated, when local sessions/logs/worktrees/config have grown over time, or when a user wants safe maintenance for Codex Desktop/CLI state.

    1.6k GitHub stars~3.1k tokensUpdated 5 mo ago
    DevelopmentAuto-check passed
  • Pre-Release PR Triage

    jamiepine/voicebox

    Sorts a backlog of open pull requests into must-merge, candidate, superseded and deferred, writes a triage doc and works the merge loop before a release.

    57k GitHub stars~3.1k tokensUpdated 4 days ago
    DevelopmentAuto-check passed

More from ZaxbyHub/opencode-swarm

All 91 skills in this repo
  • Codebase Review Swarm

    ZaxbyHub/opencode-swarm

    Runs an evidence-gated, quote-grounded audit of a codebase for security, QA, accessibility, performance and more, and writes a verified report without changing source files.

    496 GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • Issue Tracer

    ZaxbyHub/opencode-swarm

    Drives a bug report from validation and root-cause tracing through a critic-reviewed plan, an approved minimal fix and a PR-ready closure, never merging without recorded human approval.

    496 GitHub stars~4.4k tokensUpdated today
    Auto-check passed
  • Commit and PR Publishing for Codex

    ZaxbyHub/opencode-swarm

    Codex adapter for opencode-swarm that governs commits, pushes, draft PRs, PR body updates and CI closeout, deferring to the repo's canonical commit-pr protocol.

    496 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Durable Session State

    ZaxbyHub/opencode-swarm

    Keeps plans, decisions, evidence and reviewer verdicts in small files so long multi-phase tasks survive context compaction and session resumes.

    496 GitHub stars~896 tokensUpdated today
    Auto-check passed
  • Swarm PR Feedback Closer

    ZaxbyHub/opencode-swarm

    Ingests existing pull request feedback such as review comments and CI failures, verifies each claim, fixes confirmed issues and reports closure status for every item.

    496 GitHub stars~14k tokensUpdated today
    Auto-check passed
  • Swarm PR Subscribe

    ZaxbyHub/opencode-swarm

    Monitor a pull request after creation and act autonomously on pushed PR activity.

    496 GitHub stars~2.2k tokensUpdated today
    Auto-check passed

Categories

Questions about Worktree Retry Cleanup

What does Worktree Retry Cleanup do?

Protocol for cleaning parallel-coder worktree lanes before retry. Worktree Retry Cleanup is an agent skill from ZaxbyHub/opencode-swarm. Protocol for cleaning parallel-coder worktree lanes before retry.

When should I use Worktree Retry Cleanup?

Worktree Retry Cleanup fits situations like: tasks that involve Git worktrees.

How do I install Worktree Retry Cleanup in Claude Code?

Run `npx skills add ZaxbyHub/opencode-swarm --skill worktree-retry-cleanup -a claude-code`. Or copy the skill folder (.opencode/skills/worktree-retry-cleanup in ZaxbyHub/opencode-swarm) into .claude/skills/worktree-retry-cleanup in your project. Claude Code loads it when a task matches its description.

How do I install Worktree Retry Cleanup in Codex?

Run `npx skills add ZaxbyHub/opencode-swarm --skill worktree-retry-cleanup -a codex`. Or copy the skill folder (.opencode/skills/worktree-retry-cleanup in ZaxbyHub/opencode-swarm) into .agents/skills/worktree-retry-cleanup in your project. Codex loads it when a task matches its description.

Can I use Worktree Retry Cleanup in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ZaxbyHub/opencode-swarm --skill worktree-retry-cleanup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/worktree-retry-cleanup, .gemini/skills/worktree-retry-cleanup, .github/skills/worktree-retry-cleanup and .opencode/skills/worktree-retry-cleanup in your project.

What does Worktree Retry Cleanup need to run?

Going by SKILL.md and its folder, Worktree Retry Cleanup needs the command-line tools its instructions call (git).

Does Worktree Retry Cleanup access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Worktree Retry Cleanup safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Worktree Retry Cleanup use?

Worktree Retry Cleanup is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Worktree Retry Cleanup use?

About 466 tokens (SKILL.md is roughly 1.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Worktree Retry Cleanup?

Skills that share tags, products or a category with Worktree Retry Cleanup: Finishing a Development Branch (obra/superpowers, 297k stars), Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars), Finishing A Development Branch (farm-fe/farm, 5.6k stars) and Git Worktree Cleanup (lobehub/lobehub, 83k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Worktree Retry Cleanup?

ZaxbyHub (a GitHub organization) maintains it in ZaxbyHub/opencode-swarm, which has 494 GitHub stars. The repository holds 91 skills in this directory. The repository was last updated on October 10, 2026.

Source: ZaxbyHub/opencode-swarm on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.