I wanted delegation in Pi to be something I could inspect and steer, not a handoff that disappeared into a status label. When requirements change, I want to return to the same specialist and see the work in progress. For interactive children, I also want the artifact-backed result to be recoverable after a parent continuity transition.

That is the engineering problem behind pi-subagentura, an open-source extension for the Pi coding agent. It supports lightweight in-process jobs, reusable workflows, and interactive children that run as separate Pi sessions in tmux, Zellij, or Herdr. The interactive path is designed for work that benefits from visibility and follow-up.

A child session is a place you can return to

An interactive child is a real Pi process with its own conversation. The parent can check its status, inspect recent activity and saved output, send a follow-up, or focus or attach to the multiplexer pane. When the task changes, continuing the existing conversation preserves the specialist's working context instead of turning every update into a fresh assignment.

I wanted the session and control surface to be useful with the prompts people already have. People choose how much to coordinate directly and whether to enable Orchestratorv2 routing. The recorded walkthrough shows parent and child sessions and how their work can be inspected.

Make events carry identity, not just timestamps

Interactive children write protocol-v2 lifecycle records to an append-only NDJSON artifact log. A turn has a Pi-derived turnId; each record has an eventId. The parent advances a byte cursor over complete lines, so physical file order determines which event comes next. Timestamps remain useful for display and latency, but they cannot reorder events or decide which output belongs to a turn.

That distinction matters when processes are delayed or clocks disagree. A completion record points to an immutable snapshot under outputs/<eventId>.md, captured before the completion event is appended. The mutable output.md file is only staging for the active turn; it is not historical proof of a finished result. Snapshot writers enforce a byte limit before reading child-controlled output, and record explicit error metadata if a snapshot cannot be saved.

The event and snapshot contract is implemented by the artifact writer.

Keep the handoff and cursor in step

The parent polls child artifacts and converts terminal records into coordinated completion deliveries. The poller enqueues a delivery intent before advancing its in-memory cursor, then writes both in the same state update. If it stops before that write, the old cursor causes the event to be read again; after the write, the pending intent can be delivered.

Delivery identifiers are deterministic for a parent session, child, and turn. Persisted receipts let rehydration reconcile work already handled, while pending intents can be replayed after a continuity transition. This is bounded, at-least-once delivery: a crash in the dispatch window can still produce a duplicate. The guarantee is recovery-oriented, not exactly-once delivery.

The delivery queue persists these intents, and rehydration restores the state used to replay them. Interactive artifact-backed children can be restored on parent startup, reload, or resume for the matching session. Fresh new and fork transitions have different cleanup semantics. In-process jobs and background workflows are scoped to the parent session and do not survive replacement in the same way.

Keep the recovery contract narrow

Persisting state creates a compatibility contract. The interactive state file is versioned, and unsupported shapes are preserved rather than silently rewritten. Protocol-v2 events are validated; the extension does not infer missing completion history from the session transcript or timestamps. The transcript can still supply recent activity previews. This makes some old artifacts unreadable by a newer runtime, but keeps recovery behavior explicit.

The workflow runner has a different boundary. It executes trusted, agent-authored JavaScript in a VM that improves determinism; that VM is not a security sandbox. Its jobs are parent-session scoped and are retired when that session shuts down. Durable child artifacts and session-scoped workflow jobs solve different problems, so the extension does not imply that every kind of background work survives a restart.

Visibility changes how delegation feels

A status label alone does not make delegation understandable. A live child session, bounded activity preview, readable per-turn output, and a way to send the next instruction let the parent and specialist keep a shared line of work. The artifact protocol supplies the record of what happened; the terminal remains the place to inspect and continue the conversation.

See the pi-subagentura overview and recorded walkthrough.