Skip to main content

Engineering

Manage agent worktrees without losing work

Manage agent worktrees without losing work

Agent fleets pile up git worktrees. This guide shows how to see every session tree relative to local main, refresh only when it is safe, and reclaim only fully landed clean trees — without force-merging dirty WIP.

TL;DR

JobTool
Inventorypc worktree list / pc worktree insight --json or harness peer/insight.sh
UIPower Claude → Worktree Manager
Refresh clean+behindFF-only peer/refresh.sh (auto after land when configured)
DirtyFinish/commit first — never force-merge
Reclaimreclaim-landed.sh dry-run first; dirty trees always KEEP

Why worktrees exist

Each coding-agent session can use an isolated checkout under .hurc-harness/worktrees/session-* so agents do not collide on primary main.

What the inventory means

FieldMeaning
behindCommits on local main that this tree lacks
dirtyUncommitted changes
liveSession process appears active
landedBranch content fully on main (reclaim candidate if clean)
freshnesscurrent / stale / deferred

Safe refresh (fail-closed)

SituationAction
Clean and behindFast-forward only
DirtyDeferred — never overwrite WIP
Diverged / non-FFSession merge path; refresh does not force

Safe reclaim

reclaim-landed.sh (default dry-run): KEEP(landed+dirty) always; only clean fully-landed trees are removed (snapshot-backed).

Power Claude surfaces

  1. CLI: pc worktree list · pc worktree insight --json · --stale · --reclaimable
  2. Manager: Command Palette → ⚡ Power Claude: Worktree Manager

Operator FAQ

Does insight change git? No — read-only.

Will refresh touch dirty trees? No.

Can reclaim delete uncommitted work? No — dirty always kept.

Remote/GitHub? Behind is vs local main only. Push is human-owned.

Power Claude by Neural-LLM is independent software — not affiliated with Anthropic, PBC.