worktree

Create isolated git worktrees for parallel agent workflows and coordinated merges.

12|5|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/ai-pivot/xbot --skill worktree-ai-pivot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree
Source: https://github.com/ai-pivot/xbot/tree/main/tools/embed_skills/worktree
Command: npx skills add https://github.com/ai-pivot/xbot --skill worktree-ai-pivot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When multiple agents modify the same Git repository at the same time, changes can conflict and overwrite each other; this skill solves safe parallel work by isolating each agent’s filesystem changes in a dedicated git worktree.

Core Features & Use Cases

  • Isolated parallel execution: Create separate work directories via git worktree to prevent file collisions while agents iterate on the same codebase.
  • Multi-agent coordination: Supports peer discovery, SubAgent orchestration, and Best-of-N execution where multiple candidate solutions are compared.
  • Merge conflict handling: Coordinates structured merge proposals through message exchanges and applies a defined merge strategy to combine agent branches cleanly.
  • Use Case: Run Best-of-N implementations for a feature (e.g., “login”), compare code quality and tests across worktrees, then merge the chosen branch while minimizing disruption to the main workspace.

Quick Start

Ask the AI to run Best-of-N parallel implementations for the task you specify and then merge the best result using the worktree-based agent workspaces.

Frequently Asked Questions about worktree

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

FAQPage Schema
How do I isolate parallel agents working in the same git repository?

To isolate parallel agents in the same git repository, you can use git worktrees to create separate working directories. This prevents file collisions by isolating each agent’s filesystem changes while they iterate on the same codebase.

Can I run Best-of-N implementations for a feature and merge the best result?

Yes, you can run Best-of-N parallel implementations for a feature using isolated git worktrees. You compare code quality and tests across these worktrees, then merge the chosen branch while minimizing disruption to the main workspace.

How does multi-agent coordination handle merge conflicts?

Multi-agent coordination handles merge conflicts by exchanging structured merge proposals through messages and applying a defined merge strategy. This coordinates agent branches cleanly to combine changes without overwriting each other.

What's the best way to prevent file collisions during parallel agent workflows?

The best way to prevent file collisions during parallel agent workflows is creating dedicated git worktrees outside the main repository directory. This provides deterministic workspace isolation for each agent's filesystem changes.

Do I need external worktree placement for subagent orchestration?

Yes, subagent orchestration requires external worktree placement outside the repository directory. This setup ensures deterministic workspace isolation, preventing parallel subagents from overwriting each other's changes.