@xzzpig/pi-subagents

extensionmaintained

Pi extension for single-agent delegation and scripted multi-agent workflows

by — · v0.16.0 · published 4d ago

$ pi install npm:@xzzpig/pi-subagents
downloads/mo
0
stars
3.8K
last push
2d ago
open issues
12

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

No downloads in the last 12 weeks.

README

pi-subagents

pi-subagents

pi-subagents lets Pi delegate work to focused child agents. Use it for code review, scouting, implementation, parallel audits, saved workflows, background jobs, and anything else that benefits from a second or third set of model eyes.

https://github.com/user-attachments/assets/702554ec-faaf-4635-80aa-fb5d6e292fd1

Install

pi install npm:@xzzpig/pi-subagents

That is the only required step. Background children use the host's SDK: npm Pi keeps its detached Node runner; the official Pi 0.85.1 Linux x64 standalone release loads the same runner through Pi's embedded SDK, without a separate SDK install. See Standalone background execution for the supported boundary and validation gate.

Try this first

You do not need to create agents, write config, or learn slash commands. After installing, ask Pi in plain language:

Use reviewer to review this diff.
Ask oracle for a second opinion on my current plan. Challenge assumptions and tell me what I might be missing.
Use scout to understand this code based on our discussion, then ask me clarification questions.
Run parallel reviewers: one for correctness, one for tests, and one for unnecessary complexity.

That is enough to start. Pi decides whether to call the subagent tool, which agent to use, and how to compose the work.

How it works

Pi is the parent session. A subagent is a focused child Pi session with its own job.

When you ask for a subagent, Pi starts the child, gives it the task, and brings the result back. Foreground children run as sessions inside the parent Pi process and stream in the conversation. Background children run as sessions inside a detached runner process that keeps working and can be checked later.

Installing the extension does not start an automatic reviewer in the background. It gives Pi a delegation tool. If you want every implementation reviewed, say so in your prompt or project instructions:

When you finish implementing, run a reviewer subagent before summarizing.

Pre-declaring agents in context (context injection)

By default Pi discovers agents by calling subagent({ action: "list" }). You can pre-declare selected agents in the parent system prompt so routing happens without that round trip: set injectToContext: true in an agent's frontmatter, or list names under subagents.injectAgents in settings. The union is injected once per session as a compact block — byte-stable across turns, so prompt caching stays effective. Disabled and capability-restricted agents are never advertised; unknown setting names are ignored and reported by /subagents-doctor. See docs/fork-extensions.md.

Builtin agents

The extension ships with agents you can use immediately:

AgentUse it when you want...
scoutFast local codebase recon: relevant files, entry points, data flow, risks.
researcherWeb/docs research with sources and a concise research brief. Requires pi-web-access in the child.
evidence-auditorIndependently checks whether important research claims are supported by their sources. Requires pi-web-access in the child.
workerImplementation work. Edits files, validates, escalates unapproved decisions instead of guessing.
reviewerCode review and small fixes against the task/plan, tests, edge cases, and simplicity.
oracleA second opinion before acting. Challenges assumptions without editing.
delegateA lightweight general delegate that behaves close to the parent session.

Rule of thumb: scout before you understand the code, researcher before you trust external facts, evidence-auditor before you rely on important research, worker to implement, reviewer to check, and oracle when the decision itself feels risky.

Common workflows

The package includes /council and council-mode, plus documented model-based council-* profile examples that you add in your own agent directory.

WantAsk naturally
Get a second opinion"Ask oracle to review this plan and challenge assumptions."
Solve a hard problem"Use oracle to investigate this bug before we edit."
Review a diff"Use reviewer to review this diff."
Run parallel reviewers"Run reviewers for correctness, tests, and cleanup."
Debate a material decision"Use /council with model-based advisors to compare this decision."
Implement then review"Implement this, then review it."
Review until clean"Run a review loop on this change with a max of 3 rounds."
Execute a plan carefully"Have worker implement this approved plan, then run reviewers and apply the feedback."
Scout before planning"Use scout to inspect the auth flow before planning."
Run in the background"Run this in the background."
Use a saved workflow"Run the review chain on this branch."
Browse agents"Show me the available subagents."
See running work"Show active async runs." or "Show the subagent fleet."
Check setup"Check whether subagents are configured correctly."

For implementation work, the recommended loop is clarify → scout → worker → fresh reviewers → worker. Packaged prompt shortcuts like /parallel-review and /review-loop make these patterns repeatable — see Workflows.

Where running work shows up

Foreground runs stream progress in the conversation. Background runs keep working after control returns to you.

In the TUI, a persistent FleetView below the editor keeps active work visible. /subagents-fleet opens a live inspector where you can browse children, read transcripts, steer a running child, or stop a run. You can also just ask: "Show me the current async runs."

Details, keybindings, and the machine-readable run artifacts are in Observability.

For bounded orchestration, maxSubagentSpawnsPerRun limits cumulative logical children in one run tree. It defaults to 64 and stays separate from active concurrency and the session-wide cumulative spawn budget. See Configuration.

If something feels off

/subagents-doctor

or ask: "Check whether subagents and intercom are set up correctly."

For installed-version help, use /subagents-guide [topic] or subagent({ action: "guide", topic: "workflows" }). The default topic is overview; available topics are overview, workflows, agents, missions, observability, tool-reference, configuration, models, watchdog, and extension-api.

Documentation

The full reference lives in docs/:

DocWhat's in it
AgentsCustom agents, frontmatter reference, overriding builtins, tools, extensions, skills, per-agent memory.
ModelsSingle-model selection and launch, defaults, per-role overrides, recommended tiering, thinking levels, model scope enforcement, profiles.
WorkflowsOrchestration patterns, prompt shortcuts, scripted workflows, worktree isolation, child-to-parent coordination, the recursion guard.
WatchdogThe opt-in adversarial change reviewer, scope monitoring, LSP checks, and child tool permissions.
Tool referenceEvery subagent parameter, management actions, status/control actions, acceptance gates, external CLI runners.
ObservabilityFleetView, the fleet inspector, lifecycle artifacts, events, logs, session sharing.
Missions and schedulesDurable mission records, delivery receipts, timed and recurring runs.
ConfigurationEvery config.json key and environment variable.
Extension APIThe RPC, delegation API, preflight, capability ceilings, trusted workflow resources, background-work providers, Herdr integration.