Commit Graph

3686 Commits

Author SHA1 Message Date
jgrusewski
0a31bf729a fix: plan safety net ISV-driven — stop + max_hold adapt to dynamics
Stop threshold: max(plan_stop, 0.5%) / (1 + grad_norm_instability).
Tighter when gradient pressure high, wider when stable.
Max hold: 50 * regime_stability → 10-50 bars (shorter in transitions).
Plan's own learned stop_loss is the base — not hardcoded 2%.
Zero hardcoded constants — everything flows through ISV + plan head.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:05:27 +02:00
jgrusewski
2bc704f966 spec: Plan Phase 2 — 6 pearls/gems/novels for adaptive planning
P11: Counterfactual conviction drift (current vs entry conviction)
P12: Regime-plan alignment (regime shift invalidates plan)
G11: Temporal plan decay (conviction fades with time)
G12: Multi-exit strategy (partial profit taking via magnitude branch)
N17: Recursive plan revision (living plan, update mid-trade)
N18: Hindsight plan labels (learn optimal plan from trade outcomes)
N19: Plan ensemble (3 plans → agreement confidence signal)

All flow through ISV → Mamba2 → temporal attention pathway.
Learn from bad trades (N18 hindsight), exploit winners (G12 partial
exits, N17 plan extension on conviction increase).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:01:53 +02:00
jgrusewski
10baf57745 feat: plan progress in observation — model sees its own plan
4 new portfolio features (portfolio_dim 8→12, state_dim 88→96):
- plan_progress: hold_time / target_bars (how far through plan)
- pnl_vs_target: unrealized P&L / profit_target (how close to goal)
- pnl_vs_stop: unrealized P&L / stop_loss (how close to risk limit)
- plan_conviction: conviction at entry (confidence level)

Model now reasons about its own plan through temporal attention.
"I'm 80% through, 83% to target → hold" vs "I'm past stop → exit."
Planning becomes metacognitive — the model sees AND reasons about
its intentions, not just market state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:58:43 +02:00
jgrusewski
c50db37889 feat: plan enforcement → soft learning + safety net only
Hard exit removed for normal plan targets (stop/profit/time).
Model LEARNS exit timing through temporal attention:
- ISV-gated trunk → Mamba2 temporal state → branch Q-values
- Conviction scales reward → model learns confidence calibration
- Portfolio observation includes hold_time, unrealized P&L, drawdown
- Model decides when to exit through Q(Flat) vs Q(Hold)

