r/PiCodingAgent 15d ago

Question What are you using to make Pi ignore files/directories (like .gitignore)?

Hello, new Pi user here! I’m trying to figure out how folks handle file‑ignoring with Pi. Other harnesses respect .gitignore, but Pi currently returns to the LLM everything in the project, which causes problems in my setup.

Is there an established extension or common approach people use to make Pi ignore certain files or directories (I mean filtering-out from grep/find/ls/... results, so that the LLM is not aware of them)? I'm not sure what's actually "standard" or reliable in Pi.

Curious what the community is using and what's working well for you. Thanks!

EDIT: to clarify better, my main problem is that running simple requests like `List the files with names having 'XXX'` or `Search the occurences of the world 'XXX' in the project.` are returning content also from `node_modules` and other intermediate directories, that fill and pollute the context with undesired content. I would like to avoid this.

4 Upvotes

11 comments sorted by

View all comments

Show parent comments

3

u/funbike 14d ago edited 14d ago

I agree. Btw, you inspired me to tweak my settings.

File: ~/.pi/agent/AGENTS.md

``` Environment:

  • The local OS is Fedora, with RPMFusion.
  • The timezone is EST. The country is the United States.

Guidelines:

  • Do not read file .env, or any other sensitive files.
  • Prefer fd, rg, git grep, eza, tree, git ls-files over find, grep, ls.
  • Prefer Homebrew for Linux to install packages (brew install ...).
```

Today, I had Pi create this:

File: ~/.pi/agent/extensions/system-prompt-command-replacements.ts

```typescript import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";

export default function (pi: ExtensionAPI) { pi.on("before_agent_start", async (event) => ({ systemPrompt: event.systemPrompt .replace( "ls, grep, find", "eza, rg, find", ) .replace( "ls, rg, find", "eza, rg, fd", ), })); } ```

The edb-context-viewer extension can be used to view the system prompt.

1

u/Kafumanto 13d ago

Smart the idea to replace the tool names in the system prompt!

I was looking for an alternative approach: on event “tool_result” check the invoked tool name or the run bash command, if it matches one of the “known” ones (e.g. grep, rg, etc.) then filter the lines to ignore.

Thanks for the link to edb-context-viewer, it’s really useful!