harness-worktree-lifecycle

Reports git worktree status and recommends safe cleanup without deleting files.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill harness-worktree-lifecycle-maicongambini
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: harness-worktree-lifecycle
Source: https://github.com/MaiconGambini/opencode-harness-guide/tree/main/skills/harness-worktree-lifecycle
Command: npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill harness-worktree-lifecycle-maicongambini

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When running parallel agents across multiple git worktrees, it becomes hard to know which worktrees are clean, dirty, or stale, and deleting the wrong one can destroy uncommitted work. This Skill audits worktree state and recommends safe cleanup actions without ever deleting files automatically. ## Core Features & Use Cases - Worktree Status Reporting: Classifies worktrees as clean, dirty, or stale by running a Node.js script from the repository root. - Safe Cleanup Recommendations: Marks dirty worktrees as keep-salvage-first and only suggests pruning clean worktrees after explicit user approval. - Use Case: Before starting overlapping parallel implementation work with multiple agents, run the lifecycle check to see which existing worktrees are safe to reuse or prune, avoiding accidental loss of in-progress changes. ## Quick Start Ask the agent to run the harness worktree lifecycle check from the repository root and report which worktrees are clean, dirty, or safe to prune.

Frequently Asked Questions about harness-worktree-lifecycle

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check which git worktrees are safe to delete?

Run the harness-worktree-lifecycle script from the repository root with node .opencode/scripts/harness-worktree-lifecycle.mjs. It reports each worktree as clean, dirty, or stale and recommends cleanup actions without deleting anything automatically.

How to manage worktrees when running parallel AI agents?

Run the lifecycle check before starting overlapping parallel implementation work. It identifies dirty worktrees that must be kept for salvage and clean ones eligible for pruning, so agents do not collide or lose uncommitted changes.

Does this tool delete worktrees automatically?

No. The skill never deletes a worktree automatically. Dirty worktrees are marked keep-salvage-first, and clean worktrees are pruned only after explicit user approval.

What happens to dirty worktrees with uncommitted changes?

Dirty worktrees are classified as keep-salvage-first, meaning their uncommitted work is preserved and flagged for manual review. The tool recommends keeping them rather than pruning.

When should I run a worktree lifecycle check?

Run it before starting overlapping parallel implementation work or when multiple agents may share a repository. It is also useful periodically to detect stale worktrees accumulating on disk.