# TASK: GAP-049 — Telemetry STATE score is direction-incorrect # Staged: 2026-08-18 (v7.0 review, Finding 5) # Sprint: Stage 1 (P1-D) # Owner: Kilocode # ───────────────────────────────────────────────────────────────── ## THE DEFECT `MaybeWriteStateTelemetry()` scores a SYNTHETIC intent built by `BuildStateTelemetryIntent()`. Per DEC-20260818-06 that intent receives the `daily_bars` object directly and deliberately does NOT call `AttachDailyBarContext()`, because that helper mutates trade-direction, breakout-volume and ORB fields on the shared object. But `GapDirectionAlignmentCalculator.Calculate()` reads `daily.TradeDirection` — a field ONLY `AttachDailyBarContext()` sets. In the telemetry path it is therefore stale relative to the telemetry intent's own `Side`. ## RUNTIME PROOF — 2026-08-18 10:10:11 STATE: ... Direction=Sell ... Score=0.640 Grade=C STATE_DETAIL: ... GapDirectionAlignment="Large gap -523.25 opposes trade — high fade risk" A -523 (downward) gap should ALIGN with a Sell, scoring 1.00. It scored 0.10. The same block reported OrbRangeVsAtr="No daily bar context available" despite 87 daily bars loaded and factor warm-up logged SATISFIED. Thirteen seconds later the REAL intent passed the grade filter and emitted SIGNAL. Telemetry said Grade C; the trade path said it qualified. Both are in the same log file. ## WHY IT MATTERS Every `STATE:` line — and therefore every Score, Grade, factor bar and "missed B+ setup" count on the DASH-001/DASH-004 dashboard — is computed from direction-degraded inputs and understates quality on short setups. The dashboard is currently misleading on exactly the question it exists to answer: "was that a good setup the system passed on?" It also degrades the GAP-047 re-scoring study (see TASK_GAP047). ## READ-FIRST - `NT8StrategyBase.cs` `MaybeWriteStateTelemetry()`, `BuildStateTelemetryIntent()` - `SimpleORBNT8.cs` `BuildStateTelemetryIntent()` override - `SimpleORBStrategy.cs` `AttachDailyBarContext()` — establish EXACTLY which fields it mutates and why DEC-20260818-06 avoided calling it - `FactorCalculators.cs` GapDirectionAlignment / PriorDayCloseStrength / TrendAlignment — establish which factors read `daily.TradeDirection` or any other field `AttachDailyBarContext()` sets ## PREFERRED FIX Build a direction-correct CLONE of `DailyBarContext` for the telemetry path: copy the warmed daily data, set `TradeDirection` from the telemetry intent's own `Side`, and attach the clone. The shared object must not be mutated — that constraint from DEC-20260818-06 stands and is the reason a clone is required rather than a call to `AttachDailyBarContext()`. Confirm whether `DailyBarContext` is safely cloneable (arrays vs references) before assuming it. ## INTERIM FIX — if the clone is not straightforward Label the value honestly rather than leaving it wrong: - Rename the dashboard's headline to "Telemetry score (advisory)" - Add `TelemetryScore` / `TelemetryGrade` as fields distinct from `ConfluenceScore` / `TradeGrade` in the DashboardState contract, so a consumer can tell the two apart (v7.0 Section 14.5) ## ALSO IN SCOPE — verify, do not assume The logged gap magnitude of -523.25 points is implausible for a single overnight NQ session (~1.7% of index value). Verify `DailyBarContext.TodayOpen` and `Closes[Count-2]` alignment against known NQ daily closes. Report either "the values are correct and the market gapped" or an identified alignment defect. This is P1-E in the v7.0 roadmap and may be a separate gap. ## CONSTRAINTS Observability only. MUST NOT change `SIGNAL`, `SUBMIT`, `FILL`, `PNL_UPDATE` or `REJECT` behaviour, or any real trade decision. ## TESTS Given identical bar and context, telemetry score == trade-path score for the same side. A Sell setup with a downward gap must report "aligns", not "opposes". ## GOVERNANCE Track as [GAP-049] in SPRINT_BOARD.md. decisions.md entry required. Reference: NT8_SDK_Master_Document_v7.0 Finding 5, Sections 9.4 (P1-D, P1-E), 14.5.