pi-agentteam

Multi-agent team orchestration for pi โ€” leader-coordinator pattern with researcher, planner, and implementer teammates in tmux panes

Package details

extension

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.

npm license pi


โœจ 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 fyi to an idle teammate, wake is auto-upgraded to soft so the handoff doesn't stall silently.

Peer completion_report and blocked messages are also mirrored to team-lead so 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 pi sessions in tmux panes, not in-process subagents
  • Passing task to agentteam_spawn starts work immediately; omitting it creates an idle teammate for later send/task follow-up
  • State is local to one machine (no remote/distributed support)
  • Requires tmux; Windows terminals not supported (WSL works)

๐Ÿ“„ License

MIT ยฉ 2026 linys77