22
33This file is the canonical carry-over plan for implementation sequencing, test gates, and next-session priority. Keep this file updated as work progresses.
44
5+ ## Pass Status (2026-03-11)
6+
7+ Completed in this pass:
8+ 1 . Implemented ` ModelProfile ` source-of-truth layer:
9+ - ` core/ModelProfile.ts `
10+ - ` core/ModelDefaults.ts `
11+ - ` core/ModelProfileResolver.ts `
12+ 2 . Added TDD coverage for model defaults/resolution and routing derivation:
13+ - ` tests/model/ModelDefaults.test.ts `
14+ - ` tests/model/ModelProfileResolver.test.ts `
15+ - ` tests/model/RoutingPolicy.test.ts `
16+ 3 . Added ` createRoutingPolicy(...) ` derivation from profile-owned embedding dimensions.
17+ 4 . Added runtime numeric constants surface (` core/NumericConstants.ts ` ) and removed repeated byte/workgroup literals from backends and storage paths.
18+ 5 . Added ` guard:model-derived ` command and scanner (` scripts/guard-model-derived.mjs ` ) to block hardcoded model-related numeric literals outside approved sources.
19+ 6 . Validation gates passed in this workspace state:
20+ - ` npm run test:unit `
21+ - ` npm run guard:model-derived `
22+ - ` npm run build `
23+ - ` npm run lint `
24+ 7 . Added model-profile-to-policy bridge helper so runtime callers can resolve profile and derive routing in one step:
25+ - ` resolveRoutingPolicyForModel(...) ` in ` Policy.ts `
26+ - integration tests in ` tests/model/RoutingPolicy.test.ts `
27+
28+ Open items carried to next pass:
29+ 1 . Wire resolved ` ModelProfile ` into first concrete ingest/query orchestrator path (once those runtime modules are added).
30+ 2 . Add embedding provider resolver/runner modules and connect fallback policy to runtime execution.
31+ 3 . Add browser/electron runtime scripts and CI lanes for non-Node merge gating.
32+
533## Next Session Highest Priority (P0)
634
7- Run a full code pass across the repository before new feature coding .
35+ Integrate model-profile ownership into runtime flows and start the embedding vertical slice .
836
937Instruction:
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.
38+ 1 . Use ` ModelProfileResolver ` at runtime boundaries before any policy derivation or embedding execution.
39+ 2 . Implement first embedding runner/provider resolver slice with fallback semantics.
40+ 3 . Keep strict TDD (Red -> Green -> Refactor).
41+ 4 . If a blocker appears, record it in this document under an error log entry and continue with the next actionable slice.
1642
1743Definition 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 .
44+ 1 . Runtime path resolves model metadata through ` ModelProfileResolver ` before use .
45+ 2 . Embedding provider resolver tests and implementation are present .
46+ 3 . Any unresolved blocker is documented with file/symptom/next action .
2147
2248## Non-Negotiable Rules
2349
@@ -30,11 +56,11 @@ Definition of done for this pass:
3056
31571 . Lock contracts and TDD workflow.
32582 . Lock command contract and CI lanes.
33- 3 . Implement model-profile layer first:
59+ 3 . ~~ Implement model-profile layer first:~~ ✅ Done (2026-03-11)
3460 - ` core/ModelProfile.ts `
3561 - ` core/ModelProfileResolver.ts `
3662 - ` core/ModelDefaults.ts `
37- 4 . Replace hardcoded model-dependent values with ` ModelProfile ` lookups.
63+ 4 . ~~ Replace hardcoded model-dependent values with ` ModelProfile ` lookups.~~ ✅ Done for current code paths (2026-03-11)
38645 . Implement embedding runner with fallback chain and telemetry:
3965 - ` embeddings/EmbeddingRunner.ts `
4066 - ` embeddings/ProviderResolver.ts `
@@ -63,24 +89,27 @@ Definition of done for this pass:
6389
6490## Command Contract
6591
92+ Available now:
66931 . ` npm run test:unit `
67942 . ` npm run test:unit -- tests/model/ModelProfileResolver.test.ts `
68953 . ` 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 `
96+ 4 . ` npm run guard:model-derived `
97+ 5 . ` npm run build && npm run lint `
98+
99+ Planned commands to add in later passes:
100+ 1 . ` npm run test:unit -- tests/embeddings/ProviderResolver.test.ts `
101+ 2 . ` npm run test:unit -- tests/embeddings/OnnxEmbeddingRunner.test.ts `
102+ 3 . ` npm run test:browser `
103+ 4 . ` npm run test:electron `
104+ 5 . ` npm run test:all `
105+ 6 . ` npm run benchmark `
77106
78107## Known Hardcoded Hotspots To Clean First
79108
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.
109+ 1 . ~~ ` core/types.ts ` comments with sample token/dimension values. ~~ ✅ Updated to source-owned wording .
110+ 2 . ~~ ` Policy.ts ` sample projection dimensions. ~~ ✅ Replaced with derived policy implementation .
111+ 3 . ~~ ` Cortex-sketch.md ` and ` Cortex-sketch-errata.md ` illustrative constants (` 2048 ` , ` 768 ` , ` 128 ` , ` 0.68 ` , ` 40 ` , etc.). ~~ ✅ Clarified as illustrative .
112+ 4 . Any ingest/query defaults currently assumed without model metadata backing. (Pending runtime module implementation)
84113
85114## Scope Notes
86115
0 commit comments