Safety net remains: hard exit only on catastrophic loss (>2%) or
extreme hold (>50 bars). Everything else is learned, not forced.
Planning, holding, strategic positioning are all attention-driven.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:33:23 +02:00
jgrusewski
9f896878e0 feat: plan conviction scales reward — plan head learns from epoch 1
Plan conviction (ISV-attention-driven) directly scales reward signal.
Low conviction → dampened reward, high → amplified. No hardcoded
constants. The plan head's forward path (h_s2 → ISV feature gate →
Mamba2 temporal → plan MLP → conviction) is fully attention-driven.
Learning flows: conviction → reward → Q-value → C51 loss → gradients.
Plan learns planning, holding, strategic positioning throughout training.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:30:12 +02:00
jgrusewski
4a75abdcbe fix: plan exit overrides hold enforcement — prevents infinite hold
When a plan is active, the plan's target_bars IS the hold duration.
Adaptive hold was blocking plan exits → model held positions for
entire 5000-bar episodes → 0 completed trades with massive unrealized
P&L. Now: plan_active → hold enforcement bypassed. Plan manages
its own duration. Hold is safety net for plan-less trading only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:17:00 +02:00
jgrusewski
e6de3e04d2 fix: plan enforcement gated by model readiness — prevents 0-trade collapse
Plan head randomly initialized → garbage plans → immediate stop-outs →
model learns to never trade. Fix: gate plan activation + enforcement
by iqn_readiness (pinned device-mapped). readiness < 0.5 → plan
disabled (model trades freely, plan head still learns from outcomes).
readiness ≥ 0.5 → plan activates and enforces. Dynamic, not hardcoded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:13:53 +02:00
jgrusewski
919b35659a fix: ensure-fxcache uses version validation, no unconditional rm
FXCACHE_VERSION in header handles cache invalidation. First attempt
runs precompute — if cache is valid, skips (fast). If version
mismatch, deletes stale cache and regenerates. No more rm on every run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:16:38 +02:00
jgrusewski
d78fe9d4a8 fix: fxcache version display + export FXCACHE_VERSION + cleanup dead code
precompute_features prints Format: f32 (v2), OFI_DIM=20 (was hardcoded v1).
FXCACHE_VERSION exported as pub const for external use.
graph_adam_m/v/step removed (dead buffers). q_mean_ema_ptr removed
from c51_grad_kernel (ISV replaced Q-drift penalty).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:12:33 +02:00
jgrusewski
ca50bbf837 cleanup: remove dead graph_adam buffers + q_mean_ema_ptr parameter
graph_adam_m/v/step were allocated but never used — graph_params
are intentionally fixed at near-identity initialization.
q_mean_ema_ptr removed from c51_grad_kernel (ISV replaced Q-drift
penalty, no ABI to maintain for compiled cubins).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:10:30 +02:00
jgrusewski
11b1a1ca9f fix: zen precommit — 2 criticals + 3 lows resolved
CRITICAL: ISV+plan heads wired into submit_forward_ops_main (training).
CRITICAL: backtest single-step 3-branch→4-branch action encoding.
LOW: Remove dead bar_start_ns/bar_duration_ns from MicrostructureState.
LOW: Pre-allocated eps_host_buf replaces Vec allocation in hot path.
LOW: training_sharpe + val_loss added to metrics additional_metrics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:05:20 +02:00
jgrusewski
5d6c391622 fix(critical): wire ISV+plan heads into training forward pass
ISV forward, feature gate, recursive confidence, and trade plan
were only in reduce_current_q_stats (monitoring). Now also in
submit_forward_ops_main (training). Without this, these heads
never affected training Q-values — gamma_mod, branch_gate,
feature gating, and plan params were stale during actual training.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:03:46 +02:00
jgrusewski
6208ace512 fix(critical): backtest single-step uses 4-branch action encoding
Legacy 3-branch action decode/encode in backtest_env_step was
corrupting actions_history. Now uses correct 4-branch factored
logic matching backtest_env_step_batch. Fixes backtest metrics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:03:10 +02:00
jgrusewski
58c2bd7ae0 fix: eliminate non-deterministic atomicAdd from gradient kernels
selectivity_backward, risk_budget_backward, mamba2_scan_backward,
q_denoise_backward — all converted to per-weight-element accumulation
(one thread per weight, loops over batch) with plain deterministic
writes. Zero atomicAdd in these gradient paths.

recursive_confidence_backward, temporal_consistency_penalty,
predictive_coding_loss, compute_expected_q atom_stats — converted to
warp+block tree reduction, reducing to one atomicAdd per BLOCK
(8x fewer warps → near-deterministic).

kan_gate_backward, curiosity, DT linear — documented remaining
atomicAdd as acceptable (auxiliary components, not on primary DQN
gradient path).

