Commit Graph

196 Commits

Author SHA1 Message Date
jgrusewski
2e3ac28e1b docs: implementation plan for 17 additional training metrics
9 tasks covering: training_metrics.rs (definitions + verbose gate),
monitoring.proto (12 new fields), service.rs (match arms + tests),
fxt monitor CLI (grad norm, RL diagnostics, hyperopt trial detail),
DQN/PPO trainers (per-epoch recording), supervised binary (LR + duration),
hyperopt binaries (elapsed_seconds), and full workspace verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 23:48:18 +01:00
jgrusewski
477b9cf1cf docs: GPU PER sum-tree implementation plan (13 tasks)
TDD plan covering GpuReplayBuffer, proportional + rank-based GPU
sampling, priority scatter updates, async loss readback, trainer
integration, OOM fallback, and distribution correctness tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 23:45:27 +01:00
jgrusewski
9105921f8d docs: additional training metrics design — 17 new Prometheus metrics
Two-tier system: 12 always-on gauges (RL diagnostics, gradient health,
hyperopt intra-trial) + 5 opt-in verbose metrics gated behind
FOXHUNT_VERBOSE_METRICS=1. Extends proto, monitoring service, and CLI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 23:44:45 +01:00
jgrusewski
995c473ad9 docs: GPU-resident PER sum-tree design
Approved design for moving Prioritized Experience Replay entirely to
GPU — flat priority array with parallel prefix-sum sampling, GPU-resident
ring buffer for experiences, async loss readback. Eliminates the last
major CPU bottleneck in the DQN training loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 23:40:57 +01:00
jgrusewski
0c227bb7d0 docs: add monitoring service design — live training metrics over gRPC
New standalone monitoring_service that bridges Prometheus → gRPC,
enabling `fxt train monitor` and web-gateway WS streaming for
all training jobs (CI and service-managed).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 21:05:48 +01:00
jgrusewski
eefb191a62 docs: add implementation plan for fxt broker check command
7 tasks: deps → config → proto → broker.rs → main.rs wiring → lint → verify.
TDD approach with exact file paths and commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:28:51 +01:00
jgrusewski
50d1aff97c docs: add design for fxt broker check CLI command
Two-layer IBKR connectivity validation: direct ibapi handshake +
broker-gateway gRPC health check. Pure-client architecture using
ibapi as optional dep on fxt (not trading_engine).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:26:17 +01:00
jgrusewski
a489e6455e chore(infra): delete 8 per-service binary-cache PVCs (replaced by foxhunt-binaries)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 11:20:03 +01:00
jgrusewski
d35f4e0565 docs: binary cache PVC consolidation design (8 PVCs → 1 shared)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 10:58:33 +01:00
jgrusewski
58f8478320 infra(tf): add platform pool, rename services → foxhunt in Kapsule module
Terraform changes for 3-pool node split:
- New `platform` pool resource (DEV1-L, databases + monitoring)
- Renamed `services` → `foxhunt` pool (DEV1-L, max_size 1)
- Updated variables, outputs, and live terragrunt inputs
- Updated implementation plan with Terraform-based workflow

Apply in 2 phases:
  Phase 1: terragrunt apply -target=scaleway_k8s_pool.platform
  Phase 2: terragrunt apply (after databases migrated to platform)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 09:59:21 +01:00
