@mnemoai/core 1.1.4 → 1.1.5

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
@@ -41,7 +41,7 @@ The result: your AI agent's memory stays relevant instead of drowning in noise.
41
41
 
42
42
  ## Mnemo vs Paid Competitors
43
43
 
44
- | Capability | Mem0 $249 | Zep $199 | Letta $49 | Cognee $149 | **Mnemo Core** FREE | **Mnemo Pro** $69 |
44
+ | Capability | Mem0 $249 | Zep (usage) | Letta $20 | Cognee OSS | **Mnemo Core** FREE | **Mnemo Pro** $69 |
45
45
  |:---|:---:|:---:|:---:|:---:|:---:|:---:|
46
46
  | Vector search | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
47
47
  | BM25 keyword search | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ |
@@ -141,10 +141,9 @@ import { createMnemo } from '@mnemoai/core';
141
141
  const mnemo = await createMnemo({
142
142
  embedding: {
143
143
  provider: 'openai-compatible',
144
- apiKey: process.env.VOYAGE_API_KEY,
145
- baseURL: 'https://api.voyageai.com/v1',
146
- model: 'voyage-3-large',
147
- dimensions: 1024,
144
+ apiKey: process.env.OPENAI_API_KEY, // or 'ollama' for local
145
+ model: 'text-embedding-3-small',
146
+ dimensions: 1536,
148
147
  },
149
148
  dbPath: './memory-db',
150
149
  });
package/dist/index.d.ts CHANGED
@@ -2,7 +2,14 @@
2
2
  * Mnemo Memory Plugin
3
3
  * Cognitive memory framework with hybrid retrieval, multi-scope isolation, and management CLI
4
4
  */
5
- import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
5
+ interface OpenClawPluginApi {
6
+ pluginConfig: unknown;
7
+ registerMemoryProvider(provider: any): void;
8
+ registerHook(event: string, handler: (...args: any[]) => any): void;
9
+ registerCommand?(cmd: any): void;
10
+ getWorkspacePath?(): string;
11
+ [key: string]: any;
12
+ }
6
13
  declare const memoryLanceDBProPlugin: {
7
14
  id: string;
8
15
  name: string;
@@ -12,7 +19,7 @@ declare const memoryLanceDBProPlugin: {
12
19
  };
13
20
  export default memoryLanceDBProPlugin;
14
21
  export { createMnemo } from "./src/mnemo.js";
15
- export type { MnemoConfig, MnemoInstance } from "./src/mnemo.js";
22
+ export type { MnemoConfig, MnemoInstance, MemoryCategory, StorageBackend } from "./src/mnemo.js";
16
23
  export { MemoryStore } from "./src/store.js";
17
24
  export type { MemoryEntry, MemorySearchResult, StoreConfig } from "./src/store.js";
18
25
  export type { StorageAdapter } from "./src/storage-adapter.js";
@@ -2,59 +2,95 @@
2
2
  * Mnemo Core — simplified entry point
3
3
  * Usage: const mnemo = await createMnemo(config)
4
4
  */
5
+ /** Memory category — controls how memories are classified and retrieved. */
6
+ export type MemoryCategory = "preference" | "fact" | "decision" | "entity" | "other" | "reflection";
7
+ /** Supported storage backends. LanceDB is the default (embedded, zero-config). */
8
+ export type StorageBackend = "lancedb" | "qdrant" | "chroma" | "pgvector";
5
9
  export interface MnemoConfig {
10
+ /** Embedding provider configuration. */
6
11
  embedding: {
12
+ /** Currently only "openai-compatible" is supported (works with OpenAI, Ollama, Voyage, etc.) */
7
13
  provider: "openai-compatible";
14
+ /** API key for the embedding provider. Use "ollama" for local Ollama. */
8
15
  apiKey: string;
16
+ /** Base URL for the embedding API. Default: OpenAI. Use "http://localhost:11434/v1" for Ollama. */
9
17
  baseURL?: string;
18
+ /** Embedding model name. Default: "text-embedding-3-small". */
10
19
  model?: string;
20
+ /** Embedding vector dimensions. Default: 1024. */
11
21
  dimensions?: number;
22
+ /** Task prefix for query embeddings (provider-specific). */
12
23
  taskQuery?: string;
24
+ /** Task prefix for passage embeddings (provider-specific). */
13
25
  taskPassage?: string;
14
26
  };
27
+ /** Path to the local database directory. */
15
28
  dbPath: string;
29
+ /** Weibull decay model configuration. */
16
30
  decay?: {
31
+ /** Half-life in days for the recency decay curve. Default: 30. */
17
32
  recencyHalfLifeDays?: number;
33
+ /** Weight of recency in the composite score. Default: 0.5. */
18
34
  recencyWeight?: number;
35
+ /** Weight of access frequency in the composite score. Default: 0.3. */
19
36
  frequencyWeight?: number;
37
+ /** Weight of intrinsic importance in the composite score. Default: 0.2. */
20
38
  intrinsicWeight?: number;
21
39
  };
40
+ /** Memory tier promotion thresholds. */
22
41
  tier?: {
23
42
  coreAccessThreshold?: number;
24
43
  coreImportanceThreshold?: number;
25
44
  peripheralAgeDays?: number;
26
45
  };
46
+ /** LLM configuration for smart extraction and contradiction detection. */
27
47
  llm?: {
28
48
  model?: string;
29
49
  baseURL?: string;
30
50
  apiKey?: string;
31
51
  };
52
+ /** Retrieval pipeline configuration. */
32
53
  retrieval?: {
54
+ /** Number of candidates before reranking. Default: 20. */
33
55
  candidatePoolSize?: number;
56
+ /** Reranking strategy. Default: "none". */
34
57
  rerank?: "cross-encoder" | "lightweight" | "none";
58
+ /** API key for the reranker provider. */
35
59
  rerankApiKey?: string;
60
+ /** Reranker model name. */
36
61
  rerankModel?: string;
62
+ /** Reranker API endpoint. */
37
63
  rerankEndpoint?: string;
64
+ /** Reranker provider. */
38
65
  rerankProvider?: string;
39
66
  };
40
- /** Storage backend: "lancedb" (default), "qdrant", "chroma", "pgvector" */
41
- storageBackend?: string;
42
- /** Backend-specific config (url, connectionString, etc.) */
67
+ /** Storage backend. Default: "lancedb" (embedded, zero-config). */
68
+ storageBackend?: StorageBackend;
69
+ /** Backend-specific config (e.g., { url: "http://localhost:6333" } for Qdrant). */
43
70
  storageConfig?: Record<string, unknown>;
44
71
  }
45
72
  export interface MnemoInstance {
73
+ /** Store a memory. Returns the generated memory ID. */
46
74
  store(entry: {
75
+ /** The text content to remember. */
47
76
  text: string;
48
- category?: string;
77
+ /** Memory category. Default: "fact". */
78
+ category?: MemoryCategory;
79
+ /** Importance score from 0.0 to 1.0. Default: 0.7. */
49
80
  importance?: number;
81
+ /** Scope for multi-agent isolation. Default: "global". */
50
82
  scope?: string;
51
83
  }): Promise<{
52
84
  id: string;
53
85
  }>;
86
+ /** Recall memories by semantic search. Returns ranked results with scores. */
54
87
  recall(query: string, options?: {
88
+ /** Maximum number of results. Default: 5. */
55
89
  limit?: number;
90
+ /** Only return memories from these scopes. */
56
91
  scopeFilter?: string[];
57
- category?: string;
92
+ /** Only return memories of this category. */
93
+ category?: MemoryCategory;
58
94
  }): Promise<Array<{
59
95
  text: string;
60
96
  score: number;
@@ -62,12 +98,34 @@ export interface MnemoInstance {
62
98
  importance: number;
63
99
  timestamp: number;
64
100
  }>>;
101
+ /** Delete a memory by ID. Returns true if deleted, false if not found. */
65
102
  delete(id: string): Promise<boolean>;
103
+ /** Get memory store statistics. */
66
104
  stats(): Promise<{
67
105
  totalEntries: number;
68
106
  scopeCounts: Record<string, number>;
69
107
  categoryCounts: Record<string, number>;
70
108
  }>;
109
+ /** Close the instance and release resources. */
71
110
  close(): Promise<void>;
72
111
  }
112
+ /**
113
+ * Create a Mnemo memory instance.
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * const mnemo = await createMnemo({
118
+ * embedding: {
119
+ * provider: "openai-compatible",
120
+ * apiKey: process.env.OPENAI_API_KEY,
121
+ * model: "text-embedding-3-small",
122
+ * dimensions: 1536,
123
+ * },
124
+ * dbPath: "./my-memory-db",
125
+ * });
126
+ *
127
+ * await mnemo.store({ text: "User prefers dark mode", category: "preference" });
128
+ * const results = await mnemo.recall("UI preferences");
129
+ * ```
130
+ */
73
131
  export declare function createMnemo(config: MnemoConfig): Promise<MnemoInstance>;
package/dist/src/mnemo.js CHANGED
@@ -3,10 +3,10 @@ import { createRetriever, DEFAULT_RETRIEVAL_CONFIG } from "./retriever.js";
3
3
  import { Embedder } from "./embedder.js";
4
4
  import { createDecayEngine, DEFAULT_DECAY_CONFIG } from "./decay-engine.js";
5
5
  async function createMnemo(config) {
6
- if (!config) throw new Error("mnemo: config is required");
6
+ if (!config) throw new Error("mnemo: config is required \u2014 see https://github.com/Methux/mnemo#quick-start");
7
7
  if (!config.embedding) throw new Error("mnemo: config.embedding is required");
8
- if (!config.embedding.apiKey) throw new Error("mnemo: config.embedding.apiKey is required");
9
- if (!config.dbPath) throw new Error("mnemo: config.dbPath is required");
8
+ if (!config.embedding.apiKey) throw new Error("mnemo: config.embedding.apiKey is required (use 'ollama' for local Ollama)");
9
+ if (!config.dbPath) throw new Error("mnemo: config.dbPath is required \u2014 path to local database directory");
10
10
  const dimensions = config.embedding.dimensions || 1024;
11
11
  const embedder = new Embedder({
12
12
  apiKey: config.embedding.apiKey,
@@ -33,10 +33,11 @@ async function createMnemo(config) {
33
33
  return {
34
34
  async store(entry) {
35
35
  const vector = await embedder.embed(entry.text);
36
+ const category = entry.category || "fact";
36
37
  const result = await store.store({
37
38
  text: entry.text,
38
39
  vector,
39
- category: entry.category || "fact",
40
+ category,
40
41
  importance: entry.importance ?? 0.7,
41
42
  scope: entry.scope || "global"
42
43
  });
@@ -70,6 +71,12 @@ async function createMnemo(config) {
70
71
  };
71
72
  },
72
73
  async close() {
74
+ if (store.adapter) {
75
+ try {
76
+ await store.adapter.close();
77
+ } catch {
78
+ }
79
+ }
73
80
  }
74
81
  };
75
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mnemoai/core",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Cognitive science-based AI memory framework — Weibull decay, triple-path retrieval, multi-backend storage",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",