← Catalog

@henryqw/pi-add-dir

Add external directories to a Pi session with context, skills, and file search.

Skill

Install

Install with PiG

pig install npm:@henryqw/pi-add-dir

Install with Pi

pi install npm:@henryqw/pi-add-dir
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "image": "https://raw.githubusercontent.com/HenryQW/pi-harness/main/extensions/pi-add-dir/example.png",
  "extensions": [
    "./extensions/add-dir.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 3.4.1 (README.md). PiG does not review it.

@henryqw/pi-add-dir

Use external context, external skills, and searchable files in Pi without copying or linking external directories.

Pi using added external directories by name

Install

pi install npm:@henryqw/pi-add-dir

Use

Type /dir-add to see described scope flags: --project saves a directory for the repository, and --global saves it for every workspace. Completion does not suggest paths.

Run /dir-add, enter a directory, then run /dir-ls to verify it. Humans use commands; agents use tools.

SurfaceTypePurpose
/dir-add [--project|--global] [path]commandAdd to this session by default. Use --project for this repository and linked worktrees, or --global for every workspace. Omit the path for interactive input. Supports ~.
/dir-lscommandList directories and scopes; select one to remove it from that scope.
/dir-reloadcommandReload external directory resources.
add_directory(path)toolAdd session-only context and return instructions. Model-only: scripts and other tools cannot call it.
search_external_files(pattern, maxResults?)toolSearch added directories with a glob. Default: 50 results; maximum: 1,000. Codemode receives structured results.
@ file autocompleteuiFind external files and insert absolute paths.
External directory widgetuiShow directories; use /dir-ls to manage them.

Pi adds root AGENTS.md, CLAUDE.md, .pi/AGENTS.md, and .pi/CLAUDE.md to later prompts. External skills come from .pi/skills, .agents/skills, and .claude/skills.

/dir-add reloads only when discovered external skill paths change, not merely because skills exist. Directory commands wait until the agent is idle before they reload. If add_directory asks for /reload, run it to update skills.

Child repository context

From a parent directory, run /dir-add first repo or call add_directory with path: "first repo". The path is relative to the session directory. Absolute paths also work.

Session-only additions can load an explicitly selected child directory. Pi does not scan or load child repositories automatically. Only add directories whose instructions and skills you trust. This does not change the session directory or select a project for CodeGraph or other tools.

Project and global additions still reject child directories that overlap the session directory. These persistent overlap protections also apply when you promote a session addition.

Search results

In search_external_files results, truncated: true means more matches may exist.

Config

Package-owned: ~/.pi/agent/config/pi-add-dir/config.json

NameDescriptionValuesDefault
directoriesDirectories for every workspace. /dir-add --global updates this list.Array of unique absolute paths without control characters.[]

Pi skips invalid or duplicate entries and loads the valid directories. Global additions and removals fail until you fix reported config problems. Reload Pi after manual edits. For the shared rules, see Config files.

State and storage

Session directories belong to the current session branch. New session additions accept child directories but reject the session directory itself, its ancestors, and overlaps with active external directories. Restored session entries do not repeat overlap checks when the working directory changes.

Project directories use repeatable local Git config key pi-add-dir.directory, shared by linked worktrees. This machine-local config cannot come from a clone. /dir-add --project requires a Git repository.

Select persistent scopes explicitly: external directories can inject AGENTS.md, CLAUDE.md, and skills.

Limits and recovery

Search uses Node and supports basename and relative-path globs. It skips .git, node_modules, and symbolic links.

Missing or overlapping project and global directories stay configured but are skipped with warnings. Restore missing paths, or remove an incorrect path with /dir-ls and add the corrected path with /dir-add; then run /dir-reload.