@albertopaparelli/pi-subagent-panel

Watch your pi sub-agents work in a side panel, and talk to them: steer one mid-run, stop it, or continue its conversation after it finishes.

Packages

Package details

extension

Install @albertopaparelli/pi-subagent-panel from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@albertopaparelli/pi-subagent-panel
Package
@albertopaparelli/pi-subagent-panel
Version
0.1.3
Published
Dec 1, 2026
Downloads
not available
Author
apaparelli
License
MIT
Types
extension
Size
1.2 MB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "image": "https://raw.githubusercontent.com/carpe-diem/pi-subagent-panel/main/media/01-live.png",
  "extensions": [
    "./extensions/child.ts",
    "./extensions/panel.ts",
    "./extensions/launcher.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-subagent-panel

Watch your pi sub-agents work in a side panel, and talk to them.

A sub-agent working, followed live in the side panel

  • See every step live: each call a sub-agent makes, what came back, the text it writes.
  • Steer it mid-run: type in the panel and your message reaches the sub-agent as soon as its current calls finish.
  • Stop it with Escape.
  • Continue the conversation after it has finished: it resumes its own session, and the answer comes back to your main session.
  • Tabs for parallel runs, full screen on narrow terminals, the steps under ctrl+o in the tool result.

The package has three parts. Use all three in plain pi, or only the first two with any launcher that speaks the protocol.

Part File What it does
Sub-agent half extensions/child.ts Inside a sub-agent: writes its steps to a trace file, reads your messages from an inbox file
Panel extensions/panel.ts The side panel, ctrl+shift+t (or ctrl+q), /agents
Launcher extensions/launcher.ts The delegate tool: runs a task in a sub-agent (a separate pi -p process)

Install

pi install npm:@albertopaparelli/pi-subagent-panel

Or from git: pi install git:github.com/carpe-diem/pi-subagent-panel. To try it for one session: pi -e npm:@albertopaparelli/pi-subagent-panel.

Use

Ask pi to delegate something ("use the delegate tool with agent scout to map the auth code"). The panel opens on the right while the sub-agent works; you keep typing in your session.

Key Where What
ctrl+shift+t or ctrl+q session Hand the keyboard to the panel
enter panel Send your message to the agent
esc panel Stop the agent (or go back, if it has finished)
← / → panel Switch tabs
↑ / ↓ panel Scroll
ctrl+shift+t or ctrl+q panel Back to the session

Hand the keyboard to the panel and write to the sub-agent while it works:

Writing to the sub-agent from the panel

It gets your message as soon as its current calls finish, and the answer comes back to your session, with a note that you steered it:

The sub-agent took the message: it summarised the files and flagged the bugs it was asked about

/agents opens the panel; /agents hide hides it. Below 110 columns the panel opens full screen when you ask for it.

Agents

Agents are Markdown files in ~/.pi/agent/agents/<name>.md (or $PI_CODING_AGENT_DIR/agents):

---
name: scout
description: Maps code read-only and returns paths and symbols.
model: claude-haiku-5-5
tools: read, grep, find, ls
thinking: low
---
You map code for another agent. Answer with paths, line ranges and symbol names.

The body is appended to the sub-agent's system prompt. Without an agent, delegate gives the sub-agent read-only tools (read, grep, find, ls). Sub-agents don't start sub-agents.

Read-only by default

delegate runs only agents whose tools are read-only (read, grep, find, ls), and tells pi so with the standard tool hints (readOnlyHint), so a host that asks before writes can let it run without asking. To run agents that edit files or run commands, start pi with PI_SUBAGENT_ALLOW_WRITES=1; delegate then drops the read-only hint, and a host that gates writes will ask before each use.

Protocol

For a launcher of your own, or a host that already runs sub-agents.

Files, one pair per run, in a folder the launcher picks:

  • trace.jsonl: the sub-agent appends one JSON object per line. t is one of tool_start (id, tool, args), tool_end (id, tool, ok, summary, ms), text (text), turn_end, person (text, a message it received from you) and settled (aborted). Every line has at (ms).
  • inbox.jsonl: the panel appends {"kind":"say","text":…,"at":…} or {"kind":"abort","at":…}.

The sub-agent finds them through PI_SUBAGENT_TRACE and PI_SUBAGENT_INBOX. Start it with those set and with this package's extensions/child.ts loaded (installed, or passed with -e).

Events on pi.events:

Event Emitted by Data
subagent:started the launcher { id, name, model?, task, trace, inbox, continues? }
subagent:ended the launcher { id, state }, where state is succeeded, failed, killed, …
subagent:continue the panel { id, text }: the person wrote to a finished run

To support continuing, answer subagent:continue for your own runs by starting a new run that resumes the old one's session, and emit subagent:started with continues set to the old id. If nothing does within 10 seconds, the panel tells the person the run can't be continued.

subagent:started is idempotent: a run announced twice is followed once.

A launcher that can't pass the environment variables (it doesn't control the sub-agent's environment) can start the sub-agent half itself, from code running inside the sub-agent:

import { followInbox, reportTrace } from "@albertopaparelli/pi-subagent-panel/child";
reportTrace(pi, "/path/to/run/trace.jsonl");
followInbox(pi, "/path/to/run/inbox.jsonl", "/path/to/run/trace.jsonl");

With a host that has its own launcher, load only the sub-agent half and the panel:

{
  "packages": [
    {
      "source": "npm:@albertopaparelli/pi-subagent-panel",
      "extensions": ["extensions/child.ts", "extensions/panel.ts"]
    }
  ]
}

Safety

  • The trace and inbox live in a folder the sub-agent's model may be able to write in. Every line is checked field by field, and every string is stripped of escape sequences and control characters before it reaches your terminal.
  • Nothing read from a trace is passed to a model. The only thing that reaches the main session's model is the sub-agent's answer, plus your own messages to it, so it knows you steered it.
  • A message is delivered between the sub-agent's tool calls. If it has already finished, the panel asks the launcher to continue the conversation instead.

Limits

  • Terminal only.
  • Built and tested against pi 1.5.0.
  • A sub-agent that finishes before your message arrives gets it as a continued conversation, if the launcher supports continuing.

License

MIT