omp packages

pi-subdir-context1.1.7

Automatically load AGENTS.md context from subdirectories in pi coding agent

GitHub Actions Published 5 months ago MIT ~5.5K downloads/mo

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.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

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

  1. When you use the read tool, the extension checks the file's directory path
  2. It walks up the tree looking for context files (AGENTS.override.md, AGENTS.md, or CLAUDE.md)
  3. Found files are loaded in order (closest to file first)
  4. Content is injected into the tool result as additional context
  5. 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):

  1. src/AGENTS.override.md (override beats src/AGENTS.md)
  2. 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