Files
foxhunt/docs/superpowers
jgrusewski d4ea54d780 spec(ml-alpha): CfC + PPO greenfield design
Approved design document for the ml-alpha rebuild. Seven sections plus
appendices, all 7 sections + ISV-driven auto-tuning addition approved
via the brainstorming-skill flow.

Key architectural decisions:
- Full closed-loop scope: training + offline inference + live IBKR
- Three components: ml-alpha library, alpha_train binary, AlphaPpoStrategy
  in trading_agent_service (reuses existing data_acquisition,
  trading_service, broker_gateway, and the 1177-LOC IBKR adapter that
  already exists in trading_engine)
- Snapshot-level CfC perception trunk (Closed-form Continuous-time, the
  trainable LTC variant from Hasani 2022) — chosen over Mamba2 for
  native multi-time-scale via per-cell learnable τ; hard validation
  gate requires CfC AUC ≥ Mamba2 baseline before continuing
- 5 multi-horizon heads at {30, 100, 300, 1000, 6000} snapshots forward
- Decision-stride 50 snapshots (~1 min); empirically validated this
  session (per-bar→stride=200 flipped 3-fold mean Sharpe from -4.29 to
  +1.78 at quarter-tick cost)
- Action: target_position categorical ∈ {-10, ..., +10}; max_train=10
  fixed at architecture level, max_live ≤ 10 runtime-cappable
- Reward in price units (position-size invariant): dense per-segment
  PnL − C_trade·|Δcontracts| − C_vol·vol_excess; C_trade=0.034 fixed
  (IBKR $1.70 RT ÷ $50/point), C_vol=0 default
- Full online learning with EWC anchoring + 80/20 offline/live replay
  buffer + kill-switch on σ-band metric deviations (loss, mean reward,
  hit-rate, KL, entropy)
- All hyperparameters that vary during training are ISV-driven
  (controller outputs, not magic numbers) per
  pearl_controller_anchors_isv_driven.md
- Fully GPU-resident on hot path per feedback_cpu_is_read_only.md
- $35k starting capital; conservative max_live ramp 1→2→3 contracts
  with manual config bumps gated on realized track record
- Documented IBKR-specific quirks (PDT, mid-session margin spikes,
  rollover, halts, rate limits) with concrete design responses

Supersedes the abandoned 2026-05-16-alpha-ppo-trainer.md (DQN-port plan)
which inherited the wrong architectural shape.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 19:59:51 +02:00
..