npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-echo-subagents

v0.1.0

Published

Delegate tasks to specialized subagents with isolated context, via subprocess pi invocations

Downloads

133

Readme

pi-echo-subagents

Delegate tasks to specialized subagents with isolated context, adapted from Pi's own official subagent example.

Design note

Each invocation spawns a separate pi child process (--mode json -p --no-session [--model x] [--tools a,b,c] --append-system-prompt <tmpfile> "Task: ..."), parsing newline-delimited JSON events from stdout to reconstruct messages, usage, and cost. This gives true OS-level context isolation for free — no SessionManager.fork()/worktree isolation needed, and no risk of the subagent's conversation bleeding into the parent's context or vice versa, since it's a genuinely separate process with --no-session.

This package trades the official example's rich TUI rendering (custom renderCall/renderResult with themed Container output) for the default tool-result display, to keep this module smaller. The mechanism itself — subprocess spawn, JSON-event parsing, .md-frontmatter agent discovery (agents.ts, vendored verbatim from the official example), single/parallel (max 8, concurrency 4)/chain execution modes — is preserved in full. Richer rendering can be layered on later without touching this logic.

Permission-gate composition — read this before relying on it

Verified directly against the installed @earendil-works/pi-coding-agent source (dist/main.js): extension auto-discovery for a spawned child process is entirely independent of --no-session — it's driven by resource-loader options, unrelated to session persistence. Project-local extensions (like pi-echo-permissions, if installed to .pi/extensions/) still require project trust, and trust is resolved per-cwd from a persistent trust store shared between parent and child process.

In the near-universal case — the user's own interactive session already trusted this project before ever invoking a subagent — the child reads that same cached trust and pi-echo-permissions' gate applies to the subagent's tool calls exactly as it does to the parent's. In the narrow edge case of a project that has never been interactively trusted, a headless child cannot answer a trust prompt, and project-local extensions (including pi-echo-permissions itself) silently do not load for that child. This is documented in SECURITY.md, not silently assumed away — if you need the gate to unconditionally apply to subagents even on a project's very first run, trust the project once interactively before using /subagent, or pass explicit -e flags in a custom wrapper around this tool (not implemented here).

Usage

Install locally for development: pi -e ./packages/pi-echo-subagents. Agent definitions are .md files with YAML-ish frontmatter (name, description, optional tools comma-list, optional model), discovered from ~/.pi/agent/agents/ (user scope, default) and/or the nearest ancestor .pi/agents/ (project scope, opt-in via agentScope: "both" or "project" — gated behind a confirmation prompt since project agents are repo-controlled). See examples/agents/ in this package for two starter definitions (scout.md, reviewer.md) — copy them to ~/.pi/agent/agents/ (or a project's .pi/agents/) to try them; they are not auto-installed anywhere by this package.

subagent({ agent: "scout", task: "find where the auth middleware is registered" })
subagent({ tasks: [{agent: "scout", task: "..."}, {agent: "reviewer", task: "..."}] })
subagent({ chain: [{agent: "scout", task: "find X"}, {agent: "reviewer", task: "review {previous}"}] })