Files
nt8-sdk/TASK_GATE3_CLEANUP_PROMPT.md

8.1 KiB

TASK: GATE3-CLEANUP — Clean the Working Tree and Produce a Valid Gate 3 Freeze

Staged: 2026-08-16

Sprint: Gate 3 Preparation (RB-4.1 prerequisite) — BLOCKING

─────────────────────────────────────────────────────────────────

Critical framing — read this first

Two freeze attempts today already failed for the same reason:

  • docs/gate-runs/gate3/freeze_20260816_003543/FREEZE_FAILED.txt
  • docs/gate-runs/gate3/freeze_20260816_003653/FREEZE_FAILED.txt
  • docs/gate-runs/gate3/verify_20260816_003653/FREEZE_FAILED.txt

All three say the same thing: git status --porcelain is not clean. Freeze/verify baseline is invalid until the working tree is clean. No baseline.json exists yet. Gate Run #3 cannot start, and DEC-GATE3-CONFIG.md (currently Status: draft) cannot be accepted, until this is fixed. This is the single blocking item ahead of everything else queued for the weekend disarmed window.

This task is governance/process work, not a new feature. Do not add scope. Your job is to get every file below into a reviewed, correctly-committed (or correctly-ignored) state, then produce one clean, passing preflight.ps1 --freeze capture.

The dirty tree, as of the last failed attempt

 M SPRINT_BOARD.md
 M docs/00-governance/active_work.md
 M docs/00-governance/common_failures.md
 M docs/00-governance/current_status.md
 M docs/00-governance/decisions.md
 M docs/00-governance/roadmap.md
 M src/NT8.Adapters/Strategies/NT8StrategyBase.cs
 M src/NT8.Adapters/Strategies/SimpleORBNT8.cs
 M src/NT8.Strategies/Examples/SimpleORBStrategy.cs
 M tests/NT8.Core.Tests/Intelligence/OrbConfluenceFactorTests.cs
 M tests/NT8.Core.Tests/Logging/TradeProvenanceSerializerTests.cs
?? .hermes/
?? src/NT8.Adapters/ConfigHashCalculator.cs
?? tests/NT8.Core.Tests/Adapters/SimpleORBNT8DefaultsTests.cs
?? tests/NT8.Core.Tests/MaxDailyTradesTests.cs
?? tests/NT8.Core.Tests/Strategies/
?? tests/NT8.Integration.Tests/ConfigHashTests.cs
?? tools/

Note: roadmap.md and current_status.md will very likely show as modified again after this task starts, because a same-day republish of both (per the standing Sunday-cadence rule — see docs/02-runbooks/weekly_roadmap_cadence.md once it lands) is happening in parallel. Coordinate with that update rather than reverting it; if you see a conflict, take the more recent content and confirm both authors' facts are preserved.

