VS Code extension ripgrep searches from filesystem root, causing 250%+ CPU usage
Bug Description
The Claude Code VS Code extension (anthropic.claude-code) spawns rg (ripgrep) processes that search from the filesystem root (/) instead of the workspace root. These processes consume ~250% CPU each and run indefinitely (45+ minutes observed), effectively performing a full-disk traversal.
Environment
- Extension:
anthropic.claude-codev2.1.38 (darwin-arm64) - VS Code: macOS (Darwin 25.2.0, Apple Silicon)
- Triggered by: Native binary at
resources/native-binary/claude
Observed Behavior
Two rg processes are spawned with absolute glob patterns rooted at /:
Process 1 (PID 86363, 252% CPU, 20+ min runtime):
/Applications/Visual Studio Code.app/.../rg --files --hidden --case-sensitive \
--no-require-git -g /.claude/CLAUDE.md \
-g !**/.git -g !**/.svn -g !**/.hg -g !**/.DS_Store -g !**/Thumbs.db \
-g !**/.nova -g !**/.vscode \
-g !/{**/node_modules,...} \
--no-ignore --follow --no-config --no-ignore-global
Process 2 (PID 81074, 251% CPU, 47+ min runtime):
/Applications/Visual Studio Code.app/.../rg --files --hidden --case-sensitive \
--no-require-git -g /.github/agents/*.md \
-g !**/.git -g !**/.svn -g !**/.hg -g !**/.DS_Store -g !**/Thumbs.db \
-g !**/.nova -g !**/.vscode \
--no-ignore --follow --no-config --no-ignore-global
Root Cause
The glob patterns are absolute (/.claude/CLAUDE.md, /.github/agents/*.md), which causes ripgrep to search from the filesystem root /. Combined with --no-ignore and --follow (follow symlinks), this results in:
- A full traversal of the entire filesystem
- Potential infinite loops from symlink cycles
- Sustained ~250% CPU per process with no termination
Expected Behavior
The glob patterns should be relative to the workspace root (e.g., .claude/CLAUDE.md and .github/agents/*.md), and the search should be scoped to the open workspace directory — not the entire filesystem.
Impact
- Two cores pegged at 100% each indefinitely
- Machine becomes sluggish / fans spin up
- Processes must be manually killed (
kill <pid>) - They may respawn on extension reload or VS Code restart
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