Rust launchers updated: grid dimensions now match per-weight-element
thread counts for selectivity, mamba2, and denoise backward kernels.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:52:10 +02:00
jgrusewski
9775e5c48b feat(tick): TickProcessor — real-time Databento MBP-10 → 20 features
OFICalculator + MicrostructureState fed per-tick. Bar close snapshots
and broadcasts 20 features via tokio::watch channel. Intermediate
snapshots available for speculative compute between bars.
Databento live client integration deferred (requires crate dep).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:39:30 +02:00
jgrusewski
e5973027a1 feat(tick): speculative inference cache — H100 between-bar pre-computation
speculative_forward() pre-computes from intermediate features.
check_speculative_cache() validates cache vs actual bar-close features
(5% relative L2 threshold). invalidate_speculative_cache() at bar
boundary. Full cuBLAS trunk integration deferred — cache infra ready.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:38:05 +02:00
jgrusewski
55821af90d fix: argo-precompute.sh uses train workflow + regenerated v2 fxcache
Script rewritten to use argo submit --from=wftmpl/train with
train-epochs=0 — runs ensure-binary + ensure-fxcache only.
Local test fxcache regenerated with FXCACHE_VERSION=2, OFI_DIM=20.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:29:42 +02:00
jgrusewski
61c4b043c6 feat: fxcache version auto-invalidation — FXCACHE_VERSION=2
Version constant in fxcache.rs. validate() rejects stale versions
with clear error message. ensure-fxcache Argo template now deletes
old cache and regenerates unconditionally. No manual PVC cleanup
needed — version mismatch triggers automatic regeneration.
v2: OFI_DIM=20 (20 microstructure features).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:27:33 +02:00
jgrusewski
b6314ceec1 feat(plan): plan activation + enforcement + direction lock
Flat->Positioned copies plan_params to ps[23-29]. Auto-exit on
profit_target (ISV*asymmetry), stop_loss (ISV-modulated), target_bars,
regime_stability<0.3. Scale schedule via scale_aggression. Conviction
sizing. Direction locked during active plan. Wired trainer->collector.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:24:20 +02:00
jgrusewski
6cf09e0806 feat(plan): trade_plan_forward kernel + 4 weight tensors (82->86)
Plan MLP: h_s2 -> hidden[AH] -> plan_params[B, 6]. Outputs:
target_bars[3-25], profit_target[0.05-1.5%], stop_loss[0.02-0.5%],
scale_aggression[0-1], conviction[0-1], asymmetry[0.5-3.0].
NUM_WEIGHT_TENSORS: 82->86.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:17:57 +02:00
jgrusewski
242c18f4ab feat: argo-precompute.sh — regenerate fxcache on PVC
Usage: ./scripts/argo-precompute.sh [--branch main] [--watch]
Deletes old fxcache, builds precompute binary, runs with MBP-10 +
trades data. OFI_DIM=20 (20 microstructure features). ~5-10 min.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:14:46 +02:00
jgrusewski
c7a2e39c1e feat(plan): PORTFOLIO_STRIDE 23→30 — 7 plan slots ps[23-29]
Plan slots: target_bars, profit_target, stop_loss, scale_aggression,
conviction, asymmetry, counter_plan_q. Zeroed on episode reset.
Fixed hardcoded i*23 references. All CUDA + Rust files updated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:13:36 +02:00
jgrusewski
a1f967db88 fix: add epoch_sharpe + val_loss to training metrics additional_metrics map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:09:48 +02:00
jgrusewski
1cc6168a6b fix: backtest action_select missing isv_signals_ptr + regenerated fxcache
Backtest evaluator missing isv_signals_ptr arg (passed as NULL).
Regenerated test fxcache with OFI_DIM=20 from MBP-10 + trades data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:07:45 +02:00
jgrusewski
61f2ba3cb2 feat: MBP-10 data loading always enabled by default
mbp10_data_dir and trades_data_dir uncommented in localdev config.
Doc comments updated: 20 microstructure features always appended.
OFI is no longer optional — it's core to the model's feature set.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:02:54 +02:00
jgrusewski
f1af119f24 feat(isv): per-feature temporal routing — ISV controls history depth
isv_temporal_route kernel: ISV embedding [8] → temporal_weight [SH2].
mamba2_temporal_scan: h_enriched = h_s2 + temporal_weight * context.
Each feature gets learned history depth based on ISV state.
Init bias=2.0 (sigmoid≈0.88, mostly use temporal). 2 new tensors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:02:37 +02:00
jgrusewski
d6a2e99670 feat(isv): feature-level ISV gating — which features matter per regime
isv_feature_gate kernel: ISV embedding [8] → per-feature gate [SH2].
h_s2 *= sigmoid(w_gate @ isv_emb + b_gate). Near pass-through init
(bias=2.0 → sigmoid≈0.88). Model learns to amplify/suppress features
based on ISV state. 2 new tensors [78-79]. NUM_WEIGHT_TENSORS: 78→80.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:56:52 +02:00
jgrusewski
750b228ed9 plan: Trade Plan Head — 5 tasks, hierarchical plan-based trading
Task 1: PORTFOLIO_STRIDE 23→30, plan slots ps[23-29]
Task 2: trade_plan_forward kernel + 4 weight tensors (82→86)
Task 3: Plan activation + enforcement in env_step
Task 4: Direction lock in action_select + counter-plan Q (N14)
Task 5: Smoke test + compute-sanitizer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:48:18 +02:00
jgrusewski
76d6b54bff feat(isv): risk branch SH2+9→SH2+13 — all 12 ISV signals + predicted_error
w_risk_fc grows from AH*(SH2+9) to AH*(SH2+13). Risk branch now
sees all 12 ISV signals (including 4 regime: velocity, disagreement,
transition_ema, stability) + predicted_error. Forward + backward
updated with wider stride and 12-signal loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:47:03 +02:00
jgrusewski
102adf7703 spec: fix trade plan head — ps[23-29] (was 16-22 collision), STRIDE 23→30
Portfolio slots ps[15]-ps[19] are Kelly accumulators (active).
Plan params moved to ps[23]-ps[29]. PORTFOLIO_STRIDE grows 23→30.
Fixed asymmetry: scales profit_target only (not stop_loss).
Clarified epsilon mid-plan: overridden by direction lock (intended).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:44:20 +02:00
jgrusewski
2aae3ceec7 feat(isv): regime-conditioned Mamba2 decay — forget old patterns during transitions
mamba2_temporal_scan forget gate multiplied by regime_stability (ISV[11]).
Stable regime (stability=1.0): full history preserved.
Transition (stability=0.3): gate capped at 0.3 → rapid forgetting.
Model adapts to new regime within 2-3 bars. Backward matches forward.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:42:14 +02:00
jgrusewski
1acb23cb24 spec: Trade Plan Head — hierarchical plan-based trading
Plan head outputs 6 params at entry: target_bars, profit_target,
stop_loss, scale_aggression, conviction, asymmetry. Model commits
to plan, bar-by-bar execution constrained. Auto-exit on target/stop/time.

