Search task is slow in large repos – switch from find to rg

Resolved 💬 4 comments Opened Jun 14, 2025 by vintersnow Closed Jan 4, 2026

Background

When I run the Search task in Claude Code on my repository, finding even a single file takes a long time.
I discovered that Claude Code calls the find command, but my repo contains millions of dummy data files (all listed in .gitignore). Because find walks every path—including ignored ones—the search is extremely slow.

Problem

Claude Code runs find to locate files.
In repositories with millions of files (most of them in .gitignore), find scans everything and takes minutes.

Suggested fix

Use rg (ripgrep):

rg --files --glob "<pattern>"

  • Respects .gitignore automatically
  • Much faster on large trees
  • If rg isn’t available, fall back to find

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