pi-subdir-context
Automatically load AGENTS.md context from subdirectories in pi coding agent
Package details
Install pi-subdir-context from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-subdir-context- Package
pi-subdir-context- Version
1.1.6- Published
- Apr 30, 2026
- Downloads
- 1,455/mo · 452/wk
- Author
- akuzmenko
- License
- MIT
- Types
- extension
- Size
- 11.9 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-subdir-context
Automatically load AGENTS or CLAUDE context (AGENTS.override.md, AGENTS.md, or CLAUDE.md) from subdirectories in pi coding agent.
What it does
When you read a file in a subdirectory (e.g., src/components/Button.tsx), this extension automatically discovers and injects 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.
Installation
pi install npm:pi-subdir-context
Or try it temporarily:
pi -e npm:pi-subdir-context
How it works
- When you use the
readtool, the extension checks the file's directory path - It walks up the tree looking for context files (
AGENTS.override.md,AGENTS.md, orCLAUDE.md) - Found files are loaded in order (closest to file first)
- Content is injected into the tool result as additional context
- Already-loaded files are deduplicated per session
Example
Project structure:
my-project/
├── AGENTS.md # project-wide rules
├── src/
│ ├── AGENTS.override.md # src-specific override
│ └── components/
│ ├── CLAUDE.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/CLAUDE.md(component-specific — closest to file)
Scope
- 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
License
MIT