Pi Agent Package Management
Pi Packages let you bundle Extensions, Skills, prompt templates, and themes for distribution and installation via npm or git.
Package management commands
All package operations are done via the pi command; no manual editing of settings.json needed.
| Command | Function | Example |
|---|---|---|
| pi install |
Install a package; the -l parameter installs at the project level | pi install npm:@runoob/pi-todo-kit |
| pi remove |
Remove a package | pi remove npm:@runoob/pi-todo-kit |
| pi uninstall |
Same as remove | pi uninstall npm:@runoob/pi-todo-kit |
| pi list | List installed packages | pi list |
| pi update --all | Update Pi Agent and all packages | pi update --all |
| pi update --extensions | Update only installed packages (not Pi Agent itself) | pi update --extensions |
| pi update |
Update a specified package | pi update npm:@runoob/pi-todo-kit |
Usage example:
# Install npm package
$ pi install npm:@runoob/pi-todo-kit@1.0.0
# Install git package
$ pi install git:github.com/runoob/pi-todo-kit@v1
# Install local package
$ pi install ./packages/pi-todo-kit
$ pi install ~/projects/pi-share-kit
# Install as project-level (write to .pi/settings.json)
$ pi install -l npm:@runoob/pi-todo-kit
# Temporary trial package (not installed in configuration)
$ pi -e npm:@runoob/pi-todo-kit
$ pi -e git:github.com/runoob/pi-todo-kit
Installation output looks roughly like this (illustrative); the number of extensions and skills depends on the package's pi field:
$ pi install npm:@runoob/pi-todo-kit
Resolving @runoob/pi-todo-kit@1.2.0
Downloading @runoob/pi-todo-kit (12.4 kB)
Running npm install in ~/.pi/agent/npm/@runoob/pi-todo-kit
Installed @runoob/pi-todo-kit@1.2.0
extensions: 2
skills: 1
prompts: 3
Saved to ~/.pi/agent/settings.json
The package names and versions above are illustrative; replace them with the package you want to install.
Package sources
Pi Agent supports three package sources, each with different installation behavior and cache locations.
npm packages
npm is the recommended way to distribute packages:
pi install npm:@scope/pkg@1.2.3
pi install npm:pkg
npm packages with version numbers are locked and pi update won't upgrade them automatically.
Package installation locations: global at ~/.pi/agent/npm/, project-level at .pi/npm/.
Git packages
Supports HTTPS and SSH protocols:
# HTTPS
pi install https://github.com/user/repo@v1
# SSH (git@host:path requires git: prefix)
pi install git:git@github.com:user/repo@v1
# SSH 协议
pi install ssh://git@github.com/user/repo@v1
A Git package's ref is locked and pi update won't automatically move to a new ref.
Clone locations: global at ~/.pi/agent/git/, project-level at .pi/git/.
Local paths
Points to a local filesystem path; files are not copied:
pi install /Users/runoob/.pi/agent/packages/my-kit
pi install ./packages/my-kit
Create a Pi package
Add a pi field in package.json:
Example
{
"name": "@runoob/pi-todo-kit",
"keywords": ["pi-package"],
"pi": {
"extensions": ["./extensions"],
"skills": ["./skills"],
"prompts": ["./prompts"],
"themes": ["./themes"],
"video": "https://example.com/demo.mp4",
"image": "https://example.com/screenshot.png"
}
}
If there's no pi field, Pi Agent automatically discovers resources from conventional directories:
| Conventional directory | Loading Content |
|---|---|
| extensions/ | Load .ts and .js files within |
| skills/ | Recursively find folders containing SKILL.md, and load top-level .md files as standalone Skills |
| prompts/ | Load .md template files within |
| themes/ | Load .json theme files within |
add pi-package Keywords can make your package appear in the Pi Agent package gallery it.
The video and image fields are used to show previews in the gallery.
Package filtering
When installing a package, you can precisely control which resources are loaded to avoid bringing in everything at once.
Write the packages array below into ~/.pi/agent/settings.json (global effect) or .pi/settings.json (current project only).
Packages installed with pi install -l are written to the project's .pi/settings.json; both approaches ultimately land in the same configuration.
Array entries support two forms: a string form loads all resources of the package, while an object form filters by resource type item by item.
Example
{
"packages": [
"npm:simple-pkg",
{
"source": "npm:@runoob/pi-todo-kit",
"extensions": ["extensions/*.ts", "!extensions/legacy.ts"],
"skills": ["skills/brave-search"],
"prompts": [],
"themes": ["+themes/legacy.json"]
}
]
}
In the official docs, skills filtering can be written by in-package path or by skill name; in practice, follow the installed package's instructions.
Filtering rules are as follows:
| Syntax | Meaning | Example |
|---|---|---|
| Omit a key | Load all resources of that type | Not writing the skills key = load all Skills |
| Set to [] | Load no resources of that type | "prompts": [] |
| !pattern | Exclude matching resources | "!extensions/legacy.ts" |
| +path | Force-include specified paths | "+themes/legacy.json" |
| -path | Force-exclude specified paths | "-skills/internal" |
Dependency Management
Pi Agent runs npm install for each installed npm/git package, automatically installing dependencies.
Local dependencies distributed with the package can be bundled with bundledDependencies.
The following core packages are provided by Pi Agent itself and should be listed as peerDependencies, not bundled again in your package:
| Package name | Description |
|---|---|
| @earendil-works/pi-ai | AI tools and types |
| @earendil-works/pi-agent-core | Agent core |
| @earendil-works/pi-coding-agent | Pi Agent main package |
| @earendil-works/pi-tui | TUI components |
| typebox | Argument schema definitions |
pi config manages resources
Use pi config to interactively enable or disable extensions, Skills, templates, and themes of installed packages:
# Edit global configuration
$ pi config
# Edit project configuration
$ pi config -l
The Tab key switches between global and project modes.
Scope and deduplication
The same package can appear in both global and project configurations.
If a project entry exists, it takes priority over the global entry.
The exception is when a project entry sets autoload: false; instead of overriding entirely, it's applied incrementally on top of the global entry.
A package's identity is determined as follows, and Pi Agent uses this to judge whether two configurations point to the same package:
| Source | Identity marker |
|---|---|
| npm packages | Package name (e.g. @runoob/pi-todo-kit) |
| git package | Repository URL (excluding ref) |
| Local paths | Resolved absolute path |