Observable, persistent Pi subagents for independent reviews, investigations, and delegated implementation.
Each subagent runs in its own tmux session with a dedicated Pi JSONL session. The parent can inspect status, wait for durable results, steer active work, queue follow-ups, or attach directly to the child TUI.
- Pi
- Node.js 22.19 or newer
- tmux
Clone into Pi's global extension directory and expose the CLI on PATH:
git clone git@github.com:earendil-works/pi-subagent.git ~/.pi/agent/extensions/subagent
ln -s ../extensions/subagent/subagent.ts ~/.pi/agent/bin/subagentRun /reload in an existing Pi session. The extension contributes its bundled skill automatically.
Spawn with a descriptive name using the parent session's provider, model, and thinking level:
subagent spawn --name review --prompt "Review the current diff independently"Names appear in the parent UI. Generated handles remain the stable identifiers used by management commands.
Override the model configuration when needed:
subagent spawn \
--provider openai-codex \
--model gpt-5.4-mini \
--thinking low \
--prompt "Find the relevant implementation"Provide multiple prompt fragments and files:
subagent spawn \
--file /tmp/spec.md \
--prompt "Implement this specification" \
--prompt "Run the targeted tests"Restrict tools for a read-only investigation:
subagent spawn --tools read,grep,find,ls --prompt "Investigate the failure"Manage a run by its generated handle:
subagent status a1b2c3
subagent rename a1b2c3 "error handling review"
subagent send a1b2c3 "Focus on error handling"
subagent send a1b2c3 --follow-up "Then summarize"
subagent wait a1b2c3
subagent stop a1b2c3
subagent listUse /subagent to select and attach to an active child. The status widget shows active names (or handles for unnamed runs) and their current state.
Optional spawn flags:
--tools <names>: comma-separated tool allowlist--no-extensions: disable extension discovery while retaining the control bridge--no-skills: disable skills--no-prompt-templates: disable prompt templates--no-context-files: ignore repository instruction files
Nested subagents are disabled. Child sessions do not receive the subagent skill. Children survive /reload. When their spawning Pi session quits or is replaced, running children are suspended: the process stops, but transcript and metadata are kept. Resuming that parent session relaunches them idle with their full history. subagent stop removes a run permanently.