feat(plan): recursive plan revision — living plan document (N17)
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user