Subagent extension for pi — delegate well-scoped subtasks to specialized agents running in isolated pi processes.
Spawns a separate pi process per invocation so the child has its own context
window. Supports three call modes:
- single —
{ agent, task } - parallel —
{ tasks: [{agent, task}, ...] }(max 8, up to 4 concurrent) - chain —
{ chain: [{agent, task}, ...] }with{previous}substituted into each step's task
Available agents are discovered from:
~/.pi/agent/agents/*.md(user scope, default)<repo>/.pi/agents/*.md(project scope, opt-in viaagentScope: "both")
Each agent is a Markdown file with YAML frontmatter (name, description,
optional tools, model) plus a body used as the agent's system prompt.
pi install ~/repos/pi-subagentFor project-local install:
pi install -l ~/repos/pi-subagentAfter installing, reload pi resources with /reload (or restart pi).
npm install
npm run typecheckThis repo is a pi package via package.json:
pi.extensions:./src/index.ts
Entrypoint:
src/index.ts— tool registration, process spawning, renderingsrc/agents.ts— agent discovery (user + project scopes)