Batch file reads for Pi via a single tool: read_many.
It helps the model inspect multiple files in one call instead of issuing many separate read calls.
pi install npm:pi-read-manypi install git:https://github.com/Gurpartap/pi-read-manyAfter install, use Pi normally. If Pi is already running when you install or update, run:
/reload
read_manydoes not override built-inread.read_manysummarizes image attachments in combined text output; exact single-file image payload behavior remains in built-inread.
- Reads files sequentially in request order.
- Uses Pi's built-in
readunder the hood (same core semantics). - Returns one combined text response using per-file heredoc blocks.
- Continues on per-file errors by default (
stopOnError: false). - Applies combined output budgeting with block-safe packing.
- Exposes packing decisions in
details.packing.
- Adaptive packing: starts with strict request-order full-block packing.
- Strategy switch: uses smallest-first only if it increases complete successful-file coverage.
- Stable output order: rendered sections still follow original request order.
- Partial inclusion: includes at most one partial section when needed.
- Error consistency: errors are framed exactly like normal file blocks.
- Image-safe output: image payloads are summarized in text.
{
"files": [
{ "path": "src/a.ts" },
{ "path": "src/b.ts", "offset": 40, "limit": 120 }
],
"stopOnError": false
}Each included file is returned in this framed block format:
@path/to/file
<<'WORD_INDEX_HASH'
...file content...
WORD_INDEX_HASHWORD: fixed readable dictionary wordINDEX: 1-based file index in requestHASH: deterministic short hash of file path
read_many allows up to 26 files, with a 26-word dictionary (unique starting letter per word), so each file gets a unique dictionary token.
If a delimiter collides with a content line, the tool auto-suffixes (_1, _2, β¦) and keeps trying deterministic fallbacks until it finds a safe delimiter.
| Field | Meaning |
|---|---|
strategy |
Chosen packing strategy (request-order or smallest-first) |
switchedForCoverage |
Whether strategy switched to improve successful full-file coverage |
fullIncludedCount |
Number of fully included blocks |
fullIncludedSuccessCount |
Number of fully included successful blocks |
partialIncludedPath |
Path of partially included block (if any) |
omittedPaths |
Paths omitted due to budget limits |
npm install
npm run typecheck
npm testTests are unit-level and do not launch Pi directly.
For local one-off development loading:
pi -e ./read-many.tsMIT Β© 2026 Gurpartap Singh