---
name: pi-subagents
description: "Delegate one complete assignment to a native Pi child; inspect, continue, or stop saved child runs. Use for Pi delegation, not profile administration or non-Pi agents."
---

# Pi delegation

Use the eager `delegate` and `agent_runs` tools. There is one agent type and no
profile discovery, loader, role body, chain DSL, or nested delegation.

## Assignment

```js
delegate({
  prompt: "Complete assignment with constraints and expected output",
  name: "short-name",
  thinking: "low",
});
```

Supply the complete prompt: relevant original requirements, settled decisions or
readable references, scope and files, authority and non-goals, verification venue,
expected result, and stop boundary. Do not rely on a hidden profile to add them.

Fresh context is default; `context:"fork"` preserves the native conversation,
including prior tool results. A forked child still cannot delegate. Optional
`cwd`, `model`, and `thinking` are explicit launch overrides; do not change global
auth/model settings to implement an override. `thinking` accepts `off`, `minimal`,
`low`, `medium`, `high`, `xhigh`, or `max`. Omit it to inherit the parent's effort.
When `/overseer` mode is active, always supply `contract`; `contract.scope`
accepts relative literal path prefixes (`src`, `src/foo.ts`), POSIX globs
(`src/**`, `test/**/*.test.ts`, `packages/*/src/**`, `{src,test}/**`, `*.ts`),
`["*"]` for any path inside `cwd`, or `[]` for read-only work. Static leading
directory prefixes must exist inside `cwd` at launch. Runs with a `contract`
also receive a private per-run scratch directory outside the repo (shown in the
child's delegation contract and `PI_SUBAGENT_SCRATCH_DIR`) where edit tools are
allowed for temporary scripts and notes, even under `scope: []`. Omitted `model` and
`thinking` follow normal `delegate` inheritance unless `/overseer-worker`
(or `subagents.overseer.worker`) configures a default worker.
Pi clamps the child's effort to its model capabilities without changing the parent.
`model:"provider/model:thinking"` uses Pi's native suffix resolver when the host
exports it; a literal model ID wins before suffix parsing. Without that host API,
use `thinking` with an omitted model or literal ID. If both the field and a native
suffix supply effort, they must match. Never retry another model silently.

Every launch, continuation and guidance call returns a receipt; no tool waits for
child completion. Continue useful independent work; when child evidence gates the
next step, end the turn and let the completion notice resume you rather than
polling `inspect`. A launch receipt is not completion. Review actual outputs and
validation evidence before accepting the result.

Keep the main session running for completion delivery. A one-shot print
invocation exits after its final turn and stops any remaining children.

## Controls

- `agent_runs({action:"list"})` discovers this native main's saved runs: one
  line per run, running first, then newest first.
- `inspect` reads a run by ID and states every field of it; follow returned
  offsets for complete output.
- A run stays `running` while its child waits on its own background work; `list`
  and `inspect` show what it waits on, and `stop` cancels that work.
- `continue` takes a complete follow-up `prompt` and keeps the saved child chat.
  Active work receives guidance; completed work gets an immutable successor.
  Both keep the child's saved effort, independent of later parent changes. Pass
  optional `contract` to amend `scope`, `verification`, `baseBranch`,
  `requiredPrimitives`, or `nonGoals` in place (omitted fields keep their
  current values; empty `[]`/`""` clears optional fields; invalid scopes fail
  fast). Live, paused, and successor runs apply the amended contract immediately
  and `inspect` records the amendment history.
- `stop` requests termination. Inspect actual process evidence; request acceptance
  does not prove actor or command exit.
- `review` with `verdict:"approved"` records the diff and check evidence in
  `summary` without sending it to the child. Approval releases a pause or
  satisfies the completion review. On a running or paused child, pass optional
  `note` with `verdict:"approved"` to record the approval and queue a short
  steering note for the child in one call (while keeping `summary` review-only;
  `note` is rejected on settled runs or other actions/verdicts). To send a
  correction, use `continue` or `review` with `verdict:"changes_requested"` and
  the instructions as `summary` (optionally with `contract` to amend the contract
  in the same step). When an owned child asks a scope or contract question over
  `intercom`, reply with `intercom({action:"reply", ..., contract:{...}})` to
  persist the amended contract atomically before the reply wakes the child.

Use IDs returned by the tools. Runs belong to their native main session, not a
cwd, project, name, or forked copy of its transcript. Resume the same main for
ownership. Do not delete ambiguous launch state to force another attempt.

Escape aborts the parent's reply, not already-launched children; `stop` ends one
run. Children terminate when their parent exits. Resume the same parent and explicitly
continue a saved child conversation; the child inspects the interrupted work
rather than automatically replaying tool calls. Ordinary `/reload` is not exit.
Under a fork launcher that provides `ctx.managedHost`, `pi restart` or `/restart`
is not exit either: children keep running and report to the ready replacement.
That needs one full CLI relaunch after upgrading; a worker under an older loaded
launcher still stops children when it exits.

## Coordination and delivery

All pairs inside a main/children group can use `intercom` list/send/last. Across
groups, mains alone can communicate. Children cannot see or address foreign
groups, and cannot spawn children. `last` reads original completed assistant text
without waking a peer; it is not a completion notification or replacement for
run inspection.

Keep writers isolated and integration parent-owned. Prefer bounded independent
review with a fresh complete brief. Retain native SDK/journal/process boundary
proof; a child-reported pass is evidence to inspect, not automatic sign-off.

Normal child completion returns through the run, not a redundant intercom
message. Use direct `send` for guidance, corrections, or blockers that affect live
work. Ordinary `ask` is bounded request/reply, not durable supervisor revival.
The [pi-intercom skill](../pi-intercom/SKILL.md) covers messaging operations.
See [tools and lifecycle](../../docs/reference.md) for the owning contracts.
