You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CORTEX-DESIGN-PLAN-TODO.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,20 @@ Their durable content is preserved as canonical implementation/doc contracts:
54
54
4. Model-derived numeric ownership is canonical in `core/ModelDefaults.ts`, `core/ModelProfileResolver.ts`, and `Policy.ts`.
55
55
5. Naming convention is settled: use `Metroid` for project-domain graph terms; keep `medoid` only when referring to the underlying clustering statistic.
56
56
57
+
### 0.3 Runtime Harness Direction (2026-03-11)
58
+
59
+
Decision from runtime research and hotpath verification:
60
+
1. Keep the test harness browser-first; do not fork into a large Electron-specific app shell.
61
+
2. Use one renderer harness that can run unchanged in Chromium and Electron.
62
+
3. Wrap it in a thin Electron launcher for Linux GPU/WebGPU realism, switch control, and GPU diagnostics.
63
+
4. Keep Chromium as the web-parity lane and Electron as the primary runtime-realism lane.
64
+
5. Serve the harness over localhost during development/testing so WebGPU secure-context requirements are satisfied.
65
+
66
+
Why this direction won:
67
+
1. Electron retains Chromium's WebGPU path and limitations, so it is realistic instead of synthetic.
68
+
2. Electron gives better observability than raw browser automation on Linux (`app.commandLine`, GPU feature status/info).
69
+
3. The current missing confidence is browser-runtime execution, not WASM kernel validity; `Vectors.wat` and the dummy embedder hotpaths have already been executed successfully in ad hoc verification.
3.`Vectors.wat` is not just present as source text: it was compiled to wasm bytes and executed successfully through a one-off smoke harness.
57
+
4. The current terminal-only Node runtime cannot execute browser GPU paths directly:
58
+
-`document` is unavailable
59
+
-`navigator.gpu` is unavailable
60
+
-`navigator.ml` is unavailable
61
+
62
+
Interpretation:
63
+
1. WASM and deterministic embedding hotpaths are validated.
64
+
2. WebGPU/WebNN/WebGL paths still require a real browser/Electron runtime lane.
65
+
3. The missing confidence is now runtime-environment realism, not core kernel syntax.
44
66
45
67
### External Capability Verification (2026-03-11)
46
68
@@ -49,6 +71,13 @@ Verified during this pass (hard handoff facts):
49
71
2. Transformers.js device mapping exposes `webnn`, `webnn-gpu`, `webnn-cpu`, `webnn-npu`, `webgpu`, and `wasm` for web environments.
50
72
3. Transformers.js does not currently expose `webgl` as a direct `device` type; WebGL should remain an explicit ORT adapter path.
51
73
4. Node-side ONNX providers (platform-dependent) include `cuda`, `dml`, and `coreml` in upstream mapping.
74
+
5. Electron inherits Chromium GPU/WebGPU capability rather than bypassing it; it is still subject to host GPU drivers and Linux graphics stack limitations.
75
+
6. Electron is still the preferred Linux realism harness because it gives explicit Chromium switch control via `app.commandLine.appendSwitch(...)` before `ready`, plus GPU diagnostics via `app.getGPUFeatureStatus()` / `app.getGPUInfo()` after `gpu-info-update`.
76
+
7. Chrome WebGPU guidance confirms Linux support exists but can still require environment fixes when `navigator.gpu` is undefined or `requestAdapter()` returns `null`:
77
+
- secure context is required (`http://localhost` is acceptable for local dev)
78
+
- hardware acceleration must be enabled
79
+
- Linux experimental cases may need unsafe WebGPU / Vulkan enablement
80
+
- some hardware may require blocklist override for testing
52
81
53
82
Source anchors to re-check quickly in a new session:
1. Do not build a full Electron-first app shell just for testing.
104
+
2. Build one browser-first harness page/app that can run unchanged in Chromium and Electron.
105
+
3. Wrap that harness in a thin Electron launcher for Linux GPU realism and observability.
106
+
4. Keep Chromium as the web-parity lane; use Electron as the primary GPU/runtime realism lane.
107
+
5. Serve the harness over `http://127.0.0.1` / `http://localhost` during development and testing; do not rely on `file://` for WebGPU-sensitive execution.
61
108
62
109
## Next Session Highest Priority (P0)
63
110
64
-
Connect adaptive embedding selection to runtime orchestration and add real provider candidates.
111
+
Stand up the browser-first runtime harness and thin Electron wrapper so real GPU/browser validation can begin, then connect adaptive embedding selection into that runtime path.
65
112
66
113
Instruction:
67
-
1. Use `ModelProfileResolver` at runtime boundaries before any policy derivation or embedding execution.
68
-
2. Register real embedding providers in `ProviderResolver` candidate lists.
69
-
3. Keep strict TDD (Red -> Green -> Refactor).
70
-
4. If a blocker appears, record it in this document under an error log entry and continue with the next actionable slice.
114
+
1. Create a minimal harness renderer that reports:
115
+
-`navigator.gpu` availability
116
+
- adapter/device acquisition outcome
117
+
- IndexedDB + OPFS availability
118
+
- selected embedding backend/provider kind
119
+
2. Add a thin Electron main-process wrapper that:
120
+
- loads the same harness via localhost
121
+
- appends required Chromium switches before `ready`
122
+
- logs GPU feature status and GPU info after `gpu-info-update`
123
+
3. Add Playwright coverage for two lanes:
124
+
- Chromium web harness
125
+
- Electron harness
126
+
4. After the harness exists, register the first real embedding providers in `ProviderResolver` and test selection inside the real runtime lane.
127
+
5. Keep strict TDD (Red -> Green -> Refactor).
128
+
6. If a blocker appears, record it in this document under an error log entry and continue with the next actionable slice.
71
129
72
130
Definition of done for this pass:
73
-
1. Runtime path resolves model metadata through `ModelProfileResolver` before use.
74
-
2. At least one non-dummy real provider can be selected by capability + benchmark policy.
75
-
3. Any unresolved blocker is documented with file/symptom/next action.
131
+
1. A single renderer harness runs under both Chromium and Electron.
132
+
2. Electron lane emits GPU capability diagnostics on Linux.
133
+
3. At least one real provider candidate is wired into resolver selection from the runtime harness.
134
+
4. Any unresolved blocker is documented with file/symptom/next action.
76
135
77
136
## Non-Negotiable Rules
78
137
@@ -134,9 +193,10 @@ Available now:
134
193
135
194
Planned commands to add in later passes:
136
195
1.`npm run test:unit -- tests/embeddings/OnnxEmbeddingRunner.test.ts`
0 commit comments