pi_spawn
Start a background Pi worker for a self-contained task and return its id at once. Use pi_wait or pi_digest to read compact results and judge them.
Instructions
Start a Pi worker in the background on a self-contained task and return its id at once. Workers always use the model the user set with pi_model (not selectable here). Give it a complete standalone brief (it has no access to this conversation). Use disjoint dirs or let worktree isolation separate parallel workers. Then use pi_wait / pi_digest to read compact results and judge them. Workers are long-lived RPC processes that keep their context: for a fix or a follow-up in the same area, pi_send an existing worker instead of spawning a new one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dir | No | Working directory (default: session cwd) | |
| task | Yes | Complete standalone instructions for the worker | |
| agent | No | Agent type (default general). general: unrestricted, short SUMMARY (the pre-agent-types behaviour); dev: implements changes: read, edit, write, shell; short SUMMARY of what changed. Worktree by default; explore: read-only investigator: finds and reads code, returns a long evidence-backed FINDINGS report (never summarized). No worktree; review: read-only reviewer: returns every issue found with file:line, severity and a fix (never summarized). No worktree | |
| title | No | Short label | |
| checks | No | Toolbox checks (pi_tools) the worker must run and pass after its last edit. Default: the toolbox entries marked required. [] = none for this task. The worker runs them itself with `check <name>`; serial ones never run twice at once. | |
| effort | No | Reasoning effort for this worker only (default: the pi_effort setting). Raise it for tasks that need real reasoning. | |
| expect | No | Paths (relative to dir) the task must change. If the worker finishes without changing one, the digest, status and wake-up message carry a warning. | |
| noDict | No | Skip the project-dictionary requirement for a dev/general worker (the first one in a project is refused until pi_dict has entries). | |
| verify | No | A shell command the PLUGIN runs itself in the worker's directory after the worker finishes (one at a time across workers, up to 10 min). Prefer toolbox checks (pi_tools), which the worker runs and fixes itself; use verify for a final gate the worker must not run. The result goes in the digest; a failure counts as a warning. | |
| worktree | No | Isolate in a new git worktree (default depends on agent type; dev and general: true when dir is a git repo, explore and review: false) | |
| fixRounds | No | With verify: how many times (0-3, default 0) a failing verify is sent back to the worker to fix automatically. | |
| maxMinutes | No | time limit for the run (default depends on agent type, 15-20). At 85% the worker is told to wrap up; at 100% it is asked for a partial report and gets 2 more minutes before it is stopped. pi_send can resume it. | |
| verifyTimeoutSec | No | Time limit for the verify command (default 300, max 600). |