How gcoder1991/pi-mesh works
pi-mesh is a Pi extension for running durable Mesh DAGs and direct child agents through a shared in-process agent runtime. The main path starts with Host tool or command input, routes work through the extension and agent managers, executes child sessions, then exposes results and live status. It also supports scheduled and YAML-defined workflows, consensus runs, mailbox control, recovery, and optional bridging. The graph uses documented capabilities and sampled imports; unsampled implementation details are represented only where the tree or README supports them.
Main entry points: extension.ts Native extension · manager.ts Mesh manager · session-agents.ts Direct agent manager · subagent-runtime.ts Child session runtime
Components 23
Host entry points
- Native extension
src/extension.ts - Direct tools
src/compat-extension.ts
Agent execution
- Agent discovery
src/agents.ts - Direct agent manager
src/session-agents.ts - Child session runtime
src/subagent-runtime.ts - Model resolution
src/model-resolution.ts - Worktree isolation
src/worktree.ts - Agent memory
src/memory.ts
Mesh lifecycle
- Mesh manager
src/manager.ts - Workflow loader
src/workflows.ts - Consensus template
src/consensus-template.ts - Agent scheduler
src/scheduler.ts
State and control
- Mesh settings
src/settings.ts - Durable run store
src/store.ts - Run recovery
src/recovery-state.ts - Mailbox and control
src/store.ts - Optional host bridge
src/host-bridge.ts
Results and inspection
- Agent fleet view
src/fleet-view.ts - Mesh inspector
src/mesh-tree.ts - Conversation viewer
src/conversation-viewer.ts - Completion notifications
src/notifications.ts
Other components
- Pi Host
- Pi AgentSessions
Connections 30
- Pi Host → Native extension: invokes tools
- Pi Host → Direct tools: uses commands
- Native extension → Mesh manager: dispatches Mesh
- Native extension → Direct agent manager: dispatches agents
- Native extension → Mesh settings: loads settings
- Native extension → Agent discovery: discovers agents
- Native extension → Durable run store: stores messages
- Native extension → Mesh inspector: opens inspector
- Direct tools → Direct agent manager: launches agents
- Direct tools → Agent scheduler: schedules agents
- Direct tools → Model resolution: resolves model
- Mesh manager → Durable run store: checkpoints runs
- Mesh manager → Run recovery: validates state
- Mesh manager → Child session runtime: executes children
- Mesh manager → Worktree isolation: isolates tasks
- Workflow loader → Mesh manager: provides tasks
- Consensus template → Mesh manager: defines graph
- Direct agent manager → Child session runtime: runs agents
- Direct agent manager → Durable run store: persists registry
- Child session runtime → Pi AgentSessions: creates sessions
- Child session runtime → Model resolution: selects model
- Child session runtime → Worktree isolation: uses isolation
- Optional host bridge → Mesh settings: checks access
- Optional host bridge → Mailbox and control: routes messages
- Native extension → Mailbox and control: sends control
- Agent fleet view → Direct agent manager: shows agents
- Agent fleet view → Conversation viewer: opens transcript
- Mesh inspector → Mesh manager: reads runs
- Native extension → Completion notifications: notifies completion
- Direct agent manager → Agent memory: uses agent memory