pi-agented
Generic subagent switcher for pi. Header bar above chat, Ctrl+Shift+S to cycle, /agent slash command. Works with any agent in ~/.pi/agent/agents/.
Package details
Install pi-agented from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-agented- Package
pi-agented- Version
0.2.0- Published
- Jun 15, 2026
- Downloads
- not available
- Author
- lowern1ght
- License
- MIT
- Types
- extension
- Size
- 33.1 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-switch — generic subagent switcher for pi
A tiny pi extension that gives you a persistent indicator of the current subagent (header bar above chat) and lets you cycle / set / create agents. Generic — works with any agent in ~/.pi/agent/agents/.
Features
- Header bar above chat — shows current agent with emoji + description
- Ctrl+Shift+S to cycle to next agent (Shift+Tab is taken by pi's thinking-level cycler)
/agentslash command to show current + available/agent <name>to set explicitly/agent create <name>to scaffold a new user agent/agent doctorto diagnose/agent recommend <task>to suggest the right agent for a task- Task → agent heuristics baked into the system prompt so the LLM picks the right agent for the task
- Persists to
.soly/agent(if soly project) or~/.pi-switch/agent(standalone) - Reads user agents from
~/.pi/agent/agents/*.mdon every cycle — drop a file and Ctrl+Shift+S to see it
How agents work
Agents are markdown files with YAML frontmatter. pi-subagents (and pi-switch) discover them from these locations:
| Path | Type | Editable |
|---|---|---|
~/.pi/agent/npm/node_modules/pi-subagents/agents/*.md |
built-in (worker, oracle, scout, ...) | ❌ |
~/.pi/agent/agents/*.md |
user-defined | ✅ |
~/.pi/agent/extensions/soly/agents/*.md (auto-installed if useSolyWorkerSubagents: true in .soly/config.json) |
soly-augmented (soly-worker, soly-debugger, ...) | ✅ source |
Frontmatter schema
---
name: my-reviewer # required, unique, [a-zA-Z0-9_-]{1,64}
description: One-liner shown in picker
thinking: medium # off | minimal | low | medium | high | xhigh
systemPromptMode: replace # replace | append
inheritProjectContext: true
inheritSkills: false
tools: read, grep, find, ls, bash, edit, write
defaultContext: fork # fresh | fork
---
You are `my-reviewer`. The system prompt goes here.
Create a new agent
Option A: manually
Drop a markdown file in ~/.pi/agent/agents/<name>.md (see schema above). Press Ctrl+Shift+S in pi — it joins the cycle.
Option B: via slash command
/agent create my-debugger
You'll be prompted for a one-liner description. Then edit the file to specialize the system prompt.
Test agents
| Action | How |
|---|---|
| See current + available | /agent |
| Cycle | Ctrl+Shift+S |
| Set explicitly | /agent soly-debugger |
| Diagnose | /agent doctor |
| Recommend for a task | /agent recommend investigate React Server Components |
The LLM can also auto-pick — see "Task → agent" below.
Task → agent heuristics
The LLM's system prompt includes a table mapping task keywords to agents. When the user request matches, the LLM should call /agent <name> first, then subagent({ agent: <name>, ... }).
| Keywords | Agent | Why |
|---|---|---|
| research, investigate, look up, find out, explore, compare libraries | 📚 researcher | external docs, ecosystem behavior |
| scout, scan, map, where is, locate, skim | 🔍 scout | codebase recon |
| plan, design, architect, outline, structure | 📋 planner | decompose into steps |
| review, audit, check, adversarial, critique, qa | 👀 reviewer | adversarial review |
| oracle, decision, tradeoff, which approach, drift | 🔮 oracle | decision consistency |
| debug, bug, fix, crash, error, repro | 🐞 soly-debugger | bug investigation |
| test, tests, coverage, spec, assert | 🧪 soly-tester | test-only work |
| refactor, clean up, simplify, extract, rename | 🔄 soly-refactor | pure refactoring |
| document, docs, readme, jsdoc | 📝 soly-documenter | doc updates |
| implement, build, write code, add feature | ⚡ worker | implementation |
| orchestrate, coordinate, dispatch, chain | 🤝 delegate | multi-agent |
Same keywords in Russian work (изучи, баг, тест, etc.).
Integration with other extensions
- soly reads
globalThis.__PI_SWITCH_AGENT__to know which subagent to launch forsoly execute. Falls back to"worker"if pi-switch isn't loaded. - Soly also auto-installs soly-augmented agents (soly-worker, soly-debugger, etc.) to
~/.pi/agent/agents/whenuseSolyWorkerSubagents: truein.soly/config.json.
Files
core.ts— agent metadata, discovery, cycling, persistenceprompt.ts— system-prompt section + task→agent heuristics +recommendAgentindex.ts— header bar, Ctrl+Shift+S,/agentslash command,/agent create//agent doctor//agent recommendtests/core.test.ts— 21 tests for core logictests/prompt.test.ts— 20 tests for prompt + recommendAgent
Development
cd ~/.pi/agent/extensions/pi-switch
bun test # 41 tests
bun run typecheck # tsc --noEmit