@leo-alvarenga/pi-mini-subagents
v0.1.0
Published
Transient subagents for Pi: mini_subagent tool (single + parallel), /subagents command, and a live TUI panel
Maintainers
Readme
@leo-alvarenga/pi-mini-subagents
Transient subagents for the Pi coding agent.
Delegate a task to a separate headless pi process (its own context window),
get its findings back, and watch running/completed subagents live in a panel
above the input editor.
Features
mini_subagenttool: single mode (task) or parallel mode (tasks[], max 8, 4 concurrent). Each subagent is a transientpi --mode json -p --no-sessionprocess, so it has an isolated context window and nothing is persisted.- Read-only by default: subagents get
read/grep/find/ls. SetallowWrite: trueto grantreplace/insert/edit/write(hash-anchored ops preferred). - No recursion: children inherit
PI_SUBAGENT=1and the extension no-ops on it, so a subagent can never spawn its own subagents. - Dynamic minimal prompt: read-only restriction always; a write clause is
appended only when
allowWriteis set. - Question protocol: a subagent that cannot proceed emits a
NEEDS_INPUT:block in its final message. The tool reports the questions and instructs the caller to re-call withanswers(a fresh subagent is spawned with them). - Live TUI panel (
Alt+S): header with running/done counts, Nerd Font status glyphs (⏳ running, ✓ done, ✗ failed, ? needs input), an 8-row budget with… +N more, and hidden entirely while empty. /subagentscommand: prints the full list grouped by status.- Session-isolated state: survives
/reloadand compaction via replay from the session branch; no files written by the extension. Running records are dropped on replay (their processes do not survive a reload).
Install
pi install npm:@leo-alvarenga/pi-mini-subagentsor add the local path / npm spec to your project .pi/settings.json, then run
/reload.
Usage
"Use a subagent to find every place we do auth"
"Run 3 subagents in parallel: one for models, one for providers, one for routes"Tool parameters:
task(single mode) ortasks(parallel mode, array of{ task, allowWrite?, answers?, cwd? })allowWrite(single mode, default false)answers(single mode re-spawn)cwd(single mode working directory)
The NEEDS_INPUT loop
A subagent ends with:
NEEDS_INPUT: - which auth provider should this use?mini_subagentreturnsneeds_inputwith the questions listed.Answer them (ask the user if you don't know), then call
mini_subagentagain with the sametaskand your answers inanswers. A new subagent is spawned with the answers embedded.
Keybinding
Alt+S toggles the panel. If your terminal intercepts that chord, pick a free
one and change PANEL_TOGGLE_CHORD in src/constants.ts.
Skill
The package ships a sample subagent skill (skills/subagent/SKILL.md),
auto-loaded by pi. It teaches the agent when to delegate to mini_subagent,
how to write self-contained tasks, and when to keep work in the main context.
To install it manually (e.g. without the extension), copy that SKILL.md into
~/.pi/agent/skills/subagent/.
License
MIT — see LICENSE. Copyright (c) 2026 Leonardo A. Alvarenga.
