pi-subagents-hub2026.11.212
A pi extension that brings Claude Code-like sub-agents and workflow orchestration to pi — parallel execution, live widget, fleet view, custom agent types, mid-run steering, dynamic workflows, Claude Code compatibility, look and feel.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-subagents-hub
A pi extension that brings Claude Code-style autonomous sub-agents and workflow orchestration to pi. Spawn specialized agents that run in isolated sessions — each with its own tools, system prompt, model, and thinking level. Run them in the background (the default) or block on them, steer them mid-run, resume completed sessions, and define your own custom agent types. When the orchestration shouldn't be improvised, hand a deterministic JavaScript script to the SubagentWorkflow tool — agent(), parallel(), pipeline() — and scripts written for Claude Code's Workflow tool run here unchanged.
This is a fork of tintinweb/pi-subagents, carrying UI-layer enhancements and functional additions upstream does not have — most notably global
/pauseand/continue, which park every running agent across a quit and reload. See What this fork adds. Install instructions for the fork are in Install.
NOTE Respecting upstream contribution guidelines, AI assisted large un-reviewed changes were not submitted upstream.
| Windowed View (90% × 70%) | Full-Screen View (f) |
|---|---|
![]() |
![]() |
What this fork adds
Functional additions
- Global
/pauseand/continuethat survive quitting pi —/pauseparks the main agent's turn at its next boundary (before a pending tool call or the next model request — nothing in flight is killed), every active top-level agent with the background nested children it owns, and active workflow runs, writing one row per agent, nested child, or workflow run to a per-session manifest at<cwd>/.pi/subagent-pauses/<sessionId>.json— its session file when it has one, otherwise a respawn recipe (the original prompt plus the invocation the record held), or the workflow script and journal path — so the session can be exited right after;/continue— which never sends a prompt — reopens the gates and resumes paused runs in this session, or — after the session is loaded again — continues the parked main turn (pending tool calls execute first), revives session-backed agents from their persisted session files (a paused parent's nested children are restored under its revived id), re-runs session-less ones from scratch, and relaunches workflow runs from their journal replay with handles and aliases reclaimed. Loading a session with parked work hintsN subagents paused hereand/orN workflow runs paused here — /continue to resume. Upstream has no pause, resume, or revive at all — the whole family, and everything that crosses a process boundary, is fork-only. Cross-restart/continueserializes the main-turn continuation with an exclusive lock file beside the manifest; the manifest directory must support exclusive file creation and deletion. A lock record that is still being written is retried briefly; one that stays malformed fails closed with the exact path to inspect. - Universal durable execution engine via
@earendil-works/pi-durable— Subagents run exclusively onpi-durable'sHarnessengine with native task scheduling, transactional state management, and crash resilience. Built-in coding tools (read,write,edit,bash) are powered by@earendil-works/pi-durable/tools, while workspace extensions, MCP servers, and nested orchestration tools (Agent,get_subagent_result,steer_subagent,ask_parent) are bridged into durable tool registrations.
Visual support for nested agents
- Nested subagent hierarchy in Agent Hub — Child subagents spawned by custom agents via
allowed_subagentsare fully visible and manageable in the hub roster (upstream filtered them out):- Tree hierarchy: Immediate child agents render indented beneath their parent with
├─/└─branch glyphs, displaying their live transcript, state glyphs, and tool activity upon selection. - Direct child control: Steer a child agent inline with
Enter, terminate with two-pressx(ork), and inspect its execution stream vial(ppause is gracefully refused with an explanatory note since children are lifecycle-bound to their parent). - Deep delegation drill-down: Deeper descendants (grandchildren and beyond) display a flush-right delegation badge (
↳N). Pressing→drills down into that child's scope (windowing the roster to its hierarchy), while←orEscascends back up.
- Tree hierarchy: Immediate child agents render indented beneath their parent with
Improved Agent Hub (Agents & Workflows)
- Unified multi-page window — Replaces fragmented popups and detached inspector overlays with a cohesive, deep-linked multi-page hub:
- Page grammar: Seamlessly navigate between the grouped roster (R), workflow run overviews (W), workflow agent conversations (WA), and detailed execution logs (SL / SAL / L).
- Draggable pane divider: Click and drag the split divider horizontally with the mouse to adjust the master list and detail pane widths. The center of the divider features shaded grip handles (
▒idle,▓while actively dragging in accent color), clamped between 18 columns (MASTER_LIST_WIDTH) and 50% window width, persisting your chosen width across views and reloads. - Comprehensive mouse support: Interactive mouse wheel scrolling and divider dragging work across both TUI modes — native event dispatching in fullscreen mode, and automatic terminal mouse reporting capture/restore in regular TUI mode.
- Pi-native styling: Edge-to-edge rules without outer box rails and native token highlights (
uiStyle: "pi", the default) or Claude Code-compatible rounded box frames (uiStyle: "claude"). - Live activity streaming: Tool executions stream live subtext (
editing src/auth.ts,searching 'cleanup') with output lines preserved between model turns, rather than raw unformatted tool dumps. - Popup and full-screen twins: Press
fat any time to toggle between the 90%×70% centered popup twin and the full-screen window, preserving active page, scroll offsets, selection, and filter state. - Detailed agentic log: Tool calls render as
⏺ name(key-arg)with results paired inline (✓/✗plus a preview;o/ctrl+oexpands rich blocks in place,mcycles full/preview), thinking blocks as receded✻previews, and pending calls marked. - Main-window-quality tool rendering: Tool calls and results render with pi's own per-tool renderers (edit diffs, highlighted reads, bash command blocks), wired identically to the main transcript.
- FleetView mirror key:
→closes the FleetView, mirroring←/↓.
Codebase maintainability & architectural refactoring
- Centralized window chrome (
src/ui/window-frame.ts) — Consolidated four redundant implementations of border rendering, layout arithmetic, split rules, and footer fittings into a single layout engine shared across the hub, conversation viewer, and menus. - Decomposed hub architecture (
src/ui/hub/) — Refactored the monolithic agent hub into specialized, decoupled modules:hub-data.ts: Roster grouping, stable sort order, and child tree derivationhub-panes.ts: Left and right pane line builders and split row assemblyhub-input.ts: Input routing, filter interaction, and mouse event dispatchinghub-headers.ts: Standardized 3-row identity blocks across pageshub-footer.ts: Two-slot adaptive footer bands that drop hints cleanly when narrowhub-log-view.ts: Dedicated event log viewer integrationhub-types.ts: Strongly-typed interfaces for state, geometry, and events
- Consolidated redundant surfaces — Retired the standalone ~1,660-line
WorkflowDialogand legacy detached chat overlay in favor of the unified page model. - Unified terminal input handling — Standardized raw SGR mouse event parsing in
terminal-mouse.tsand user-configurable viewer keys inviewer-keys.ts. - SOLID architectural refactoring:
- Single Responsibility Principle (SRP): Extracted worktree allocation, branch cleanup with commit notes, and worktree pruning out of the monolithic
AgentManagerinto a dedicatedWorktreeCoordinator(src/manager/worktree-coordinator.ts). Decomposed the 530+ linerunAgentsession runner into a five-stage modular pipeline (prepareAgentSystemPrompt,createRunnerResourceLoader,buildSessionToolLoadout,createAndBindSession,executeAgentPrompt). - Interface Segregation Principle (ISP): Segregated fat dependency interfaces (
LifecycleDepsinsrc/entry/session-lifecycle.tsandAgentToolDepsinsrc/tools/agent-tool.ts) into cohesive role-based contracts (AgentLifecycleState,AgentLifecycleActions,AgentLifecycleFeatures,AgentToolPresentationDeps,AgentToolSpawnDeps). - Dead code and unused export cleanup: Eliminated obsolete tail and grouping helpers (
hubAgents,childAgentsOf,lastNonEmptyLine,MIN_BODY_ROWS,DEFAULT_AGENT_NAMES,WORKFLOW_TICK_MS), removed duplicate dependencies, and trimmed unused exports across commands and tools.
- Single Responsibility Principle (SRP): Extracted worktree allocation, branch cleanup with commit notes, and worktree pruning out of the monolithic
Regular TUI mode has no mouse support of its own — pi only parses mouse input in
tuiMode: "fullscreen"(in regular mode the terminal owns the wheel for its scrollback). The panel therefore enables mouse reporting itself while it is open and restores the terminal when it closes.
Features
- Claude Code look & feel — same tool names, calling conventions, and UI patterns (
Agent,get_subagent_result,steer_subagent) — feels native - Parallel background agents — spawn multiple agents that run concurrently with automatic queuing (configurable concurrency limit, default 10) and completion notifications that reach the parent at its next boundary, several at once when they finish together
- FleetView & nested subagents tree — Claude Code-style navigable list of
main+ running subagents rendered below the editor. Automatically expands by default, re-expands when agents or workflow runs are added or removed, and displays nested child subagents indented with tree branches (├─/└─). Press↓(or←) at an empty prompt to jump in,↑/↓to move the selection,Enterto open the selected agent's live, auto-updating conversation,Escto return. Toggle via/agents → Settings → Fleet view - Conversation viewer — select any agent in
/agentsto open a live-scrolling overlay of its full conversation (auto-follows new content, scroll up to pause). In pi's fullscreen mode it is a borderless, full-terminal observer with mouse support. Steer a running agent inline by pressingEnterto open a composer, typing, thenEnterto send (Escor an empty submit returns). The composer shows sending progress and keeps the draft with an error if delivery fails. Accepted messages appear in the live conversation and redirect the agent after its current tool. Pressbon a running foregroundAgentcall to hand that run to the background (see Sending a foreground agent to the background). Stop a still-running agent by pressingx(thenxagain to confirm) — steer and stop both work for background agents too. Assistant text renders as Markdown;mcycles that between off, assistant-only and everything (see Viewer markdown). The fullscreen observer's scroll-to-top and jump-to-latest keys followtui.altScreen.top/tui.altScreen.bottom(Ctrl+Home/Ctrl+Endby default, withHome/Endas aliases), and the jump indicator's label reflects the binding. - Custom agent types — define agents in
.pi/agents/<name>.mdor.agents/agents/<name>.md(project) or globally, with YAML frontmatter: custom system prompts, model selection, thinking levels, tool restrictions, and Claude Code-compatible colored name badges - Package-shipped agents — a pi package can declare its own subagents (and workflow scripts) with
"pi": { "subagents": { "agents": ["./agents"] } }in itspackage.json, sopi installis the whole setup: no copying files into.pi/agents/on every machine or container start. Only packages pi has actually installed are read (nevernode_modules), package definitions rank below every agent you wrote, and/agentsshows them read-only with Eject and Disable. Narrow or switch it off withpackageAgents/packageWorkflows. Full guide - Nested subagents — the built-in
general-purposeagent can delegate to subagents of its own, as in Claude Code;ExploreandPlancannot, and a custom agent opts in by settingallowed_subagents. A delegating agent gets its own ownership-scopedAgent,get_subagent_result, andsteer_subagenttools, depth-capped from the main session (default 2). It can control only its own children, they are stopped when it finishes, and their transcripts and token spend roll up to it. Separately, every non-isolated subagent at any depth getsask_parentandanswer_subagent: a child stuck on an ambiguity can ask its owner instead of guessing — the question reaches the nearest ancestor that can actually answer (or the main session), the child states its assumption and keeps working, and the answer arrives mid-run as a steering message — no delegation rights or depth headroom required. The allowlist remains a privilege boundary for delegation — a child runs with its own tools, so pick it as carefully astools:itself - Agent mentions — subagents are first-class: type
@explore also check the RPC pathat the prompt and it goes to that agent instead of the main model, without a word of it entering the chat. One syntax covers the whole lifecycle — message it while it runs, resume it once it has finished, reopen its session from disk long after that, or start it if it never ran. Mentioning an agent that isn't running spawns it through an off-screen clone of the conversation, so it gets Claude Code's context-written prompt and a realAgenttool call without a word of it reaching the chat;directmode starts it here from your text instead, with no model call at all. The orchestrator cannamean agent so you address it as@auth-audit, and handles work insteer_subagent/get_subagent_resulttoo.@completes live agents, resumable ones, and startable types alongside pi's file completion;@mainforces text back to the main model. Toggle via/agents → Settings → Agent mentions - Scripted workflows — a
SubagentWorkflowtool that runs a deterministic JavaScript script orchestrating many subagents:agent(),parallel(),pipeline(),phase(),log()andargs, with a pure-literalmetablock declaring the phases.pipeline()has no barrier between stages, so one item can be in a later stage while another is still in the first — unlikeparallel(), which idles every fast agent until the slowest finishes. Runs in the background with a live card, inspectable via/agents → Workflowsor by selecting the run in FleetView.agent()also takesgate: "npm test"to verify a child by running a command (inside its worktree, when isolated) rather than asking another model, andresume: "<label>"to continue a child instead of re-paying its context. Scripts run in anode:vmsandbox on a worker thread whereDate.now(),Math.random()andevalthrow. On by default, but it stands down for company: if another extension already provides aWorkfloworSubagentWorkflowtool, this one warns and disables itself for the session rather than offering the model two orchestrators. Pin it either way with"workflowsEnabled"insubagents.jsonor/agents → Settings → Workflows. A script written for Claude Code'sWorkflowtool runs here unchanged: same globals,schemareturns a validated object exactly as it does there,budgetis present and always reports no token target (pi has no such directive) so itsbudget.total-guarded patterns still take the branch they were written for, and nestedworkflow()composes saved workflows one level deep. Full guide - Live context display — the percentage uses the latest successful response's input, output, and cache tokens rather than lifetime spend. Empty usage and failed or aborted responses do not replace the last valid measurement; compaction and native continuation invalidate it.
- Mid-run steering — inject messages into running agents to redirect their work without restarting
- Pause, resume, revive —
/agents pause [handle]parks active agents at their next run boundary while keeping their records and sessions (no argument: every active top-level agent and the background nested children it owns),/agents resume [handle]reopens their gates — no continuation prompt is ever sent (no argument: all of them, re-queued through the concurrency pool), and/agents revive [handle]reopens an evicted agent's conversation from disk (no argument: a newest-first picker). A parked agent hands its concurrency slot back for as long as it is parked, so a wall of them cannot starve the queue, and a resume re-takes the slot before reopening the gate — if the pool has filled up it waits its turn in the queue. Foreground agents a caller is blocked on, worktree-isolated runs, and agents owned by another agent or a workflow refuse to pause directly — a parent pauses its background children with itself; paused agents render‖, are exempt from the 10-minute record GC, and are swept on/newlike every other agent. All three also appear in the/agentsmenu when they have something to act on, andpin FleetView and the agent hub pauses/resumes the selected (or viewed) agent. The global/pause//continuepair adds the cross-restart dimension: park everything, quit pi, reload the session, and continue the parked agents there - Session resume — pick up where an agent left off, preserving full conversation context. Resumes detached by default and notifies you on completion, just like a fresh spawn; pass
run_in_background: falseto block and get the result inline. A foreground resume of a running or queued agent is refused; usesteer_subagentwhile the run is live - Graceful turn limits — agents get a "wrap up" warning before hard abort, producing clean partial results instead of cut-off output
- Case-insensitive agent types —
"explore","Explore","EXPLORE"all work. A type that doesn't resolve to exactly one enabled agent — unknown, disabled, or ambiguous between two agents differing only by case — falls back to general-purpose with a note, or is refused outright underfallbackSubagent: none - Fuzzy model selection — specify models by name (
"haiku","sonnet") instead of full IDs, with automatic filtering to only available/configured models - Context inheritance — optionally fork the parent conversation into a sub-agent so it knows what's been discussed
- Persistent agent memory — three scopes (project, local, user) with automatic read-only fallback for agents without write tools
- Git worktree isolation — run agents in isolated repo copies; changes auto-committed to branches on completion
- Skill preloading — inject named skills into agent system prompts, discovered from
.pi/skills/,.agents/skills/, and global locations (Pi-standard<name>/SKILL.mddirectory layout supported) - Tool denylist — block specific tools via
disallowed_tools(or Claude Code'sdisallowedTools) frontmatter - Styled completion notifications — background agent results render as themed, compact notification boxes (icon, stats, result preview) instead of raw XML. Expandable to show the whole report, or a failed agent's error body when it wrote none. Group completions render each agent individually
- Event bus — lifecycle events (
subagents:created,started,completed,failed,steered,paused,resumed,compacted) and a per-message spend ledger (subagents:usage) emitted viapi.events, enabling other extensions to react to sub-agent activity - Cross-extension RPC — other pi extensions can spawn, stop, steer, pause/resume, and join subagents via the
pi.eventsevent bus (subagents:rpc:ping,subagents:rpc:spawn,subagents:rpc:stop,subagents:rpc:pause,subagents:rpc:resume,subagents:rpc:consume,subagents:rpc:steer,subagents:rpc:get,subagents:rpc:list,subagents:rpc:workflow_get,subagents:rpc:workflow_list). Standardized reply envelopes with protocol versioning; thepingreply advertises acapabilitiesarray naming the request channels this build answers and afeatureslist naming the additions that are not channels. Emitssubagents:readyon session start. Full reference - Schedule subagents — pass
scheduleto theAgenttool to fire on cron / interval / one-shot. Session-scoped jobs with PID-locked persistence; results land via the samesubagent-notificationpath as manual background completions; manage via/agents → Scheduled jobs - Model scope enforcement — opt-in validation that subagent model choices stay within your pi
enabledModelsallowlist (sourced from/scoped-models, with both global and project-local pi settings honored). Caller-supplied out-of-scope → hard error to orchestrator; frontmatter-pinned out-of-scope → warning + runs anyway (frontmatter authoritative). Toggle via/agents → Settings → Scope models
Install
Install this fork (git source, tracks master):
pi install git:github.com/ahati/pi-subagents-hub@master
Update later with pi update git:github.com/ahati/pi-subagents-hub@master.
A prepare script compiles dist/ during that install, and pi loads the compiled ./dist/index.js entry instead of transpiling ./src/index.ts on every boot (tintinweb/pi-subagents#279 — thanks @tobymao). The path-derived extension name is [dist]; refer to this extension as [pi-subagents-hub] in extensions: lists.
Upstream release (npm package, without the fork's UI additions):
pi install npm:@tintinweb/pi-subagents
Or load directly for development:
pi -e ./src/index.ts
Requires pi 1.6.0 or newer: the extension compiles against the 1.6 API baseline (readonly render() output, pi-durable ToolPark). The peerDependencies range declares this minimum, so npm flags an older pi at install time.
Other hosts
This extension is developed and tested against pi.
Third-party adapters report running it elsewhere. These are maintained independently of this project: not tested here, not covered by our CI, and compatibility may break with any release.
- DeepSeek Harness (
dsh) — via an adapter that maps pi's host API onto native DSH agents. Details and reports: #258
Quick Start
The parent agent spawns sub-agents using the Agent tool:
Agent({
subagent_type: "Explore",
prompt: "Find all files that handle authentication",
description: "Find auth files",
run_in_background: true,
})
Agents run in the background by default: the call returns an ID immediately and notifies you on completion, carrying a preview of the result (use get_subagent_result for the full text). Pass run_in_background: false to block until the agent finishes and get its full output inline; while it blocks, ctrl+b hands it to the background (see below).
Sending a foreground agent to the background
Press ctrl+b while a foreground Agent call is running to hand it to the background, as in Claude Code. The same run keeps going — same session, in-flight turn, transcript and worktree — and the blocked call returns the agent ID with the same result a run_in_background: true spawn gets. Completion then arrives as the normal background notification, naming the original tool call. After 2 seconds the running call's row shows (ctrl+b to run in background).
ctrl+bhands off every running foregroundAgentcall at once. To hand off just one, pressbin its conversation viewer (FleetView or/agents → Running agents).- The key is claimed only while such a call is running and the prompt editor has focus; the rest of the time — and in dialogs or the viewer's steering composer —
ctrl+bis still pi's cursor-left. With FleetView disabled the extension cannot see which component has focus, so it claims the key whenever a call is running. - One hint shows per batch of parallel calls, on the earliest one still running.
- Esc in the parent no longer reaches a handed-off agent. Stop it from
/agents → Running agentswithx. - It is one-way: there is no way back to foreground.
- Other tool calls in the same assistant message still hold the model's next turn until they finish; pi runs a message's tool calls as one batch.
- Not offered for a foreground call still queued for a slot, a foreground
resume, a workflow's agents or nested children. There is no automatic timeout.
Scheduling
Add a schedule field to register the agent to fire later instead of running now:
Agent({
subagent_type: "Explore",
prompt: "Look at recent commits and summarize what changed since last week",
description: "Weekly commit review",
schedule: "0 0 9 * * 1", // 9am every Monday (6-field cron)
})
Schedule formats:
- Cron — 6-field (
second minute hour day-of-month month day-of-week), e.g."0 0 9 * * 1"for 9am every Monday,"0 */15 * * * *"for every 15 minutes. - Interval —
"5m","1h","30s","2d". Fires repeatedly at that interval. - One-shot relative —
"+10m","+2h","+1d". Fires once at that future time. - One-shot absolute — full ISO timestamp, e.g.
"2026-12-25T09:00:00.000Z".
When a schedule fires, the spawn runs in background and its completion notification arrives the same way as a manually-spawned background agent's — your parent agent reasons about the result the same way.
Schedules are session-scoped: they reset on /new and restore on /resume. List and cancel via /agents → Scheduled jobs (creation is the Agent tool's job — there is no parallel manual-create wizard). Storage at <cwd>/.pi/subagent-schedules/<sessionId>.json with PID-based file locking for cross-instance safety.
Disable the feature entirely: /agents → Settings → Scheduling → disabled removes schedule from the Agent tool spec (no LLM-context cost), hides the menu entry, and stops any active scheduler. The schema-level removal takes effect on the next pi session; the runtime kill is immediate. Re-enable from the same menu.
Restrictions:
schedulecannot be combined withinherit_context(no parent conversation exists at fire time) orresume(schedules create fresh agents).run_in_background: falseis refused — scheduled jobs always run in the background. Omitting it, or passingtrue, is fine.- Scheduled fires bypass the
maxConcurrentqueue so a 5-minute interval cannot be deferred behind long-running manual agents. - Headless
pi -pdoesn't wait for scheduled fires that haven't happened yet. A scheduled agent already running when the turn ends is waited for like any other background work — see Headless mode.
Headless mode (pi -p)
In print and JSON mode, a turn that ends while background agents or workflows are still running does not end the run. pi-subagents waits for that work at pi's agent_before_settle boundary, writes [pi-subagents] Waiting for background work to finish (…). Press Ctrl+C to exit now. to stderr, and hands the completions to the model, which reacts in a further turn. The printed answer is that reaction, as with Claude Code's -p. The wait has no limit by default; headlessWaitMinutes stops the work after that many minutes instead, and lets pi exit without another turn. Interactive (TUI) and RPC sessions never wait — their completions start a turn through the outbox as usual. Nested background children follow their own rule: they are stopped when the agent that started them ends its run, unless it collected them first (Nested subagents).
UI
FleetView
While subagents are running, a Claude Code-style navigable list renders below the editor (automatically expanded by default, auto-reopening when agents are added or removed):
esc to interrupt · ← for agents · ↓ to manage
● main
○ orchestrator Managing refactor team 32s · ↓ 26.4k tokens
├─ ○ worker-1 Explore auth module 11s · ↓ 13.1k tokens
└─ ○ worker-2 Verify security rules 11s · ↓ 13.1k tokens
Running workflows appear as a single workflow row above the agents, carrying a 20-cell progress bar and the phases currently running — Fixing (1/2), or Fixing & Testing when a pipeline has two stages in flight — in place of a description, with the done/total agents count, elapsed time and tokens flush right (a narrow terminal loses the bar before it loses the numbers). In the agent hub roster the two kinds are grouped instead: a SUBAGENTS section (its agents in stable launch order — a settling agent never reshuffles the list under the cursor) and a WORKFLOWS section below it, each run row led by the same run-state glyph the agents use (● running, ‖ paused, ✓ completed, ✗ failed) and tailed with a right-aligned done/total counter; the master cell is identity-only, so the name truncates before the counter does. The section headers take a line but no cursor slot, so ↑/↓ crosses them seamlessly. Enter on a run opens that run's page inside the hub — its phases and agents in the right pane — with Esc back to the roster, rather than a second overlay; /agents → Workflows opens the same page directly. A run's own agents are not listed separately — they belong to the run, which reports for them, so they are filtered out of the fleet list, the /agents menus and @handle resolution. Nested child subagents spawned by other subagents appear indented under their parent in FleetView with tree connectors (├─ / └─ ). Each row's token and cost figures are that agent's own, so a parent's row excludes its children, which have rows of their own; every other surface still reports the rolled-up total. They are also outside the maxConcurrent pool: the run has its own concurrency cap, and routing a fan-out through the session pool as well would let one workflow starve everything else. The agents are ordered earliest-launched first, and only agents you can actually open are shown (pending/queued agents with no session yet appear once they start). At an empty prompt, press ↓ (or ←) to move focus from the prompt into the list — the selected row is marked ●, the rest ○. The selected row renders in the theme's primary text color rather than the muted/dim treatment of the others; an agent with a configured color shows its badge there too, bolded. Each row names the agent itself — its tool-call name alias, else its type-derived handle (general-purpose-2), else the type's display name — so siblings of one type are distinguishable at a glance; the badge color is still the type's. ↑/↓ move the selection, Enter opens the selected agent's live conversation overlay (it auto-updates as the agent works), and Esc (or ↑ above main) returns to the prompt. → is ←'s mirror: it dismisses the list entirely — bar included — until ↓/← recall it or fresh agent activity re-shows it. Selecting main returns to the normal view. Inside the overlay, press Enter to steer the running agent — type a message and Enter to send it (Esc or an empty submit returns), and it redirects the agent the same way the steer_subagent tool does. On a running foreground Agent call, press b to hand that run to the background. A viewer stays open when its agent finishes so you can read the final output, and finished agents linger in the list for a few seconds before dropping out. Typing anything at a non-empty prompt behaves normally — the list only captures arrow keys when the prompt is empty. Opening the agent hub from the list — Enter on an agent or workflow, or from /agents — collapses the bar for as long as the hub is up, popup and full-screen alike; it comes back exactly as it was (dismissal included) when the hub closes. p pauses the selected agent (or resumes a paused one — the same toggle the hub's roster offers) and is inert on settled rows. Disable it entirely via /agents → Settings → Fleet view.
Agent mentions
Subagents are addressable. Every agent has a typeable handle — the agent type, lowercased, numbered when instances collide (explore, explore-2) — and @handle <message> at the prompt talks to that agent, whatever state it happens to be in. Type @ to pick one:
❯ @
@auth-audit send message · Explore · running · audit the auth flow
@explore-2 send message · running · find flaky tests
@code-review resume · code-review · check the diff
@plan start agent · Software architect agent for designing implementation plans.
index.ts src/index.ts ← pi's own file rows, still there
index.d.ts dist/index.d.ts
The handle names the agent, not one process, so a single syntax covers its whole lifecycle:
| State | @explore fix the flaky test does |
|---|---|
| running or queued | sends the message into its conversation, exactly as steer_subagent would |
| finished | resumes it in the background from its existing session, continuing where it left off |
| finished long ago, record gone | reopens its session from disk and continues there |
| never started | starts it — by default, through a clone of this conversation (below) |
No turn is ever spent in the main conversation, and nothing about the mention enters the chat. The answer comes back as the ordinary background-completion notification, so the main model can relay it.
Starting a new agent
Claude Code does not start a mentioned agent itself. @agent-<type> becomes an attachment appending a <system-reminder> to your prompt — "the user has expressed a desire to invoke the agent X; please invoke the agent appropriately, passing in the required context to it" — and the main model makes the tool call. There is no tool forcing and no allowed-tools narrowing: the mention constrains which agent, not what it is told. So the model writes the agent's prompt, giving it the conversation context a cold spawn lacks.
The cost is a visible turn — the model's reasoning and its tool block, narrating a decision you already made by typing the handle. This extension keeps the mechanism and moves it off-screen. The conversation is copied into a throwaway in-memory session, that clone takes the turn holding only the Agent tool, and what it starts is an ordinary top-level agent:
@cyan whats your favorite color → (nothing in the chat)
└─ clone of this conversation, off-screen
└─ Agent(subagent_type: "cyan", prompt: …)
▸ Cyan Agent favorite color ← widget, fleet row, handle
It is a literal clone — the session's own entries and the same system prompt, not inherit_context's text rendering of them — taken from memory and compaction-aware, so what the copy reads is what the main model is working from. The clone gets one tool and one job; it cannot read, write or run anything, because an invisible turn with the full toolset could do invisible work. The agent it starts is attributed to the real session, so its transcript and rootSessionId land where they would have anyway, and it carries no tool-use-id — the main conversation never issued one.
| Mode | @plan sketch the migration, with no Plan agent running |
|---|---|
model (default) |
a clone of this conversation takes the turn off-screen and calls Agent, so the agent starts with a prompt written from the conversation. Nothing reaches the chat but a Prompting @plan… toast — the wording marks the wait for that turn, where direct's Started @plan means it is already running |
direct |
the agent starts here, immediately, with your message verbatim as its prompt (after this conversation, if its file sets inherit_context). No model call at all, so no latency before it begins |
off |
@ means only "attach a file" again |
Either way the started agent honours its own frontmatter — model:, thinking:, max_turns: all apply, since neither path passes them and the agent's config wins, and inherit_context: true hands it this conversation even in direct mode. Mentioning something as the very first thing in a session works: there is simply no history to carry, and the clone still runs on your model and system prompt. If it cannot deliver at all — a model can always answer in prose instead of calling the tool — the agent is started directly with your text and the toast says so, rather than leaving you with nothing running.
model is also the only mode that works outside the TUI: pi -p '@plan the migration' clones, spawns, and reports through the normal completion path, where a direct start would have detached the agent and printed nothing. Messaging and resuming stay TUI-only for that reason, in both modes.
Two things to weigh against direct: the clone re-sends the whole conversation, and the agent does not start until that turn finishes.
Named agents. The Agent tool takes an optional name, so the orchestrator can call one auth-audit instead of leaving you to tell @explore-2 from @explore-3. The alias leads every roster surface — FleetView, the above-editor widget, the agent hub (roster page and its conversation pane), the conversation viewer header and the Agent tool call header — with the type-derived handle as the fallback and the type's display name last, so two same-type agents no longer render under one identical label; the badge color stays the type's. A name is additive: the type-derived handle is still assigned, so @explore keeps reaching that agent rather than starting a second one beside it. Both names share one namespace — an alias can never shadow a live handle or the reverse — and the popup shows one row per agent, under its alias, with the type moved into the description. steer_subagent and get_subagent_result accept a handle too, so you and the model address agents the same way.
Resuming much later. Because subagent sessions are persisted by default (rememberAgents), a handle keeps working after the agent's in-memory record is evicted: @explore anything else? reopens the conversation from disk. Only the definition is re-resolved, so a continuation runs under the agent type's current frontmatter, not the one the first run used. If the type has since been deleted or disabled, the resume is refused rather than falling back to another agent — re-enable it and the handle works again. Names from an evicted agent stay reserved, so a later Explore becomes explore-2 rather than shadowing something you can still reach; the 100 most recent are kept, and all of them are forgotten on /new and session switch. A resumed agent takes those names back, so @explore keeps meaning the same conversation. An agent whose session was only ever in memory leaves nothing to reopen, and the mention starts a fresh one instead; if the session file has since been deleted, the mention says so and frees the handle rather than silently sending your message to a new agent.
The grammar mirrors Claude Code's, and is deliberately narrow so nothing gets swallowed by accident:
| Input | Goes to |
|---|---|
@explore fix the flaky test |
the explore agent |
@agent-explore fix the flaky test |
the same agent — Claude Code's manual spelling, accepted as a synonym |
@main @explore is not a mention |
the main model, with @main stripped — the escape hatch |
@explore (no message) |
the main model — a bare handle is never a send |
hey @explore look at this |
the main model — only a leading mention is routed |
@src/index.ts summarize this |
the main model, with pi's normal file attachment |
@nosuchagent hello |
the main model, verbatim — no agent, no type, no interception |
While an agent is live its handle addresses it, so @explore never starts a second Explore alongside a running one — use the Agent tool for deliberate parallelism. @<agent-id> works too. main is reserved and can never be an agent's handle (a type slugging to it gets main-2); handles are capped at 64 characters. A handle written as typed always wins over the @agent- form, so an agent genuinely called agent-explore stays reachable. Nested subagents are not addressable — they are hidden from every top-level surface and only their owner may steer them, so a handle that would name one starts a fresh top-level agent instead of reaching through that boundary. Suggestions list live agents first, then resumable ones, then startable types — and then pi's own file rows, in the same popup: @ stays the file picker it always was, and the handles are added to it rather than replacing it. Disable the whole thing via /agents → Settings → Agent mentions.
A direct-mode start takes the non-tool spawn path shared with the scheduler and cross-extension RPC, so — like those — it writes no .output transcript. That is the trade for skipping the model call: a model-mode start goes through the real Agent tool and keeps everything. Live tool activity and the turn counter are not part of that trade — a direct start renders them like any other agent. A mention-resumed agent goes through the full resume wiring and keeps both in either mode.
Individual agent results render Claude Code-style in the conversation:
| State | Example |
|---|---|
| Running | ⠹ ↻3≤30 · 3 tool uses · 12.4k token (8%) / ⎿ reading src/auth.ts, searching 'token'… |
| Completed | ✓ ↻8 · 5 tool uses · 33.8k token (62%) · 12.3s / ⎿ Done |
| Wrapped up | ✓ ↻50≤50 · 50 tool uses · 89.1k token (84% · ⇊2) · 45.2s / ⎿ Wrapped up (turn limit) |
| Stopped | ■ ↻3 · 3 tool uses · 12.4k token (8%) / ⎿ Stopped |
| Error | ✗ ↻3 · 3 tool uses · 12.4k token (8%) / ⎿ Error: timeout |
| Aborted | ✗ ↻55≤50 · 55 tool uses · 102.3k token (95% · ⇊3) / ⎿ Aborted (max turns exceeded) |
Completed results can be expanded (ctrl+o in pi) to show the full agent output inline. The conversation viewer honors the same toggle for the agent's own tool output: rich-rendered blocks collapse to a preview with pi's own "ctrl+o to expand" hint, and the key — resolved through the user's app.tools.expand binding — flips them to full output; plain o is bound as the same toggle, which is what the hub's band advertises (o expand / o collapse). Blocks rendered as text carry an o/ctrl+o for full hint and answer both keys.
By default, foreground and background agents each stream their full conversation to a per-subagent transcript — a JSON-lines file at <os-tmpdir>/pi-subagents-<uid>/<cwd>/<session>/tasks/<agent-id>.output (owner-only 0700, cleared on reboot). Set output_transcript: false on a custom agent to write no transcript path or file for it, or set outputTranscript: false in subagents.json to make transcripts opt-in for the whole project (frontmatter overrides the project default). This governs only the transcript: it is independent of persist_session (the pi session on disk), and it does not affect isolation: worktree (which commits the agent's work to a git branch) or memory: (durable files) — set those accordingly if the goal is to keep a run off disk entirely. Background agent completion notifications render as styled boxes:
✓ Find auth files completed
↻3 · 3 tool uses · 12.4k token · 4.1s
⎿ Found 5 files related to authentication...
transcript: /tmp/pi-subagents-501/home-user-project/sess-1/tasks/agent-abc123.output
Group completions render each agent as a separate block. The LLM receives structured <task-notification> XML for parsing, while the user sees the themed visual.
Default Agent Types
| Type | Tools | Model | Prompt Mode | Description |
|---|---|---|---|---|
general-purpose |
all 7 | settings default → inherit | append (parent twin) |
Inherits the parent's system prompt — same rules, CLAUDE.md, project conventions. Its skills, cwd and extension sections are left out |
Explore |
read, bash, grep, find, ls | inherit | replace (standalone) |
Fast codebase exploration (read-only) |
Plan |
read, bash, grep, find, ls | inherit | replace (standalone) |
Software architect for implementation planning (read-only) |
The general-purpose agent is a parent twin — it receives the parent's system prompt plus a sub-agent context bridge, so it follows the same rules the parent does. The parent's skill list, cwd and extension sections are left out: the subagent's own session adds them for itself, so its skills follow its skills setting. When it can delegate, it also gets Claude Code's closing line telling it not to hand its whole assignment to a single child. Explore and Plan use standalone prompts tailored to their read-only roles.
Default agents can be ejected (/agents → select agent → Eject) to export them as .md files for customization, overridden by creating a .md file with the same name (e.g. .pi/agents/general-purpose.md), or disabled per-project with enabled: false frontmatter. To run Explore on a cheaper model, eject it and add model: (e.g. model: anthropic/claude-haiku-4-5); a pinned model resolves through any provider with a key, not just the session's.
Custom Agents
Define custom agent types by creating .md files. The frontmatter name: is the subagent_type and dispatch identity, falling back to the filename when absent; display_name only changes the UI label. Claiming a default agent's name overrides it.
Agents are discovered from four locations (higher priority wins):
| Priority | Location | Scope |
|---|---|---|
| 1 (highest) | .pi/agents/<name>.md |
Project — pi's config dir; authoritative, and where /agents writes |
| 2 | .agents/agents/<name>.md |
Project — the shared cross-tool .agents workspace (same convention as .agents/skills/) |
| 3 | $PI_CODING_AGENT_DIR/agents/<name>.md (default ~/.pi/agent/agents/<name>.md) |
Global — available everywhere |
| 4 (lowest) | Paths declared by an installed pi package | Package — see Shipping agents in a pi package |
Project-level agents override global ones with the same name, so you can customize a global agent for a specific project. If both project locations define the same name, .pi/agents/ wins — .pi stays the project authority; .agents/agents/ is an additional read location for projects that keep their agent assets in the .agents workspace. The global location follows the upstream PI_CODING_AGENT_DIR env var — set it to relocate all pi-coding-agent state (agents, skills, settings) to a custom directory. An agent's name is its frontmatter name:, falling back to the filename, so two files can now claim the same one — the later load wins, and the warning below names the file that took over.
An unreadable or unparseable agent file is skipped, not fatal — a warning names the file and the error. If it was overriding a same-named agent, a second line names the file that loads instead. Set strictAgentFiles: true in subagents.json (or /agents → Settings → Strict agent files) to fail startup on a broken file instead; mid-session reloads still only warn.
Example: .pi/agents/auditor.md
---
color: red
description: Security Code Reviewer
tools: read, grep, find, bash
model: anthropic/claude-opus-4-6
thinking: high
max_turns: 30
---
You are a security auditor. Review code for vulnerabilities including:
- Injection flaws (SQL, command, XSS)
- Authentication and authorization issues
- Sensitive data exposure
- Insecure configurations
Report findings with file paths, line numbers, severity, and remediation advice.
Then spawn it like any built-in type:
Agent({ subagent_type: "auditor", prompt: "Review the auth module", description: "Security audit" })
Frontmatter Fields
All fields are optional — sensible defaults for everything.
| Field | Default | Description |
|---|---|---|
description |
the agent's name | Agent description shown in tool listings |
name |
filename | The agent's type — what subagent_type and @handle address. Claude Code's rule: the filename doesn't have to match, so blubb.md with name: code-review dispatches as code-review. Omit it and the filename is used. Any value works except one containing :, which Claude Code reserves for plugin-scoped identifiers — such a file is skipped with a warning. Two files may declare the same name; the later load wins, as a filename clash always did |
display_name |
the type | Label shown in the UI (widget, agent list, badges) when an instance has no name alias or handle — cosmetic only, and independent of name. Claude Code has no equivalent; a file that sets only name badges as its type, unchanged |
color |
— | Background color for the agent name badge in the Agent tool header, widget, FleetView, and conversation viewer. Supports Claude Code's red, blue, green, yellow, purple, orange, pink, cyan (the values its own default theme uses); quoted six-digit hex such as "#8B5CF6"; and Agency Agents aliases (amber, teal, indigo, gold, neon-green, neon-cyan, metallic-blue, violet, rose, lime, gray/grey, fuchsia, slate, navy). Badge text is black or white, whichever clears 4.5:1 against the rendered background — Claude Code uses one inverse color for every badge. Invalid values render no badge and preserve each surface's existing theme foreground |
tools |
all 7 | Which tools the agent can call. Built-in names (read, grep, …, or Claude Code's Read, Glob, …), * / all (all built-ins), none, ext:<extension> / ext:<extension>/<tool> selectors for extension tools, and bare mcp__<server>__<tool> entries for MCP tools. See Tool & extension scoping below |
extensions |
true |
Which extensions to load for the agent. true (all defaults), false (none), or an explicit list: [mcp, "/abs/path.ts", "*"]. See Tool & extension scoping below |
exclude_extensions |
— | Extension denylist applied after extensions: — exclude wins. Plain names only (case-insensitive), no paths or *. Useful with extensions: true to drop one extension (e.g. pi-notify) |
skills |
true |
true inherits the parent's skills; false inherits none. A comma-separated list preloads only those skills into the system prompt and does not inherit the rest (see Skill Preloading for discovery locations) |
memory |
— | Persistent agent memory scope: project, local, or user. Auto-detects read-only agents |
disallowed_tools |
— | Comma-separated tools to deny even if extensions provide them. Claude Code's disallowedTools key and tool names (Write, Glob) work too |
cache_retention |
— | Prompt-cache retention for this agent's model calls: none, short (5 min on Anthropic), long (1 hour). Outranks the cacheRetention setting; inherit is the setting's job, so leave the key out to defer |
isolation |
— | Set to worktree to run in an isolated git worktree, or off to refuse one even when the caller passes isolation: "worktree" (frontmatter is authoritative). Workflow scripts are the exception: as in Claude Code, only their agent() option decides. none, no, and false are accepted spellings of off |
model |
the session's configured default, else the parent's model | Model — provider/modelId or fuzzy name ("haiku", "sonnet"). Resolved tolerantly (./- and a trailing date stamp are interchangeable) and falls back to the same model under another provider if the named one doesn't have it. Precedence: this pin → the subagent session's own pi settings default (defaultProvider/defaultModel) → the spawning session's model |
thinking |
inherit | off, minimal, low, medium, high, xhigh, max — actual availability depends on your pi version and model; pi clamps unsupported levels down |
max_turns |
unlimited | Max agentic turns before graceful shutdown. 0 or omit for unlimited |
persist_session |
subagents.json rememberAgents (default true) |
Persist this subagent as a normal pi session instead of keeping the session in memory only; overrides the rememberAgents project default in both directions. It records its spawning session as parent, so it nests under it in /resume. The subagent's .output transcript is still written either way unless output_transcript: false |
output_transcript |
true (or subagents.json outputTranscript) |
Write this subagent's .output transcript; when set, overrides the subagents.json outputTranscript default. Set false to write no transcript file or path. Governs only the transcript — independent of persist_session, isolation: worktree, and memory: |
session_dir |
pi default | Optional session directory when persist_session: true; omitted uses pi's normal session location, and relative paths resolve from the agent cwd. A session outside the parent's session directory (this override, or isolation: worktree) is listed separately, so it shows as a root instead of nesting |
allowed_subagents |
none | Opt in to scoped nested Agent, get_subagent_result, and steer_subagent tools. Omitted / empty / none / false = no nesting; all (or "*" / true) = any enabled agent; comma-separated list = only those agent types. ask_parent/answer_subagent do not need this — every non-isolated subagent gets them at any depth |
prompt_mode |
replace |
replace: body is the full system prompt (no AGENTS.md / CLAUDE.md inheritance). append: body appended to parent's prompt minus its skills, cwd and extension sections (agent acts as a "parent twin" — inherits parent's AGENTS.md / CLAUDE.md) |
inherit_context |
false |
Fork parent conversation into agent |
run_in_background |
— | Pin this agent to background (true) or foreground (false). Omit to follow backgroundByDefault |
isolated |
false |
Hermetic specialist mode: forces extensions: false + skills: false + drops ext: selectors. Only built-in tools. Distinct from isolation: worktree (filesystem) |
enabled |
true |
Set to false to disable an agent (useful for hiding a default agent per-project) |
Frontmatter is authoritative. If an agent file sets model, thinking, max_turns, inherit_context, run_in_background, isolated, or isolation, those values are locked for that agent. Agent tool parameters only fill fields the agent config leaves unspecified. Other spawn paths differ per field:
isolatedholds on every spawn path, including@handlementions, workflows and cross-extension RPC.isolationholds on every path except workflows: as in Claude Code, only the script'sagent()option decides there.inherit_contextholds wherever you start the agent from this session:Agenttool and nested spawns, and@handlementions in either mode. Spawns another caller starts are its caller's to decide, as in Claude Code, where only a fork inherits the conversation: workflow children and scheduled runs never inherit, and an RPC caller opts in withinheritContext.
Forgiving model: resolution. A model: pin is matched against pi's model registry tolerantly, so cosmetic id variations don't silently drop the agent back to the parent's model: . and - are treated as equivalent in version numbers (claude-haiku-4.5 ≡ claude-haiku-4-5), a trailing -YYYYMMDD date stamp is optional (anthropic/claude-haiku-4-5-20251001 matches an undated registry id and vice-versa), and a provider/modelId whose named provider doesn't carry that model retries the bare id against every provider. Precedence is exact → fuzzy under the named provider → same model under any provider → unavailable, so an exact match always wins and dated snapshots aren't conflated. If nothing resolves, the pin can't run and the agent inherits the parent model — /agents → Agent types flags this case as (unavailable, fallback: inherit) and shows the resolved target (→ provider/id) when resolution lands on a different provider or version than configured. (This is distinct from Model Scope enforcement, which matches the enabledModels allowlist by exact entry.)
Nested subagents
Nested delegation is default-off for custom agents. The built-in general-purpose agent delegates out of the box, matching Claude Code: it already has every tool, so a child can do nothing it could not. It does not delegate as a workflow agent(), where the script does the fanning out — Claude Code's workflow agents have no Agent tool either. Explore and Plan never delegate. For custom agents, set allowed_subagents only on a non-isolated agent that owns a real fan-out responsibility:
---
tools: read, grep, find
extensions: false
allowed_subagents: support-file-finder, support-callsite-tracer # or `all`
---
The allowlist is a privilege boundary, not just a routing hint. A child runs with its own tools:, extensions:, and isolated: — the parent's restrictions are not inherited — so delegation grants the parent the union of what the listed agents can do. The read-only agent above can write and run commands through any listed agent that can, and all reaches every enabled agent including general-purpose. Choose the list as carefully as you would choose tools: itself; that is the main reason this is default-off for custom agents.
The nested Agent tool lists the allowed agent types with their descriptions and tools, as the main session's does, and follows toolDescriptionMode "compact".
allowed_subagents is runtime-enforced. A comma-separated list restricts nesting to those types; all (or "*" / true, matching how extensions: and skills: take booleans) allows any enabled agent; omitted, empty, none, or false means no nested tools are injected at all. Unknown, disabled, and out-of-list types are rejected rather than falling back — regardless of the project's fallback agent setting, so a configured fallback can never hand a nested caller an agent outside its allowlist — and a nested model: is validated against Model Scope exactly like a top-level spawn. Result, resume, steering, and question-answering operations are ownership-scoped, so a parent can control only its own children. Nested records remain internal to that parent and do not appear in top-level tools or lifecycle events — though in this fork they are visible and manageable within the Agent Hub with tree hierarchy and scope drill-down. When a nested child runs with run_in_background: true, its parent receives a <task-notification> steering message on completion (just as the main session does), and a cleanly idle parent waits for its active background children to report back rather than stopping them early; if a parent fails, is stopped, or hits its turn limit, its running nested children are stopped with it. They do write their own .output transcript (subject to the same output_transcript gate), filed under the root session's directory alongside their ancestors', so a nested run can still be inspected after the fact. Their token usage is folded into every ancestor's totals up to the top-level agent (lifecycle events, completion notifications, /agents), so nested spend stays attributable at any depth even though the children themselves stay hidden from outer tools. A nested result that ends stopped, aborted, or steered is labelled as partial, the same guarantee top-level results carry.
maxSubagentDepth (default 2) is the deepest level an agent may run at, counted from the main session (0). An agent can spawn only while its own depth is below it:
maxSubagentDepth |
Main → subagent (1) | Subagent → child (2) | Child → grandchild (3) |
|---|---|---|---|
0 or 1 |
yes | no | no |
2 (default) |
yes | yes | no |
3 (Claude Code's default) |
yes | yes | yes |
0 or 1 turns nested subagents off everywhere, even for agents that set allowed_subagents (including the built-in general-purpose). No agent gets nested tools or the re-delegation line, so no prompt carries any nesting text; top-level spawns from the main session are unaffected. Set it in subagents.json or /agents → Settings → Nested depth. An agent already at the cap gets no delegation tools at all — not even get_subagent_result, since it can never own a child — but it keeps ask_parent and answer_subagent: asking needs an owner, not headroom. A child delegates again only if its own agent allows it (general-purpose does); isolated agents receive none of these tools.
Asking the parent (ask_parent / answer_subagent). Every non-isolated subagent — at any depth, with or without an allowlist — can ask its owner when it hits a genuine ambiguity instead of guessing: ask_parent records the question — with the assumption the child will proceed on — and delivers it to the nearest ancestor that can actually take a turn (a blocked ancestor is skipped; the chain ends at the main session, which answers with its own answer_subagent). The child never blocks: it continues on its stated assumption, and the answer arrives mid-run as a steering message. If no answer lands before the run ends, the question rides the result as a [QUESTION for you] footer — resume the child with the answer if it matters. Asking again supersedes the earlier question; the main session sees the same protocol from its own side via answer_subagent, which answers any of its background children. Questions are stripped of their answer path honestly: an error or aborted run drops its open questions rather than dangling them, and disallowedTools: ["ask_parent"] removes the tool for agents that should resolve things themselves.
Nested children occupy no slot in either queueing pool — their parent already holds one, and queueing them behind it would deadlock a parent waiting on its own child. They do count toward the nested limit maxConcurrentNested (default 10), which bounds how wide nesting goes: a nested spawn over it is refused, not queued, and the parent gets a tool error telling it to do the work itself. The depth cap bounds how deep.
Because a subagent session never activates this extension (that is what keeps a child from building a second agent manager, and it is why nested tools are injected directly instead), a subagent also gets none of the extension's other surfaces: no /agents command, no cross-extension RPC handlers, no subagents:ready event.
Tool & extension scoping
extensions: decides which extensions load, tools: decides which tools surface to the LLM. They compose:
# Default (both omitted): all extensions load, all 7 built-ins surface
tools: read, grep, find # narrow to listed built-ins; extensions still load
tools: "*" # all 7 built-ins (alias: `all`)
tools: none # zero built-ins (alias: `""`)
tools: "*, ext:mcp/search" # built-ins plus one extension tool
tools: Read, Grep, Glob # Claude Code names: read, grep, find
tools: "read, mcp__radius__*" # read plus the radius MCP server's tools
extensions: false # no extensions load
extensions: [mcp] # only mcp loads
extensions: [builtin:mcp, builtin:codemode] # pi's built-in MCP + codemode
extensions: ["*", "/abs/foo.ts"] # all defaults plus one path-loaded extension
exclude_extensions: pi-notify # everything except pi-notify (with extensions: true)
exclude_extensions: builtin:mcp # everything except pi's built-in MCP
# Specialist: load one extension, expose only one of its tools, keep built-ins
extensions: [mcp]
tools: "*, ext:mcp/search"
isolated: true # hermetic: built-ins only, no extensions/skills/context
A few rules the examples don't m

