@mporenta/pi-trading-quant-chain
v0.1.7
Published
Pi extension package for a sequential ML/algo-trading quant agent chain.
Maintainers
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-reviewerThe 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-chainOr run for one session without installing:
pi -e npm:@mporenta/pi-trading-quant-chain --trading-quant-chainAfter installing, launch Pi with:
pi --trading-quant-chainWhat's included
trading-quant-chain.ts— extension entrypoint and chain runner.themeMap.ts— optional theme compatibility helper.agents/agent-chain.yaml— bundledtrading-quantchain 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 to1.
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. |
