Skip to content

fix(discover): skip .worktrees directory during indexing#37

Open
wassertim wants to merge 1 commit intoDeusData:mainfrom
wassertim:fix/skip-worktrees-directory
Open

fix(discover): skip .worktrees directory during indexing#37
wassertim wants to merge 1 commit intoDeusData:mainfrom
wassertim:fix/skip-worktrees-directory

Conversation

@wassertim
Copy link

Summary

  • Add .worktrees to IGNORE_PATTERNS in internal/discover/discover.go
  • Add test case verifying .worktrees/ contents are skipped during discovery

Problem

Git worktrees (stored in .worktrees/) duplicate the entire source tree. When indexing a monorepo that uses worktrees for parallel development, the knowledge graph ends up with duplicate nodes and edges for every function, class, and route. This causes:

  • Route searches returning 2-3x duplicate results
  • search_graph results pointing to worktree copies instead of the main source
  • Inflated node/edge counts (we saw 12,554 nodes where many were duplicates)

Context

Discovered while evaluating codebase-memory-mcp on a TypeScript monorepo with active worktrees. Related to #31 (.gitignore support would also solve this, but .worktrees should be unconditionally skipped like .git).

Test plan

  • go test ./internal/discover/ -v -run TestDiscoverSkipsWorktrees passes
  • Existing TestDiscoverBasic still passes

Git worktrees (stored in .worktrees/) duplicate the entire source tree,
causing the knowledge graph to contain duplicate nodes and edges for
every function, class, and route. This is especially problematic in
monorepos where worktrees are used for parallel development.

Add .worktrees to IGNORE_PATTERNS alongside other VCS/tool directories
like .git and .svn. Includes a test case verifying the directory and
its contents are skipped during discovery.

Fixes DeusData#31 (partial — .worktrees specifically)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant