Worktree Manager Plugin for Claude Code

Parallel workspaces
for your code.

Worktree Manager creates isolated git worktrees for parallel feature development. Handles the tedious setup so you can focus on building. Pairs with Chainer for workflow automation.

/worktree-manager:create payments
Creates isolated worktree with automatic setup. What happens
Behind that command:
1. Creates ~/worktrees/payments/ directory
2. Creates feature/payments branch
3. Auto-detects project type (Node, Swift, & 20 more)
4. Offers to run setup (npm install, swift build, etc.)

The Concept

Work on multiple features
in parallel.

When you ask an AI to build a feature, it usually monopolizes your environment. You wait. You watch text stream.

Worktree Manager sets you up to collaborate in parallel with agents. It spins up a clean, separate copy of your project (a git worktree) and installs dependencies, so you can assign an AI worker to that directory.

Capabilities

Designed for workflows that go beyond a single assistant and into multi-agent collaboration.

  • Creates isolated Git Worktrees automatically
  • Auto-detects project type & installs dependencies
  • Auto-copies development environment files (.env, .vscode)
  • Move, lock, repair, and prune worktrees for lifecycle management
  • Rename and delete branches with safety checks
  • Create worktrees from existing branches
  • Automatically initializes git submodules
  • Pairs with Chainer for workflow automation
  • Safe experimentation without contaminating main
  • Zero bookkeeping required

Installation

Simple setup.

Requires Claude Code. For automated workflows, also install Chainer plugin.

# 1. Add the marketplace (in Claude Code) /plugin marketplace add danielraffel/generous-corp-marketplace # 2. Install the plugin /plugin install worktree-manager@generous-corp-marketplace # 3. Restart Claude Code # Quit and reopen Claude Code to load the plugin
View on GitHub →
After installation, verify with /worktree-manager:list

Command Reference

Quick lookup.

Worktree Manager creates isolated worktrees. For automated workflows (planning + implementation), use Chainer.

What you want Command You provide What happens
Create a worktree /worktree-manager:create bug-fix feature name (bug-fix) Creates worktree at ~/worktrees/bug-fix on branch feature/bug-fix with auto-setup (npm install, etc.)
List all worktrees /worktree-manager:list nothing Shows all active worktrees with their paths, branches, and lock status
Check worktree status /worktree-manager:status <path> worktree path Shows git status, uncommitted changes, and branch info
Cleanup worktree /worktree-manager:cleanup <path> [--merge] worktree path, optional --merge flag Removes worktree. With --merge, merges branch to main first
Move worktree /worktree-manager:move <current> <new> current path, new path Moves worktree to new location. Git updates all references automatically
Lock worktree /worktree-manager:lock <path> [--reason="text"] worktree path, optional reason Prevents accidental removal. Useful for protecting important worktrees
Unlock worktree /worktree-manager:unlock <path> worktree path Allows removal again after locking
Repair worktree /worktree-manager:repair <path> worktree path Fixes broken administrative files. Use when worktree was manually moved
Prune orphaned worktrees /worktree-manager:prune nothing Removes references to worktrees that were manually deleted
Rename branch /worktree-manager:rename-branch <path> <old> <new> worktree path, old name, new name Renames branch in worktree. Updates all git references automatically
Delete branch /worktree-manager:delete-branch <name> [--force] [--delete-remote] branch name, optional flags Deletes branch with safety checks. Use --force for unmerged branches, --delete-remote to also delete from origin

Configuration

Override defaults.

Create a config file to customize behavior. Project config overrides user config, which overrides defaults.

Config file locations

  • Project: .claude/worktree-manager.local.md
  • Global: ~/.claude/worktree-manager.local.md
# .claude/worktree-manager.local.md --- # Where to create worktrees worktree_base_path: ~/worktrees # Branch prefix (default: feature/) branch_prefix: feature/ # Create LEARNINGS.md in worktree create_learnings_file: false # Auto-initialize git submodules auto_init_submodules: true # Setup behavior: prompt | auto | false auto_run_setup: prompt # Auto-copy environment files copy_files_enabled: true copy_file_patterns: [".env", ".vscode/**"] # Auto-commit changes auto_commit: false # Auto-push to remote auto_push: false ---
Option Default Description
worktree_base_path ~/worktrees Base directory where all worktrees are created
branch_prefix feature/ Prefix for new branches (e.g., feature/my-task)
create_learnings_file false Create LEARNINGS.md in worktree to capture insights
auto_init_submodules true Auto-initialize git submodules recursively in new worktrees
auto_run_setup 'prompt' Setup behavior: 'prompt' (ask which ecosystems), 'auto' (run first detected), false (skip all)
copy_files_enabled true Auto-copy development environment files to new worktrees
copy_file_patterns ['.env', '.vscode/**'] Glob patterns for files to copy from main repo
exclude_file_patterns ['node_modules', 'dist'] Glob patterns to exclude from copying
auto_commit false Auto-commit changes during AI agent execution
auto_push false Auto-push to remote after commits

FAQ

