henyo-pi-subagent
v1.0.4
Published
Subagent extension for Pi — dual Qwen3.6 model setup (35B-A3B + 27B)
Readme
henyo-pi-subagent
Subagent extension for Pi — delegate tasks to specialized agents with isolated context windows, configured for a dual Qwen3.6 model setup (35B-A3B + 27B) served via llama.cpp router.
Models
| Agent | Model | Context | Role | |---|---|---|---| | scout | qwen3.6-27b | 58k | Fast codebase exploration, compressed findings | | planner | qwen3.6-35b-a3b | 200k | Implementation planning with deep reasoning | | worker | qwen3.6-27b | 58k | Deterministic code implementation | | reviewer | qwen3.6-35b-a3b | 200k | Insightful code review and quality analysis | | researcher | qwen3.6-35b-a3b | 200k | Web research, fact-finding, and information synthesis |
Installation
Via npm (recommended)
pi install npm:henyo-pi-subagentVia git
pi install git:github.com/<user>/henyo-pi-subagent@v1Local development
pi install /workspace/henyo-pi-subagentTry without installing
pi -e /workspace/henyo-pi-subagentAgents and prompts are bundled with the extension — no manual file copying needed. User-level agents in ~/.pi/agent/agents/ override bundled agents with the same name.
Usage
Via prompt templates (recommended)
# Full implement chain: scout → planner → worker
pi -p "/template implement 'Add a new API endpoint for user profiles'"
# Scout and plan only: scout → planner
pi -p "/template scout-and-plan 'Explore the auth module'"
# Implement with review: worker → reviewer → worker
pi -p "/template implement-and-review 'Refactor the auth module'"Direct subagent tool calls
The main agent can invoke subagents directly:
{ "agent": "scout", "task": "Find all authentication-related code" }{
"chain": [
{ "agent": "scout", "task": "Explore the codebase for: <query>" },
{ "agent": "planner", "task": "Create a plan for <query> using: {previous}" },
{ "agent": "worker", "task": "Implement the plan: {previous}" }
]
}How It Works
Each subagent runs as a separate pi subprocess with its own context window. This prevents the main agent's context from bloating with task-specific details.
Prompt composition (applied in order):
- Qwen3.6 preamble — injected by
model-system-prompt.tsextension for allqwen3*models - Pi default system prompt — standard tool-use instructions
- Agent role prompt — from the agent's
.mdfile (bundled or user override)
Model swap: With MODELS_MAX=1, the llama.cpp router swaps models on demand (~5-15s). Chains are the recommended pattern over parallel execution.
Customization
Override an agent
Create ~/.pi/agent/agents/scout.md with your own frontmatter + body. It will take precedence over the bundled version.
Add new agents
Create .md files in ~/.pi/agent/agents/ with frontmatter:
---
name: my-agent
description: What this agent does
model: qwen3.6-27b
tools: bash,read,edit,write
---
Your role-specific system prompt here.File Structure
henyo-pi-subagent/
├── index.ts # Extension entry point
├── agents.ts # Agent discovery (package + user + project)
├── package.json # Pi package manifest
├── agents/ # Bundled agent definitions
│ ├── scout.md
│ ├── planner.md
│ ├── worker.md
│ ├── reviewer.md
│ └── researcher.md
├── prompts/ # Prompt templates
│ ├── implement.md
│ ├── scout-and-plan.md
│ └── implement-and-review.md
└── README.md