TODO: Migrate worktree location to /tmp

todo-worktree-tmp-migration Todo

todo done

TODO: Migrate worktree location to /tmp

Move all Claude agent worktree operations from repo-local directories to /tmp. Worktrees are session-scoped (10+ PRs/day), so persisting them in the repo tree creates stale accumulation and wastes tokens when agents encounter outdated state.

Changes Needed

1. Update worktree-workflow SOP

Specify /tmp/claude-worktrees/[repo]/[branch] as the canonical worktree location. Remove any references to .claude/worktrees/ or .worktrees/ as worktree roots.

2. Update claude-custom hooks/config

Audit claude-custom repo for any hooks or config that reference .claude/worktrees/ or .worktrees/ and update paths to /tmp/claude-worktrees/.

3. Add post-merge freshness step

Add a post-merge hook or SOP step: after PR merge, run git fetch origin + git pull in ~/[repo] to keep local main current. This prevents new worktrees from branching off stale commits.

4. Clean up existing stale worktrees

One-time sweep: remove any existing stale worktrees in .claude/worktrees/ and .worktrees/ across all repos. Verify no active sessions depend on them before cleanup.
Review and likely supersede:
  • todo-worktree-staleness-prevention — may be fully addressed by the /tmp migration + post-merge freshness step
  • todo-worktree-cleanup — may be fully addressed by the /tmp migration (auto-clean on reboot)
  • phase-postgres-epilogue-cleanup — parent phase
  • worktree-workflow — SOP to update
  • sop-claude-config-development — config conventions to update
  • todo-worktree-staleness-prevention — likely superseded
  • todo-worktree-cleanup — likely superseded