jgrusewski
9942ba8c29 docs: 3-pool node split implementation plan
11-task step-by-step plan: create platform pool, move monitoring
(stateless), migrate databases (PVC migration with backups), scale
services pool to 1 node. Includes verification and rollback procedures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 09:54:28 +01:00
jgrusewski
4da3a16bfe docs: 3-pool node split design (gitlab/platform/foxhunt)
Isolate platform infra (postgres, redis, minio, monitoring) from foxhunt
app services on separate DEV1-L nodes. Same EUR 61/mo total cost, better
blast radius containment and burst headroom for trading services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 09:49:46 +01:00
jgrusewski
3799981321 docs: add infrastructure security hardening implementation plan
7-task plan: NetworkPolicy (default-deny + per-service), SecurityContext
(pod + container hardening), secret scoping (split foxhunt-secrets),
deploy-secrets.sh (Scaleway integration), Trivy CI scanning.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 23:16:44 +01:00
jgrusewski
a5e0558e08 docs: add infrastructure security hardening design
Minimal hardening plan for production deployment: NetworkPolicy
(default-deny + explicit allow), SecurityContext on all pods,
secret scoping (split monolithic foxhunt-secrets), and Trivy
image scanning in CI pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 23:13:13 +01:00
jgrusewski
5296b44fe7 docs: workspace cleanup design and implementation plan
Delete 92 scattered .md files, 137 plan docs, create/update all READMEs,
add lib.rs doc comments, clean stale worktrees.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 22:32:54 +01:00
jgrusewski
7524406e3b docs: training observability implementation plan (reduced scope)
DCGM exporter + dashboards already exist. Actual work: 3 tasks —
per-fold metrics in train_baseline_rl, OTLP tracing in all 6 binaries,
OTEL env var in K8s job template.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 22:31:54 +01:00
jgrusewski
638d7c733f docs: training observability + Grafana dashboards design
GPU metrics polling, per-epoch RL metrics, OTLP tracing in training
binaries, and three Grafana dashboards (training cockpit, traces,
infra cockpit trace row).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 22:25:11 +01:00
jgrusewski
8910591f85 docs: I/O pipeline wiring implementation plan — 7 tasks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:42:38 +01:00
jgrusewski
93ad873e40 docs: I/O pipeline wiring design — prefetcher, buffer pool, double-buffer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:39:50 +01:00
jgrusewski
69a9808107 docs: GPU full sweep implementation plan — 17 tasks covering P0-P3
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:25:36 +01:00
jgrusewski
7cb8c305df docs: GPU optimization full sweep design — training binary, PPO parity, NCCL multi-GPU
Audit found training binary bypasses all DQNTrainer/PpoTrainer infrastructure
and explicitly disables Rainbow DQN. Design covers 6 sections:
- P0: Wire train_baseline_rl.rs to Trainers
- P1: PPO mixed precision + gradient accumulation + Liquid/TLOB detach fixes
- P2: Mamba2 HardwareBudget + CUDA pipeline wiring + NCCL multi-GPU
- P3: Ensemble parallel inference + BF16 benchmarks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:25:36 +01:00
jgrusewski
6157ea0f77 docs: add deferred stubs implementation plan
6-task plan: proto change, client compilation, retrain wiring,
ensemble confidence RPC, portfolio positions DB query, verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:21:53 +01:00
jgrusewski
e006518ab0 docs: add deferred stubs implementation design
Design for 3 remaining deferred stubs from 2026-02-24 audit:
- Retrain Model: fine-tune via gRPC with TrainingMode proto field
- Portfolio Positions: PositionProvider trait with broker + DB fallback
- ML Confidence: ensemble RPC with liquidity heuristic fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 21:17:30 +01:00
jgrusewski
eaa2cf4e5a docs: add codebase consolidation implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 19:25:01 +01:00
jgrusewski
cbd36fb7eb docs: add codebase consolidation & DRY cleanup design
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 19:22:22 +01:00
jgrusewski
169821b3da docs: GPU max performance Phase 2 design (L4 → H100)
8 optimizations: dynamic batch size, tensor core alignment, no-grad
inference, CUDA stream double-buffering, epoch prefetch, INT8
quantized inference, memory pinning, CUDA kernel optimization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 18:37:03 +01:00
jgrusewski
b91fa43b32 Merge branch 'worktree-gpu-max-performance'
# Conflicts:
#	crates/ml/examples/hyperopt_baseline_rl.rs
2026-03-01 18:00:10 +01:00
jgrusewski
2b2ff4ffa5 feat(ml): maximize GPU utilization — BF16 mixed precision, dynamic sizing, sync reduction
Wire BF16/FP16 mixed precision end-to-end for DQN and PPO with auto-detection
from GPU name (Ampere+ → BF16, Volta/Turing → FP16). Add hidden_dim_base to
hyperopt and wire through training/eval binaries. Reduce GPU sync points: make
DQN NaN checks periodic (every 100 steps), replace PPO GAE GPU round-trip with
pure CPU implementation. Cache training data across hyperopt trials for all 10
models via Arc. Batch DQN experience storage (128x fewer lock acquisitions).
Correct VRAM constants and batch bounds for all 9 supervised model adapters.

