How each harness starts and configures subagents, what they can see and change, which lifecycle hooks run, and how their transcripts are saved and read.
Worktrees: creation, setup, integration and cleanup
Starting one
| Question | pichecked at 1.2.0 |
|---|---|
| Is there one, and how does it start | Not supported pi deliberately ships without subagents: its README says to build them yourself or install a package. The repo includes an example Third-party packages in the pi package gallery (https://pi.dev/packages) add subagents too, for example |
| Built-in subagents | Not supported pi has no built-in subagent types. The example extension comes with four sample agent files you can install: |
| Define your own | Not supported Core pi has no agent definition format. With the example extension, an agent is a Markdown file with YAML frontmatter in Agent files are re-read on every call, so you can edit them mid-session. |
| What a definition can set | Not supported In the example extension, a definition sets only |
While it runs
| Question | pichecked at 1.2.0 |
|---|---|
| What it sees, and what comes back | Not supported In the example extension, each subagent is a separate |
| Several at once | |
| Keep working while it runs | Not supported No. The example Gallery packages such as |
| Your checkout or its own copy | Not supported There is no isolation. The example extension runs each subagent process directly in the parent's working directory, or in a per-task |
| Its permissions | Not supported pi has no approval prompts or sandbox. Tools run with your OS user's permissions, and subagent processes are no different. A definition can only narrow the tool list ( For real containment, run all of pi inside a container or sandbox (see docs/containerization.md), or add the example |
| Subagents of subagents | Not supported The example extension has no depth limit or recursion guard. Each subagent is a full |
Watching and handing off
| Question | pichecked at 1.2.0 |
|---|---|
| Watch, steer or stop one | Not supported With the example extension, the tool row streams each subagent's live status, recent tool calls and token/cost usage.
|
| Hand work to a cloud agent | Not supported pi has no cloud or remote agent handoff. The closest options are running the whole |
Notes and sources
pi, 11 sources
Your checkout or its own copy, 1
Hand work to a cloud agent, 2
Subagent lifecycle hooks
Recorded start and stop events, with their control semantics and availability caveats. A dash means no event is recorded here. General session or tool events do not establish a dedicated subagent hook.
Which moments a hook can attach to, and what it can do there. Event names link to each harness’s documentation. “Block”, “deny” and “modify” change what the agent does; “observe only” can watch but not intervene. Where hook files live is on the Locations page.
| Moment | piExtension event handlers |
|---|---|
| Hook types | Extension event handlers |
Notes and sources
pi
- In-process TypeScript extension events, run in extension load order; extensions run with full user permissions.
- pi's documentation names its extension type definitions as the event reference.
- Project extensions load only after the project is trusted.
- pi 1.2.0 extension event overloads, Source code, checked 2026-10-14
Subagent transcripts
Child storage and parent links are described separately from the harness’s general session format. Internal and source-observed formats can change between versions; these records do not promise a stable external schema.
| Question | pidocumented-public; checked at 1.5.2 |
|---|---|
| Child transcripts and parent links | Partly Pi has no built-in subagents. Third-party subagent extensions can save child sessions any way they like. |
| Session file format | JSONL: the first line is a New entry types still appear (for example |
| What is recorded | Version-3 JSONL stores a session header and a parentId tree of message, model/thinking changes, usage, compaction, branch summary, custom/custom_message, context_edit, label and session_info entries. Assistant content supports text, thinking, images and toolCall; toolResult messages match toolCallId. System messages record prompt/tool deltas. Optional cost.totalFromProvider distinguishes provider-billed totals from estimates, while context edits change replay without erasing original display/history entries. In 1.6.0, when showCacheMissNotices is enabled, the transcript displays the reasons OpenAI dropped reasoning items after compaction if the dropped count increased over the previous response. The system prompt and tool list are saved too: the first request writes a full system message, and later changes are saved as deltas. Compaction and context edits never delete the original entries; the file keeps the full history. |
| Read transcripts from code | The SDK ( You can also parse the JSONL files directly; |
| Session record structure | pi |
|---|---|
| Envelope fields | type, id, parentId, timestamp |
| Record discriminator | type |
| Identifiers and lineage | session header id (UUIDv7 by default, or custom via --session-id), entry id (8-char hex), parentId, parentSession (header, path of source session for /fork, /clone), targetId (label, context_edit), fromId (branch_summary), firstKeptEntryId (compaction), message.toolCallId |
| Ordering | append order in file; conversation structure is an id/parentId tree with the active leaf selecting the branch |
Notes and sources
pi, 13 sources
- 2026-11-15 source refresh: v1.5.2 at b4afdddf44e059c67ccf5097e5317d913521b470. Source inspection, not a harness runtime probe. Historical supplements keep their independent evidence and dates.