@rolemodel/pi-chains
Dynamic Chain Extension — discovers .chain.json files and registers slash commands
Package details
Install @rolemodel/pi-chains from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@rolemodel/pi-chains- Package
@rolemodel/pi-chains- Version
0.0.1- Published
- Jun 26, 2026
- Downloads
- 424/mo · 13/wk
- Author
- rolemodel-it-support
- License
- MIT
- Types
- extension
- Size
- 7.3 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@rolemodel/chains — Dynamic Chain Extension
This extension discovers .chain.json files and registers a slash command for each one, so you can invoke a multi-step subagent pipeline as /<chain-name> <task> instead of /run-chain <chain-name> -- <task>. It is not a subagent tool — it has no chaining or subagent logic of its own. The actual subagent execution comes from the pi-subagents extension's chain mode. This extension is purely an alias layer: it reads chain files, translates them into a subagent({ chain: [...] }) call, and injects that into your session.
Requires
pi-subagentsinstalled and enabled. If the subagent tool is not available, chain commands will fail with "Invalid parameters" errors.
Table of Contents
Quick Start
# 1. Install the subagent extension (required dependency)
pi install npm:pi-subagents
# 2. Install this chains extension
pi install npm:@rolemodel/pi-chains
# 3. Create a chain directory and write your first chain
mkdir -p ~/.pi/agent/chains
cat > ~/.pi/agent/chains/my-review.chain.json << 'EOF'
{
"name": "my-review",
"description": "Review PR and suggest improvements",
"chain": [
{ "agent": "reviewer", "task": "Review changes: {task}" },
{ "agent": "worker", "task": "Suggest improvements: {previous}" }
]
}
EOF
Reload and use:
/reload
/my-review Add input validation to the auth endpoint
Chain File Format
This follows the format from pi-subagents. It requires the JSON format. Any chains with the markdown syntax will not be registered.
Configuration
Chain Directories
The extension searches chain directories in this order:
| Priority | Location | Scope |
|---|---|---|
| 1 | ~/.pi/agent/chains/ |
Global (all projects) |
| 2 | .pi/agent/chains/ (relative to cwd) |
Project-local (only if it exists) |
Chains are discovered at extension startup and on /reload.