Avoiding Duplicated node_modules Across Worktrees
You're using worktree.sparsePaths to scope several parallel
worktrees to specific packages, but each one is still duplicating a
heavy shared node_modules directory.
What setting pairs with sparsePaths to avoid that?
The correct answer is "symlinkDirectories."
symlinkDirectories is paired with sparsePaths specifically for a
heavy shared directory like node_modules, symlinking it instead of
copying it into every worktree. additionalDirectories is about
granting a session access to another directory, not deduplicating
worktree contents; CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD is
the env var that makes --add-dir also load a directory's CLAUDE.md,
unrelated to symlinking; and claudeMdExcludes only affects which
CLAUDE.md files load.
Share this question