Common questions.

Can you explain this without all the jargon?

Worktree Manager lets you safely ask AI to try ideas and make changes to a project without messing up what you're currently working on.

The simple mental model: it creates a separate "workspace" for each task—like making a duplicate of your project dedicated to "try Feature A" or "fix Bug B." You keep working in your normal workspace while the AI works in the separate one.

How it works:

1. You tell Worktree Manager to create a workspace for a task.
2. It spins up a fresh, isolated directory with your project code.
3. You open Claude Code in that directory and work on the feature.
4. Your main project stays clean and stable while experiments happen elsewhere.
5. When done, you review the results and decide what to merge back.

For automation: Pair it with Chainer to automatically chain planning (feature-dev) and implementation (ralph-loop) inside isolated worktrees.

What's the status of this project?

Very early beta. This project was cobbled together on December 31, 2025 and should be considered experimental. Only a handful of people have tried it so far.

Expect rough edges, breaking changes, and incomplete features. Use at your own risk. This notice will be updated if/when the project matures.

How do I install plugins in Claude Code?

For official marketplace plugins (like feature-dev and ralph-loop): Launch Claude Code and type /plugins. Search for the plugin you want, select it, and install. After installing marketplace plugins, you must quit and restart Claude Code for them to take effect. See the official plugin documentation for more details.

For Worktree Manager: Add the marketplace, then install:

/plugin marketplace add danielraffel/generous-corp-marketplace
/plugin install worktree-manager@generous-corp-marketplace

Then restart Claude Code to load the plugin.

Why would I need a plugin like this? What's the alternative?

Without worktrees, the typical process is: stash your current changes, create a new branch, work on the feature, commit, switch back to your original branch, pop your stash. If you want AI help, it monopolizes your terminal while it works.

With Worktree Manager, you skip all that context-switching. The AI works in a completely separate directory on a separate branch. You can spin up multiple worktrees and have several Claude agents working in parallel—each isolated, each on its own feature.

What's a typical workflow?

Create a worktree for your feature:

/worktree-manager:create payment-flow
Creates isolated workspace at ~/worktrees/payment-flow on branch feature/payment-flow. Detects your project type, asks what to install.

Work on your feature:

Open Claude Code in the worktree directory and build. Your main branch stays clean while you experiment.

Check status when needed:

/worktree-manager:list - See all active worktrees
/worktree-manager:status ~/worktrees/payment-flow - Check uncommitted changes

Manage as you go:

/worktree-manager:lock ~/worktrees/payment-flow --reason="In progress" - Prevent accidental deletion
/worktree-manager:rename-branch ~/worktrees/payment-flow feature/payment-flow feature/new-payments - Rename if needed

Clean up when done:

/worktree-manager:cleanup ~/worktrees/payment-flow --merge
Merges changes to main, removes worktree, deletes feature branch. Push to git or let Claude handle it.

Parallel development: Create multiple worktrees, open separate Claude Code sessions in each, work on different features simultaneously.

Why does it say "no git repo detected" when I have one?

Git worktrees require an existing repository with at least one commit. If you just ran git init but haven't committed anything yet, worktrees won't work.

Fix: make an initial commit first (git add . && git commit -m "Initial commit"), then try again.

Can this automatically set up my development environment?

Yes, but you control what gets installed. We detect your project type and ask you which dependencies to install—we don't run anything without your permission.

How it works:

1. You create a worktree - Run /worktree-manager:create my-feature
2. We scan for ecosystems - Detects all 22+ project types in ~100ms
3. You pick what to install - Interactive menu shows options, you select what you need
4. We run only your selections - Executes only what you chose

Example: Project with Node.js, Rust, and Swift shows:

Which project types should I set up?
[x] Node.js (npm) - npm install
[ ] Rust - cargo fetch
[ ] Swift - swift package resolve
[Other...]

Select Node.js, press Enter, and you're coding in 30 seconds. Need Rust later? The command is shown—just run it manually. Want to skip all setup? Deselect everything.

What we detect and can install:

Node.js - npm, yarn, pnpm, or bun (auto-detects from lockfiles)
Python - uv, Conda, Poetry, pipenv, or pip
Native/Mobile - Swift Package Manager, Flutter, iOS (Xcode)
Backend - Go, Rust, Java (Maven/Gradle), PHP, Elixir, .NET, Scala, Ruby
Other - Deno, C++ (CMake), Dart

Control how this works: Set auto_run_setup in your config (.claude/worktree-manager.local.md):

'prompt' (default) - Interactive menu, you choose what to install (recommended)
'auto' - Runs first detected ecosystem only (faster for single-language projects)
'all' - Installs all detected ecosystems (slower, could take 5+ minutes for polyglot repos)
'false' - Skip all detection and setup

Is this safe? We think so—but you’re the best judge. We only run standard package manager commands (npm install, pip install, etc.)—the same commands you'd run manually. In default mode, you explicitly select what runs. If you're not interested in scanning for ecosystems, set auto_run_setup: false to disable and skip this entirely.