@tian.zuo/pi-find
Simple, bounded ripgrep/fd-backed grep and find tools for the pi coding agent.
Package details
Install @tian.zuo/pi-find from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@tian.zuo/pi-find- Package
@tian.zuo/pi-find- Version
0.5.0- Published
- Sep 16, 2026
- Downloads
- 999/mo · 373/wk
- Author
- tian.zuo
- License
- MIT
- Types
- extension
- Size
- 53.7 KB
- Dependencies
- 2 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-find
Release notes: changelog · GitHub releases
Simple, bounded grep and find tools for the pi coding agent,
backed by ripgrep and fd.
Install: npm:@tian.zuo/pi-find · npm package @tian.zuo/pi-find · workspace
packages/pi-find
The extension reuses pi's built-in tool names, so the model sees one search surface instead of competing built-in and extension tools.
Tools
grep
grep(pattern, path?, glob?)
patternis a case-sensitive ripgrep regular expression.pathis one file or directory and defaults to the current directory.globoptionally limits file names, for example*.tsor**/*.test.ts.
{ "pattern": "TODO|FIXME", "path": "src", "glob": "*.ts" }
find
find(pattern, path?)
patternis a case-insensitive file glob, for example*.tsor**/*.test.ts.pathis one directory and defaults to the current directory.
{ "pattern": "**/*.test.ts", "path": "packages" }
Search behavior
- Both tools respect
.gitignoreand always skip.git. Explicit.gitroots, files inside them, and symlink aliases to them are rejected. - Globs without
/match basenames at any depth. Globs containing/match paths relative to the search directory (or the parent of an explicit grep file) or to the working directory, so both{ "path": "src", "glob": "src/*.ts" }and{ "path": "src", "glob": "deep/*.ts" }select files undersrc.src/*.tsmatches direct children ofsrc, whilesrc/**/*.tsincludes descendants. Use/in globs on every platform. Glob filtering never re-includes ignored files. - A leading
!excludes instead of includes, like ripgrep's own--glob: for exampleglob: "!*.test.ts"orpattern: "!**/*.generated.ts". - A leading
@is stripped from input paths;~and~/...expand to the home directory. Ripgrep user configuration is ignored so it cannot change the tool's case sensitivity or ignore behavior. - Hidden files and directories are not searched by default. An explicitly
named hidden path still works, for example
path: ".github". - Grep stops after 100 matches; find stops after 200 files. A result says when the fixed limit was reached so the caller can narrow the search.
- Grep skips files larger than 4 MiB during directory traversal. Explicitly named files follow ripgrep's explicit-file behavior and can exceed that limit.
- Grep lines longer than 400 characters are clipped.
- A single match or path record larger than 8 MiB is skipped instead of being buffered, and the result says so. Explicitly named files bypass ripgrep's traversal size cap, so this is what keeps a search of a single-line bundle, sourcemap, or lockfile from ballooning memory.
- Search output also has a hard byte limit, and running searches are cancellable.
- Relative result paths can be passed directly to pi's
readandedittools. Paths containing control characters, backslashes, or quotes are JSON-quoted; decode the JSON string before using them. Newlines in filenames do not create extra find results. - Timeouts are marked as partial, including when no results were gathered. Unexpected process termination is an error, not a completed empty search.
For uncommon searches involving several roots, exclusions, multiline matching,
counts, sorting, or pipelines, use rg or fd through the shell rather than
expanding these tool schemas.
Hidden files and secrets
Default searches do not walk hidden paths. This reduces accidental exposure of
files such as .env, .npmrc, and private keys in model-visible tool output.
It is not a complete secret boundary: explicitly named files, ordinary tracked
files, read, and shell tools can still expose secrets. Strong secret isolation
must be enforced across every filesystem tool, not only grep.
Binaries
The extension first uses pi's managed ~/.pi/agent/bin/{rg,fd} binaries, then
checks PATH (fdfind is accepted on Debian/Ubuntu). It requires ripgrep >=
12.0 and fd >= 8.7.0. If either is unavailable, the tool returns a clear install
or upgrade message; it does not run a package manager.
Development
pnpm --filter @tian.zuo/pi-find run check
pnpm --filter @tian.zuo/pi-find test
pi -e ./packages/pi-find
The integration tests run real rg and fd searches when those binaries are available.