mcp-super-memory 0.10.1 → 0.10.3

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 CHANGED
@@ -46,9 +46,9 @@ Key Space (concepts) Value Space (memories)
46
46
  [strawberry]────┘
47
47
  ```
48
48
 
49
- Search `"Newton"` matches `[Newton]`, `[apple]` keys (1-hop) → follows shared `[fruit]` key → reaches strawberry memory (2-hop, score decayed by 0.3×).
49
+ `recall("Newton")` returns matching key clusters such as `[Newton]` and `[apple]`, not memory content. The agent then navigates explicitly: `read_key(apple)` select the Newton memory → `read_memory(...)`discover its `[fruit]` key → `read_key(fruit)` select the strawberry memory.
50
50
 
51
- **Results include `hop` field** you always know if a result is direct or associative.
51
+ The default MCP flow is therefore **Key Memory Key**. Full memory content enters the model context only when the agent deliberately calls `read_memory()`.
52
52
 
53
53
  ---
54
54
 
@@ -57,6 +57,7 @@ Search `"Newton"` → matches `[Newton]`, `[apple]` keys (1-hop) → follows sha
57
57
  | Feature | Super Memory | A-MEM | Mem0 | MemGPT |
58
58
  |---------|-------------|-------|------|--------|
59
59
  | Key/Value separation | ✅ N:M | ❌ | ❌ | ❌ |
60
+ | Agent-driven Key → Memory navigation | ✅ built-in | ❌ | ❌ | ❌ |
60
61
  | Associative multi-hop | ✅ built-in | ❌ | ❌ | ❌ |
61
62
  | Depth system | ✅ | ❌ | ❌ | partial |
62
63
  | Memory versioning | ✅ supersede | overwrites | overwrites | ❌ |
@@ -113,26 +114,37 @@ Add key "파이썬" → finds existing "Python" (similarity 0.87 > threshold 0.
113
114
 
114
115
  Prevents key space fragmentation. Same concept across languages or phrasing stays unified.
115
116
 
116
- ### Hybrid Retrieval (BM25 + dense, RRF-fused)
117
+ ### Agent-driven Retrieval (default)
117
118
 
118
- Recall is not a single similarity scan. Three signals run in parallel and are fused with **Reciprocal Rank Fusion** (`RRF_K = 60`):
119
+ The default MCP API keeps Key Space and Value Space separate:
120
+
121
+ 1. `recall(query)` searches canonical keys and aliases. It returns key IDs, concept labels, match scores, linked-memory counts, hub status, and specificity — never memory content.
122
+ 2. `read_key(key_id)` returns ranked memory IDs and metadata, never content. Hub keys are paginated with `limit`/`offset` so broad concepts cannot flood context.
123
+ 3. `read_memory(memory_id, via_key_id)` returns the full memory plus every connected key cluster. Only this full read increases memory depth/access count; only the traversed `via_key_id` edge receives Hebbian reinforcement.
124
+ 4. The agent follows any returned key with another `read_key()` call, producing an explicit **Key → Memory → Key** graph walk.
125
+
126
+ Semantically merged keys are preserved as aliases on one canonical key cluster (for example `Python` + `파이썬`). A key linked to at least three active memories is surfaced as a hub with `is_hub`, `memory_count`, and `specificity` metadata rather than being hidden by IDF. Override the threshold with `SUPER_MEMORY_KEY_HUB_MIN_LINKS`.
127
+
128
+ ### Direct Hybrid Retrieval (optional compatibility mode)
129
+
130
+ Set `SUPER_MEMORY_DIRECT_RECALL=true` to expose `recall_memories()`, the previous one-call memory retrieval path. Three signals run in parallel and are fused with **Reciprocal Rank Fusion** (`RRF_K = 60`):
119
131
 
120
132
  - **BM25 (sparse):** lexical full-text search over memory content (MiniSearch, fuzzy + prefix). Catches exact terms, names, and rare tokens that embeddings blur.
121
133
  - **Dense Path A (key matching):** query embedding → match keys → follow links → memories. Score = `keySim × IDF × linkWeight`, summed across all matching keys.
122
134
  - **Dense Path B (content matching):** query embedding → directly compare against memory content embeddings. Finds memories even when they weren't tagged with the right keys.
123
135
 
124
- Sparse and dense rank lists are merged by RRF, then modulated by depth and time before 2-hop expansion. Combining lexical and semantic signals is more robust than either alone.
136
+ Sparse and dense rank lists are merged by RRF, then modulated by depth and time before configurable multi-hop expansion (`hops=1–5`, default `2`). This compatibility tool is hidden by default so agents use explicit key navigation instead of collapsing the graph into one search call.
125
137
 
126
138
  ### Hebbian Link Learning
127
139
 
128
- Recall is a **write**, not just a read. Every recall reshapes the graph:
140
+ Reading a full memory is a **write**, not just a read. In the default flow, `recall()` and `read_key()` are read-only; `read_memory(memory_id, via_key_id)` reshapes the selected path:
129
141
 
130
- - Links whose key **actually matched the query** and led to a **returned** memory are **reinforced** (`+0.1`, capped at `3.0`).
131
- - Links explored (matched key) but whose memory was **not returned** are **decayed** (`−0.005`, floored at `0.1`).
142
+ - The traversed `via_key_id memory_id` link is **reinforced** (`+0.1`, capped at `3.0`).
143
+ - Memory depth and access count increase only after the agent reads the full memory.
132
144
 
133
- Reinforcement is scoped to the keys that *fired* for this query — not to every key of a returned memory. This is the literal Hebbian rule ("fire together, wire together") and it matters: reinforcing a returned memory's unrelated keys would let a stray association grow every time that memory surfaced for a *different* key, slowly polluting the graph. Weights are clamped to `[0.1, 3.0]`, so a hot memory's pull is bounded and the graph can recover from a bad reinforcement via subsequent decay.
145
+ Reinforcement is scoped to the key the agent actually traversed — not every key attached to the memory. This is the literal Hebbian rule ("fire together, wire together") and prevents unrelated associations from growing when the memory is reached through a different concept. Weights are clamped to `[0.1, 3.0]`.
134
146
 
135
- Link weights feed directly back into scoring (`keySim × IDF × linkWeight`), so connections that repeatedly co-fire grow stronger and stale ones fade the graph learns which associations actually matter from access patterns.
147
+ Link weights feed back into `read_key()` ranking, so repeatedly selected paths become easier to reach. Optional `recall_memories()` retains the previous matched-link reinforcement and explored-link decay behavior.
136
148
 
137
149
  ---
138
150
 
@@ -155,7 +167,15 @@ Link weights feed directly back into scoring (`keySim × IDF × linkWeight`), so
155
167
  └─────────────────────────────────────────────────────────┘
156
168
  ```