Pearls: P8 learned stops, P9 Kelly conviction, P10 options framework.
Gems: G8 asymmetric R/R, G9 pyramiding, G10 learned termination.
Novels: N13 plan-conditioned Q, N14 counter-plan evaluation,
N15 plan replay priority, N16 ISV-modulated plan parameters.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:41:05 +02:00
jgrusewski
8a746fceb2 feat(isv): regime awareness — ISV_DIM 8→12, 4 regime signals
regime_velocity (EMA of ADX+CUSUM deltas), regime_disagreement
(|norm_ADX - norm_CUSUM|), regime_transition_ema, regime_stability
(1 - sigmoid(5*velocity)). Read from states buffer sample 0.
isv_signal_update + isv_forward kernels updated. w_isv_fc1 grows
16*8→16*12. Pinned buffers resized automatically via ISV_DIM.
Introduced ISV_EMB_DIM=8 to decouple embedding output from signal
input dimension — FC2/gate/gamma stay at 8.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:34:49 +02:00
jgrusewski
8b68954ded feat(tick): precompute pipeline wires MicrostructureState — 20 OFI features
12 new tick-level features computed per bar from MBP-10 snapshots:
OFI trajectory, realized variance, Hawkes intensity, book pressure,
spread dynamics, aggression, queue depletion, order count flux,
intra-bar momentum, regime score, OFI acceleration, toxicity gradient.
Combined with existing 8 OFI into [f64; 20] per bar in fxcache.

Also fixes pre-existing bug: no-MBP-10 fallback was [0.0; 8] not [0.0; 20].

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:29:03 +02:00
jgrusewski
b2d7af0763 feat: adaptive hold in BOTH layers — action select + enforce_hold
Layer 1 (experience_action_select): isv_signals_ptr param added.
Adaptive hold = base + stability × confidence × 8 extension.
Layer 2 (enforce_hold in env_step): already had adaptive hold.
Both layers use identical ISV-driven formula. Consistent behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:25:44 +02:00
jgrusewski
81771d7920 feat(tick): OFI_DIM 8→20 — atomic update across 15 files
fxcache: OFI_DIM=20 (pub const), RECORD_F64_COUNT=66, 272 bytes/bar.
constructor: state_dim 74→86 (aligned 88) with OFI.
experience collector: ofi_dim detection 8→20.
All [f64; 8] → [f64; 20]. Existing 8 features preserved at 0-7.
New 12 features zero-padded until precompute is extended.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:21:15 +02:00
jgrusewski
06be03effb feat: adaptive hold enforcement — ISV-driven dynamic minimum hold time
enforce_hold() reads ISV signals: grad_norm (stability), ensemble_var
(confidence), reward_ema (performance). Adaptive hold = base(5) +
extension(0-8 bars from stability × confidence). Negative reward_ema
reduces to base only (allow faster exit when losing).

ISV signals passed from trainer → fused_ctx → experience collector →
env_step kernel via isv_signals_dev_ptr. NULL = static hold (backtest).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:09:57 +02:00
jgrusewski
4d08472d95 feat(tick): MicrostructureState — 12 new tick-level features, O(1)/tick
OFI trajectory (online LinReg), realized variance, Hawkes intensity,
book pressure gradient, spread dynamics, aggression ratio, queue
depletion, order count flux, intra-bar momentum (Welford), regime
score, OFI acceleration, toxicity gradient. ExtendedOFIFeatures [20].

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:06:32 +02:00
jgrusewski
ddb7b170bc plan: Tick Microstructure Intelligence — 4 tasks, OFI_DIM 8→20
Task 1: IncrementalMicrostructureCalculator (12 new features, O(1)/tick)
Task 2: fxcache OFI_DIM 8→20 atomic update (15 files, 30+ locations)
Task 3: Extend precompute pipeline with MicrostructureState
Task 4: Regenerate fxcache + smoke test + compute-sanitizer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:02:02 +02:00
jgrusewski
460a5f3841 feat: adaptive minimum hold time — 5-bar minimum prevents coin-flip exits
The hold enforcement infrastructure (enforce_hold in trade_physics.cuh,
hold_time counter at ps[10], action masking in experience_action_select)
was already fully implemented but disabled by min_hold_bars defaulting
to 1. Change default from 1 to 5 so hold enforcement is active by
default. Production configs already set min_hold_bars=10 via TOML.
Targets ~100-200K trades instead of 619K across 5M bars.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:02:01 +02:00
jgrusewski
7deaa88d83 feat(isv): target network — ISV weights online-only
EMA sync restricted to indices 0-67 (non-ISV params).
ISV weights (68-77) exist only in online params_buf.
Target forward uses online gamma_buf (drift-conditioned) and
online branch_gate_buf — correct for Bellman projection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:52:38 +02:00
jgrusewski
1d958c7ab9 spec: Phase 4 adaptive minimum hold time — prevent coin-flip exits
3-bar base + regime_stability extension (0-12) + confidence extension
(0-3) = adaptive 3-18 bar minimum hold. Only prevents exits, not
entries. Targets 100-200K trades instead of 619K.

