.claudeignore is not respected by Glob/Grep tools — only affects auto-context loading

Resolved 💬 2 comments Opened Apr 11, 2026 by yhakmo Closed Apr 11, 2026

Summary

.claudeignore entries are ignored when Claude explicitly calls Glob or Grep tools.
The file only affects automatic context loading, not tool-based file searches.

Environment

  • Claude Code version: 2.1.101
  • OS: macOS 25.4.0 (Darwin)
  • Shell: zsh

.claudeignore content

\\\`

Virtual environment — large, not needed for analysis

.venv/
venv/
__pycache__/
\\\`

Steps to Reproduce

  1. Add .venv/ to .claudeignore
  2. Ask Claude to find test files (e.g., "run tests" or "find test files")
  3. Claude calls Glob with pattern **/test_*.py
  4. Results include .venv/lib/.../test_*.py files — .claudeignore is not applied

Expected Behavior

Glob and Grep tools should respect .claudeignore and exclude matching paths from results.

Actual Behavior

.venv/ entries appear in Glob/Grep results despite being listed in .claudeignore.

Example paths returned:

  • .venv/lib/python3.14/site-packages/Cryptodome/SelfTest/Util/test_number.py
  • .venv/lib/python3.14/site-packages/Cryptodome/SelfTest/Signature/test_eddsa.py
  • .venv/lib/python3.14/site-packages/Cryptodome/SelfTest/Hash/test_SHA256.py

Impact

  • Claude wastes context window on irrelevant third-party package files
  • Test discovery may incorrectly include third-party package tests
  • Users have no reliable way to exclude directories from Glob/Grep tool searches
  • .claudeignore behavior is inconsistent and misleading — works for auto-context but not tool calls

View original on GitHub ↗

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