157
169
 
158
- **Recall algorithm (hybrid, 2-hop):**
170
+ **Default MCP navigation:**
171
+
172
+ 1. Embed the query and match canonical key concepts plus exact aliases.
173
+ 2. Return key clusters with `memory_count`, `is_hub`, and `specificity`; do not return memory content.
174
+ 3. Rank a selected key's memory handles by link weight, depth, and time decay in `read_key()`.
175
+ 4. Return full content and adjacent key clusters from `read_memory()`; reinforce only the traversed edge.
176
+ 5. Repeat `read_key(next_key_id)` to walk the graph deliberately.
177
+
178
+ **Optional `recall_memories()` algorithm (hybrid, configurable 1–5 hops; default 2):**
159
179
 
160
180
  Three retrieval signals run in parallel, then get fused and expanded:
161
181
 
@@ -166,7 +186,7 @@ Three retrieval signals run in parallel, then get fused and expanded:
166
186
  5. **Depth & time modulation:** `score × (0.9 + depth × 0.1) × timeFactor`, where `timeFactor` is a depth-weighted 30-day half-life decay (deep memories decay slower).
167
187
  6. **Associative expansion (`hops`, default 2):** breadth-first from the directly-matched set — each round follows shared keys (`× HOP_DECAY(0.3) × IDF × linkWeight`) and explicit `related_to` links (bidirectional, `× HOP_DECAY`) to the next frontier. `hops=N` walks up to N steps, so a memory's `hop` is its shortest chain distance. Score decays by `HOP_DECAY` per hop.
168
188
  7. **Hebbian update:** reinforce matched-key links of returned memories (`+0.1`), decay explored-but-unreturned links (`−0.005`).
169
- 8. Return ranked results with `hop` field (`1` = direct, `2` = associative).
189
+ 8. Return ranked results with `hop` field (`1` = direct, `2+` = associative distance).
170
190
 
171
191
  ### Similarity thresholds (calibrated per embedding model)
172
192
 
@@ -194,19 +214,19 @@ SUPER_MEMORY_MEMORY_DEDUP=0.99
194
214
 
195
215
  | Env var | Default (profile) | Description |
196
216
  | --- | --- | --- |
197
- | `SUPER_MEMORY_MIN_SCORE` | per-model (e.g. `0.55` for bge-m3) | Absolute cosine floor for recall. Effective on well-separated models (bge-m3 / bge / openai) where unrelated queries fall well below related ones. Set to `0` to disable. |
198
- | `SUPER_MEMORY_GATE_Z` | per-model (e.g. `2.5` for e5, `0` for others) | Distribution gate threshold (robust-z, median/MAD). The top-hit cosine must be at least this many MAD-sigmas above the median of the query's similarity distribution to count as "found". `0` disables the gate. |
199
- | `SUPER_MEMORY_CONTRADICTION` | per-model (e.g. `0.80` for bge-m3) | Contradiction-band lower bound. Memory pairs whose cosine similarity falls in `[contradiction, memoryDedup)` are flagged as contradictions. `recall()` and `related()` results include a `contradicts` string array listing conflicting memory IDs. |
217
+ | `SUPER_MEMORY_MIN_SCORE` | per-model (e.g. `0.55` for bge-m3) | Absolute cosine floor for optional `recall_memories()`. Set to `0` to disable. |
218
+ | `SUPER_MEMORY_GATE_Z` | `0` by default | Opt-in distribution gate for `recall_memories()` (robust-z, median/MAD). Values around 2–5 are typical; `0` disables it. |
219
+ | `SUPER_MEMORY_CONTRADICTION` | per-model (e.g. `0.80` for bge-m3) | Contradiction-band lower bound. Memory pairs whose cosine similarity falls in `[contradiction, memoryDedup)` are flagged as contradictions. `read_memory()`, `related()`, and optional `recall_memories()` expose conflicting IDs. |
200
220
 
201
- **Why e5 needs the distribution gate:** multilingual-e5's narrow cosine band (~0.86–0.99) makes the absolute `min_score` gate largely inert — both related and unrelated queries land in the same range, so a static floor cannot separate them. The **distribution gate** instead checks whether the top hit is a robust outlier within that query's own distribution. A query with no good match produces a flat similarity band (low robust-z) and is gated out; a query with a real match produces a clear right-tail outlier (high robust-z) and passes.
221
+ **Why e5 gates are opt-in:** multilingual-e5's narrow cosine band (~0.86–0.99) makes a static floor unreliable, while held-out tests showed distribution and key-proximity gates can also overfit. Both are disabled by default to avoid hiding real memories. Use bge-m3 for reliable not-found behavior, or calibrate e5 gates on your own corpus.
202
222
 
203
223
  Distribution gate parameters:
204
- - **`gateZ`** (profile default, e.g. `2.5` for e5) — set via `SUPER_MEMORY_GATE_Z` env var or the `min_z` parameter of `recall()`.
224
+ - **`gateZ`** — set via `SUPER_MEMORY_GATE_Z` or the `min_z` parameter of optional `recall_memories()`.
205
225
  - **`0` disables** the gate (default for bge-m3, bge, openai, minilm — where `min_score` already works).
206
226
  - Both gates **compose (AND)**: a result must clear both `min_score` and `gateZ` to be returned.
207
227
  - A **literal name/proper-noun key match** (e.g. querying a stored `name`-typed key exactly) is always a definite anchor and bypasses the distribution gate.
208
228
  - **`GATE_MIN_POPULATION = 8`**: the gate is skipped when fewer than 8 memories exist (too few samples for a reliable distribution), so early-session recall is unaffected. The gate's background population is **namespace-filtered** and excludes superseded/expired memories, so recall scoped to a sparse namespace may fall below this threshold and skip the gate entirely.
209
- - **Known e5 limitation:** the gate keys off `maxContentSim` (content cosine only). A genuinely-relevant hit that anchors solely via a fuzzy (non-literal) key match but produces a flat content distribution may be gated out on e5. This is intentional — the gate overrides weak fuzzy-key anchors; only literal key matches (`memRawSim ≥ 0.999`, i.e. exact name/proper-noun hits) are protected via `definiteAnchor` and bypass the distribution gate regardless of `distOK`.
229
+ - **Known e5 limitation:** the optional gate keys off `maxContentSim` (content cosine only). A relevant fuzzy-key hit with a flat content distribution may be rejected; literal key matches bypass the gate.
210
230
 
211
231
  An uncalibrated `LOCAL_EMBEDDING_MODEL` falls back to the BGE profile **and logs a warning** so the miscalibration is never silent.
212
232
 
@@ -216,11 +236,13 @@ An uncalibrated `LOCAL_EMBEDDING_MODEL` falls back to the BGE profile **and logs
216
236
 
217
237
  ## MCP Tools
218
238
 
219
- The memory system exposes 10 tools via MCP:
239
+ The memory system exposes 12 tools by default:
220
240
 
221
241
  | Tool | Description |
222
242
  | --- | --- |
223
- | `recall(query, top_k, namespace?, expand?, hops?, min_rel_score?, min_score?, min_z?, min_key_gate?, min_depth?)` | Hybrid search (BM25 + dense key/content, RRF-fused) with associative traversal. `hops` sets depth (default 2; 1=direct, up to 5 for chained drill-down — one call replaces manual `related()` chaining). For complex/multi-fact questions, **decompose into focused sub-queries and call recall per sub-query, then merge** (a single broad query blurs concepts). `min_rel_score` (0–0.9, default 0) drops results below that fraction of the top score — set ~0.05 with deep `hops` to trim hub-key noise. `min_score` (0–1, overrides `SUPER_MEMORY_MIN_SCORE`) is an absolute cosine floor; `0` disables. `min_z` (≥0, overrides `SUPER_MEMORY_GATE_Z`) is the distribution gate threshold; `0` disables. **`min_depth` (0–1, default 0)** returns only well-established memories whose depth ≥ floor — surface frequently-confirmed/important facts only. Returns `[]` when nothing clears the active gates. Results include a `contradicts` array. |
243
+ | `recall(query, top_k?, namespace?)` | Search Key Space only. Returns canonical keys, aliases, scores, and hub metadata; never memory content. |
244
+ | `read_key(key_id, namespace?, limit?, offset?)` | List ranked memory IDs and metadata connected to one key. Never returns content; supports pagination for hubs. |
245
+ | `read_memory(memory_id, via_key_id?, namespace?)` | Read full memory content and connected keys. Increases depth/access and reinforces the traversed edge. |
224
246
  | `remember(content, keys, key_types?, namespace?, ttl_seconds?, related_to?)` | Save memory with key concepts and optional type annotations |
225
247
  | `correct(memory_id, content, keys?, key_types?, related_to?)` | Versioned update — old memory preserved but weakened |
226
248
  | `related(memory_id)` | Find memories sharing keys (associative exploration) |
@@ -231,6 +253,8 @@ The memory system exposes 10 tools via MCP:
231
253
  | `cleanup_expired()` | Delete memories whose TTL has expired |
232
254
  | `memory_stats()` | Get current key/memory/link counts |
233
255
 
256
+ Set `SUPER_MEMORY_DIRECT_RECALL=true` to expose a thirteenth compatibility tool, `recall_memories(...)`, with the previous BM25+dense+RRF multi-hop behavior.
257
+
234
258
  A system prompt template is also available via `memory_system_prompt` MCP prompt — include it to instruct the agent to recall silently, use diverse keys, and never mention the memory system to users.
235
259
 
236
260
  ---
@@ -256,7 +280,7 @@ Add to `claude_desktop_config.json`:
256
280
  }
257
281
  ```
258
282
 
259
- **Local embeddings (no API key required):**
283
+ **Local embeddings (no API key required) — bge-m3 recommended:**
260
284
  ```json
261
285
  {
262
286
  "mcpServers": {
@@ -264,21 +288,24 @@ Add to `claude_desktop_config.json`:
264
288
  "command": "npx",
265
289
  "args": ["-y", "mcp-super-memory"],
266
290
  "env": {
267
- "EMBEDDING_BACKEND": "local"
291
+ "EMBEDDING_BACKEND": "local",
292
+ "LOCAL_EMBEDDING_MODEL": "bge-m3"
268
293
  }
269
294
  }
270
295
  }
271
296
  }
272
297
  ```
273
298
 
299
+ > `bge-m3` (multilingual, recommended) **auto-downloads ~570MB on first run**, then caches. Omit `LOCAL_EMBEDDING_MODEL` for the lighter default (`fast-multilingual-e5-large`). Add `"SUPER_MEMORY_RERANK": "true"` to enable cross-encoder reranking (downloads a second model on first use).
300
+
274
301
  ### Claude Code
275
302
 
276
303
  ```bash
277
304
  # OpenAI embeddings
278
305
  claude mcp add mcp-super-memory -e OPENAI_API_KEY=your-openai-api-key -- npx -y mcp-super-memory
279
306
 
280
- # Local embeddings (no API key required)
281
- claude mcp add mcp-super-memory -e EMBEDDING_BACKEND=local -- npx -y mcp-super-memory
307
+ # Local embeddings (no API key required) — bge-m3 recommended (auto-downloads ~570MB on first run)
308
+ claude mcp add mcp-super-memory -e EMBEDDING_BACKEND=local -e LOCAL_EMBEDDING_MODEL=bge-m3 -- npx -y mcp-super-memory
282
309
  ```
283
310
 
284
311
  ### Manual / Development
@@ -313,18 +340,29 @@ LOCAL_EMBEDDING_MODEL=bge-m3
313
340
 
314
341
  > First run downloads ~570MB once, then reuses the cache. If `LOCAL_EMBEDDING_MODEL_PATH` already holds the model it is used **as-is with no download** (a partial dir is self-healed — only missing files are fetched). Online-API backends (OpenAI) and fastembed built-ins are unaffected.
315
342
 
316
- **Cross-encoder reranking (optional):** set `SUPER_MEMORY_RERANK=true` to re-score recall's top candidates with `bge-reranker-v2-m3` a joint query↔memory relevance model that fixes cases where the right memory is retrieved but ranked too low. The model (~570MB, quantized) **auto-downloads on first use** and caches under `~/.super-memory/models/reranker` (its tokenizer is shared with bge-m3). It is a model, not an LLM, so it runs in-process.
343
+ **Cross-encoder reranking (optional direct mode):** set `SUPER_MEMORY_DIRECT_RECALL=true` and `SUPER_MEMORY_RERANK=true` to re-score `recall_memories()` candidates with `bge-reranker-v2-m3`. The default key-navigation flow does not load the reranker. The model (~570MB, quantized) auto-downloads on first use and caches under `~/.super-memory/models/reranker`.
317
344
 
318
345
  ```
319
346
  SUPER_MEMORY_RERANK=true
347
+ SUPER_MEMORY_DIRECT_RECALL=true
320
348
  # optional: SUPER_MEMORY_RERANK_MODEL_PATH=/dir SUPER_MEMORY_RERANK_POOL=30 (candidates re-scored)
321
349
  ```
322
350
 
323
- > Off by default. If the model can't load, recall transparently falls back to its fused ranking (never breaks). Most useful for multi-fact / competing-candidate queries; single-fact recall is already strong without it. (Note: query *decomposition* splitting a complex question into sub-queries — is the **caller's** job, since that needs LLM reasoning; the reranker is the server-side precision pass.)
351
+ > Off by default. If the model cannot load, `recall_memories()` falls back to fused ranking. Query decomposition remains the caller's responsibility.
352
+
353
+ **Reranker not-found gate (`SUPER_MEMORY_RERANK_MIN_SCORE`):** in direct compatibility mode, reject the complete `recall_memories()` result when the top cross-encoder logit is below this floor.
354
+
355
+ ```
356
+ SUPER_MEMORY_RERANK=true
357
+ SUPER_MEMORY_DIRECT_RECALL=true
358
+ SUPER_MEMORY_RERANK_MIN_SCORE=0 # reject when top rerank logit < 0 (bge-reranker-v2-m3 scale)
359
+ ```
360
+
361
+ > ⚠️ **Caveats.** (1) Unset by default — no gate. (2) The logit scale is **model-dependent**; `0` (≈ sigmoid 0.5) suits `bge-reranker-v2-m3` (measured: same-language found ≈ +3.9, not-found ≈ −5 to −6) — recalibrate for other rerankers. (3) **Trusted for SAME-LANGUAGE only.** Cross-lingual relevance logits run low even when relevant (KR query ↔ EN memory ≈ −5.4), so the gate auto-**bypasses on a script mismatch** (KR↔Latin) to avoid false-rejecting cross-lingual hits — which means **cross-lingual content must be reachable via bilingual keys** (`["Jiwoo","지우"]`), and cross-lingual *not-found* precision is a known limitation. Leave this off if you can't tag bilingual keys.
324
362
 
325
363
  > **Prefix behavior:** BGE-M3 does **not** use `passage:`/`query:` prefixes — embeddings are passed through as-is. All other local models (e5, BGE-en, MiniLM) continue to use prefixes unchanged.
326
364
 
327
- > **Recommended for multilingual / cross-lingual use: `bge-m3`.** On a real 19-memory Korean graph, English natural-language queries against Korean content land the correct memory at rank #1 in **7/7** cases under bge-m3 versus **2/7** under e5 (e5 leans on literal BM25 token overlap, so an English query sharing no tokens with Korean content is buried below noise). bge-m3 also separates found from not-found cleanly via the absolute `min_score` gate (≈96% on the gate fixture), whereas e5 needs the gate disabled entirely. Use e5 only if you cannot supply the bge-m3 ONNX model.
365
+ > **Recommended for multilingual / cross-lingual use: `bge-m3`.** It separates unrelated queries more reliably and performs substantially better than e5 on the project's Korean↔English fixtures. In optional direct mode, bge-m3's absolute `min_score` gate reaches ≈96% on the gate fixture; e5 requires corpus-specific tuning.
328
366
 
329
367
  If `OPENAI_API_KEY` is not set and `EMBEDDING_BACKEND` is unset, the server automatically uses the local `fastembed` backend.
330
368
  For English-only use or lower local resource usage, set `LOCAL_EMBEDDING_MODEL=fast-bge-base-en-v1.5` or `fast-bge-small-en-v1.5`.
@@ -353,7 +391,7 @@ All data is local. No external database required.
353
391
 
354
392
  ```
