Worktree Retry Cleanup
SkillProductivityProtocol for cleaning parallel-coder worktree lanes before retry. Triggered before re-dispatching any task that already has a lane (completed, denied, cancelled, or failed).
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Worktree Retry Cleanup skill
What this skill tells your AI
The instructions your AI receives, as published by zaxbyhub/opencode-swarm in .opencode/skills/worktree-retry-cleanup/SKILL.md and read by ahel’s review.
Trigger
Before re-dispatching a coder for a task that already has a lane (any prior dispatch status).
Protocol
- 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.
- 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.
- 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.jsonand verify no other session'sdelegationChainsreference<session>/<task>. If another active session owns it, STOP. - Remove only the specific lane. Target
.swarm-worktrees/<session>/<task>, never the session parent. Prefergit worktree remove .swarm-worktrees/<session>/<task>and thengit worktree prune. - 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. - 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.
Signals
- GitHub stars
- 467
- Forks
- 51
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
worktree-retry-cleanup- Source
- github.com/zaxbyhub/opencode-swarm