Automatically load AGENTS context (AGENTS.override.md or AGENTS.md) from subdirectories in pi coding agent.
When you read a file in a subdirectory (e.g., src/components/Button.tsx), this extension automatically discovers and injects AGENTS context files in the path hierarchy. AGENTS.override.md is treated as AGENTS.md and wins when both exist in the same directory, so you get relevant local context without manual loading.
pi install npm:pi-subdir-contextOr try it temporarily:
pi -e npm:pi-subdir-context- When you use the
readtool, the extension checks the file's directory path - It walks up the tree looking for AGENTS context files (
AGENTS.override.mdfirst, thenAGENTS.md) - Found files are loaded in order (closest to root first)
- Content is injected into the tool result as additional context
- Already-loaded files are deduplicated per session
Project structure:
my-project/
├── AGENTS.md # project-wide rules
├── src/
│ ├── AGENTS.override.md # src-specific override
│ └── components/
│ ├── AGENTS.md # component-specific rules
│ └── Button.tsx
When you read src/components/Button.tsx, the extension automatically loads subdirectory context (the root AGENTS context is already loaded by pi):
src/AGENTS.override.md(override beatssrc/AGENTS.md)src/components/AGENTS.md(component-specific — closest to file)
- Context loading stops at the project root (current working directory)
- Files outside the project or home directory are ignored
- Files are loaded once per session and deduplicated
MIT