From 4b7fb3340fae2c4b1136d2b8ab5a0a2c412d1a50 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Fri, 17 Apr 2026 09:12:37 +0200 Subject: [PATCH] =?UTF-8?q?feat(plan):=20recursive=20plan=20revision=20?= =?UTF-8?q?=E2=80=94=20living=20plan=20document=20(N17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When readiness≥0.7 and conviction changes significantly mid-trade: +30% conviction → extend plan (thesis strengthening) -60% conviction → shorten to exit in 3 bars (thesis collapsing) Normal fluctuation (0.4x-1.3x) → plan unchanged. The model learns to revise plans based on evolving assessment. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/cuda_pipeline/experience_kernels.cu | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/ml/src/cuda_pipeline/experience_kernels.cu b/crates/ml/src/cuda_pipeline/experience_kernels.cu index 9024b40e4..07107551e 100644 --- a/crates/ml/src/cuda_pipeline/experience_kernels.cu +++ b/crates/ml/src/cuda_pipeline/experience_kernels.cu @@ -1485,11 +1485,31 @@ extern "C" __global__ void experience_env_step( position *= fmaxf(ps[27] * readiness, 0.1f); } + int has_plan = (ps[23] > 0.5f); + + /* Recursive plan revision (N17): living plan document. + * When model is highly confident (readiness ≥ 0.7) and conviction changes + * significantly, update the stored plan. The model learns WHEN to revise. */ + if (has_plan && fabsf(position) > 0.001f && readiness >= 0.7f && plan_params_ptr != NULL) { + float conv_now = plan_params_ptr[i * 6 + 4]; + float conv_entry = ps[27]; + + if (conv_now > conv_entry * 1.3f) { + /* Conviction increased 30%+ → thesis strengthening → extend plan */ + float new_target = plan_params_ptr[i * 6 + 0]; + ps[23] = fmaxf(ps[23], new_target); /* only extend, never shorten from conviction increase */ + ps[24] = fmaxf(ps[24], plan_params_ptr[i * 6 + 1]); /* widen profit target */ + } else if (conv_now < conv_entry * 0.4f) { + /* Conviction dropped 60%+ → thesis collapsing → shorten plan to exit soon */ + ps[23] = fminf(ps[23], hold_time + 3.0f); /* exit within 3 bars */ + } + /* Between 0.4x and 1.3x → plan stays as-is (normal fluctuation) */ + } + /* Plan enforcement: ISV-driven safety net. * The model LEARNS exit timing through Q-values + conviction-scaled reward. * Safety thresholds are ISV-modulated — tighter when unstable, wider when stable. * All driven by temporal attention, nothing hardcoded. */ - int has_plan = (ps[23] > 0.5f); if (has_plan && fabsf(position) > 0.001f) { float pnl_pct = (raw_close - entry_price) / fmaxf(fabsf(entry_price), 1.0f) * ((position > 0.0f) ? 1.0f : -1.0f);