|
| 1 | +# Project Execution Plan (2026-03-11) |
| 2 | + |
| 3 | +This file is the canonical carry-over plan for implementation sequencing, test gates, and next-session priority. Keep this file updated as work progresses. |
| 4 | + |
| 5 | +## Next Session Highest Priority (P0) |
| 6 | + |
| 7 | +Run a full code pass across the repository before new feature coding. |
| 8 | + |
| 9 | +Instruction: |
| 10 | +1. Traverse all TypeScript source and tests. |
| 11 | +2. Remove hardcoded model-dependent assumptions. |
| 12 | +3. Classify every numeric constant as one of: |
| 13 | + - `model-derived`: must come from resolved model metadata. |
| 14 | + - `runtime-policy`: must come from explicit policy/config objects. |
| 15 | +4. Add or update tests first (Red), then implement (Green), then refactor. |
| 16 | + |
| 17 | +Definition of done for this pass: |
| 18 | +1. No model-dependent domain constants remain in feature code. |
| 19 | +2. A `ModelProfile` contract is the single source of truth for model-derived values. |
| 20 | +3. A guard command fails CI when disallowed hardcoded literals are introduced. |
| 21 | + |
| 22 | +## Non-Negotiable Rules |
| 23 | + |
| 24 | +1. Strict TDD: Red -> Green -> Refactor for every slice. |
| 25 | +2. Runtime realism: browser and Electron lanes are required merge gates. |
| 26 | +3. Provider fallback policy: `webnn -> webgpu -> webgl -> wasm`. |
| 27 | +4. Numeric ownership: model-derived values from profile; policy values from declared policy objects. |
| 28 | + |
| 29 | +## Execution Sequence |
| 30 | + |
| 31 | +1. Lock contracts and TDD workflow. |
| 32 | +2. Lock command contract and CI lanes. |
| 33 | +3. Implement model-profile layer first: |
| 34 | + - `core/ModelProfile.ts` |
| 35 | + - `core/ModelProfileResolver.ts` |
| 36 | + - `core/ModelDefaults.ts` |
| 37 | +4. Replace hardcoded model-dependent values with `ModelProfile` lookups. |
| 38 | +5. Implement embedding runner with fallback chain and telemetry: |
| 39 | + - `embeddings/EmbeddingRunner.ts` |
| 40 | + - `embeddings/ProviderResolver.ts` |
| 41 | + - `embeddings/TransformersEmbeddingBackend.ts` |
| 42 | + - `embeddings/OrtWebglEmbeddingBackend.ts` |
| 43 | + - `embeddings/OnnxEmbeddingRunner.ts` |
| 44 | +6. Build Hippocampus ingest using profile-derived chunking/dimensions. |
| 45 | +7. Build Cortex retrieval using profile-derived routing/truncation policies. |
| 46 | +8. Add parity, integration, runtime, and benchmark gates. |
| 47 | + |
| 48 | +## Required Test Matrix |
| 49 | + |
| 50 | +1. `unit-node` (required on each PR): |
| 51 | + - Model profile derivation and defaults |
| 52 | + - Fallback resolver semantics |
| 53 | + - Deterministic logic helpers |
| 54 | +2. `runtime-browser` (required on each PR): |
| 55 | + - Real IndexedDB + OPFS |
| 56 | + - Real ONNX runtime provider selection |
| 57 | +3. `runtime-electron` (required on each PR): |
| 58 | + - Desktop parity for embedding/storage contracts |
| 59 | +4. `integration-vertical` (required on each PR): |
| 60 | + - ingest -> persist -> query coherence with deterministic fixtures |
| 61 | +5. `benchmark-nightly` (release gate): |
| 62 | + - latency and throughput trend tracking |
| 63 | + |
| 64 | +## Command Contract |
| 65 | + |
| 66 | +1. `npm run test:unit` |
| 67 | +2. `npm run test:unit -- tests/model/ModelProfileResolver.test.ts` |
| 68 | +3. `npm run test:unit -- tests/model/ModelDefaults.test.ts` |
| 69 | +4. `npm run test:unit -- tests/embeddings/ProviderResolver.test.ts` |
| 70 | +5. `npm run test:unit -- tests/embeddings/OnnxEmbeddingRunner.test.ts` |
| 71 | +6. `npm run guard:model-derived` |
| 72 | +7. `npm run test:browser` |
| 73 | +8. `npm run test:electron` |
| 74 | +9. `npm run build && npm run lint` |
| 75 | +10. `npm run test:all` |
| 76 | +11. `npm run benchmark` |
| 77 | + |
| 78 | +## Known Hardcoded Hotspots To Clean First |
| 79 | + |
| 80 | +1. `core/types.ts` comments with sample token/dimension values. |
| 81 | +2. `Policy.ts` sample projection dimensions. |
| 82 | +3. `Cortex-sketch.md` and `Cortex-sketch-errata.md` illustrative constants (`2048`, `768`, `128`, `0.68`, `40`, etc.). |
| 83 | +4. Any ingest/query defaults currently assumed without model metadata backing. |
| 84 | + |
| 85 | +## Scope Notes |
| 86 | + |
| 87 | +1. ONNX runner scope for this milestone is embeddings-first. |
| 88 | +2. `webgl` support is preserved through explicit ORT fallback adapter even when Transformers.js device mapping does not expose it directly. |
| 89 | +3. Daydreamer depth, peer exchange, and advanced merge policies remain post-vertical work. |
0 commit comments