Claude Code plugin for git worktrees of Unity projects. A plain git worktree add has no Library/
(10-30 min cold import) and drops uncommitted Packages//ProjectSettings/ edits.
- Seeding hook (
hooks/seed-if-needed.sh): when Claude is working in a linked Unity worktree with noLibrary/, runsseed-worktree.sh. Fires on session start (claude --worktree, Orca, plaingit worktree add), afterEnterWorktree, on subagent start (isolation: "worktree"), and before each Bash call as a backstop (a no-op in ~10-25 ms once seeded). It only observes: Claude still creates and removes its worktrees itself. - Editor-closing hook (
hooks/close-agent-editor.sh): when a subagent finishes in its isolated worktree,ExitWorktreeremoves a worktree, or a session in a Claude-created worktree ends, an open Unity editor there is saved and closed (close-editor.sh). Never on the main project or on worktrees made outside Claude (<repo>/.claude/worktrees/only). new-unity-worktreeskill: creates a sibling worktree + branch, then seeds it.remove-unity-worktreeskill: removes a worktree and its branch; refuses on an open editor, uncommitted changes, unmerged commits or a lock held by a live Claude process or anyone else.- Unity CLI, when installed: both skills go through
unity vcs git worktree add/remove(editor-version check, Hub registration and removal). Without it they use plain git. seed-worktree.sh: APFS-clonesLibrary/(~4 s, ~free; falls back to reflink/plain copy), copies uncommittedPackages/+ProjectSettings/files when the base's copies match the source's HEAD. Drops the source editor's session files (Pipeline/,ilpp.pid,*-lock) but keepsPackageCache/: a full Library measured ~2x faster first open than Unity's default--seed cache. No-op outside Unity projects.
claude plugin marketplace add notapro/unity-worktrees
claude plugin install unity-worktrees@agentic-workflows
The hook also keeps a symlink ~/.claude/unity-worktrees -> the installed plugin, so skills and
other tools can use a path that survives plugin version bumps.
- Opening Unity by hand in an unseeded worktree, with no Claude session started there, gets no
Library; run
seed-worktree.shyourself. - Cloning a
Library/while its editor is open is untested:new-worktree.shrefuses unless--force; the seeding hook only warns. - Saving writes each dirty scene to its own path; a dirty untitled scene is saved as
Assets/Untitled.unity, which then shows as uncommitted work. If saving fails (play mode, a modal dialog, or a project withoutcom.unity.pipeline),ExitWorktreeremoval is refused so you can save by hand; a subagent or session end cannot be held, so the editor is force-quit (unity close --force) and its unsaved work is lost. SessionEndfrom/clearis ignored, so the editor stays open while the session continues. Editors on worktrees made outside Claude must be closed by whoever opened them. An editor on a Claude-created worktree is closed whoever opened it.SubagentStartcannot hold a subagent, so its first command may wait on the seeding lock.- Verified on macOS only for now (the APFS clone is macOS-specific; other platforms are untested).
- Orca users: see docs/orca.md for the optional removal guard.
bash tests/run.sh [test_name] (macOS; tests that need the Unity CLI register and remove Hub rows).
MIT. See CHANGELOG.md for release notes.