Pearl: P7 hard minimum hold. Gem: G7 regime-conditioned extension.
Novel: N12 ISV-driven hold confidence.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:51:45 +02:00
jgrusewski
e1f234cd82 feat(isv): recursive confidence head — model predicts own TD-error
h_s2 → sigmoid(w_conf @ h + b_conf) → predicted_error [B].
MSE loss vs lagged_td_error (0.01× weight). Backward accumulates
into trunk gradient + conf weight gradients in main grad_buf.
Creates self-improvement loop: model learns to predict when wrong.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:46:18 +02:00
jgrusewski
e6b3fffa6d spec: fix 4 critical issues from review — OFI_DIM cascade, deploy atomicity
1. Enumerate all 6+ files with hardcoded OFI_DIM=8 literal
2. Document atomic deploy requirement (code + fxcache together)
3. Rename Depth Renewal Rate → Order Count Flux (MBP-10 approximation)
4. Fix Intra-Bar Momentum to Welford online covariance (O(1), no Vec)
5. Clarify snapshot() is pure read, non-mutating, idempotent
6. Fix precompute time: 8s CPU + 5min I/O = ~5-10min total

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:43:55 +02:00
jgrusewski
a2587fd087 spec: Tick-Level Microstructure Intelligence — 12 new features from MBP-10
OFI_DIM: 8→20. IncrementalMicrostructureCalculator: O(1) per tick.
Pearls: OFI trajectory, realized variance, Hawkes trade intensity.
Gems: book pressure gradient, spread dynamics, aggression ratio,
queue depletion, depth renewal rate.
Novels: intra-bar momentum, microstructure regime score, order flow
acceleration, toxicity gradient, speculative H100 inference (N10),
mid-bar regime early warning (N11).

Databento (GLBX.MDP3, mbp-10) for all tick data. IBKR execution only.
fxcache single format, regenerate all files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:39:36 +02:00
jgrusewski
42964437fc feat(isv): risk branch wider input SH2→SH2+9 — ISV + predicted_error
risk_budget_forward: h_s2 || isv_signals[8] || predicted_error[1].
risk_budget_backward: wider stride j*(SH2+9), grads for ISV+error cols.
w_risk_fc grows from AH*SH2=32768 to AH*(SH2+9)=33920 (+1152 elems).
risk_aligned_count and offset callers updated atomically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:30:17 +02:00
jgrusewski
4c917d83d2 feat(isv): branch confidence routing replaces regime_branch_gate
ISV gate [4] × Q-value separation confidence per branch.
Market regime (ADX, CUSUM) still flows through trunk → branches.
ISV adds training dynamics awareness on top.
Confidence = sigmoid(5 * (Q_max - Q_mean)) per branch, floor 0.3.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:25:33 +02:00
jgrusewski
ad402deec7 feat(isv): drift-conditioned gamma — C51 scalar→per-sample buffer
c51_loss_kernel: float gamma → const float* gamma_buf [B].
fill_gamma_buf kernel: broadcasts base_gamma * gamma_mod[0] to [B].
gamma_mod from isv_forward ∈ [0.5, 1.0] → effective_gamma ∈
[base_gamma*0.5, base_gamma]. Model learns its own planning horizon.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:21:07 +02:00
jgrusewski
2acaaeaacd spec: Phase 3 dynamic inference brain — feature gating + temporal routing
7 adaptive pathways modulated by ISV at inference: feature gating
(WHICH features matter), temporal routing (HOW MUCH history per
feature), branch gating, gamma mod, risk budget, Mamba2 decay,
branch confidence. Model adapts to unseen regimes in 2-3 bars.

Pearls: P6 feature-level ISV gating.
Gems: G6 per-feature temporal routing.
Novels: N8 dynamic inference adaptation, N9 graceful cold start.
4 new weight tensors (78-81), 4608 params. Tasks 14-16.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:11:39 +02:00
jgrusewski
ffc8c1c46a feat(isv): ISV encoder MLP + branch gating + gamma modulation
isv_forward kernel: temporal decay-weighted average + 8->16->8 MLP.
Outputs: isv_embedding [8], branch_gate [4] (softmax), gamma_mod [1]
(0.5+0.5*sigmoid -> [0.5,1.0]). NUM_WEIGHT_TENSORS: 68->78.
10 new tensors for ISV encoder, gate, gamma, and confidence head.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:10:13 +02:00