r/PiCodingAgent • • 28d ago

Question Stop Pi From Running find /

I'm on a giant shared server and "find /" might take an hour. I've been unable to persuade pi to stop issuing it. In settings.json I changed defaultTools to defaultTools": ["read", "bash", "edit", "write", "grep", "ls"] and in AGENT.md I added a rule "don't ever run find /" and similar message in my README.md but it continues to issue "find /"

How can I enforce this?

11 Upvotes

22 comments sorted by

20

u/TBMonkey 28d ago

Regex hook that intercepts the call and returns it failed with a reminder to not use that?

9

u/Glaaki 28d ago

Yes, this has come up before. Just ask Pi to make an extension that blocks this and tells the model to try something less intrusive. Work perfectly for me.

2

u/jtackman 26d ago

precisely, i use a combination of this and prompt steering to get models to not write huge heredoc scripts

27

u/MrCatberry 28d ago

Running pi on a "giant shared server"... unsandboxed of course...

10

u/Majestic_Department7 28d ago

Put it in a container

8

u/bitzap_sr 28d ago

You have multiple answers already. Let me just add a couple notes:

  • it's the model, not pi.
  • ask it this very question. It will suggest some config setting in your permissions extension if you have one, a wrapper script for find, or to write some extention that blocks the calls. It will know what to do. This should be your first instinct.

5

u/LordMoridin84 28d ago

https://pi.dev/packages/@gotgenes/pi-permission-system?name=permission

      "find / *": {
        "action": "deny",
        "reason": "Use rg instead of find"
      }

4

u/Wayne_Kane 28d ago

Use pi permission system extension and block find / pattern

3

u/ChampionshipIcy7602 28d ago

Just don't use bash find, instead use the find tool

2

u/cryowastakenbycryo 28d ago

install locate and ask nicely? good luck

2

u/greenhilltony 28d ago

Let Pi write an extension to intercept calls with `find` and to hint the model to use `fd`. I did the port to TS from my Claude Code plugin: https://github.com/TonyWu20/no-find-grep

1

u/_JohnMcAfee 18d ago

I think it does this automatically by default. If you enable its find and grep tools it conditionally alters the system prompt and also uses fd and rip grep 

1

u/CyberTod 28d ago

I added the block in cc-safety-net.

1

u/PrimaryHuckleberry11 28d ago

for me it was enough to instruct in AGENT.md not to use it ever for / But even if I say to disallow it for all, it still respect this guardrail. What model are you using?

1

u/o_sht_hi 28d ago

Loool create an alias

1

u/Khurrame 27d ago

Use fff plugin.

1

u/jensilo 28d ago

”Stoppning pi from doing x“ is like saying „stopping my car from driving in the wrong lane“. It’s the driver, not the vehicle.

1

u/ali0une 28d ago

Maybe with a wrapper in ~/bin/find in your PATH that translates 'find /' in 'echo "do not use find /"

1

u/LearnedByError 27d ago

This is what I do. It checks environment variables to see if it is an agent (pi, cursor,codex…) and it is and matches a ragged then print an error message and not allowed then exit 1.

0

u/fell_ware_1990 28d ago

Just block it > use XYZ, or even translate its call.

0

u/Ambitious_Spare7914 25d ago

Pi, prevent agents from running find /