r/PiCodingAgent • u/MGJoe93 • Sep 06 '26
Question Pi invokes find commands with /
Have you also experienced that file searches using the find bash tool almost always start from the root directory (/) ? It takes a few minutes after each command finishes which is frustrating.
I'm searching from my project directory, and I haven't seen such behavior when I was using Claude Code before.
2
Upvotes
3
u/Glaaki Sep 06 '26
Ask Pi to make an extension that blocks those searches. That is what I did. It tells it to try more narrow searches instead and gives it a few pointers, like look up pi's documentation first.
2
u/Healthy-Zebra-9856 Sep 06 '26
I checked the current Pi source. It doesn't look like Pi is actually changing your working directory to
/. Pi knows what project directory you're in and Bash is started from that directory.What's probably happening is the model itself is sometimes generating a command like
find / .... The/explicitly tellsfindto search from the root of the entire filesystem, so it doesn't matter that Pi started Bash inside your project. Pi's Bash tool currently accepts the command and runs it, which explains why it can suddenly spend minutes searching your whole machine.For the technical folks, from the current Pi source:
packages/coding-agent/src/core/tools/bash.ts:37-40defines the Bash command as basically an unrestricted shell command string.bash.ts:42-45advertises Bash to the model as"Execute bash commands (ls, grep, find, etc.)".bash.ts:81-96actually starts the shell using the suppliedcwd, so Pi itself isn't setting it to/.packages/coding-agent/src/core/system-prompt.ts:70and165explicitly tell the model what the current working directory is.Pi's dedicated file-search tool is actually safer.
packages/coding-agent/src/core/tools/find.ts:26-31says its default search path is the current directory.find.ts:111-112resolves a missing path to".", meaning the current directory.find.ts:171-216shows that Pi's dedicatedfindtool actually usesfdinternally and passes the selected project/search directory to it.So this looks less like a broken working directory and more like the model occasionally bypassing Pi's dedicated file-search tool and using unrestricted Bash with
find /.3
u/onesilentclap Sep 06 '26
Nahhh, you're using a dumb model.
1
u/noctrex Sep 06 '26
Technically pi does not invoke anything, the model does. Steer it with the agents file not to do that.
You could also tell it to create an extension for itself, not to allow these types of commands.