[BUG] Agent tries to find outside of the project
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I have a project with a .git folder in a place like C:/dev/a/b/c/project. It is a git repository.
I'm running Claude in this project. I asked a prompt that led to Claude start an Agent with this text Find all files related to the HTTPS server configuration in this project [...]. Instead of searching in this project, it tries to run a find command within C:/dev/a (up 2 parent folders). This a folder is not even a git project (no parent folder is a project).
This is a big problem as I have more sibling projects along the first one and it finds everything everywhere and starts working with them.
It is reproducible almost each time, just going to run it again:
https://github.com/user-attachments/assets/872dbe60-b34e-480c-9610-0a1fa3c5300d
Now it ran glob instead of find, and it ran it 3 folders up in the project. Here is the project and Claude knows it (in the video you see the glob):
<img width="435" height="229" alt="Image" src="https://github.com/user-attachments/assets/205fb3ff-163c-48f4-bf95-ade8b1edef67" />
I asked tons of things to detect if maybe I have a rule somewhere that says to exit the project scope, but nope:
<img width="703" height="223" alt="Image" src="https://github.com/user-attachments/assets/d91026ff-cc28-4eb5-a7b1-be62039f6af7" />
<img width="694" height="307" alt="Image" src="https://github.com/user-attachments/assets/00c34676-0013-4951-932c-f386e70a6c02" />
<img width="705" height="202" alt="Image" src="https://github.com/user-attachments/assets/74ddb988-7d53-4259-815d-3e20e000f267" />
<img width="712" height="141" alt="Image" src="https://github.com/user-attachments/assets/908681f3-aeb1-408e-b9f6-de132222090a" />
In short: There's no rules to exit the project folder. Only the "broad search" can be detected as that, but it notes broad search in patterns, not folders (even with pattern examples), and having a rule saying that it should search in the project, this behavior for this Agent text is not correct (I did not create the Agent text, it was created by Claude itself, I just asked to search about the requestCert logic when different clients are connected).
What Should Happen?
To never exit the current project if the instruction is to not exit the current project.
Error Messages/Logs
Steps to Reproduce
I guess that having multiple sibling projects (C:/dev/a/project1, C:/dev/a/project2, C:/dev/a/project3...) and requesting in one project to search for something and learn from it. My prompt was exactly: I have this requestCert in the HTTPS server, as I need the server to request client certificates when a distributed node is connected (different place as a normal user). Can you read the server and understand this?
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.92
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