28 files changed, +1207/-208 lines. 2418 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 17:54:25 +01:00
jgrusewski
259082279d docs: ML inference production cleanup implementation plan
8-task plan covering:
- Delete ~4,600 lines of dead code (push_metrics, legacy tests/benches)
- Remove MLFeatureExtractor from trading_agent_service
- Delete MLFeatureExtractor + SimpleDQNAdapter from ml_strategy.rs (~2,100 lines)
- Refactor SharedMLStrategy to new_with_models() constructor
- Update all callers (backtesting, integration tests)
- Create EnsembleModelAdapter + build_production_strategy() factory
- Harden metrics HTTP server (timeout, size limit, charset)
- Full verification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 17:23:07 +01:00
jgrusewski
c9de023b32 docs: ML inference production cleanup design
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 17:16:08 +01:00
jgrusewski
415480929d docs: training metrics design — common::metrics ownership
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 15:23:41 +01:00
jgrusewski
d417807132 docs: add real metrics overhaul implementation plan
13-task plan across 4 layers: fix dashboard PromQL, add metrics
servers to data-acquisition and web-gateway, create gRPC metrics
Tower layer, deploy Pushgateway for training jobs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 02:00:08 +01:00
jgrusewski
43235686a8 docs: add real metrics overhaul design
Four-layer plan: fix dashboard queries to use real metric names,
add metrics servers to data-acquisition and web-gateway, add shared
gRPC metrics tower layer, deploy Pushgateway for training job metrics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 01:51:24 +01:00
jgrusewski
9bbb03dcf1 docs: GPU utilization optimization implementation plan
5 tasks: fix DQN batch clamp, add HyperoptStrategy, wire VRAM-aware
concurrency, update binary, verify. TDD throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 21:24:51 +01:00
jgrusewski
6d7684a0c5 docs: GPU utilization optimization design
Parallel hyperopt trials, VRAM-aware batch bounds, 5-layer OOM protection.
Scales from L4 through H100.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 21:18:51 +01:00
jgrusewski
359f847026 docs: add S3 binary share implementation plan (15 tasks)
Detailed step-by-step plan covering: S3 bucket creation, CI builder
updates, 3 base image Dockerfiles, CI pipeline rewiring, 8 cache PVCs,
all service deployment YAML updates, training job template, and cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:50:37 +01:00
jgrusewski
df20ed74d4 docs: add S3 binary share design — eliminate Docker builds, faster pod startup
Replace per-service Docker images with generic base images + S3-based binary
distribution. CI compiles and uploads stripped binaries to S3. Pods fetch
binaries via initContainer with PVC cache fallback for trading resilience.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:46:13 +01:00
jgrusewski
f0f779a971 docs: add PPO CUDA pipeline Phase 2c implementation plan — 11 tasks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 13:07:20 +01:00
jgrusewski
a38dd64a71 docs: add PPO CUDA pipeline Phase 2c design — zero-roundtrip experience collection
Single monolithic kernel with in-kernel GAE, full portfolio simulation,
shared device functions header, 5-layer critic matching trainer exactly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:59:45 +01:00
jgrusewski
5c23c79a1c docs: add Phase 2b implementation plan — 10 tasks for zero-roundtrip kernel
Detailed task-by-task plan for implementing the full GPU experience
collection pipeline:

