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

@yishan-io/pi-subagents

v0.2.6

Published

Pi sub-agent orchestration package for Yishan.

Readme

@yishan-io/pi-subagents

Pi sub-agent orchestration package for Yishan.

What it provides

This package adds a lightweight multi-agent layer on top of Pi using Pi's SDK session APIs.

Current MVP features:

  • @agent:<name> direct invocation
  • Multiple leading @agent:<name> tokens with one shared task
  • /agent, /agents, /agent-result, /agent-stop, /agent-steer, /agent-send, /agent-view
  • Main-agent Agent tool for delegation
  • User/project agent overrides
  • Background runs, stop/steer support, and persisted child sessions in the shared Pi session store
  • Live TUI footer status and progress widget for queued/running agents
  • Read-only-aware concurrency control

Installation

As a Pi package:

pi install /absolute/path/to/packages/pi-subagents

Or from a checked-out monorepo path:

pi install ./packages/pi-subagents

The package manifest exposes the extension from ./extensions.

Child-session extensions

Child sessions are isolated: they load with noExtensions: true, so settings.json packages do not run inside sub-agents. Extension tools that should reach sub-agents are forwarded explicitly as inline factories via resolveChildExtensionFactories() (src/runtime/childExtensions.ts). Today this forwards the optional @yishan-io/pi-lsp factory (when installed) so lsp_diagnostics/lsp_fix work in child sessions; any future extension whose tools belong in sub-agents must be added there.

Agent definition locations

This package ships built-in agents inside the package:

  • general
  • explore
  • builder
  • code-reviewer
  • plan-reviewer

User and project full-definition overrides use standard Pi locations:

  • User: <active-agent-dir>/agents/*.md (normally ~/.pi/agent/agents/*.md; Yishan-managed sessions use ~/.yishan/pi/agent/agents/*.md)
  • Project: .pi/agents/*.md

Model and thinking level are part of the agent definition frontmatter (model: / thinking:), so a user markdown definition can set them without touching built-in files. A project .pi/agents/*.md definition remains the highest-priority full override, including for model and thinking.

Since 0.2.0 the old <active-agent-dir>/agent.overrides.json patch file is no longer read. If you previously used it to set model/thinking, move those values into the model: / thinking: frontmatter of the agent definition file.

Override precedence:

  1. project markdown definition
  2. user markdown definition
  3. built-in definition

Built-in agents

general

  • Purpose: general-purpose implementation and investigation
  • Default tools: unset (falls back to the user's normal Pi tool/session resolution)
  • Default mode: writable when needed
  • Default model: unset (falls back to the user's normal Pi session/model resolution)

explore

  • Purpose: search and understand the codebase
  • Default tools: read, grep, find, ls
  • Default mode: read-only
  • Default model: unset (falls back to the user's normal Pi session/model resolution)

builder

  • Purpose: implement one scoped task from a plan or task brief
  • Default tools: read, grep, glob, bash, apply_patch, lsp_diagnostics, lsp_fix
  • Default mode: writable when needed
  • Default model: unset

code-reviewer

  • Purpose: review code changes for bugs, regressions, and missing tests
  • Default tools: read, grep, glob, bash, lsp_diagnostics
  • Default mode: read-only
  • Default model: unset

plan-reviewer

  • Purpose: review implementation plans before execution
  • Default tools: read, grep, glob
  • Default mode: read-only
  • Default model: unset

Usage

Direct invocation

@agent: is shorthand for the main agent to delegate through the Agent tool, receive the sub-agent result, and continue the work. The original shorthand stays visible in the transcript; the expanded delegation prompt is applied only to LLM context.

Single agent:

@agent:explore investigate how authentication works

Multiple agents with one shared task:

@agent:explore
@agent:general

Investigate the current authentication implementation.

Slash commands

/agents
/agent explore inspect the auth flow
/agent explore --background inspect the auth flow
/agent-result agent-abc123
/agent-stop agent-abc123
/agent-steer agent-abc123 focus on tests too
/agent-send agent-abc123
/agent-view
/agent-view agent-abc123

Keyboard shortcuts:

  • Ctrl+J opens the live sub-agent viewer selector

Main-agent tool

The package registers an Agent tool for the main agent:

Agent({
  agent: "explore",
  prompt: "Investigate authentication",
  background: true,
})

Foreground runs return the child agent response. Background runs return the new agent id immediately. Completed background results are not auto-injected back into the main agent; use /agent-send <agent-id> (or /agent-send for all completed runs) to hand them back manually. /agent-steer applies only to a currently running agent, and this MVP does not expose an OpenCode-style resumable task_id flow.

Live progress in TUI

While agents are queued or running, the extension shows:

  • a footer status like 🤖 1 running · 2 queued
  • a widget above the editor listing active agent ids, names, and modes
  • a popup live sub-agent viewer via /agent-view or Ctrl+J

Child session persistence

Each sub-agent run now persists as a normal Pi session under the shared Pi session store (for example under ~/.yishan/pi/agent/sessions/... in Yishan-managed environments).

The child session stores:

  • normal Pi session history
  • parentSession linkage back to the main session
  • child metadata such as agent id, title, and summary

The parent session also records child-reference metadata so the relationship can be reconstructed later.

Current MVP limitations

  • Autocomplete uses a flat merged list with clear Agent · ... labels; it does not yet render explicit grouped Agents / Files sections.
  • Child sessions intentionally disable extension loading to avoid recursive self-loading; they still use Pi SDK sessions, context files, and normal tool/session infrastructure.
  • Session-history list filtering/classification for parent vs child sessions is intentionally deferred to a separate follow-up task.
  • Built-in agent definitions are loaded from this package manually because Pi packages do not auto-discover agent-definition directories.
  • The package currently exposes only the single-agent Agent tool; result/stop/steer remain slash-command driven, and background-result handoff remains manual via /agent-send.
  • The progress widget is intentionally lightweight for MVP; it does not yet stream rich per-agent session history or provide a dedicated selector/details pane.
  • Child runs are fresh Pi SDK sessions; this MVP does not expose an OpenCode-style resumable task_id/session-resume API.

License

This package is licensed under the MIT License. See LICENSE.

Development

Package-local checks:

bun run --cwd packages/pi-subagents typecheck
bun run --cwd packages/pi-subagents lint
bun run --cwd packages/pi-subagents test