AGENT SKILL

worktree-retry-cleanup

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

License 许可
MIT
所属仓库
djimit/djimitflo
最近更新
2026-11-15
Stars
★ 2
Forks
0

01 前言 Front Matter

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

03 SKILL.md 正文

Worktree Retry Cleanup

Trigger

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

Protocol

  1. Ownership check — do this FIRST, before any deletion. 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 — surface the conflict and do not delete.
  2. Check for existing lane branch: git branch --list "swarm/lane/<session>/<task>"
  3. If branch exists:
    • Verify 0-commits-ahead: git log --oneline HEAD..swarm/lane/<session>/<task> — empty = safe
    • Delete: git branch -d swarm/lane/<session>/<task> (use -D only if -d fails AND the commits are confirmed unneeded)
    • Under full-auto, -D is deny-pattern-blocked — use -d
  4. Remove the per-lane worktree directory. Target the SPECIFIC lane .swarm-worktrees/<session>/<task>, NOT the session parent (the parent holds sibling lanes). Prefer git worktree remove .swarm-worktrees/<session>/<task> — this is permitted because the path is under the .swarm-worktrees/ base. A bare rm -rf / Remove-Item -Recurse -Force on .swarm-worktrees/ is deny-pattern-blocked by the guardrail, so do not use it here.
  5. Prune: git worktree prune
  6. Verify: git branch --list "swarm/lane/<session>/<task>" returns empty
  7. Only after cleanup, proceed to declare_scope + coder dispatch

Root cause

The provisioning code should auto-clean after coder completion/denial/cancellation (tracked in issue #1746 item 1). This playbook is the temporary protocol.

04 同仓库更多 Skills

djimit
djimit/djimitflo

provider-step-usage-v1-0-0

Sum measured OpenCode step_finish token totals with replay deduplication and fail-closed validation.

★ 2
djimit
djimit/djimitflo

writing-tests

Guidelines for writing, organizing, and maintaining tests in the opencode-swarm repository. Covers framework rules (bun:test), mock isolation, CI pipeline structure, file placement, and anti-patterns that break cross-platform CI. Load this skill before writing or modifying any test file.

★ 2
djimit
djimit/djimitflo

swarm

Cross-agent swarm-mode behavior model — a higher-rigor workflow using parallel investigation, independent reviewer validation, and critic challenge, plus the mandatory implementation closeout gate. Runtime adapters (.claude, .agents) add execution-specific notes and command wiring.

★ 2
djimit
djimit/djimitflo

swarm-pr-subscribe

Monitor a pull request after creation and act autonomously on pushed PR activity. Use when subscribing to a PR after opening it, when asked to watch, babysit, or autofix a PR until merge, or when a <pr-activity> wake message or [pr-monitor:...] advisory arrives for a subscribed PR. Owns event triage (fix / ask / skip), bounded-retry escalation, and terminal-state cleanup.

★ 2
djimit
djimit/djimitflo

swarm-pr-review

Run a graph-guided, tool-augmented Swarm PR review using context packing, parallel exploration, triggered plugin micro-lanes, independent reviewer validation, critic challenge, and metrics writeback. Use for deep pull request review with low false-positive tolerance and high recall.

★ 2
djimit
djimit/djimitflo

swarm-pr-feedback

Ingest and resolve known pull request feedback with skeptical source verification. Use when addressing pasted PR feedback, GitHub review comments or threads, requested changes, CI/check failures, merge conflicts, stale PR branches, or PR follow-up work that must close all known issues without dropping findings. Supports multi-round bot reviews (the repository's bot posts a new review after every push) via the iterative pattern documented in the body. Stage A (structural pre-checks) and Stage B (reviewer + test_engineer) gates and the reviewer + critic closeout gate are MANDATORY for any change made as part of this process.

★ 2