Skip to content
Development
Skill

/using-git-worktrees

OPTIONAL per-task isolation for autonomous parallel work. Routed to only on explicit opt-in by subagent-driven-development or dispatching-parallel-agents, so parallel units mutate files without colliding. Stands up one worktree per unit, works it in isolation, then integrates

From plugin
codearbiter
15356 skills20 agents38 commands

Claude Code

$ npx -y skills add arbiterForge/codeArbiter --skill using-git-worktrees --agent claude-code

SKILL.md

using-git-worktrees.SKILL.md
name: using-git-worktrees
description: OPTIONAL per-task isolation for autonomous parallel work. Routed to only on explicit opt-in by subagent-driven-development or dispatching-parallel-agents, so parallel units mutate files without colliding. Stands up one worktree per unit, works it in isolation, then integrates each unit back onto the caller's working branch for the caller's single commit-gate + finishing-a-development-branch exit. Never on the default path; it does not bypass a gate or finish per unit.
disable-model-invocation: true

using-git-worktrees

OPTIONAL. Per-task filesystem isolation for parallel agent work — opt-in only, never the default path. Routed to by `subagent-driven-development` and `dispatching-parallel-agents` when, and only when, the caller requests isolation. If no isolation is requested, this skill does not run; parallel units share the working tree under their own discipline.

Isolation lets concurrent units edit files without collision. It changes nothing about the gates — the consolidated work still clears `commit-gate` and the single `finishing-a-development-branch` terminal step, run by the caller. What it MUST NOT do is multiply that terminal step into one PR per unit.

Pre-flight

Read these, or STOP and surface the gap — never guess:

  • `{{PROJECT_DIR}}/.codearbiter/CONTEXT.md` — confirm the repo is a git repo and the base/working branch.
  • The discovered authoritative spec/plan pair for the caller's pipeline. Use its

exact selected plan for the parallel unit list. Re-run the private bridge resolver `_resolve_workflow_pair` with the trusted project root and pipeline slug rather than reconstructing either path. For an HTML pair, load `{{PLUGIN_ROOT}}/includes/artifacts.md` and obtain HTML task and path records only through the installed engine `identity`, `index`, and symbol-scoped `read` operations. For a Markdown pair, use its existing Markdown task table. Worktree planning must not create, convert, or consult a counterpart.

Confirm the caller selected isolation within its current authorized scope AND supplied the parallel unit list from the exact selected plan. Absent either, do not stand up worktrees. A selected isolation method is not new authority to discard a branch or worktree.

Phase 1 — Provision · gate: BLOCK

Stand up one worktree per parallel unit. For each unit, create a worktree on a fresh branch off the current base, under a dedicated parent directory outside the main working tree (e.g. `../.codearbiter-worktrees/<slug>`):

  • One worktree, one branch, one unit. Never share a worktree across units.
  • Branch name MUST be unique and traceable to its unit's task ID.
  • Retain the integration owner, base, branch, path ownership and each worktree path in the existing handoff record; update `.codearbiter/.worktrees.json` where that scratch manifest is already supported. Do not introduce a mandatory new schema to make ordinary isolation possible.

Before provisioning, inventory dirty inputs relevant to each unit and record each path's SHA-256 or absence. A fresh worktree does not contain uncommitted caller bytes. If a dirty input overlaps a unit-owned path, stop: the unit cannot safely distinguish caller work from its own delta. Otherwise, reproduce it only as a read-only baseline, verify its hash before and after unit work, and exclude it from the unit index and commits. Recheck the caller copy is still byte-identical before fold-back. Preserve unrelated dirty paths by leaving them untouched.

Gate: every unit has a distinct worktree on a distinct branch, all rooted at the same verified base and recorded for resumption. Every relevant dirty input is either a content-addressed read-only baseline outside unit ownership or a named stop; unit commits exclude those baselines, and no cleaning, resetting, stashing or overwriting occurred.

Phase 2 — Isolated work · gate: BLOCK

Each parallel unit works entirely inside its own worktree. Dispatch is unchanged — the caller still dispatches its author and reviewer agents; they simply operate on the isolated path.

  • A unit MUST NOT read or write outside its assigned worktree.
  • A unit MUST NOT touch `main` or any other unit's branch.
  • All implementation inside a worktree still flows through `tdd` — isolation is not a TDD bypass.

Gate: each unit's work is contained to its own worktree, with no cross-worktree or base-branch writes.

Phase 3 — Fold back · gate: BLOCK

Integrate each isolated unit's work back onto the caller's single working branch — do NOT finish each unit on its own. Per unit, in order:

1. Confirm the unit was accepted by the caller under its applicable completion and check contract. Inspect accessible command, cwd, source/input identity, output and exit status; reuse valid evidence and rerun only missing or affected checks. An explicit review batch retains its triaged verdict. An unaccepted unit does not fold back. 2. Integrate its branch onto the caller's working branch (merge or rebase), resolving any conflict here, in the open. If a rebase rewrites the unit branch, immediately refresh its recorded tip in the handoff before fold-back and use that refreshed tip for later ancestry proof. Never integrate onto `main` or the default branch.

The consolidated working branch then takes the caller's normal single exit — ONE `commit-gate` pass and ONE `finishing-a-development-branch` decision, run by the caller, not per unit. This skill integrates; it never opens N PRs or finishes N branches. A unit that cannot integrate cleanly is surfaced as a conflict for resolution — never force-merged, never dropped silently.

Gate: every accepted unit integrated onto the caller's working branch with conflicts resolved; no per-unit PR or finish was opened.

Phase 4 — Cleanup handoff · gate: BLOCK

Record which worktrees and branches remain after fold-back. Integrated unit worktrees and branches remain retained by default: they have no per-unit merge

Read more
@arbiterforge
Ships withcodearbiter

Open-source governance and hard gates for AI coding agents across Claude Code, Codex CLI, and Pi.

15356 skills20 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
153
Star history of arbiterForge/codeArbiter on GitHub, a chart by star-history.com

Other skills on codearbiter.

brainstorming

brainstorming

Refine feature and sprint intent into a useful specification. Capture scope, observable criteria and material choices without…

commit-gate

commit-gate

Create a verified local Git commit when committing changes is requested. Not for explaining commit history, drafting a message…

debug

debug

Investigate an unexplained defect or unexpected behavior without changing application code. Use for root-cause diagnosis and an…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about using-git-worktrees.

Which coding agents can use using-git-worktrees?
using-git-worktrees installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.