Task 1-3: CUDA kernel (Q-network, curiosity, barrier, diversity, reward)
Task 4: Weight extraction module (VarMap → CudaSlice)
Task 5: GPU experience collector (Rust wrapper + buffer management)
Task 6: Unit tests for weights and kernel compilation
Task 7: DQN trainer integration (GPU round-based collection)
Task 8: Periodic curiosity training with weight sync
Task 9: Workspace verification (2392+ tests, clippy)
Task 10: Final commit and branch completion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:58:30 +01:00
jgrusewski
fccd703bcb docs: add GPU pipeline Phase 2b design — zero-roundtrip CUDA experience collection
Full design for monolithic CUDA kernel that runs the entire DQN
experience collection pipeline on GPU: Dueling Q-network inference
(online + target), epsilon-greedy action selection, portfolio
simulation, barrier tracking, diversity entropy, curiosity inference,
and reward combination. 128 parallel episodes × 500 timesteps =
64,000 experiences per kernel launch with zero CPU roundtrips.

Key decisions:
- Approach A (monolithic kernel) for speed + accuracy
- Parallel episode architecture (N threads × L timesteps)
- Q-network + curiosity inference in raw CUDA (matrix-vector multiply)
- Curiosity training stays on Candle (periodic batch updates)
- TD error pre-computed for priority replay
- Weight sync after gradient updates (~1.2MB upload)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:51:43 +01:00
jgrusewski
43754bf5d5 docs: numeric type standardization implementation plan
12-worktree phased migration: foundation types → core crates →
ML boundary → services → peripheral → cleanup. Full code for
Phase 1 (Price/Quantity/Money/Ratio in common/financial_types),
migration patterns for Phases 2-6.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 02:37:53 +01:00
jgrusewski
de3a807670 docs: numeric type standardization design (i64/6dp financial types)
Consolidate competing Price/Quantity implementations into canonical
i64 fixed-point types in common/. Adds Money and Ratio newtypes.
Phased migration plan across 5 phases using parallel worktrees.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 02:32:46 +01:00
jgrusewski
52630a77d3 perf: eliminate heap-alloc Decimal→float casts across 19 files (36 instances)
Replace all `.to_string().parse::<f32/f64>()` patterns with
`num_traits::ToPrimitive` methods (`.to_f32()`, `.to_f64()`).
Each string roundtrip heap-allocated per conversion — fatal in
DQN hot loop (300K+ bars × epochs). Decimal stays as canonical
financial type; conversions happen at GPU/float boundaries only.

Also fixes blocking_read() in async context (risk_integration.rs).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 02:29:04 +01:00
jgrusewski
2538d52324 docs: add training pipeline & model deployment implementation plan
11 tasks across 2 independent tracks:
- Track 1 (Tasks 1-5): Wire fxt train → gRPC → JobSpawner → K8sDispatcher → GPU Jobs
- Track 2 (Tasks 6-9): Wire promotion RPCs to real PromotionManager
- Shared (Tasks 10-11): Docker build + end-to-end validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 22:13:29 +01:00
jgrusewski
93115c1fc5 docs: add training pipeline & model deployment design
Two parallel tracks:
- Track 1: fxt CLI -> gRPC -> JobSpawner (PostgreSQL) -> K8sDispatcher -> GPU Jobs
- Track 2: S3 checkpoints -> model loader -> promotion manager -> serving

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 22:08:26 +01:00
jgrusewski
c20ce9fdb8 docs: GPU resource optimization implementation plan
4 tasks: add .train-rl-base template, switch RL jobs, reduce epochs, validate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:16:55 +01:00
jgrusewski
2286b8976a docs: GPU resource optimization design — RL→L4, supervised→L40S
Route DQN/PPO to cheaper L4 (CPU-bound), supervised models to L40S
(GPU-bound). Separate CI templates with tuned resource requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:15:07 +01:00
jgrusewski
94f98c65f8 docs: add autonomous agents implementation plan (23 tasks, 6 phases)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 08:20:56 +01:00
jgrusewski
9937c67b4a docs: autonomous CI agents design — OpenHands + GitLab issue bus
5-phase agent loop (diagnose → plan → implement → verify → deliver)
with GitLab issues as durable communication/handoff layer. OpenHands
on Kapsule K8s runtime, LiteLLM proxy routing to Claude Opus/Sonnet
and Scaleway devstral. Rust dispatcher service. Auto-merge for CI
failure fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 08:14:17 +01:00