pi-auto-inject1.0.1
Pi extension that injects @-referenced files and AGENTS.md references into model context.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-auto-inject
Type @path in a Pi prompt. File contents reach the model without a model-initiated read call.
Try it
- Install:
pi install npm:pi-auto-inject - Start Pi in your project:
pi - Send:
Summarize @README.md
Your prompt keeps @README.md. The contents appear in a separate, read-like message, collapsed to three lines until expanded. This is a custom message, not a real read tool call.
Choose what to include
@src/index.ts— entire UTF-8 file.@src/index.ts:9— line 9 only (lines start at 1).@src/index.ts:9-13— lines 9 through 13, inclusive.@"notes/meeting notes.md":9— quote paths with spaces; ranges still work.@src— names of regular files directly insidesrc, not their contents. Skips subdirectories and symlinks.
Prompt paths resolve from Pi's working directory. Absolute paths and ~/ paths also work.
Markdown and AGENTS.md
- A referenced
.mdfile can contain@references. Those paths resolve relative to that Markdown file. - Pi's automatically loaded
AGENTS.mdandAGENTS.override.mdfiles expand their@references once per session, on the first prompt after they load. Paths resolve relative to each context file. Later prompts do not auto-inject them again; resumed sessions keep their earlier injection. The extension uses Pi's loaded text; it does not reread those context files. - Expansion stops after one level: references inside additionally included files are not followed. With a line range, only selected Markdown lines are scanned.
- Duplicate references from the first prompt and loaded context files inject only once.
- Queued steering and follow-ups keep their
@references; only references typed in the queued prompt are injected when it runs.
Limits and privacy
- Each request has a shared 256 KiB limit for file contents, selected lines, Markdown references, and directory listings.
- Missing, binary, oversized, or invalid references produce error markers rather than partial contents. Images are unsupported. Empty directories and line ranges on directories also produce errors.
- Referenced contents can include secrets, including files linked from Markdown or AGENTS files. Directory filenames also go to the model. Do not reference private files you do not want sent.
Develop locally
pnpm install
pnpm test
pnpm dev
pnpm dev loads the extension only in that Pi process. To install this checkout persistently, run pi install ./.