Skip to content

Using SuperClaude with git worktrees #473

@jwagon

Description

@jwagon

Hi,

I'm trying to get SuperClaude to work with a git worktree. Here's what I did:

cd ~/my_repo
git worktree add ../worktree1 -b feature1 main
cd ../worktree1
claude

Then once Claude Code + SuperClaude fire up, I'll do something like

/sc:implement "implement new feature blah blah blah"

It'll go through and do its thing, but only apply code changes to the working copy in ~/my_repo instead of ~/worktree1 (!)

When I asked in Claude Code why this happened, it said:

Fix Worktree Issue & Prevent Future Occurrences

 🔍 Problem Analysis

 What Happened:
 - Changes applied to: ~/my_repo on branch main ❌
 - Should have been applied to: ~/worktree1 on branch
 feature1 ✅

 Root Cause:
 When I used /sc:analyze and Serena MCP activated the project, it switched to the registered project path at
 ~/my_repo, completely ignoring your current worktree context.

 📋 Recovery Plan

 Step 1: Discard Changes from Wrong Branch

 cd /Users/jwagon/Documents/GitHub/MyMedStudy
 git restore ~/my_repo/file1.cs
 git restore ~/my_repo/file1.cs

 Step 2: Re-Apply Changes to Correct Worktree

 Apply the exact same changes to files in:
 - git restore ~/worktree1/file1.cs
 - git restore ~/worktree1/file2.cs
 - etc

 🛡️ Prevention Strategy

 Option A: Deactivate Serena MCP in Worktrees (Recommended)

 Update .claude/settings.local.json to disable Serena when in worktrees:
 {
   "mcpServers": {
     "serena": {
       "disabled": true
     }
   }
 }
 Pros: Simple, prevents the issue entirelyCons: Loses Serena's symbolic tools (but you still have native Read/Edit/Grep/Glob)

 Option B: Keep Serena but Always Use Relative Paths

 When using Serena tools, explicitly pass relative_path parameter starting from current working directory. However, this is error-prone as Serena still
 operates on its registered project path.

 Option C: Create Worktree-Specific Serena Project Registration

 Register the worktree as a separate Serena project, but this requires manual setup for each worktree.

 ✅ Recommendation

 Use Option A - Disable Serena MCP in the worktree's .claude/settings.local.json. This ensures:
 - All file operations respect current working directory
 - No accidental cross-branch contamination
 - Native Claude Code tools are sufficient for most development tasks
 - You can still use Serena in the main repository when needed

 Would you like me to proceed with this plan?

I don't think any of those options are appealing. Am I doing this wrong, and/or is there some way to configure SuperClaude + Serena to behave as one would expect?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions