@danielsimonjr/memoryjs 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +385 -113
- package/README.md.backup-1768084780988 +266 -0
- package/dist/index.cjs +24156 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +16967 -0
- package/dist/index.d.ts +16963 -11
- package/dist/index.js +23887 -19
- package/dist/index.js.map +1 -1
- package/dist/workers/levenshteinWorker.cjs +102 -0
- package/dist/workers/levenshteinWorker.cjs.map +1 -0
- package/dist/workers/levenshteinWorker.js +57 -91
- package/dist/workers/levenshteinWorker.js.map +1 -1
- package/package.json +75 -69
- package/dist/core/EntityManager.d.ts +0 -268
- package/dist/core/EntityManager.d.ts.map +0 -1
- package/dist/core/EntityManager.js +0 -512
- package/dist/core/EntityManager.js.map +0 -1
- package/dist/core/GraphEventEmitter.d.ts +0 -202
- package/dist/core/GraphEventEmitter.d.ts.map +0 -1
- package/dist/core/GraphEventEmitter.js +0 -347
- package/dist/core/GraphEventEmitter.js.map +0 -1
- package/dist/core/GraphStorage.d.ts +0 -395
- package/dist/core/GraphStorage.d.ts.map +0 -1
- package/dist/core/GraphStorage.js +0 -786
- package/dist/core/GraphStorage.js.map +0 -1
- package/dist/core/GraphTraversal.d.ts +0 -141
- package/dist/core/GraphTraversal.d.ts.map +0 -1
- package/dist/core/GraphTraversal.js +0 -574
- package/dist/core/GraphTraversal.js.map +0 -1
- package/dist/core/HierarchyManager.d.ts +0 -111
- package/dist/core/HierarchyManager.d.ts.map +0 -1
- package/dist/core/HierarchyManager.js +0 -225
- package/dist/core/HierarchyManager.js.map +0 -1
- package/dist/core/ManagerContext.d.ts +0 -76
- package/dist/core/ManagerContext.d.ts.map +0 -1
- package/dist/core/ManagerContext.js +0 -129
- package/dist/core/ManagerContext.js.map +0 -1
- package/dist/core/ObservationManager.d.ts +0 -85
- package/dist/core/ObservationManager.d.ts.map +0 -1
- package/dist/core/ObservationManager.js +0 -124
- package/dist/core/ObservationManager.js.map +0 -1
- package/dist/core/RelationManager.d.ts +0 -131
- package/dist/core/RelationManager.d.ts.map +0 -1
- package/dist/core/RelationManager.js +0 -212
- package/dist/core/RelationManager.js.map +0 -1
- package/dist/core/SQLiteStorage.d.ts +0 -354
- package/dist/core/SQLiteStorage.d.ts.map +0 -1
- package/dist/core/SQLiteStorage.js +0 -919
- package/dist/core/SQLiteStorage.js.map +0 -1
- package/dist/core/StorageFactory.d.ts +0 -45
- package/dist/core/StorageFactory.d.ts.map +0 -1
- package/dist/core/StorageFactory.js +0 -65
- package/dist/core/StorageFactory.js.map +0 -1
- package/dist/core/TransactionManager.d.ts +0 -464
- package/dist/core/TransactionManager.d.ts.map +0 -1
- package/dist/core/TransactionManager.js +0 -869
- package/dist/core/TransactionManager.js.map +0 -1
- package/dist/core/index.d.ts +0 -17
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -20
- package/dist/core/index.js.map +0 -1
- package/dist/features/AnalyticsManager.d.ts +0 -44
- package/dist/features/AnalyticsManager.d.ts.map +0 -1
- package/dist/features/AnalyticsManager.js +0 -224
- package/dist/features/AnalyticsManager.js.map +0 -1
- package/dist/features/ArchiveManager.d.ts +0 -133
- package/dist/features/ArchiveManager.d.ts.map +0 -1
- package/dist/features/ArchiveManager.js +0 -282
- package/dist/features/ArchiveManager.js.map +0 -1
- package/dist/features/CompressionManager.d.ts +0 -119
- package/dist/features/CompressionManager.d.ts.map +0 -1
- package/dist/features/CompressionManager.js +0 -470
- package/dist/features/CompressionManager.js.map +0 -1
- package/dist/features/IOManager.d.ts +0 -225
- package/dist/features/IOManager.d.ts.map +0 -1
- package/dist/features/IOManager.js +0 -1093
- package/dist/features/IOManager.js.map +0 -1
- package/dist/features/KeywordExtractor.d.ts +0 -61
- package/dist/features/KeywordExtractor.d.ts.map +0 -1
- package/dist/features/KeywordExtractor.js +0 -127
- package/dist/features/KeywordExtractor.js.map +0 -1
- package/dist/features/ObservationNormalizer.d.ts +0 -90
- package/dist/features/ObservationNormalizer.d.ts.map +0 -1
- package/dist/features/ObservationNormalizer.js +0 -194
- package/dist/features/ObservationNormalizer.js.map +0 -1
- package/dist/features/StreamingExporter.d.ts +0 -128
- package/dist/features/StreamingExporter.d.ts.map +0 -1
- package/dist/features/StreamingExporter.js +0 -212
- package/dist/features/StreamingExporter.js.map +0 -1
- package/dist/features/TagManager.d.ts +0 -147
- package/dist/features/TagManager.d.ts.map +0 -1
- package/dist/features/TagManager.js +0 -211
- package/dist/features/TagManager.js.map +0 -1
- package/dist/features/index.d.ts +0 -14
- package/dist/features/index.d.ts.map +0 -1
- package/dist/features/index.js +0 -15
- package/dist/features/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/search/BM25Search.d.ts +0 -148
- package/dist/search/BM25Search.d.ts.map +0 -1
- package/dist/search/BM25Search.js +0 -340
- package/dist/search/BM25Search.js.map +0 -1
- package/dist/search/BasicSearch.d.ts +0 -51
- package/dist/search/BasicSearch.d.ts.map +0 -1
- package/dist/search/BasicSearch.js +0 -138
- package/dist/search/BasicSearch.js.map +0 -1
- package/dist/search/BooleanSearch.d.ts +0 -98
- package/dist/search/BooleanSearch.d.ts.map +0 -1
- package/dist/search/BooleanSearch.js +0 -431
- package/dist/search/BooleanSearch.js.map +0 -1
- package/dist/search/EarlyTerminationManager.d.ts +0 -140
- package/dist/search/EarlyTerminationManager.d.ts.map +0 -1
- package/dist/search/EarlyTerminationManager.js +0 -280
- package/dist/search/EarlyTerminationManager.js.map +0 -1
- package/dist/search/EmbeddingCache.d.ts +0 -175
- package/dist/search/EmbeddingCache.d.ts.map +0 -1
- package/dist/search/EmbeddingCache.js +0 -247
- package/dist/search/EmbeddingCache.js.map +0 -1
- package/dist/search/EmbeddingService.d.ts +0 -277
- package/dist/search/EmbeddingService.d.ts.map +0 -1
- package/dist/search/EmbeddingService.js +0 -531
- package/dist/search/EmbeddingService.js.map +0 -1
- package/dist/search/FuzzySearch.d.ts +0 -118
- package/dist/search/FuzzySearch.d.ts.map +0 -1
- package/dist/search/FuzzySearch.js +0 -313
- package/dist/search/FuzzySearch.js.map +0 -1
- package/dist/search/HybridScorer.d.ts +0 -181
- package/dist/search/HybridScorer.d.ts.map +0 -1
- package/dist/search/HybridScorer.js +0 -258
- package/dist/search/HybridScorer.js.map +0 -1
- package/dist/search/HybridSearchManager.d.ts +0 -80
- package/dist/search/HybridSearchManager.d.ts.map +0 -1
- package/dist/search/HybridSearchManager.js +0 -188
- package/dist/search/HybridSearchManager.js.map +0 -1
- package/dist/search/IncrementalIndexer.d.ts +0 -201
- package/dist/search/IncrementalIndexer.d.ts.map +0 -1
- package/dist/search/IncrementalIndexer.js +0 -343
- package/dist/search/IncrementalIndexer.js.map +0 -1
- package/dist/search/OptimizedInvertedIndex.d.ts +0 -163
- package/dist/search/OptimizedInvertedIndex.d.ts.map +0 -1
- package/dist/search/OptimizedInvertedIndex.js +0 -359
- package/dist/search/OptimizedInvertedIndex.js.map +0 -1
- package/dist/search/ParallelSearchExecutor.d.ts +0 -172
- package/dist/search/ParallelSearchExecutor.d.ts.map +0 -1
- package/dist/search/ParallelSearchExecutor.js +0 -310
- package/dist/search/ParallelSearchExecutor.js.map +0 -1
- package/dist/search/QuantizedVectorStore.d.ts +0 -171
- package/dist/search/QuantizedVectorStore.d.ts.map +0 -1
- package/dist/search/QuantizedVectorStore.js +0 -308
- package/dist/search/QuantizedVectorStore.js.map +0 -1
- package/dist/search/QueryAnalyzer.d.ts +0 -76
- package/dist/search/QueryAnalyzer.d.ts.map +0 -1
- package/dist/search/QueryAnalyzer.js +0 -228
- package/dist/search/QueryAnalyzer.js.map +0 -1
- package/dist/search/QueryCostEstimator.d.ts +0 -244
- package/dist/search/QueryCostEstimator.d.ts.map +0 -1
- package/dist/search/QueryCostEstimator.js +0 -653
- package/dist/search/QueryCostEstimator.js.map +0 -1
- package/dist/search/QueryPlanCache.d.ts +0 -220
- package/dist/search/QueryPlanCache.d.ts.map +0 -1
- package/dist/search/QueryPlanCache.js +0 -380
- package/dist/search/QueryPlanCache.js.map +0 -1
- package/dist/search/QueryPlanner.d.ts +0 -58
- package/dist/search/QueryPlanner.d.ts.map +0 -1
- package/dist/search/QueryPlanner.js +0 -138
- package/dist/search/QueryPlanner.js.map +0 -1
- package/dist/search/RankedSearch.d.ts +0 -71
- package/dist/search/RankedSearch.d.ts.map +0 -1
- package/dist/search/RankedSearch.js +0 -239
- package/dist/search/RankedSearch.js.map +0 -1
- package/dist/search/ReflectionManager.d.ts +0 -120
- package/dist/search/ReflectionManager.d.ts.map +0 -1
- package/dist/search/ReflectionManager.js +0 -232
- package/dist/search/ReflectionManager.js.map +0 -1
- package/dist/search/SavedSearchManager.d.ts +0 -79
- package/dist/search/SavedSearchManager.d.ts.map +0 -1
- package/dist/search/SavedSearchManager.js +0 -147
- package/dist/search/SavedSearchManager.js.map +0 -1
- package/dist/search/SearchFilterChain.d.ts +0 -120
- package/dist/search/SearchFilterChain.d.ts.map +0 -1
- package/dist/search/SearchFilterChain.js +0 -186
- package/dist/search/SearchFilterChain.js.map +0 -1
- package/dist/search/SearchManager.d.ts +0 -326
- package/dist/search/SearchManager.d.ts.map +0 -1
- package/dist/search/SearchManager.js +0 -454
- package/dist/search/SearchManager.js.map +0 -1
- package/dist/search/SearchSuggestions.d.ts +0 -27
- package/dist/search/SearchSuggestions.d.ts.map +0 -1
- package/dist/search/SearchSuggestions.js +0 -58
- package/dist/search/SearchSuggestions.js.map +0 -1
- package/dist/search/SemanticSearch.d.ts +0 -149
- package/dist/search/SemanticSearch.d.ts.map +0 -1
- package/dist/search/SemanticSearch.js +0 -324
- package/dist/search/SemanticSearch.js.map +0 -1
- package/dist/search/SymbolicSearch.d.ts +0 -61
- package/dist/search/SymbolicSearch.d.ts.map +0 -1
- package/dist/search/SymbolicSearch.js +0 -164
- package/dist/search/SymbolicSearch.js.map +0 -1
- package/dist/search/TFIDFEventSync.d.ts +0 -85
- package/dist/search/TFIDFEventSync.d.ts.map +0 -1
- package/dist/search/TFIDFEventSync.js +0 -134
- package/dist/search/TFIDFEventSync.js.map +0 -1
- package/dist/search/TFIDFIndexManager.d.ts +0 -151
- package/dist/search/TFIDFIndexManager.d.ts.map +0 -1
- package/dist/search/TFIDFIndexManager.js +0 -433
- package/dist/search/TFIDFIndexManager.js.map +0 -1
- package/dist/search/VectorStore.d.ts +0 -235
- package/dist/search/VectorStore.d.ts.map +0 -1
- package/dist/search/VectorStore.js +0 -312
- package/dist/search/VectorStore.js.map +0 -1
- package/dist/search/index.d.ts +0 -35
- package/dist/search/index.d.ts.map +0 -1
- package/dist/search/index.js +0 -53
- package/dist/search/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -13
- package/dist/types/index.js.map +0 -1
- package/dist/types/types.d.ts +0 -1811
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -10
- package/dist/types/types.js.map +0 -1
- package/dist/utils/BatchProcessor.d.ts +0 -271
- package/dist/utils/BatchProcessor.d.ts.map +0 -1
- package/dist/utils/BatchProcessor.js +0 -377
- package/dist/utils/BatchProcessor.js.map +0 -1
- package/dist/utils/MemoryMonitor.d.ts +0 -176
- package/dist/utils/MemoryMonitor.d.ts.map +0 -1
- package/dist/utils/MemoryMonitor.js +0 -306
- package/dist/utils/MemoryMonitor.js.map +0 -1
- package/dist/utils/WorkerPoolManager.d.ts +0 -233
- package/dist/utils/WorkerPoolManager.d.ts.map +0 -1
- package/dist/utils/WorkerPoolManager.js +0 -421
- package/dist/utils/WorkerPoolManager.js.map +0 -1
- package/dist/utils/compressedCache.d.ts +0 -221
- package/dist/utils/compressedCache.d.ts.map +0 -1
- package/dist/utils/compressedCache.js +0 -349
- package/dist/utils/compressedCache.js.map +0 -1
- package/dist/utils/compressionUtil.d.ts +0 -214
- package/dist/utils/compressionUtil.d.ts.map +0 -1
- package/dist/utils/compressionUtil.js +0 -248
- package/dist/utils/compressionUtil.js.map +0 -1
- package/dist/utils/constants.d.ts +0 -245
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js +0 -253
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/entityUtils.d.ts +0 -379
- package/dist/utils/entityUtils.d.ts.map +0 -1
- package/dist/utils/entityUtils.js +0 -649
- package/dist/utils/entityUtils.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -95
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -146
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/formatters.d.ts +0 -145
- package/dist/utils/formatters.d.ts.map +0 -1
- package/dist/utils/formatters.js +0 -133
- package/dist/utils/formatters.js.map +0 -1
- package/dist/utils/index.d.ts +0 -26
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -88
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/indexes.d.ts +0 -270
- package/dist/utils/indexes.d.ts.map +0 -1
- package/dist/utils/indexes.js +0 -527
- package/dist/utils/indexes.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -31
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -41
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/operationUtils.d.ts +0 -124
- package/dist/utils/operationUtils.d.ts.map +0 -1
- package/dist/utils/operationUtils.js +0 -176
- package/dist/utils/operationUtils.js.map +0 -1
- package/dist/utils/parallelUtils.d.ts +0 -76
- package/dist/utils/parallelUtils.d.ts.map +0 -1
- package/dist/utils/parallelUtils.js +0 -192
- package/dist/utils/parallelUtils.js.map +0 -1
- package/dist/utils/schemas.d.ts +0 -556
- package/dist/utils/schemas.d.ts.map +0 -1
- package/dist/utils/schemas.js +0 -485
- package/dist/utils/schemas.js.map +0 -1
- package/dist/utils/searchAlgorithms.d.ts +0 -99
- package/dist/utils/searchAlgorithms.d.ts.map +0 -1
- package/dist/utils/searchAlgorithms.js +0 -168
- package/dist/utils/searchAlgorithms.js.map +0 -1
- package/dist/utils/searchCache.d.ts +0 -108
- package/dist/utils/searchCache.d.ts.map +0 -1
- package/dist/utils/searchCache.js +0 -210
- package/dist/utils/searchCache.js.map +0 -1
- package/dist/utils/taskScheduler.d.ts +0 -294
- package/dist/utils/taskScheduler.d.ts.map +0 -1
- package/dist/utils/taskScheduler.js +0 -487
- package/dist/utils/taskScheduler.js.map +0 -1
- package/dist/workers/index.d.ts +0 -12
- package/dist/workers/index.d.ts.map +0 -1
- package/dist/workers/index.js +0 -10
- package/dist/workers/index.js.map +0 -1
- package/dist/workers/levenshteinWorker.d.ts +0 -60
- package/dist/workers/levenshteinWorker.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,17 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MemoryJS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/danielsimonjr/memoryjs)
|
|
4
|
+
[](https://www.npmjs.com/package/@danielsimonjr/memoryjs)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
|
|
8
|
+
A **TypeScript knowledge graph library** for managing entities, relations, and observations with **advanced search capabilities**, **hierarchical organization**, and **multiple storage backends**.
|
|
9
|
+
|
|
10
|
+
> **Core library** powering [@danielsimonjr/memory-mcp](https://www.npmjs.com/package/@danielsimonjr/memory-mcp). Provides 73 TypeScript files, ~29K lines of code, dual storage backends (JSONL/SQLite), and sophisticated search algorithms including BM25, TF-IDF, fuzzy, semantic, and hybrid search.
|
|
11
|
+
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
- [Features](#features)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Quick Start](#quick-start)
|
|
17
|
+
- [Core Concepts](#core-concepts)
|
|
18
|
+
- [Storage Options](#storage-options)
|
|
19
|
+
- [Search Capabilities](#search-capabilities)
|
|
20
|
+
- [Graph Algorithms](#graph-algorithms)
|
|
21
|
+
- [API Reference](#api-reference)
|
|
22
|
+
- [Configuration](#configuration)
|
|
23
|
+
- [Development](#development)
|
|
24
|
+
- [Documentation](#documentation)
|
|
25
|
+
- [License](#license)
|
|
4
26
|
|
|
5
27
|
## Features
|
|
6
28
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
|
|
29
|
+
### Core Capabilities
|
|
30
|
+
|
|
31
|
+
- **Knowledge Graph Storage**: Entity-Relation-Observation model for structured data
|
|
32
|
+
- **Dual Storage Backends**: JSONL (human-readable) or SQLite (FTS5, 3-10x faster)
|
|
33
|
+
- **Full CRUD Operations**: Create, read, update, delete entities and relations
|
|
34
|
+
- **Hierarchical Nesting**: Parent-child relationships for tree structures
|
|
35
|
+
- **Timestamps**: Automatic createdAt and lastModified tracking
|
|
36
|
+
|
|
37
|
+
### Advanced Features
|
|
38
|
+
|
|
39
|
+
| Category | Description |
|
|
40
|
+
|----------|-------------|
|
|
41
|
+
| **Search Algorithms** | Basic, TF-IDF ranked, BM25, Boolean (AND/OR/NOT), Fuzzy (Levenshtein), Semantic (embeddings), Hybrid |
|
|
42
|
+
| **Graph Algorithms** | Shortest path (BFS), all paths, centrality metrics (degree, betweenness, PageRank), connected components |
|
|
43
|
+
| **Hierarchical Nesting** | Parent-child relationships, ancestor/descendant traversal, subtree operations |
|
|
44
|
+
| **Duplicate Detection** | Intelligent compression with similarity scoring |
|
|
45
|
+
| **Tag Management** | Tags, aliases, bulk operations, importance scores (0-10) |
|
|
46
|
+
| **Import/Export** | JSON, CSV, GraphML formats with Brotli compression |
|
|
47
|
+
| **Analytics** | Graph statistics, validation, integrity checks |
|
|
48
|
+
|
|
49
|
+
### Module Statistics
|
|
50
|
+
|
|
51
|
+
| Module | Files | Key Components |
|
|
52
|
+
|--------|-------|----------------|
|
|
53
|
+
| `core/` | 12 | EntityManager, GraphStorage, SQLiteStorage, TransactionManager |
|
|
54
|
+
| `search/` | 29 | SearchManager, BM25Search, HybridScorer, VectorStore, QueryPlanner |
|
|
55
|
+
| `features/` | 9 | IOManager, ArchiveManager, CompressionManager, StreamingExporter |
|
|
56
|
+
| `utils/` | 18 | BatchProcessor, CompressedCache, WorkerPoolManager, MemoryMonitor |
|
|
57
|
+
| `types/` | 2 | Entity, Relation, KnowledgeGraph interfaces |
|
|
58
|
+
| `workers/` | 2 | Levenshtein distance calculations |
|
|
59
|
+
|
|
60
|
+
**Total:** 73 TypeScript files | ~29,000 lines of code | 558 exports
|
|
15
61
|
|
|
16
62
|
## Installation
|
|
17
63
|
|
|
@@ -19,198 +65,292 @@ Core knowledge graph library for managing entities, relations, and observations
|
|
|
19
65
|
npm install @danielsimonjr/memoryjs
|
|
20
66
|
```
|
|
21
67
|
|
|
68
|
+
### Requirements
|
|
69
|
+
|
|
70
|
+
- Node.js >= 18.0.0
|
|
71
|
+
- TypeScript >= 5.0 (for development)
|
|
72
|
+
|
|
22
73
|
## Quick Start
|
|
23
74
|
|
|
75
|
+
### 1. Initialize Storage
|
|
76
|
+
|
|
24
77
|
```typescript
|
|
25
78
|
import { ManagerContext } from '@danielsimonjr/memoryjs';
|
|
26
79
|
|
|
27
|
-
//
|
|
80
|
+
// JSONL storage (default, human-readable)
|
|
28
81
|
const ctx = new ManagerContext({
|
|
29
82
|
storagePath: './memory.jsonl'
|
|
30
83
|
});
|
|
31
84
|
|
|
32
|
-
//
|
|
85
|
+
// Or SQLite storage (faster, FTS5 search)
|
|
86
|
+
const ctx = new ManagerContext({
|
|
87
|
+
storageType: 'sqlite',
|
|
88
|
+
storagePath: './memory.db'
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 2. Create Entities
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
33
95
|
await ctx.entityManager.createEntities([
|
|
34
|
-
{
|
|
35
|
-
|
|
96
|
+
{
|
|
97
|
+
name: 'TypeScript',
|
|
98
|
+
entityType: 'language',
|
|
99
|
+
observations: ['A typed superset of JavaScript'],
|
|
100
|
+
tags: ['programming', 'frontend'],
|
|
101
|
+
importance: 8
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Node.js',
|
|
105
|
+
entityType: 'runtime',
|
|
106
|
+
observations: ['JavaScript runtime built on V8'],
|
|
107
|
+
tags: ['backend', 'server']
|
|
108
|
+
}
|
|
36
109
|
]);
|
|
110
|
+
```
|
|
37
111
|
|
|
38
|
-
|
|
112
|
+
### 3. Create Relations
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
39
115
|
await ctx.relationManager.createRelations([
|
|
40
116
|
{ from: 'TypeScript', to: 'Node.js', relationType: 'runs_on' }
|
|
41
117
|
]);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 4. Search
|
|
42
121
|
|
|
43
|
-
|
|
122
|
+
```typescript
|
|
123
|
+
// Basic search
|
|
44
124
|
const results = await ctx.searchManager.search('JavaScript');
|
|
125
|
+
|
|
126
|
+
// Ranked search (TF-IDF scoring)
|
|
127
|
+
const ranked = await ctx.searchManager.searchRanked('runtime environment', { limit: 10 });
|
|
128
|
+
|
|
129
|
+
// Boolean search
|
|
130
|
+
const filtered = await ctx.searchManager.booleanSearch('TypeScript AND runtime');
|
|
131
|
+
|
|
132
|
+
// Fuzzy search (typo-tolerant)
|
|
133
|
+
const fuzzy = await ctx.searchManager.fuzzySearch('Typscript', { threshold: 0.7 });
|
|
45
134
|
```
|
|
46
135
|
|
|
47
|
-
##
|
|
136
|
+
## Core Concepts
|
|
137
|
+
|
|
138
|
+
### Entities
|
|
48
139
|
|
|
49
|
-
|
|
140
|
+
Primary nodes in the knowledge graph.
|
|
50
141
|
|
|
51
142
|
```typescript
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
143
|
+
interface Entity {
|
|
144
|
+
name: string; // Unique identifier
|
|
145
|
+
entityType: string; // Classification (person, project, concept)
|
|
146
|
+
observations: string[]; // Facts about the entity
|
|
147
|
+
parentId?: string; // Parent entity for hierarchical nesting
|
|
148
|
+
tags?: string[]; // Lowercase tags for categorization
|
|
149
|
+
importance?: number; // 0-10 scale for prioritization
|
|
150
|
+
createdAt?: string; // ISO 8601 timestamp
|
|
151
|
+
lastModified?: string; // ISO 8601 timestamp
|
|
152
|
+
}
|
|
55
153
|
```
|
|
56
154
|
|
|
57
|
-
###
|
|
155
|
+
### Relations
|
|
156
|
+
|
|
157
|
+
Directed connections between entities.
|
|
58
158
|
|
|
59
159
|
```typescript
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
160
|
+
interface Relation {
|
|
161
|
+
from: string; // Source entity name
|
|
162
|
+
to: string; // Target entity name
|
|
163
|
+
relationType: string; // Relationship type (active voice)
|
|
164
|
+
}
|
|
64
165
|
```
|
|
65
166
|
|
|
66
|
-
|
|
67
|
-
- FTS5 full-text search with BM25 ranking
|
|
68
|
-
- Referential integrity (ON DELETE CASCADE)
|
|
69
|
-
- WAL mode for better concurrency
|
|
70
|
-
- ACID transactions
|
|
167
|
+
### Observations
|
|
71
168
|
|
|
72
|
-
|
|
169
|
+
Discrete facts about entities. Each observation should be atomic and independently manageable. Use `addObservations()` to append new facts without overwriting existing ones.
|
|
73
170
|
|
|
74
171
|
### ManagerContext
|
|
75
172
|
|
|
76
|
-
Central access point for all managers:
|
|
173
|
+
Central access point for all managers with lazy initialization:
|
|
77
174
|
|
|
78
175
|
```typescript
|
|
79
176
|
ctx.entityManager // Entity CRUD + hierarchy
|
|
80
177
|
ctx.relationManager // Relation management
|
|
81
178
|
ctx.searchManager // All search operations
|
|
82
|
-
ctx.tagManager // Tag aliases
|
|
179
|
+
ctx.tagManager // Tag aliases and bulk operations
|
|
83
180
|
ctx.ioManager // Import/export/backup
|
|
84
181
|
ctx.graphTraversal // Graph algorithms
|
|
85
182
|
ctx.semanticSearch // Vector similarity search (optional)
|
|
86
183
|
```
|
|
87
184
|
|
|
88
|
-
|
|
185
|
+
## Storage Options
|
|
186
|
+
|
|
187
|
+
### Comparison
|
|
188
|
+
|
|
189
|
+
| Feature | JSONL (Default) | SQLite (better-sqlite3) |
|
|
190
|
+
|---------|-----------------|-------------------------|
|
|
191
|
+
| Format | Human-readable text | Native binary database |
|
|
192
|
+
| Transactions | Basic | Full ACID with WAL mode |
|
|
193
|
+
| Full-Text Search | Basic | FTS5 with BM25 ranking |
|
|
194
|
+
| Performance | Good | 3-10x faster |
|
|
195
|
+
| Concurrency | Single-threaded | Thread-safe with async-mutex |
|
|
196
|
+
| Best For | Small graphs, debugging | Large graphs (10k+ entities) |
|
|
197
|
+
|
|
198
|
+
### JSONL Storage
|
|
89
199
|
|
|
90
200
|
```typescript
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
observations: string[]; // Facts about the entity
|
|
95
|
-
parentId?: string; // For hierarchy
|
|
96
|
-
tags?: string[]; // Categories
|
|
97
|
-
importance?: number; // 0-10 scale
|
|
98
|
-
createdAt?: string; // ISO 8601
|
|
99
|
-
lastModified?: string;
|
|
100
|
-
}
|
|
201
|
+
const ctx = new ManagerContext({
|
|
202
|
+
storagePath: './memory.jsonl'
|
|
203
|
+
});
|
|
101
204
|
```
|
|
102
205
|
|
|
103
|
-
|
|
206
|
+
Features:
|
|
207
|
+
- Human-readable line-delimited JSON
|
|
208
|
+
- In-memory caching with write-through invalidation
|
|
209
|
+
- Atomic writes via temp file + rename
|
|
210
|
+
- Backward compatibility for legacy formats
|
|
211
|
+
|
|
212
|
+
### SQLite Storage
|
|
104
213
|
|
|
105
214
|
```typescript
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
215
|
+
const ctx = new ManagerContext({
|
|
216
|
+
storageType: 'sqlite',
|
|
217
|
+
storagePath: './memory.db'
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Features:
|
|
222
|
+
- FTS5 full-text search with BM25 ranking
|
|
223
|
+
- WAL mode for better concurrency
|
|
224
|
+
- Referential integrity with ON DELETE CASCADE
|
|
225
|
+
- ACID transactions
|
|
226
|
+
|
|
227
|
+
### Storage Files
|
|
228
|
+
|
|
229
|
+
When using JSONL, related files are automatically created:
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
/your/data/directory/
|
|
233
|
+
├── memory.jsonl # Main knowledge graph
|
|
234
|
+
├── memory-saved-searches.jsonl # Saved search queries
|
|
235
|
+
├── memory-tag-aliases.jsonl # Tag synonym mappings
|
|
236
|
+
└── .backups/ # Timestamped backups
|
|
111
237
|
```
|
|
112
238
|
|
|
113
239
|
## Search Capabilities
|
|
114
240
|
|
|
241
|
+
### Search Methods
|
|
242
|
+
|
|
243
|
+
| Method | Description | Use Case |
|
|
244
|
+
|--------|-------------|----------|
|
|
245
|
+
| `search()` | Basic substring matching | Simple queries |
|
|
246
|
+
| `searchRanked()` | TF-IDF relevance scoring | Finding most relevant results |
|
|
247
|
+
| `booleanSearch()` | AND/OR/NOT operators | Complex filtering |
|
|
248
|
+
| `fuzzySearch()` | Levenshtein distance | Typo tolerance |
|
|
249
|
+
| `hybridSearch()` | Semantic + lexical + symbolic | Multi-signal ranking |
|
|
250
|
+
|
|
115
251
|
### Basic Search
|
|
116
252
|
|
|
117
253
|
```typescript
|
|
118
|
-
// Find entities by name or observation content
|
|
119
254
|
const results = await ctx.searchManager.search('TypeScript');
|
|
120
255
|
```
|
|
121
256
|
|
|
122
257
|
### Ranked Search (TF-IDF)
|
|
123
258
|
|
|
124
259
|
```typescript
|
|
125
|
-
|
|
126
|
-
|
|
260
|
+
const ranked = await ctx.searchManager.searchRanked('JavaScript runtime', {
|
|
261
|
+
limit: 10,
|
|
262
|
+
minScore: 0.1
|
|
263
|
+
});
|
|
127
264
|
```
|
|
128
265
|
|
|
129
266
|
### Boolean Search
|
|
130
267
|
|
|
131
268
|
```typescript
|
|
132
|
-
// AND
|
|
269
|
+
// AND - both terms must match
|
|
133
270
|
const results = await ctx.searchManager.booleanSearch('TypeScript AND runtime');
|
|
134
|
-
|
|
271
|
+
|
|
272
|
+
// OR - either term matches
|
|
273
|
+
const results = await ctx.searchManager.booleanSearch('frontend OR backend');
|
|
274
|
+
|
|
275
|
+
// NOT - exclude term
|
|
276
|
+
const results = await ctx.searchManager.booleanSearch('JavaScript NOT browser');
|
|
277
|
+
|
|
278
|
+
// Parentheses for grouping
|
|
279
|
+
const results = await ctx.searchManager.booleanSearch('(TypeScript OR JavaScript) AND server');
|
|
135
280
|
```
|
|
136
281
|
|
|
137
282
|
### Fuzzy Search
|
|
138
283
|
|
|
139
284
|
```typescript
|
|
140
|
-
// Typo-tolerant search
|
|
141
|
-
const results = await ctx.searchManager.fuzzySearch('Typscript', {
|
|
285
|
+
// Typo-tolerant search with threshold (0-1, higher = stricter)
|
|
286
|
+
const results = await ctx.searchManager.fuzzySearch('Typscript', {
|
|
287
|
+
threshold: 0.7
|
|
288
|
+
});
|
|
142
289
|
```
|
|
143
290
|
|
|
144
291
|
### Hybrid Search
|
|
145
292
|
|
|
146
|
-
Combines
|
|
293
|
+
Combines three signal layers for sophisticated ranking:
|
|
147
294
|
|
|
148
295
|
```typescript
|
|
149
296
|
const results = await ctx.searchManager.hybridSearch('programming concepts', {
|
|
150
|
-
weights: {
|
|
151
|
-
|
|
297
|
+
weights: {
|
|
298
|
+
semantic: 0.5, // Vector similarity (requires embeddings)
|
|
299
|
+
lexical: 0.3, // TF-IDF text matching
|
|
300
|
+
symbolic: 0.2 // Metadata (tags, importance, type)
|
|
301
|
+
},
|
|
302
|
+
filters: {
|
|
303
|
+
entityTypes: ['concept'],
|
|
304
|
+
minImportance: 5,
|
|
305
|
+
tags: ['programming']
|
|
306
|
+
}
|
|
152
307
|
});
|
|
153
308
|
```
|
|
154
309
|
|
|
155
310
|
## Graph Algorithms
|
|
156
311
|
|
|
312
|
+
### Path Finding
|
|
313
|
+
|
|
157
314
|
```typescript
|
|
158
|
-
// Shortest path between entities
|
|
315
|
+
// Shortest path between entities (BFS)
|
|
159
316
|
const path = await ctx.graphTraversal.findShortestPath('A', 'Z');
|
|
317
|
+
// Returns: ['A', 'B', 'C', 'Z']
|
|
160
318
|
|
|
161
|
-
// All paths
|
|
319
|
+
// All paths with max depth
|
|
162
320
|
const paths = await ctx.graphTraversal.findAllPaths('A', 'Z', { maxDepth: 5 });
|
|
163
|
-
|
|
164
|
-
// Centrality analysis
|
|
165
|
-
const centrality = await ctx.graphTraversal.getCentrality({ algorithm: 'pagerank' });
|
|
166
|
-
|
|
167
|
-
// Connected components
|
|
168
|
-
const components = await ctx.graphTraversal.getConnectedComponents();
|
|
321
|
+
// Returns: [['A', 'B', 'Z'], ['A', 'C', 'D', 'Z'], ...]
|
|
169
322
|
```
|
|
170
323
|
|
|
171
|
-
|
|
324
|
+
### Centrality Analysis
|
|
172
325
|
|
|
173
326
|
```typescript
|
|
174
|
-
//
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
// Export to CSV
|
|
178
|
-
const csv = await ctx.ioManager.exportGraph('csv');
|
|
179
|
-
|
|
180
|
-
// Export to GraphML (with compression)
|
|
181
|
-
await ctx.ioManager.exportGraph('graphml', {
|
|
182
|
-
outputPath: './graph.graphml.br',
|
|
183
|
-
compress: true
|
|
327
|
+
// Calculate importance metrics
|
|
328
|
+
const centrality = await ctx.graphTraversal.getCentrality({
|
|
329
|
+
algorithm: 'pagerank' // or 'degree', 'betweenness'
|
|
184
330
|
});
|
|
185
|
-
|
|
186
|
-
// Import from file
|
|
187
|
-
await ctx.ioManager.importGraph('json', jsonData, { mergeStrategy: 'merge' });
|
|
331
|
+
// Returns: Map<string, number> with entity scores
|
|
188
332
|
```
|
|
189
333
|
|
|
190
|
-
|
|
334
|
+
### Connected Components
|
|
191
335
|
|
|
192
336
|
```typescript
|
|
193
|
-
//
|
|
194
|
-
await ctx.
|
|
195
|
-
|
|
196
|
-
// Get hierarchy
|
|
197
|
-
const children = await ctx.entityManager.getChildren('Module');
|
|
198
|
-
const ancestors = await ctx.entityManager.getAncestors('Component');
|
|
199
|
-
const subtree = await ctx.entityManager.getSubtree('Module');
|
|
337
|
+
// Find isolated subgraphs
|
|
338
|
+
const components = await ctx.graphTraversal.getConnectedComponents();
|
|
339
|
+
// Returns: [['A', 'B', 'C'], ['X', 'Y'], ...]
|
|
200
340
|
```
|
|
201
341
|
|
|
202
|
-
|
|
342
|
+
### Traversal
|
|
203
343
|
|
|
204
344
|
```typescript
|
|
205
|
-
//
|
|
206
|
-
await ctx.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// Tag aliases (synonyms)
|
|
210
|
-
await ctx.tagManager.addTagAlias('js', 'javascript');
|
|
345
|
+
// Breadth-first traversal
|
|
346
|
+
await ctx.graphTraversal.bfs('startNode', (node) => {
|
|
347
|
+
console.log('Visited:', node.name);
|
|
348
|
+
});
|
|
211
349
|
|
|
212
|
-
//
|
|
213
|
-
await ctx.
|
|
350
|
+
// Depth-first traversal
|
|
351
|
+
await ctx.graphTraversal.dfs('startNode', (node) => {
|
|
352
|
+
console.log('Visited:', node.name);
|
|
353
|
+
});
|
|
214
354
|
```
|
|
215
355
|
|
|
216
356
|
## API Reference
|
|
@@ -223,23 +363,31 @@ await ctx.entityManager.addTagsToMultipleEntities(['E1', 'E2'], ['shared-tag']);
|
|
|
223
363
|
| `deleteEntities(names)` | Delete entities by name |
|
|
224
364
|
| `getEntityByName(name)` | Get single entity |
|
|
225
365
|
| `addObservations(name, observations)` | Add observations to entity |
|
|
226
|
-
| `deleteObservations(name, observations)` | Remove observations |
|
|
366
|
+
| `deleteObservations(name, observations)` | Remove specific observations |
|
|
227
367
|
| `addTags(name, tags)` | Add tags to entity |
|
|
228
368
|
| `removeTags(name, tags)` | Remove tags from entity |
|
|
229
369
|
| `setImportance(name, score)` | Set importance (0-10) |
|
|
230
|
-
| `setEntityParent(name, parentName)` | Set
|
|
231
|
-
| `getChildren(name)` | Get
|
|
370
|
+
| `setEntityParent(name, parentName)` | Set/remove parent |
|
|
371
|
+
| `getChildren(name)` | Get immediate children |
|
|
232
372
|
| `getAncestors(name)` | Get ancestor chain |
|
|
233
373
|
| `getDescendants(name)` | Get all descendants |
|
|
234
374
|
|
|
375
|
+
### RelationManager
|
|
376
|
+
|
|
377
|
+
| Method | Description |
|
|
378
|
+
|--------|-------------|
|
|
379
|
+
| `createRelations(relations)` | Create multiple relations |
|
|
380
|
+
| `getRelations(entityName)` | Get incoming/outgoing relations |
|
|
381
|
+
| `deleteRelations(relations)` | Delete specific relations |
|
|
382
|
+
|
|
235
383
|
### SearchManager
|
|
236
384
|
|
|
237
385
|
| Method | Description |
|
|
238
386
|
|--------|-------------|
|
|
239
|
-
| `search(query, options)` | Basic search |
|
|
387
|
+
| `search(query, options)` | Basic substring search |
|
|
240
388
|
| `searchRanked(query, options)` | TF-IDF ranked search |
|
|
241
|
-
| `booleanSearch(query, options)` | Boolean operators |
|
|
242
|
-
| `fuzzySearch(query, options)` |
|
|
389
|
+
| `booleanSearch(query, options)` | Boolean operators (AND/OR/NOT) |
|
|
390
|
+
| `fuzzySearch(query, options)` | Levenshtein-based typo tolerance |
|
|
243
391
|
| `hybridSearch(query, options)` | Multi-signal search |
|
|
244
392
|
| `smartSearch(query, options)` | AI-assisted refinement |
|
|
245
393
|
|
|
@@ -247,20 +395,144 @@ await ctx.entityManager.addTagsToMultipleEntities(['E1', 'E2'], ['shared-tag']);
|
|
|
247
395
|
|
|
248
396
|
| Method | Description |
|
|
249
397
|
|--------|-------------|
|
|
250
|
-
| `exportGraph(format, options)` | Export to
|
|
251
|
-
| `importGraph(format, data, options)` | Import
|
|
252
|
-
| `createBackup(options)` | Create backup |
|
|
398
|
+
| `exportGraph(format, options)` | Export to JSON/CSV/GraphML |
|
|
399
|
+
| `importGraph(format, data, options)` | Import with merge strategies |
|
|
400
|
+
| `createBackup(options)` | Create timestamped backup |
|
|
253
401
|
| `restoreBackup(path)` | Restore from backup |
|
|
254
402
|
|
|
255
|
-
|
|
403
|
+
### GraphTraversal
|
|
256
404
|
|
|
257
|
-
|
|
258
|
-
|
|
405
|
+
| Method | Description |
|
|
406
|
+
|--------|-------------|
|
|
407
|
+
| `findShortestPath(from, to)` | BFS shortest path |
|
|
408
|
+
| `findAllPaths(from, to, options)` | All paths with max depth |
|
|
409
|
+
| `getCentrality(options)` | Centrality metrics |
|
|
410
|
+
| `getConnectedComponents()` | Find isolated subgraphs |
|
|
411
|
+
| `bfs(start, visitor)` | Breadth-first traversal |
|
|
412
|
+
| `dfs(start, visitor)` | Depth-first traversal |
|
|
413
|
+
|
|
414
|
+
## Configuration
|
|
415
|
+
|
|
416
|
+
### Environment Variables
|
|
417
|
+
|
|
418
|
+
| Variable | Description | Default |
|
|
419
|
+
|----------|-------------|---------|
|
|
420
|
+
| `MEMORY_STORAGE_TYPE` | Storage backend: `jsonl` or `sqlite` | `jsonl` |
|
|
421
|
+
| `EMBEDDING_PROVIDER` | Embedding provider: `openai`, `local`, or `none` | `none` |
|
|
422
|
+
| `OPENAI_API_KEY` | OpenAI API key (required if provider is `openai`) | - |
|
|
423
|
+
|
|
424
|
+
## Development
|
|
425
|
+
|
|
426
|
+
### Prerequisites
|
|
427
|
+
|
|
428
|
+
- Node.js 18+
|
|
429
|
+
- npm 9+
|
|
430
|
+
- TypeScript 5.0+
|
|
431
|
+
|
|
432
|
+
### Build Commands
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
npm install # Install dependencies
|
|
436
|
+
npm run build # Build TypeScript to dist/
|
|
437
|
+
npm run build:watch # Watch mode compilation
|
|
438
|
+
npm test # Run all tests
|
|
439
|
+
npm run test:watch # Watch mode testing
|
|
440
|
+
npm run test:coverage # Run with coverage report
|
|
441
|
+
npm run typecheck # Type checking without emit
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Architecture
|
|
445
|
+
|
|
446
|
+
```
|
|
447
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
448
|
+
│ Layer 1: ManagerContext (Central Facade) │
|
|
449
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
450
|
+
│ │ Lazy-initialized access to all managers │ │
|
|
451
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
452
|
+
└──────────────────────────┬──────────────────────────────────┘
|
|
453
|
+
│
|
|
454
|
+
┌──────────────────────────┴──────────────────────────────────┐
|
|
455
|
+
│ Layer 2: Specialized Managers │
|
|
456
|
+
│ • EntityManager (CRUD + hierarchy + archive) │
|
|
457
|
+
│ • RelationManager (relation CRUD) │
|
|
458
|
+
│ • SearchManager (search + compression + analytics) │
|
|
459
|
+
│ • IOManager (import + export + backup) │
|
|
460
|
+
│ • TagManager (tag aliases) │
|
|
461
|
+
│ • GraphTraversal (path finding, centrality) │
|
|
462
|
+
│ • SemanticSearch (embeddings, similarity) │
|
|
463
|
+
└──────────────────────────┬──────────────────────────────────┘
|
|
464
|
+
│
|
|
465
|
+
┌──────────────────────────┴──────────────────────────────────┐
|
|
466
|
+
│ Layer 3: Storage Layer │
|
|
467
|
+
│ GraphStorage (JSONL) or SQLiteStorage (better-sqlite3) │
|
|
468
|
+
└─────────────────────────────────────────────────────────────┘
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### Project Structure
|
|
472
|
+
|
|
473
|
+
```
|
|
474
|
+
memoryjs/
|
|
475
|
+
├── src/ # Source (73 TypeScript files)
|
|
476
|
+
│ ├── index.ts # Entry point
|
|
477
|
+
│ ├── core/ # Core managers (12 files)
|
|
478
|
+
│ │ ├── ManagerContext.ts # Context holder (lazy init)
|
|
479
|
+
│ │ ├── EntityManager.ts # Entity CRUD + hierarchy
|
|
480
|
+
│ │ ├── RelationManager.ts # Relation CRUD
|
|
481
|
+
│ │ ├── GraphStorage.ts # JSONL I/O + caching
|
|
482
|
+
│ │ ├── SQLiteStorage.ts # SQLite with better-sqlite3
|
|
483
|
+
│ │ ├── TransactionManager.ts # ACID transactions
|
|
484
|
+
│ │ └── ...
|
|
485
|
+
│ ├── search/ # Search implementations (29 files)
|
|
486
|
+
│ │ ├── SearchManager.ts # Search orchestrator
|
|
487
|
+
│ │ ├── BasicSearch.ts # Text matching
|
|
488
|
+
│ │ ├── RankedSearch.ts # TF-IDF scoring
|
|
489
|
+
│ │ ├── BooleanSearch.ts # AND/OR/NOT logic
|
|
490
|
+
│ │ ├── FuzzySearch.ts # Typo tolerance
|
|
491
|
+
│ │ ├── SemanticSearch.ts # Embedding-based
|
|
492
|
+
│ │ ├── HybridSearchManager.ts # Multi-layer search
|
|
493
|
+
│ │ └── ...
|
|
494
|
+
│ ├── features/ # Advanced capabilities (9 files)
|
|
495
|
+
│ │ ├── IOManager.ts # Import/export/backup
|
|
496
|
+
│ │ ├── TagManager.ts # Tag aliases
|
|
497
|
+
│ │ ├── ArchiveManager.ts # Entity archival
|
|
498
|
+
│ │ ├── CompressionManager.ts # Duplicate detection
|
|
499
|
+
│ │ └── ...
|
|
500
|
+
│ ├── types/ # TypeScript definitions (2 files)
|
|
501
|
+
│ ├── utils/ # Shared utilities (18 files)
|
|
502
|
+
│ └── workers/ # Worker pool (2 files)
|
|
503
|
+
├── tests/ # Test suite
|
|
504
|
+
│ ├── unit/ # Unit tests
|
|
505
|
+
│ ├── integration/ # Integration tests
|
|
506
|
+
│ └── performance/ # Benchmarks
|
|
507
|
+
├── docs/ # Documentation
|
|
508
|
+
│ └── architecture/ # Architecture docs
|
|
509
|
+
├── tools/ # Development utilities
|
|
510
|
+
│ ├── chunking-for-files/ # File splitting tool
|
|
511
|
+
│ └── create-dependency-graph/ # Dependency analyzer
|
|
512
|
+
└── README.md # This file
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## Documentation
|
|
516
|
+
|
|
517
|
+
Comprehensive architecture documentation in `docs/architecture/`:
|
|
518
|
+
|
|
519
|
+
- [OVERVIEW.md](docs/architecture/OVERVIEW.md) - High-level project overview
|
|
520
|
+
- [ARCHITECTURE.md](docs/architecture/ARCHITECTURE.md) - Technical architecture and design
|
|
521
|
+
- [COMPONENTS.md](docs/architecture/COMPONENTS.md) - Component breakdown
|
|
522
|
+
- [DATAFLOW.md](docs/architecture/DATAFLOW.md) - Data flow patterns
|
|
523
|
+
- [API.md](docs/architecture/API.md) - Complete API documentation
|
|
524
|
+
- [DEPENDENCY_GRAPH.md](docs/architecture/DEPENDENCY_GRAPH.md) - Module dependencies
|
|
259
525
|
|
|
260
526
|
## License
|
|
261
527
|
|
|
262
|
-
MIT
|
|
528
|
+
**MIT License** - see [LICENSE](LICENSE)
|
|
263
529
|
|
|
264
530
|
## Related
|
|
265
531
|
|
|
266
532
|
- [@danielsimonjr/memory-mcp](https://github.com/danielsimonjr/memory-mcp) - MCP server built on this library
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
**Repository:** https://github.com/danielsimonjr/memoryjs
|
|
537
|
+
**NPM:** https://www.npmjs.com/package/@danielsimonjr/memoryjs
|
|
538
|
+
**Issues:** https://github.com/danielsimonjr/memoryjs/issues
|