@mporenta/pi-trading-quant-chain

Pi extension package for a sequential ML/algo-trading quant agent chain.

Packages

Package details

extension

Install @mporenta/pi-trading-quant-chain from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@mporenta/pi-trading-quant-chain
Package
@mporenta/pi-trading-quant-chain
Version
0.1.18
Published
Jun 7, 2026
Downloads
2,133/mo · 763/wk
Author
pi-porenta
License
MIT
Types
extension
Size
115.8 KB
Dependencies
1 dependency · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./trading-quant-chain.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@mporenta/pi-trading-quant-chain

Pi package for a sequential machine-learning / algo-trading agent pipeline:

trading-quant-researcher ──▶ trading-quant-architect ──▶ trading-quant-planner ──▶ trading-quant-developer ──▶ trading-quant-reviewer

The extension registers the --trading-quant-chain flag, /trading-quant-chain commands, a status widget, and the run_trading_quant_chain tool.

Install

pi install npm:@mporenta/pi-trading-quant-chain

Or run for one session without installing:

pi -e npm:@mporenta/pi-trading-quant-chain --trading-quant-chain

After installing, launch Pi with:

pi --trading-quant-chain

What's included

  • trading-quant-chain.ts — extension entrypoint and chain runner.
  • themeMap.ts — optional theme compatibility helper.
  • agents/agent-chain.yaml — bundled trading-quant chain definition.
  • agents/trading-quant-*.md — bundled researcher, architect, planner, developer, and reviewer definitions.
  • fixtures/fake-pi-child.mjs — deterministic fake child Pi for local no-provider smoke tests.

Project-local .pi/agents definitions take precedence when present; the bundled definitions are the fallback that makes the npm package self-contained.

Current behavior

  • The researcher runs before the architect so architecture follows concrete repo evidence.
  • The widget shows a full-width Current Agent activity panel above the chain cards.
  • Chain cards use distinct pending, running, complete, and error status colors.
  • Debug logging can capture step prompts, handoffs, child events, tool calls, token counts, lags, and developer delta metadata.
  • The reviewer receives a programmatic developer delta and should not fail solely on unrelated pre-existing dirty files.
  • If the reviewer returns CHAIN_RETRY_REQUIRED, the orchestrator automatically reruns the developer once, then reruns the reviewer. The retry limit is hard-coded to 1.

See trading-quant-chain.README.md for local development and debugging details.

Safety defaults

The chain defaults to research, simulation, dry-run, and paper-trading behavior. It reviews for leakage, look-ahead bias, backtest realism, transaction costs, slippage, timezones, calendars, broker/live-order safety, secrets, and operational risk.

Environment variables

Variable Default Purpose
TRADING_QUANT_CHAIN_PROGRESS_INTERVAL_MS 15000 User-visible progress throttle.
TRADING_QUANT_CHAIN_IDLE_TIMEOUT_MS 900000 Child idle timeout.
TRADING_QUANT_CHAIN_STEP_TIMEOUT_MS 2700000 Per-step max runtime.
TRADING_QUANT_CHAIN_DEBUG / ..._VERBOSE off Enable JSONL debug logs.
TRADING_QUANT_CHAIN_DEBUG_MAX_CHARS 20000 Max characters stored for any single logged string.
TRADING_QUANT_CHAIN_DEBUG_HEARTBEAT_INTERVAL_MS progress interval Frequency for idle/lag heartbeat records.
TRADING_QUANT_CHAIN_DEBUG_RAW_CHILD_EVENTS off Log raw child event type records.
TRADING_QUANT_CHAIN_DEBUG_STREAM_DELTAS off Log every streamed assistant text delta.