How javepreem/pi-worker-graph works
pi-worker-graph is a Pi coding-agent extension and DAG-first runtime for coordinating writable workers in a shared checkout. The parent activates the graph tool, scopes tasks, and receives results; the runtime validates dependencies, schedules eligible work, builds bounded prerequisite context, executes workers, and retains reports and run state. Optional capabilities include checks with review/repair, coordination events and inboxes, artifacts, and usage accounting. Edges reflect the README and shown imports or calls; several source excerpts are partial, so uncertain internal links are omitted.
Main entry points: orchestrator.ts Orchestration · run.ts Graph runner · store.ts Run store · extension.ts Extension tools
Components 15
Pi integration
- Extension tools
src/extension.ts - Configuration
src/config.ts
Graph execution
- Orchestration
src/orchestrator.ts - DAG primitives
src/graph.ts - Graph runner
src/run.ts - Pi subprocess
src/pi-subprocess.ts - Checks and review
src/check.ts
Reports and context
- Prerequisite context
src/context.ts - Worker reports
src/output.ts - Execution failures
src/execution-failure.ts - Usage accounting
src/usage.ts - JSON validation
src/json.ts
Run state
- Coordination
src/coordination.ts - Run store
src/store.ts
Other components
- Parent agent
Connections 21
- Parent agent → Extension tools: invokes tools
README.md - Extension tools → Configuration: loads settings
src/extension.ts - Extension tools → Orchestration: registers tool
src/extension.ts - Extension tools → Coordination: imports
src/extension.ts - Orchestration → Configuration: loads profiles
src/orchestrator.ts - Orchestration → Graph runner: runs graph
src/orchestrator.ts - Orchestration → Pi subprocess: configures executor
src/orchestrator.ts - Orchestration → Checks and review: configures checks
src/orchestrator.ts - Orchestration → Run store: accesses run state
src/orchestrator.ts - Graph runner → DAG primitives: schedules tasks
src/run.ts - Graph runner → Prerequisite context: serializes prerequisites
src/run.ts - Graph runner → Run store: reads and publishes
src/run.ts - Graph runner → Worker reports: validates outputs
src/run.ts - Pi subprocess → Checks and review: runs checks
src/pi-subprocess.ts - Pi subprocess → Worker reports: parses tool result
src/pi-subprocess.ts - Prerequisite context → Worker reports: validates reports
src/context.ts - Execution failures → Usage accounting: validates usage
src/execution-failure.ts - Run store → Worker reports: parses artifacts
src/store.ts - Run store → Usage accounting: parses accounting
src/store.ts - Coordination → Run store: persists coordination
src/coordination.ts - Configuration → Pi subprocess: parses profiles
src/config.ts