pi-auto-context-files

Auto-inject AGENTS.md and CLAUDE.md context files into pi read tool results

Packages

Package details

extension

Install pi-auto-context-files from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-auto-context-files
Package
pi-auto-context-files
Version
1.0.0
Published
May 13, 2026
Downloads
18/mo · 18/wk
Author
victorhsb
License
MIT
Types
extension
Size
10.4 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions/**/*.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-auto-context-files

A pi extension that automatically discovers and injects AGENTS.md and CLAUDE.md context files into read tool results.

How it works

When the agent reads any file, this extension walks up the directory tree from that file's location looking for AGENTS.md or CLAUDE.md files, and prepends them to the read tool result. The model sees the local instructions before the file contents it requested.

Walking stops at the git repository root (or your working directory if not inside a git repo).

Context files are injected once per session — deduplicated to avoid cluttering the context window with the same instructions repeatedly.

Installation

pi install npm:pi-auto-context-files

Configuration

No configuration needed. The extension automatically activates when pi starts.

Commands

  • /auto-context — Show extension status (discovered, injected, and pending context files)

Details

The extension searches for context files in this order (closest file wins):

  1. CLAUDE.md
  2. AGENTS.md

If multiple context files exist at different directory levels (e.g., one at the repo root and another in a subdirectory), all are collected with closer files taking precedence.

Changelog

1.0.0

  • Initial release