pi-agentteam
Multi-agent team orchestration for pi โ leader-coordinator pattern with researcher, planner, and implementer teammates in tmux panes
Package details
Install pi-agentteam from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-agentteam- Package
pi-agentteam- Version
0.4.0- Published
- Apr 28, 2026
- Downloads
- 744/mo ยท 286/wk
- Author
- linys77
- License
- MIT
- Types
- extension
- Size
- 244.1 KB
- Dependencies
- 0 dependencies ยท 4 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-agentteam
Multi-agent team orchestration for pi
Coordinate a leader with specialized teammates โ researcher, planner, and implementer โ each running in a visible tmux pane, collaborating through shared tasks and typed messages.
โจ Highlights
| Feature | ||
|---|---|---|
| ๐ฅ๏ธ | tmux-native teamwork | Each teammate is a real pi session in its own pane โ watch them work in real time |
| ๐ | Shared task board | Create, claim, update, complete โ full lifecycle tracking across the team |
| ๐ฌ | Typed messaging | assignment ยท question ยท blocked ยท completion_report ยท fyi โ each with auto-wake semantics |
| ๐ฏ | Role-based tool guard | Researcher/Planner (read-only) โ Implementer (full tools) โ least privilege by default |
| ๐ก | Event-driven wake | Teammates auto-wake on actionable messages; no polling, no wasted tokens |
| ๐ | Unified /team console |
Browse state, recover old teams, remove stale teammates, and cleanup without memorizing extra commands |
| ๐ | Peer handoff | Workers coordinate directly (researcher โ planner) without going through the leader |
| ๐งน | Zero footprint | One folder, file-based state, no database โ delete and it's gone |
๐ฆ Install
pi install npm:pi-agentteam
Requirements: pi โฅ 0.60 ยท tmux. The leader pi session must run inside tmux.
๐ Quick Start
You (leader):
Create a team and spawn a researcher to analyze the build pipeline.
> agentteam_create({ team_name: "my-project", description: "Optimize the build pipeline" })
> agentteam_spawn({ name: "research", role: "researcher",
task: "Analyze the build pipeline and report bottlenecks" })
> agentteam_spawn({ name: "plan", role: "planner" })
... researcher works in its own tmux pane ...
> agentteam_send({ to: "plan", message: "Research done, draft an optimization plan",
type: "fyi" })
... planner drafts plan ...
> agentteam_receive() โ pick up completion_report from planner
Or open the unified local console:
/team โ local console for status, recovery, and cleanup
๐ฎ /team Console
/team is the only slash command exposed by agentteam. It opens a local console instead of a pile of maintenance commands.
Attached to a team:
/team
โ Members ยท Tasks ยท Mailbox ยท Details
โ select an item
โ Enter opens contextual actions
Not attached to a team:
/team
โ AgentTeam Console
โ list saved teams and stale panes
โ recover an old team as current leader, delete a team, or cleanup all agentteam state
| Key | Action |
|---|---|
Tab |
Cycle sections |
โ โ |
Move selection |
Enter |
Open action menu / choose action |
Esc |
Step back / close |
The panel intentionally does not focus tmux panes or perform task/message CRUD. Use tmux for pane navigation, and use tools for collaboration work. /team is for local runtime visibility, recovery, and cleanup. Expanded Details use an internal reader so long notes/messages remain readable without flooding terminal scrollback.
Available action-menu operations include:
- refresh/reconcile tmux pane bindings;
- sync leader mailbox projection without marking messages read;
- remove selected teammate;
- delete selected/current team;
- recover an existing team as the current leader;
- cleanup all agentteam state and stale panes while keeping the current pane alive and clearing its agentteam label.
๐ฌ Messages & Wake Behavior
Messages carry an implicit wake hint that controls how the recipient reacts. Mailbox lifecycle is created โ delivered โ read: wake marks messages as delivered, while only agentteam_receive marks them read.
| Type | Purpose | Wake | Typical Flow |
|---|---|---|---|
assignment |
Leader โ worker task assignment | hard | Leader delegates work |
question |
Clarification request | soft | Anyone asks a question |
blocked |
Escalation needing attention | hard | Worker hits a wall |
completion_report |
Work finished | hard (leader) ยท soft (teammate) | Worker reports back |
fyi |
Informational update | none* | Context sharing |
* Peer handoff exception: when a non-leader sends
fyito an idle teammate, wake is auto-upgraded tosoftso the handoff doesn't stall silently.Peer
completion_reportandblockedmessages are also mirrored toteam-leadso the leader can always converge completed work and blockers.
๐ฅ Built-in Roles
agentteam intentionally keeps a small fixed role set for predictable permissions and prompts.
๐ฌ researcher โ read grep find ls + collab
Fact finding: relevant files, constraints, risks, and evidence-backed findings
๐ planner โ read grep find ls + collab
Advisory planning for complex work: options, risks, dependencies, and acceptance criteria
๐ implementer โ read grep find ls bash edit write + collab
Focused code changes, checks, and validation evidence
collab =
agentteam_send+agentteam_receive+agentteam_task
โ๏ธ Model Configuration
Create ~/.pi/agent/agentteam/config.json to assign models per role:
{
"agentModels": {
"planner": "glm-5.1",
"researcher": "glm-5.1",
"implementer": "gpt-5.3-codex"
}
}
Values are model selectors from ~/.pi/agent/models.json. Empty string or missing key = use the default model. The leader always uses your current session model.
Runtime state is stored under ~/.pi/agent/agentteam/ (teams/, mailboxes/, session-bindings, and worker-sessions). config.json lives in the same directory. Set PI_AGENTTEAM_HOME only for testing or temporary sandboxes.
๐ Tools & Commands
Tools
| Tool | Description |
|---|---|
agentteam_create |
Create a new team |
agentteam_spawn |
Spawn a teammate (omit task for idle) |
agentteam_send |
Send a typed message |
agentteam_receive |
Pull unread mailbox messages |
agentteam_task |
Manage shared tasks (create ยท claim ยท update ยท complete ยท list ยท note) |
Command
| Command | Description |
|---|---|
/team |
Unified local console for status, recovery, teammate removal, team deletion, and cleanup |
๐ Architecture
index.ts โ Extension entry point
โโโ tools/ โ Thin tool registrations plus team/message/task/worker services & policy helpers
โโโ commands/ โ /team console command and runtime action handlers
โโโ hooks/ โ Thin hook registrations plus lifecycle/context services and tool guard
โโโ teamPanel/ โ Interactive console (layout, view model, input, actions)
โโโ state.ts โ State facade
โโโ state/ โ File-based stores (team, mailbox, bindings, merge policy)
โโโ runtime.ts โ Runtime facade (session helpers, team lookup, leader mailbox projection)
โโโ runtimeRules.ts โ Pure naming, owner, and spawn-task classification rules
โโโ runtimeWake.ts โ Worker/leader wake prompts and wake status updates
โโโ runtimePanes.ts โ Pane reconciliation and team pane cleanup
โโโ runtimeStorage.ts โ Team storage/mailbox readiness cache
โโโ runtimeService.ts โ Leader mailbox sync, digest injection
โโโ protocol.ts โ Message type defaults & wake hints
โโโ orchestration.ts โ Leader digest (coordination counters)
โโโ policy.ts โ Leader delegation policy
โโโ agents.ts โ Role discovery & agent loading
โโโ tmux.ts โ tmux facade
โโโ tmux/ โ tmux client, pane/window/wake/label helpers
โโโ messageLifecycle.ts โ Mailbox created/delivered/read helpers
โโโ types.ts โ Shared type definitions
โโโ agents/ โ Bundled role prompts (markdown)
โโโ researcher.md
โโโ planner.md
โโโ implementer.md
Design Principles
- Removable โ delete the folder and reload; no core modifications
- Observable โ each teammate is a visible tmux pane you can watch
- Minimal prompt burden โ role behavior in markdown, not inflated system prompts
- File-based state โ JSON + lock files + atomic writes; no database
- Event-driven โ teammates wake on actionable messages, not polling
โ Tests
npm test
npm run test:e2e # optional local tmux smoke; requires tmux
| Suite | Covers |
|---|---|
| Tools + state flow | create โ spawn โ send โ receive โ task lifecycle |
| Command | /team unified console |
| Protocol + orchestration | Wake defaults, leader digest injection |
| Panel rendering | Visual output across terminal widths |
| Wake + permission guards | Role-based access control |
| Service unit helpers | Pure worker/message/task/context helper behavior |
โ ๏ธ Limitations
- Workers are separate
pisessions in tmux panes, not in-process subagents - Passing
tasktoagentteam_spawnstarts work immediately; omitting it creates an idle teammate for latersend/taskfollow-up - State is local to one machine (no remote/distributed support)
- Requires tmux; Windows terminals not supported (WSL works)
๐ License
MIT ยฉ 2026 linys77