fix: update all Stage 2 references to Stage 3 CANONICAL type counts

Comprehensive update of type count references from Stage 2 (31 nouns + 40 verbs)
to Stage 3 CANONICAL (42 nouns + 127 verbs) across entire codebase.

Changes (23 files):
- Core architecture: Memory tracking comments, speedup calculations
- Tests: Type count assertions, enum index expectations, memory benchmarks
- CLI: User-visible type count output
- Augmentations: Type detection comments
- Documentation: Architecture docs, guides, performance docs
- Type embeddings: Regenerated for all 169 types (338KB)

Specific updates:
- 31 → 42 (noun count): 38 occurrences
- 40 → 127 (verb count): 24 occurrences
- 124 → 168 bytes (noun array size): 5 occurrences
- 160 → 508 bytes (verb array size): 5 occurrences
- 284 → 676 bytes (total type tracking): 12 occurrences
- Enum indices updated to match Stage 3 reordering

Type embeddings regenerated:
- 42 noun embeddings (64.5 KB)
- 127 verb embeddings (194.8 KB)
- Total: 338 KB (was 108.8 KB)

All constants, arrays, and tests now consistent with Stage 3 taxonomy.

Fixes #v5.5.1-type-count-migration
This commit is contained in:
David Snelling 2025-11-06 09:40:33 -08:00
parent f57732be90
commit 823cd5cf1b
23 changed files with 106 additions and 106 deletions

View file

@ -7,7 +7,7 @@
* - Storage: Already type-first from Phase 1a
*
* Architecture:
* - One HNSWIndex per NounType (31 total)
* - One HNSWIndex per NounType (42 total)
* - Lazy initialization (indexes created on first use)
* - Type routing for optimal performance
* - Falls back to multi-type search when type unknown
@ -128,7 +128,7 @@ export class TypeAwareHNSWIndex {
const typeIndex = TypeUtils.getNounIndex(type)
if (typeIndex === undefined || typeIndex === null || typeIndex < 0) {
throw new Error(
`Invalid NounType: ${type}. Must be one of the 31 defined types.`
`Invalid NounType: ${type}. Must be one of the 42 defined types.`
)
}
@ -193,7 +193,7 @@ export class TypeAwareHNSWIndex {
* **All-types search** (fallback):
* ```typescript
* await index.search(queryVector, 10)
* // Searches all 31 graphs (slower but comprehensive)
* // Searches all 42 graphs (slower but comprehensive)
* ```
*
* @param queryVector Query vector
@ -393,7 +393,7 @@ export class TypeAwareHNSWIndex {
* Rebuild HNSW indexes from storage (type-aware)
*
* CRITICAL: This implementation uses type-filtered pagination to avoid
* loading ALL entities for each type (which would be 31 billion reads @ 1B scale).
* loading ALL entities for each type (which would be 42 billion reads @ 1B scale).
*
* Can rebuild all types or specific types.
* Much faster than rebuilding a monolithic index.
@ -451,7 +451,7 @@ export class TypeAwareHNSWIndex {
}
// Load ALL nouns ONCE and route to correct type indexes
// This is O(N) instead of O(31*N) from the previous parallel approach
// This is O(N) instead of O(42*N) from the previous parallel approach
let cursor: string | undefined = undefined
let hasMore = true
let totalLoaded = 0