Preflight Checklist
What's Wrong?
The agent regularly calls "Glob" tool as well as find and grep bash command listing and reading sensitive and ignored files like .env and node_modules. The files were included in the .gitignore and the agent was explicitly told not to in the CLAUDE.md to respect the .gitignore and to not touch the sensitive files. Closer investigation revealed that
- .gitignore is not respected in the Glob (file listing / search) tool
- The agent uses the built-in "Explore" sub-agent which ignores the project and user level CLAUDE.md and does not respect the project's .gitignore file.
What Should Happen?
- All agents should either respect the CLAUDE.md file or have another option to inject system prompt into them
- All agents and tools should respect .gitignore or at least be instructed to use it in for commands like
find and others.
Error Messages/Logs
Steps to Reproduce
Create a test repo containing .gitignore, put some files there and ask the agent to explore the project.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
v2.1.42
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
No response
Preflight Checklist
What's Wrong?
The agent regularly calls "Glob" tool as well as
findandgrepbash command listing and reading sensitive and ignored files like.envandnode_modules. The files were included in the .gitignore and the agent was explicitly told not to in the CLAUDE.md to respect the .gitignore and to not touch the sensitive files. Closer investigation revealed thatWhat Should Happen?
findand others.Error Messages/Logs
Steps to Reproduce
Create a test repo containing .gitignore, put some files there and ask the agent to explore the project.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
v2.1.42
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
No response