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: ARCHITECTURE-REVIEW.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
**Scope:** Full repository audit against corrected DESIGN.md (v1.2)
5
5
**Status:** Documentation-only pass; no code changes made in this review
6
6
7
+
**Update (P0-X resolved):** All P0-X naming drift items (D1–D9) have been corrected. `SemanticNeighbor`, `SemanticNeighborSubgraph`, `putSemanticNeighbors`, `getSemanticNeighbors`, `getInducedNeighborSubgraph`, `needsNeighborRecalc`, `flagVolumeForNeighborRecalc`, and `clearNeighborRecalcFlag` are now in place throughout `core/types.ts`, `storage/IndexedDbMetadataStore.ts`, `cortex/Query.ts`, and all test files. The IDB object store is `neighbor_graph` (DB_VERSION=3). The divergence entries below are preserved as historical record.
Copy file name to clipboardExpand all lines: DESIGN.md
+2-6Lines changed: 2 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -495,8 +495,6 @@ interface Edge {
495
495
#### Semantic Neighbor (Proximity Edge)
496
496
Sparse radius-graph edge connecting pages with high cosine similarity. Used for subgraph expansion during retrieval.
497
497
498
-
> **Note:** The current codebase names this type `MetroidNeighbor` — this is an architectural naming error introduced by early conceptual drift. The correct term is `SemanticNeighbor` (or equivalent). A code-level rename is tracked in the TODO. The edge is a proximity concept, not a Metroid concept.
499
-
500
498
**Critical distinction — two edge types, two roles:**
501
499
502
500
| Edge type | Storage | Role |
@@ -525,8 +523,6 @@ interface SemanticNeighbor {
525
523
#### Semantic Neighbor Subgraph
526
524
Induced subgraph for BFS-based coherence path expansion.
527
525
528
-
> **Note:** Currently named `MetroidSubgraph` in the codebase — same renaming correction applies.
-`hotpath_index` (periodic HOT-membership checkpoint, keyed by `entityId`; loaded on startup to reconstruct the RAM resident index; written by Daydreamer each maintenance cycle)
@@ -789,7 +785,7 @@ Matryoshka dimensional unwinding. Runs the thesis→freeze→antithesis→synthe
789
785
search; m2 via cosine-opposite medoid; c computed once and frozen; subsequent candidates evaluated
790
786
relative to frozen c. Planned module: `cortex/MetroidBuilder.ts`.
791
787
792
-
**Semantic neighbor graph** (also: proximity graph, neighbor graph): The sparse radius-graph of cosine-similarity edges between pages, used for subgraph expansion during retrieval. This is **not** the same as a Metroid. The edges connect pages with high cosine similarity and are used for BFS expansion. Currently named `MetroidNeighbor` / `metroid_neighbors` in the codebase — this is a naming error that must be corrected (tracked in TODO as P0-X).
788
+
**Semantic neighbor graph** (also: proximity graph, neighbor graph): The sparse radius-graph of cosine-similarity edges between pages, used for subgraph expansion during retrieval. This is **not** the same as a Metroid. The edges connect pages with high cosine similarity and are used for BFS expansion.
793
789
794
790
**Hotpath**: The in-memory resident index of H(t) entries spanning all four hierarchy tiers. The hotpath is the first lookup target for every query; misses spill to WARM/COLD storage. HOT membership and salience are checkpointed to the `hotpath_index` IndexedDB store by Daydreamer each maintenance cycle, allowing the RAM index to be restored after a page reload or machine reboot without full corpus replay.
| Open TSP Solver | ❌ Missing |`cortex/OpenTSPSolver.ts` (planned) | Dummy-node open-path heuristic for coherent ordering |
103
103
| Query Orchestrator | 🟡 Needs Rework |`cortex/Query.ts`| Flat top-K scoring implemented (hotpath-first → warm/cold spill → PageActivity update → promotion sweep). **Must be substantially reworked** to implement the full dialectical pipeline: replace flat scoring with hierarchical resident-first ranking, add MetroidBuilder, dialectical zone scoring (thesis/antithesis/synthesis), subgraph expansion with dynamic Williams bounds, TSP coherence path, and query cost meter. The existing implementation does not use Hebbian edges or cosine-similarity-bounded subgraph expansion; it is a functional placeholder only. |
104
104
| Result DTO | 🟡 Needs Rework |`cortex/QueryResult.ts`| Minimal DTO (`pages`, `scores`, `metadata`). **Must be reworked** to add `coherencePath: Hash[]`, `metroid?: { m1, m2, centroid }`, `knowledgeGap?: KnowledgeGap`, and `provenance: { subgraphSize, hopCount, edgeWeights, vectorOpCost, earlyStop }`. |
@@ -116,7 +116,7 @@ This document tracks the implementation status of each major module in CORTEX. I
| Prototype Recomputation | ❌ Missing |`daydreamer/PrototypeRecomputer.ts` (planned) | Recalculate volume/shelf medoids and centroids; recompute salience for affected entries; run tier-quota promotion/eviction |
119
-
| Full Neighbor Graph Recalc | ❌ Missing |`daydreamer/FullNeighborRecalc.ts` (planned) | Rebuild bounded neighbor lists for dirty volumes; batch size bounded by O(√(t log t)) per idle cycle; recompute salience after recalc. **Note:** Currently planned as `FullMetroidRecalc` — this is a naming error; see TODO P0-X. |
119
+
| Full Neighbor Graph Recalc | ❌ Missing |`daydreamer/FullNeighborRecalc.ts` (planned) | Rebuild bounded neighbor lists for dirty volumes; batch size bounded by O(√(t log t)) per idle cycle; recompute salience after recalc. |
| Cluster Stability | ❌ Missing |`daydreamer/ClusterStability.ts` (planned) | Detect/trigger split/merge for unstable clusters; run lightweight label propagation for community detection; store community labels in PageActivity |
122
122
@@ -400,9 +400,9 @@ This document tracks the implementation status of each major module in CORTEX. I
400
400
**Impact:** Core discovery-sharing value proposition is missing; knowledge gaps cannot be resolved via P2P.
401
401
**Mitigation:** Phase 3 required track; implement eligibility classifier + curiosity broadcaster + signed subgraph exchange as v1 scope. CuriosityProbe must include `mimeType` and `modelUrn` to prevent incommensurable graph merges.
402
402
403
-
### Blocker 4: Naming Drift (P0-X)
404
-
**Impact:** The term "Metroid" is currently used for the proximity graph in all code. MetroidBuilder cannot be introduced without a rename collision.
405
-
**Mitigation:** P0-X tasks (rename `MetroidNeighbor` → `SemanticNeighbor`, etc.) must be completed before MetroidBuilder is implemented.
403
+
### Blocker 4: Naming Drift (P0-X) — RESOLVED
404
+
**Impact:** The term "Metroid" was used for the proximity graph in all code. MetroidBuilder cannot be introduced without a rename collision.
405
+
**Resolution:** P0-X rename completed. `SemanticNeighbor`, `SemanticNeighborSubgraph`, and all `*SemanticNeighbors`/`*NeighborRecalc` method names are now in place throughout `core/types.ts`, `storage/IndexedDbMetadataStore.ts`, `cortex/Query.ts`, and all test files. The IDB object store is `neighbor_graph` (DB_VERSION=3).
406
406
407
407
### Risk 1: TSP Complexity
408
408
Open TSP is NP-hard; heuristic may be slow on large subgraphs.
@@ -485,7 +485,7 @@ After every implementation pass:
485
485
486
486
## Notes
487
487
488
-
-**Metroid vs medoid vs semantic neighbor graph:** These are three distinct concepts. `Metroid` refers only to the dialectical search probe `{ m1, m2, c }` constructed by `MetroidBuilder` at query time. `medoid` refers to a cluster representative node. The sparse proximity/neighbor graph (used for BFS subgraph expansion) is the **semantic neighbor graph** — it is currently misnamed `MetroidNeighbor`/`MetroidSubgraph` in code (see TODO P0-X for the rename task).
488
+
-**Metroid vs medoid vs semantic neighbor graph:** These are three distinct concepts. `Metroid` refers only to the dialectical search probe `{ m1, m2, c }` constructed by `MetroidBuilder` at query time. `medoid` refers to a cluster representative node. The sparse proximity/neighbor graph (used for BFS subgraph expansion) is the **semantic neighbor graph** — represented by `SemanticNeighbor` / `SemanticNeighborSubgraph` in `core/types.ts` and stored in the `neighbor_graph` IDB object store.
489
489
-**Model-derived numerics:** Never hardcode; always source from `core/` model profile modules.
490
490
-**Policy-derived constants:** Never hardcode; always source from `core/HotpathPolicy.ts`.
491
491
-**Test philosophy:** TDD (Red → Green → Refactor) for all new slices.
Copy file name to clipboardExpand all lines: TODO.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,17 +208,17 @@ These items **must** be completed to have a usable system. Without them, users c
208
208
209
209
**Why:** The codebase uses the term "Metroid" to name the sparse proximity/neighbor graph (`MetroidNeighbor`, `MetroidSubgraph`, `metroid_neighbors`, `getInducedMetroidSubgraph`, `FastMetroidInsert`, `FullMetroidRecalc`). This is architecturally incorrect. In CORTEX, a **Metroid** is a structured dialectical search probe `{ m1, m2, c }` — a concept that does not yet exist in the codebase at all. The proximity graph has nothing to do with Metroids. This naming collision will cause permanent confusion and make the MetroidBuilder impossible to implement cleanly without a rename.
210
210
211
-
-[]**P0-X1:** Rename `MetroidNeighbor` → `SemanticNeighbor` in `core/types.ts`
211
+
-[x]**P0-X1:** Rename `MetroidNeighbor` → `SemanticNeighbor` in `core/types.ts`
212
212
- Update all references in `storage/IndexedDbMetadataStore.ts`
213
213
- Update all references in test files
214
214
- Update JSDoc and inline comments
215
215
216
-
-[]**P0-X2:** Rename `MetroidSubgraph` → `SemanticNeighborSubgraph` in `core/types.ts`
216
+
-[x]**P0-X2:** Rename `MetroidSubgraph` → `SemanticNeighborSubgraph` in `core/types.ts`
217
217
- Update all references in `storage/IndexedDbMetadataStore.ts`
- Rename class/function to `FullNeighborRecalc`/`runNeighborRecalc`
235
235
236
-
-[]**P0-X6:** Rename IndexedDB object store from `metroid_neighbors` → `neighbor_graph`
236
+
-[x]**P0-X6:** Rename IndexedDB object store from `metroid_neighbors` → `neighbor_graph`
237
237
- Increment `DB_VERSION` in `storage/IndexedDbMetadataStore.ts`
238
238
- Add migration in `applyUpgrade` to copy data from old store to new store
239
239
240
-
-[]**P0-X7:** Update all documentation strings and JSDoc that use "Metroid neighbor" to use "semantic neighbor"
240
+
-[x]**P0-X7:** Update all documentation strings and JSDoc that use "Metroid neighbor" to use "semantic neighbor"
241
241
242
242
**Exit Criteria:** No source file uses "Metroid" to refer to the proximity graph. The term "Metroid" is reserved exclusively for the `{ m1, m2, c }` dialectical probe type implemented in `cortex/MetroidBuilder.ts`.
243
243
@@ -863,7 +863,7 @@ These items improve quality, performance, and developer experience. Not blockers
863
863
If you're reading this and want to know "what do I work on right now?", here's the answer:
864
864
865
865
**Immediate (unblock MetroidBuilder):**
866
-
1.**P0-X1–X7:** Fix architectural naming drift (`MetroidNeighbor` → `SemanticNeighbor` and related renames)
866
+
1.~~**P0-X1–X7:** Fix architectural naming drift (`MetroidNeighbor` → `SemanticNeighbor` and related renames)~~ ✅ DONE
Copy file name to clipboardExpand all lines: docs/api.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,18 +112,18 @@ interface Edge {
112
112
}
113
113
```
114
114
115
-
#### `MetroidNeighbor`
115
+
#### `SemanticNeighbor`
116
116
117
-
A nearest-neighbour entry in the Metroid radius graph (a project-domain term for the medoid-inspired NN graph).
117
+
A nearest-neighbour entry in the semantic neighbor radius graph — a sparse proximity graph connecting pages with high cosine similarity, used for BFS subgraph expansion during retrieval.
118
118
119
119
```typescript
120
-
interfaceMetroidNeighbor {
120
+
interfaceSemanticNeighbor {
121
121
neighborPageId:Hash;
122
122
cosineSimilarity:number; // threshold defined by runtime policy
0 commit comments