TypeScript/Node.js CLI that runs an autoresearch-style PI loop for business operations on top of WorkGraph MCP.
It includes:
src/gather/— Context Gatherer (business.yamlproducer)src/workgraph/— Typed WorkGraph MCP client over JSON-RPC HTTPsrc/metrics/— Health score calculator fromprogram.mdsrc/harness/— Bootstrap + observe/hypothesize/execute/measure loopsrc/cli.ts— CLI entrypoint (gather,bootstrap,run,health)
- Node.js 20+
- A reachable WorkGraph MCP endpoint
npm install
npm run buildRun directly after build:
node dist/cli.js --helpOr install globally from this directory:
npm link
workgraph-pi-harness --helpconfig.yaml must include:
workgraph:
url: https://your-workgraph-host
mcp_endpoint: /mcp
token: wgk_...
actor: pi-agentOptional env overrides:
WORKGRAPH_URLWORKGRAPH_TOKENWORKGRAPH_ACTOR
Discovery-first context gatherer with interview prompts; writes business.yaml.
node dist/cli.js gather --config config.yaml --output business.yamlNon-interactive mode:
node dist/cli.js gather --non-interactiveReads business.yaml, checks graph state, and attempts bootstrap.
node dist/cli.js bootstrap --config config.yaml --business business.yamlRuns bootstrap preflight (unless skipped), then loops forever:
- observe (
status,hygiene,ledger,list_threads) - hypothesize (pick highest-value thread)
- execute (claim; optional auto-complete)
- measure (health score)
- record (
results.tsv)
node dist/cli.js run --config config.yaml --business business.yamlOne cycle only:
node dist/cli.js run --onceSkip bootstrap and set interval:
node dist/cli.js run --skip-bootstrap --interval 3Enable auto-complete:
node dist/cli.js run --auto-completeCalculates health score from live WorkGraph data:
node dist/cli.js health --config config.yamlImplemented from program.md:
health = 100
- (orphan_links × 0.5)
- (stale_threads × 2)
- (blocked_threads × 3)
- (overdue_threads × 5)
- (missing_evidence × 2)
+ (threads_completed_today × 1)
+ (revenue_threads_completed × 3)
+ (automation_triggers_fired × 0.5)
- Results are appended to
results.tsv. rundefaults to conservative behavior: claim-only execution unless--auto-completeis set.- Bootstrap uses
workgraph.workgraph_bootstrapwhen available and falls back toworkgraph.workgraph_query.