Skip to content

arbiterForge/codeArbiter / core/surface/skills/using-git-worktrees

using-git-worktrees

Unverified

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.

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 merged PR, so post-merge-cleanup cannot prove them merged. This phase is their removal path only when all of the following hold: for a rebased unit, the recorded tip was refreshed after rebase; the current recorded tip is an ancestor of the caller's consolidated working branch after fold-back; the unit worktree is clean with no unique untracked or stashed residue; and the existing explicit cleanup confirmation names both its path and branch. Then remove that exact worktree with git worktree remove and delete that exact branch with git branch -d; never use -D. If any proof or confirmation is absent, retain the unit and its handoff entry. Continue to route cleanup of the consolidated PR branch itself through post-merge-cleanup. Do not auto-delete an integrated, unaccepted or abandoned unit merely to close this skill.

Gate: every remaining worktree is accounted for; no unreviewed work or user data is discarded.

Hard rules

  • MUST NOT run on the default path — isolation requires an explicit caller opt-in.
  • MUST NOT share a worktree or a branch across parallel units.
  • MUST NOT let a unit read or write outside its assigned worktree, or touch main.
  • MUST NOT open a per-unit PR or run finishing-a-development-branch per unit — integrate accepted units onto the caller's working branch, which takes the single commit-gate + finishing exit.
  • MUST NOT delete a branch or worktree without the separately required per-item confirmation and cleanup proof (ADR-0036). Retain and report worktrees awaiting that action.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 463kUpdated Claude CodeCodexVerifiedInstall
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 463kUpdated Claude CodeCodexVerifiedInstall
discernment-nudgeanthropics/skillsAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.Stars: 195kUpdated Claude CodeCodexVerifiedInstall
internal-commsanthropics/skillsA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).Stars: 195kUpdated Claude CodeCodexVerifiedInstall