What to do, in order

  1. Governance doc diffs (SPRINT_BOARD.md, active_work.md, common_failures.md, current_status.md, decisions.md, roadmap.md): review each diff against the last commit. These almost certainly capture real, already-decided state (GAP-034/035/036 analysis, DEC-20260814-01 through DEC-20260815-01, the DEC-20260814-04 EnableShortTrades flip accepted today). Confirm nothing in the diff contradicts a decision that was later superseded, then stage and commit as governance-only, e.g.: git commit -m "docs: record GAP-034/035/036 forensics and DEC-20260814/15 decisions"

  2. Runtime source diffs (NT8StrategyBase.cs, SimpleORBNT8.cs, SimpleORBStrategy.cs): these are weekend-disarmed-window changes. For each, confirm the diff maps to a named item — GAP-035 (rejection-reason FileLog routing), GAP-036 (risk_mode sourced from intent.Metadata), GAP-039 (_dailyTradeCount realtime-only guard), and/or DASH-002 (EnableStateTelemetry, additive only, existing SIGNAL/SUBMIT/FILL/PNL_UPDATE lines byte-for-byte unaffected). If any hunk doesn't map to a named, decided item, stop and flag it — do not commit undocumented behavior changes to files this close to a gate freeze.

  3. New source file src/NT8.Adapters/ConfigHashCalculator.cs: this is GAP-038 (ConfigHash must include BarsPeriod). Confirm it's referenced from the strategy's config-hash call site and that tests/NT8.Integration.Tests/ConfigHashTests.cs (also untracked) actually exercises the new BarsPeriod-inclusion behavior, not just the old hash path.

  4. New test files (SimpleORBNT8DefaultsTests.cs, MaxDailyTradesTests.cs, tests/NT8.Core.Tests/Strategies/, ConfigHashTests.cs): confirm each corresponds to a named gap — MaxDailyTradesTests.cs should be the 4-case GAP-037 regression suite the roadmap calls out as currently having zero coverage. Add all of them.

  5. .hermes/: determine what this is before touching it. If it's local agent/tool working state (cache, scratch, session artifacts) rather than project source, it does not belong in the repo — add it to .gitignore and leave it untracked, do not commit it. If it turns out to be something else, flag it back rather than guessing.

  6. tools/: this is the full non-runtime tooling tree — dashboard/ (DASH-001, built and approved 2026-08-10), logtriage/ (TOOL-001), configdiff/ (TOOL-002), preflight/ (TOOL-003, including the Gate 3 freeze/verify capture logic this very task depends on), runnersweep/ (RUNNER-001, DEC-20260815-01), plus the currently-empty market-data/ and replay/. All of it is standalone, has no NT8 assembly references, and was explicitly approved as safe to build/commit at any time (SPRINT_BOARD.md, "PARALLEL — Non-Algorithm Product Work"). Add and commit the whole tree. Double check tools/dashboard/config.json and tools/dashboard/dashboard_state.json are NOT present or are gitignored if they contain a live operator's local paths/webhook URLs — only config.example.json should be committed.

  7. Build and test. Run dotnet test NT8-SDK.sln --configuration Release --verbosity minimal. All tests must pass (500+ expected; confirm the new GAP-037/038 tests are included in the count). Run the NinjaScript manual compile check per RB-4.1 step 1.

  8. Commit in logical groups, not one giant commit — governance docs, runtime remediations (GAP-035/036/039 + DASH-002), GAP-038 ConfigHash fix + its tests, GAP-037 regression tests, tools/ tree. Reference GAP/DASH/TOOL IDs in every commit message so git log stays audit-usable.

  9. Confirm git status --porcelain is empty.

  10. Re-run the freeze capture:

    powershell -ExecutionPolicy Bypass -File .\tools\preflight\preflight.ps1 `
      -ExpectAccount "SimSimple ORB" `
      -ExpectInstrument "NQ SEP26" `
      --freeze
    

    This must produce docs/gate-runs/gate3/baseline.json and move docs/gate-runs/gate3/DEC-GATE3-CONFIG.md from Status: draft toward acceptance. If it fails again, capture the new failure reason (it will no longer be the dirty-tree message) and report back rather than retrying blind.

  11. Re-arm check for the weekend disarmed window. The window (2026-08-15 to 08-17) closes before Monday market open. After this cleanup, confirm the strategy is deployed clean and armed per active_work.md's RB-4.1 steps, and that preflight.ps1 (non-freeze mode) passes with -ExpectAccount "SimSimple ORB" -ExpectInstrument "NQ SEP26" before Monday.

Explicit non-goals

  • No new features, no scope beyond getting the reviewed diffs committed and the tree clean.
  • Do not silently drop any hunk instead of understanding it — if a diff's purpose is unclear, flag it in your report rather than guessing and committing.
  • Do not touch DEC-GATE3-CONFIG.md's frozen parameter values — freezing the config is preflight.ps1 --freeze's job, not a manual edit.

Validation

  • git status --porcelain is empty.
  • Full test suite passes (record the exact pass count in your report).
  • preflight.ps1 --freeze succeeds and produces baseline.json.
  • Report back: final commit list (hash + message), test pass count, and freeze result.

Governance

  • Log a decisions.md entry only if any hunk required a judgment call you had to make unilaterally (e.g., resolving an unclear .hermes/ classification). Otherwise no new decision entry is needed — this task is process cleanup, not a new design decision.
  • Update SPRINT_BOARD.md's Gate Run #3 row once the freeze succeeds.