Skip to content

using-git-worktrees: Copy .serena/ directory to new worktrees #241

Closed

Description

@jasonkuhrt

Summary

The using-git-worktrees skill should copy the .serena/ directory from the main project to new worktrees for faster Serena MCP startup.

Context

Serena is a popular MCP server for semantic code understanding. It stores project-specific cache and config in .serena/:

project/
  └── .serena/
      └── project.yml    # project config + language server cache

When creating worktrees, Serena treats each as a separate project and rebuilds its language server index from scratch. This causes slow startup in new worktrees.

Proposal

Add an optional step after worktree creation to copy .serena/:

# After: git worktree add "$path" -b "$BRANCH_NAME"
# Before: cd "$path"

if [ -d ".serena" ]; then
  cp -r ".serena" "$path/"
fi

Key points:

  • Copy TO worktrees only (never back to main)
  • Serena will incrementally update for any branch differences
  • Gives warm start vs cold rebuild
  • Safe: worktrees are separate projects, no conflict if both used simultaneously

Alternatives Considered

  • Symlink .serena/ - Would cause conflicts if multiple worktrees used simultaneously
  • Let Serena rebuild - Works but slow, especially for large codebases
  • Skip entirely - Current behavior, users manually copy if needed

Activity

  1. obra commented on Jan 19, 2026

    @obra
    Owner

    This appears to be a local issue, and the ticket appears to have been submitted by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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