[BUG] .rgignore patterns block REPL startup for ~7s on large repos (synchronous glob matching)

Resolved 💬 1 comment Opened Apr 24, 2026 by ablanchet Closed May 29, 2026

Summary

Starting claude in a large repository freezes the REPL for ~7 seconds because .rgignore patterns are applied synchronously on the Node event loop, blocking keystroke rendering. .gitignore does not exhibit this because it is processed asynchronously.

Environment

  • Claude Code: 2.1.119
  • Node: v22.18.0
  • OS: macOS 26.4.1 (also expected on Linux/Windows — work is CPU-bound on the main thread)
  • Repo scale: ~352K tracked files, ~150 .rgignore patterns

Debug log (truncated)

15:16:13.567  [FileIndex] git ls-files (tracked) took 654ms
15:16:13.596  [FileIndex] loaded ignore patterns from /opt/Repos/myrepo/.rgignore
15:16:20.436  [FileIndex] applied ignore patterns: 351891 -> 298915 files
15:16:20.437  [FileIndex] git ls-files: 298915 tracked files in 7524ms
15:16:20.611  [FileIndex] cache refresh completed in 7698ms

The 6.84-second gap between loaded ignore patterns and applied ignore patterns is the entire freeze. During this window the REPL does not echo keystrokes.

Hypothesis

FileIndex performs ~352K paths × ~150 patterns ≈ 53M synchronous glob comparisons on the main thread. .gitignore filtering does not block because it runs asynchronously / post-mount; .rgignore does.

Minimal synthetic repro

mkdir -p /tmp/cc-rgignore-repro && cd /tmp/cc-rgignore-repro
git init -q

# ~350K tracked files
for d in $(seq 1 1000); do
  mkdir -p "dir$d"
  for f in $(seq 1 350); do : > "dir$d/file$f.txt"; done
done
git add -A && git commit -q -m initial

# 150 .rgignore patterns
for i in $(seq 1 150); do echo "**/*pattern${i}*"; done > .rgignore

claude --debug

Expected: REPL responsive immediately.
Actual: REPL freezes for several seconds; debug log shows a multi-second gap between loaded ignore patterns and applied ignore patterns.

Scaling either dimension (file count or pattern count) reproduces proportionally.

Workarounds attempted (none worked except removing .rgignore)

  • respectGitignore: false in settings.json — only affects .gitignore, not .rgignore
  • CLAUDE_CODE_DISABLE_ATTACHMENTS=1 — no effect
  • Custom fileSuggestion command — FileIndex still runs and still freezes
  • Renaming .rgignore — works, but loses the ignore semantics

Related (closed) issues

  • #22950 — @ file completion indexing is slow on optimal hardware (related FileIndex perf, but @ picker, not startup)
  • #1104 — Feature request for .claudecodeignore / disable git indexing (tangential — this report is specifically about .rgignore blocking, not the absence of an ignore mechanism)

Neither covers the specific .rgignore synchronous-blocking behavior on REPL startup.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