[GAP-047]: runtime confluence weights complete

- ConfluenceScorer.cs: apply designed factor baseline weights

- ConfluenceScorerTests.cs: cover 5.85 total weight, worked example, and overrides

- TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md: add accepted runtime prompt

- docs/00-governance: record DEC implementation and fresh-freeze requirement

- SPRINT_BOARD.md: mark GAP-047 Part 2 implemented

Build: clean | Tests: 514 passing; Core 425 passing | Deploy: backup 20260823_135331
This commit is contained in:
2026-08-23 13:55:57 -04:00
parent cbf45dfa3b
commit 80c5f53bb9
8 changed files with 260 additions and 19 deletions

View File

@@ -71,10 +71,12 @@ Both can run at the same time; neither touches runtime behavior.
**Play 3 — Review GAP-048 output.** Confirm the four overloaded KillSwitch paths and four overloaded GradeFilter paths now log distinguishable reasons, that existing log-line formats are unchanged (only the reason string), and that the existing test suite still passes. Mark SPRINT_BOARD entry done.
**Play 4 — Review GAP-047 output.** This is a study, not a change — read the re-scoring report (equal-weight vs. designed-weight composite against historical STATE:/SIGNAL_DETAIL: lines). Confirm it reports the pre/post GAP-049 telemetry populations separately, per the task's caveat. Do NOT apply any weight change from this yet; it's an input to a future decision, not an approved fix.
**Play 4 — Review GAP-047 output and apply runtime weights. DONE 2026-08-23.**
Part 1: Kilocode built `tools/rescore/rescore_weights.py`, scanned 182 session logs, reproduced the required worked example exactly (equal=0.640, designed=0.727), and reported the STATE telemetry population (923 samples, direction-degraded per GAP-049) separately from the real signal population (81 samples), per the task's caveat. Independently re-derived the headline numbers from the raw distribution tables in `GAP-047_weight_rescore_output.md` rather than trusting the summary — they check out, including that the signal population's "25 cross into A" figure is a gross count net of a small number of downgrades (consistent with the report's own note that some real signals score worse under designed weights).
Part 2: DEC-20260823-01 was accepted, and `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md` applied the five designed baseline weights in `ConfluenceScorer.cs` with no normalization, calculator, threshold, or adapter/NinjaScript changes. Automated proof now covers default total weight 5.85, the worked example at 0.727 / Grade B, and `UpdateFactorWeights()` override behavior. A fresh gate freeze is required before gate evidence after this scoring-policy change.
**Play 5 — Runner trail fix (DEC-18 accepted). DONE 2026-08-21, source-verified.**
Kilocode implemented Option 0: removed the `OnBarUpdate()` `SetStopLoss` call on the runner signal, added no new `SetTrailStop` call, removed the stale `Diag_Breakeven` draw, cited NT8's own API docs on the mutual-exclusivity behavior. Independently re-read the changed code directly (not just the report) — confirmed. Build/tests/deploy all passed, hash matches. Two low-priority follow-ups logged in the process (GAP-056: breakeven params now fully inert, not scaler-scoped as previously assumed; GAP-057: no test seam for NT8 managed-order call assertions) — see `decisions.md` DEC-20260821-01. **Not committed yet** — sits on top of the still-unreconciled DASH-002 diff from Section 0; recommend two separate commits (DASH-002 first, GAP-054 second) when the operator is ready to commit.
**Play 5 — Runner trail fix (DEC-18 accepted). DONE 2026-08-21, source-verified. Committed 2026-08-23 as its own isolated commit (`28c30bc`), exactly as recommended in Section 0.**
Kilocode implemented Option 0: removed the `OnBarUpdate()` `SetStopLoss` call on the runner signal, added no new `SetTrailStop` call, removed the stale `Diag_Breakeven` draw, cited NT8's own API docs on the mutual-exclusivity behavior. Independently re-read the changed code directly (not just the report) — confirmed. Build/tests/deploy all passed, hash matches. Two low-priority follow-ups logged in the process (GAP-056: breakeven params now fully inert, not scaler-scoped as previously assumed; GAP-057: no test seam for NT8 managed-order call assertions) — see `decisions.md` DEC-20260821-01. The DASH-002 reconciliation from Section 0 is also resolved — committed as `d84949c` ahead of the GAP-054 commit, working tree is clean.
**Play 6 — Validate GAP-054 before any live exposure. STILL PENDING — this is the next actual step.**
NinjaTrader needs to be reopened for a manual NinjaScript compile, then a SIM trade run reaching +25 ticks or more, confirming no `BREAKEVEN runner stop ->` line appears and the runner's exit is materially better than entry + 1 tick (a trail stop in the execution grid, not a fixed stop), and that the scaler leg's target behavior is unchanged. Only after this passes is GAP-054 done and RUNNER-001 unblocked.
@@ -110,7 +112,7 @@ This is a separate, later step — not part of today's six tasks. Once GAP-054,
- [x] Section 1 decisions recorded — all accepted 2026-08-19
- [ ] GAP-048 taxonomy: implemented, tested, SPRINT_BOARD updated
- [ ] GAP-047 Part 1: study delivered, read, weight-change decision explicitly deferred (not silently applied)
- [x] GAP-047 Part 1/2: study delivered, DEC-20260823-01 accepted, runtime designed weights implemented and tested
- [ ] GAP-054 runner trail: implemented, validated on sim/replay before any live gate run
- [ ] GAP-055 persistence: implemented, restart/rollover-boundary test passed
- [ ] GAP-045/046 all three parts: implemented on NQ, including the post-sizing Tier 1 reorder and the MNQ tick-table check

View File

@@ -16,7 +16,7 @@ Full detail: `docs/NT8_SDK_Master_Document_v7.0_Complete.docx`.
| 2 | **GAP-045/046 guards** — resolved: MNQ (cutover staged separately) + per-position semantics | `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md` (Part 3 now actionable) | Kilocode, on current NQ config | All high-ATR days |
| 3 | **GAP-048** — split the reject taxonomy | `TASK_GAP048_REJECT_TAXONOMY_PROMPT.md` | Kilocode | Nothing — diagnostics only, safe now |
| 4 | **GAP-055** — persist `MaxDailyTrades` across restarts | `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md` | Kilocode | Gate Run #3 sample integrity |
| 5 | **GAP-047 Part 1** — offline factor-weight re-scoring study | `TASK_GAP047_WEIGHT_RESCORE_PROMPT.md` — completed 2026-08-23, evidence in `tools/rescore/`, DEC-20260823-01 proposed | Kilocode | Part 2 blocked on operator weighting decision |
| 5 | **GAP-047** — Part 1 complete (commit `cbf45df`), Part 2 runtime weight fix implemented 2026-08-23 | `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md` — verification passed, deploy backup `20260823_135331` | Kilocode | Fresh gate freeze needed before gate evidence |
| 6 | **GAP-054** — auto-breakeven destroys the runner trail | `TASK_GAP054_RUNNER_TRAIL_PROMPT.md` — **Option 0 implemented + source-verified 2026-08-21, NOT yet SIM-validated, NOT committed** | Kilocode implemented; operator validates | **RUNNER-001**, still blocked until SIM/replay validation passes |
| 7 | **GAP-049** — telemetry `STATE:` score is direction-incorrect | `TASK_GAP049_TELEMETRY_DIRECTION_PROMPT.md` | Kilocode | Dashboard trustworthiness; degrades item 5 |
| 8 | **MNQ cutover** — reconfigure instrument, retune risk params for $0.50/tick, fresh Gate 3 freeze | not yet staged as its own TASK file | Operator + Kilocode | Only after items 2, 4, 5, 6 pass validation on NQ |

View File

@@ -1,5 +1,20 @@
# Current Status — NT8 SDK
**Last Updated:** 2026-08-23 (GAP-047 Part 1 offline re-scoring study complete; decision proposed)
**Last Updated:** 2026-08-23 (GAP-047 Part 2 runtime designed weights implemented)
---
## 2026-08-23 — GAP-047 Part 2 IMPLEMENTED, fresh gate freeze required
Kilocode executed `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md`. The runtime scoring fix is intentionally minimal: `ConfluenceScorer` now uses the designed baseline weights for the five non-core factors (`0.20/0.15/0.15/0.20/0.15`) while leaving scoring normalization, overrides, calculators, grade thresholds, and NinjaScript/adapter files unchanged.
Evidence:
- `src/NT8.Core/Intelligence/ConfluenceScorer.cs` changed only the five approved baseline weight constants.
- `tests/NT8.Core.Tests/Intelligence/ConfluenceScorerTests.cs` now asserts total default weight is 5.85, reproduces the 2026-08-18 worked example at weighted score 0.727 / Grade B, and verifies `UpdateFactorWeights()` still overrides the baseline.
- `verify-build.bat`: passed, 514/514 tests.
- `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal`: passed, 425/425.
- `deployment\deploy-to-nt8.bat`: completed; backup `deployment\backups\20260823_135331`; `NinjaTrader.Custom.dll` was not present to invalidate.
Next required action: run the normal manual NT8 compile/deploy hygiene when starting NinjaTrader, then capture a fresh Gate 3 configuration freeze/baseline before collecting any gate evidence because trade-qualification behavior changed. No SIM trade is required to prove correctness for this platform-neutral `NT8.Core` change.
---

View File

@@ -16,13 +16,16 @@ Use this file to record durable project decisions that affect implementation pat
### DEC-20260823-01
- **ID:** DEC-20260823-01
- **Date:** 2026-08-23
- **Status:** proposed
- **Status:** **accepted** (2026-08-23)
- **Operator Decision (2026-08-23):** Approved — proceed with the designed weights.
- **Implementation approach resolved (Claude, 2026-08-23):** Read `ConfluenceScorer.cs` directly rather than assume. Two things confirmed that shape Part 2: (1) `Score()`'s composite (`weightedScoreSum / totalWeight`, ~line 183) already normalizes dynamically by whatever weights are actually applied — it is NOT hardcoded to divide by 10 or 5.85, so there is no separate normalization defect to fix; removing the bug is sufficient on its own. (2) The five wrong weights are hardcoded `1.0` literals in the constructor (`ConfluenceScorer.cs` ~113-117) rather than the calculators' own designed values ever being consulted, even though a `ResolveWeight()`/`UpdateFactorWeights()` mechanism already exists to make the dictionary the authoritative source — this reads as a placeholder value that was never replaced, not an architectural gap. **Resolved fix: change the five literals directly** (`NarrowRange 1.0→0.20`, `OrbRangeVsAtr 1.0→0.15`, `GapDirectionAlignment 1.0→0.15`, `BreakoutVolumeStrength 1.0→0.20`, `PriorDayCloseStrength 1.0→0.15`, verified against `FactorCalculators.cs` lines 569/670/797/897/1021) rather than removing the pre-population and routing through `ResolveWeight`'s fallback path — smaller diff, same result, keeps the dictionary as the single source of truth the API already assumes. The "configuration-driven" alternative floated in the original task is not pursued now — no scenario surfaced that needs it, and it would add parameter surface for no behavioral benefit. Flag if you want it anyway.
- **Context:** GAP-047 Part 1 completed the offline equal-weight versus designed-weight re-scoring study against existing NT8 SDK session logs. The study scanned 182 `session_*.log` files under `C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk`, including `ARCHIVE`, and reproduced the required worked example from `session_20260818_071117.log` at 10:10:11.833: equal=0.640, designed=0.727. The `STATE:` telemetry population remains direction-degraded by GAP-049 and is reported separately from real signal samples. No runtime trading code was changed.
- **Evidence:** `tools/rescore/GAP-047_weight_rescore_output.md` and `.json`. Headline results: `STATE:` telemetry samples=923, designed weights crossed A while equal weights did not in 82 samples and crossed B while equal weights did not in 164 samples. Real signal factor samples=81, designed weights crossed A while equal weights did not in 25 samples. Current logs contained 0 `SIGNAL_DETAIL:` lines; signal scoring used real `SIGNAL` lines followed by their numeric `Factors:` breakdowns.
- **Decision:** Proposed operator decision: proceed to GAP-047 Part 2 planning with an explicit weighting policy decision. The study supports replacing accidental equal 1.00 weights with the designed factor weights or making the weighting model configuration-driven, but the runtime change must be staged separately because it changes scoring behavior and `ConfigHash`.
- **Consequences:** Designed weights would materially increase grade eligibility in the direction-degraded telemetry population and upgrade a meaningful subset of real signal samples to Grade A. Because some real signal samples also downgrade under designed weights, the decision should be treated as a scoring-policy change rather than a pure relaxation. A fresh configuration freeze is required before any gate evidence is collected after implementation.
- **Related Files:** `tools/rescore/rescore_weights.py`, `tools/rescore/GAP-047_weight_rescore_output.md`, `tools/rescore/GAP-047_weight_rescore_output.json`, `TASK_GAP047_WEIGHT_RESCORE_PROMPT.md`
- **Action Required:** Operator to accept/reject the proposed direction, then stage GAP-047 Part 2 as a separate runtime-change prompt.
- **Decision:** Replace the accidental equal 1.00 weights with the designed factor weights, per the resolved implementation approach above. Staged as `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md`.
- **Consequences:** Designed weights will materially increase grade eligibility in the direction-degraded telemetry population and upgrade a meaningful subset of real signal samples to Grade A — this is the intended effect, directly targeting the low-trade-frequency problem. Because some real signal samples also downgrade under designed weights, this is a scoring-policy change, not a pure relaxation — expect a shift in which setups qualify, not just how many. Unlike GAP-054, this change is fully testable in the platform-neutral `NT8.Core` layer with ordinary unit tests — no NinjaTrader-specific managed-order call is involved, so no SIM trade is required to prove correctness (see `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md` Validation). A fresh gate configuration freeze/baseline is still required before any gate evidence is collected after this lands, since trade-qualification behavior changes. Also worth revisiting once live: the workspace currently runs `MinTradeGrade=4` (B) while the Gate 3 plan targets `MinTradeGrade=A` (5) — now that Grade A is actually reachable, the operator may want to reconsider which threshold to gate on.
- **Related Files:** `tools/rescore/rescore_weights.py`, `tools/rescore/GAP-047_weight_rescore_output.md`, `tools/rescore/GAP-047_weight_rescore_output.json`, `TASK_GAP047_WEIGHT_RESCORE_PROMPT.md`, `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md`, `src/NT8.Core/Intelligence/ConfluenceScorer.cs`
- **Implementation Note (2026-08-23):** Implemented in `src/NT8.Core/Intelligence/ConfluenceScorer.cs` by changing only the five approved constructor baseline weights: `NarrowRange=0.20`, `OrbRangeVsAtr=0.15`, `GapDirectionAlignment=0.15`, `BreakoutVolumeStrength=0.20`, and `PriorDayCloseStrength=0.15`. `Score()` normalization, `ResolveWeight()`, `UpdateFactorWeights()`, factor calculators, grade thresholds, and adapter/NinjaScript files were left unchanged. Added `ConfluenceScorerTests` coverage proving the default total weight is 5.85, the 2026-08-18 10:10:11.833 worked example now scores 0.727 / Grade B instead of the old 0.640, and `UpdateFactorWeights()` still overrides the new baseline. Verification: `verify-build.bat` passed with 514/514 tests (425 Core, 79 Integration, 10 Performance); `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 425/425; `deployment\deploy-to-nt8.bat` completed with backup `20260823_135331` and noted `NinjaTrader.Custom.dll` was not present to invalidate.
- **Action Required:** Fresh Gate 3 configuration freeze/baseline is required before collecting gate evidence after this scoring-policy change. Manual NT8 compile remains part of normal deploy hygiene, but no SIM trade is required for correctness.
### DEC-20260821-01
- **ID:** DEC-20260821-01