355
393
  ~/.super-memory/
356
- ├── graph.json # keys, memories, links
394
+ ├── graph.json # canonical keys, aliases, memories, weighted links
357
395
  └── conversations/
358
396
  └── {session_id}.jsonl # original conversation turns
359
397
  ```
@@ -365,7 +403,8 @@ Set `SUPER_MEMORY_DATA_DIR` to use a different storage directory.
365
403
  ## Limitations
366
404
 
367
405
  - **Linear scan** — suitable for personal use (~10k memories). FAISS/ChromaDB integration planned for larger scale.
368
- - **2-hop max** — deeper associative chains require `related()` tool calls by the agent.
406
+ - **Agentic round trips** — the default `recall read_key → read_memory` flow is more controllable and context-efficient, but needs more tool calls than one-shot retrieval.
407
+ - **Hub breadth** — broad keys can connect many memories. `read_key()` paginates hubs; the agent must choose whether to continue paging or follow a more specific adjacent key.
369
408
  - **Agent quality matters** — key selection on `remember` affects retrieval quality. System prompt tuning is important.
370
409
  - **Cross-lingual content bias** — with multilingual e5, raw content similarity favors same-language memories regardless of meaning. Tag memories with multilingual keys so the key graph (not biased content cosine) carries cross-lingual recall.
371
410
  - **Threshold calibration** — thresholds are tuned per embedding model. A new/uncalibrated model falls back to the BGE profile (with a warning); recalibrate via the `SUPER_MEMORY_*` env overrides.
@@ -12,6 +12,8 @@ export declare class MemoryGraph {
12
12
  private _storedDim;
13
13
  private _storedFingerprint;
14
14
  private _lock;
15
+ private _saveLock;
16
+ private _saveSeq;
15
17
  private _dirty;
16
18
  private _bm25;
17
19
  constructor();
@@ -33,6 +35,9 @@ export declare class MemoryGraph {
33
35
  private _isExpired;
34
36
  private _timeFactor;
35
37
  private _keyIdf;
38
+ private _recordKeyAlias;
39
+ private _activeMemoryIdsForKey;
40
+ private _keyView;
36
41
  private _findDuplicate;
37
42
  private _findContradiction;
38
43
  private _autoLinkKeys;
@@ -57,6 +62,13 @@ export declare class MemoryGraph {
57
62
  namespace?: string | null;
58
63
  relatedTo?: string[] | null;
59
64
  }): Promise<string>;
65
+ searchKeys(query: string, topK?: number, namespace?: string | null): Promise<object[]>;
66
+ readKey(keyId: string, options?: {
67
+ namespace?: string | null;
68
+ limit?: number;
69
+ offset?: number;
70
+ }): object;
71
+ readMemory(memoryId: string, viaKeyId?: string | null, namespace?: string | null): Promise<object>;
60
72
  recall(query: string, topK?: number, namespace?: string | null, expand?: boolean, maxHops?: number, minRelScore?: number, minScore?: number, minZ?: number, minKeyGate?: number, minDepth?: number): Promise<object[]>;
61
73
  getRelated(memoryId: string): object[];
62
74
  delete(memoryId: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"memoryGraph.d.ts","sourceRoot":"","sources":["../src/memoryGraph.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAa,MAAM,YAAY,CAAC;AAqEzD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE5E;AAgBD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAMlE;AAMD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EAAE,EAChB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAKT;AAyBD,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CAgBpD;AAID,qBAAa,WAAW;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAEtC,O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