How tintinweb/pi-subagents works
@tintinweb/pi-subagents is a pi extension for autonomous subagents and deterministic workflow orchestration. The main workflow starts in the extension’s pi-facing entry point: users or the orchestrator invoke agent tools, agent types and invocation settings are resolved, and the manager coordinates isolated agent sessions through the runner. Results, usage, and lifecycle state feed the UI and notifications. Separate capabilities include mentions, schedules, nested delegation, memory, and worktree isolation. Workflow scripts have their own host/runtime and progress interface. Edges reflect README statements or source-index references; some integrations are documented but their implementation details were not sampled.
Main entry points: index.ts Extension entry · agent-manager.ts Agent manager · nested-tools.ts Nested tools · runtime.ts Workflow runtime
Components 26
Extension and agents
- Extension entry
src/index.ts - Agent registry
src/agent-types.ts - Custom agents
src/custom-agents.ts - Invocation config
src/invocation-config.ts
Agent runtime
- Agent manager
src/agent-manager.ts - Session runner
src/agent-runner.ts - Nested tools
src/nested-tools.ts - Model resolution
src/model-resolver.ts - Usage accounting
src/usage.ts
User surfaces
- Agent mentions
src/mention.ts - Mention UI
src/ui/agent-mention.ts - Agent widget
src/ui/agent-widget.ts - Fleet view
src/ui/fleet-list.ts - Conversation viewer
src/ui/conversation-viewer.ts
Workflow orchestration
- Workflow tool
src/workflow/host.ts - Workflow runtime
src/workflow/runtime.ts - Workflow metadata
src/workflow/meta.ts - Workflow progress
src/workflow/progress.ts - Workflow task
src/workflow/task.ts - Workflow UI
src/ui/workflow-menu.ts
Persistence and integrations
- Scheduler
src/schedule.ts - Agent memory
src/memory.ts - Worktree isolation
src/worktree.ts - Extension RPC
src/cross-extension-rpc.ts
Other components
- Pi user
- Pi host
Connections 37
- Pi user → Extension entry: invokes
README.md - Pi host → Extension entry: loads extension
README.md - Extension entry → Agent manager: registers agents
src/index.ts - Extension entry → Agent registry: uses registry
src/index.ts - Extension entry → Scheduler: registers schedules
src/index.ts - Extension entry → Workflow tool: registers workflow
src/index.ts - Extension entry → Agent mentions: integrates mentions
src/index.ts - Extension entry → Extension RPC: registers RPC
src/index.ts - Custom agents → Agent registry: provides definitions
src/agent-types.ts - Agent manager → Session runner: starts or resumes
src/agent-manager.ts - Agent manager → Worktree isolation: creates and cleans
src/agent-manager.ts - Agent manager → Usage accounting: records usage
src/agent-manager.ts - Session runner → Agent registry: gets agent config
src/agent-runner.ts - Session runner → Agent memory: loads memory
src/agent-runner.ts - Nested tools → Agent registry: resolves child types
src/nested-tools.ts - Nested tools → Agent manager: delegates child runs
src/nested-tools.ts - Nested tools → Invocation config: resolves options
src/nested-tools.ts - Nested tools → Model resolution: resolves model
src/nested-tools.ts - Extension entry → Nested tools: enables delegation
src/index.ts - Extension entry → Agent widget: registers widget
src/index.ts - Extension entry → Fleet view: registers fleet view
src/index.ts - Extension entry → Mention UI: registers mention UI
src/index.ts - Fleet view → Conversation viewer: opens conversation
src/ui/fleet-list.ts - Conversation viewer → Agent widget: reuses rendering
src/ui/conversation-viewer.ts - Scheduler → Agent manager: starts scheduled agents
src/schedule.ts - Scheduler → Session runner: runs agent
src/schedule.ts - Workflow tool → Agent manager: dispatches agents
src/workflow/host.ts - Workflow tool → Workflow runtime: runs scripts
src/workflow/host.ts - Workflow runtime → Workflow metadata: extracts metadata
src/workflow/runtime.ts - Workflow runtime → Workflow progress: records progress
src/workflow/runtime.ts - Workflow runtime → Workflow task: updates task
src/workflow/task.ts - Workflow UI → Workflow task: inspects runs
src/ui/workflow-menu.ts - Workflow UI → Conversation viewer: opens agent view
src/ui/workflow-menu.ts - Extension entry → Workflow UI: registers workflow UI
src/index.ts - Agent mentions → Agent manager: resolves agent actions
src/agent-manager.ts - Mention UI → Agent manager: uses agent state
src/ui/agent-mention.ts - Invocation config → Agent manager: configures spawning
src/index.ts