@prmichaelsen/remember-mcp 0.1.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/.env.example +65 -0
- package/AGENT.md +840 -0
- package/README.md +72 -0
- package/agent/design/.gitkeep +0 -0
- package/agent/design/access-control-result-pattern.md +458 -0
- package/agent/design/action-audit-memory-types.md +637 -0
- package/agent/design/common-template-fields.md +282 -0
- package/agent/design/complete-tool-set.md +407 -0
- package/agent/design/content-types-expansion.md +521 -0
- package/agent/design/cross-database-id-strategy.md +358 -0
- package/agent/design/default-template-library.md +423 -0
- package/agent/design/firestore-wrapper-analysis.md +606 -0
- package/agent/design/llm-provider-abstraction.md +691 -0
- package/agent/design/location-handling-architecture.md +523 -0
- package/agent/design/memory-templates-design.md +364 -0
- package/agent/design/permissions-storage-architecture.md +680 -0
- package/agent/design/relationship-storage-strategy.md +361 -0
- package/agent/design/remember-mcp-implementation-tasks.md +417 -0
- package/agent/design/remember-mcp-progress.yaml +141 -0
- package/agent/design/requirements-enhancements.md +468 -0
- package/agent/design/requirements.md +56 -0
- package/agent/design/template-storage-strategy.md +412 -0
- package/agent/design/template-suggestion-system.md +853 -0
- package/agent/design/trust-escalation-prevention.md +343 -0
- package/agent/design/trust-system-implementation.md +592 -0
- package/agent/design/user-preferences.md +683 -0
- package/agent/design/weaviate-collection-strategy.md +461 -0
- package/agent/milestones/.gitkeep +0 -0
- package/agent/milestones/milestone-1-project-foundation.md +121 -0
- package/agent/milestones/milestone-2-core-memory-system.md +150 -0
- package/agent/milestones/milestone-3-relationships-graph.md +116 -0
- package/agent/milestones/milestone-4-user-preferences.md +103 -0
- package/agent/milestones/milestone-5-template-system.md +126 -0
- package/agent/milestones/milestone-6-auth-multi-tenancy.md +124 -0
- package/agent/milestones/milestone-7-trust-permissions.md +133 -0
- package/agent/milestones/milestone-8-testing-quality.md +137 -0
- package/agent/milestones/milestone-9-deployment-documentation.md +147 -0
- package/agent/patterns/.gitkeep +0 -0
- package/agent/patterns/bootstrap.md +1271 -0
- package/agent/patterns/firebase-admin-sdk-v8-usage.md +950 -0
- package/agent/patterns/firestore-users-pattern-best-practices.md +347 -0
- package/agent/patterns/library-services.md +454 -0
- package/agent/patterns/testing-colocated.md +316 -0
- package/agent/progress.yaml +395 -0
- package/agent/tasks/.gitkeep +0 -0
- package/agent/tasks/task-1-initialize-project-structure.md +266 -0
- package/agent/tasks/task-2-install-dependencies.md +199 -0
- package/agent/tasks/task-3-setup-weaviate-client.md +330 -0
- package/agent/tasks/task-4-setup-firestore-client.md +362 -0
- package/agent/tasks/task-5-create-basic-mcp-server.md +114 -0
- package/agent/tasks/task-6-create-integration-tests.md +195 -0
- package/agent/tasks/task-7-finalize-milestone-1.md +363 -0
- package/agent/tasks/task-8-setup-utility-scripts.md +382 -0
- package/agent/tasks/task-9-create-server-factory.md +404 -0
- package/dist/config.d.ts +26 -0
- package/dist/constants/content-types.d.ts +60 -0
- package/dist/firestore/init.d.ts +14 -0
- package/dist/firestore/paths.d.ts +53 -0
- package/dist/firestore/paths.spec.d.ts +2 -0
- package/dist/server-factory.d.ts +40 -0
- package/dist/server-factory.js +1741 -0
- package/dist/server-factory.spec.d.ts +2 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +1690 -0
- package/dist/tools/create-memory.d.ts +94 -0
- package/dist/tools/delete-memory.d.ts +47 -0
- package/dist/tools/search-memory.d.ts +88 -0
- package/dist/types/memory.d.ts +183 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/weaviate/client.d.ts +39 -0
- package/dist/weaviate/client.spec.d.ts +2 -0
- package/dist/weaviate/schema.d.ts +29 -0
- package/esbuild.build.js +60 -0
- package/esbuild.watch.js +25 -0
- package/jest.config.js +31 -0
- package/jest.e2e.config.js +17 -0
- package/package.json +68 -0
- package/src/.gitkeep +0 -0
- package/src/config.ts +56 -0
- package/src/constants/content-types.ts +454 -0
- package/src/firestore/init.ts +68 -0
- package/src/firestore/paths.spec.ts +75 -0
- package/src/firestore/paths.ts +124 -0
- package/src/server-factory.spec.ts +60 -0
- package/src/server-factory.ts +215 -0
- package/src/server.ts +243 -0
- package/src/tools/create-memory.ts +198 -0
- package/src/tools/delete-memory.ts +126 -0
- package/src/tools/search-memory.ts +216 -0
- package/src/types/memory.ts +276 -0
- package/src/utils/logger.ts +42 -0
- package/src/weaviate/client.spec.ts +58 -0
- package/src/weaviate/client.ts +114 -0
- package/src/weaviate/schema.ts +288 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weaviate schema definitions for remember-mcp
|
|
3
|
+
* Based on agent/design/weaviate-collection-strategy.md
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import weaviate, { WeaviateClient } from 'weaviate-client';
|
|
7
|
+
import { getWeaviateClient, sanitizeUserId } from './client.js';
|
|
8
|
+
import { config } from '../config.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Create Memory collection schema for a user
|
|
12
|
+
*
|
|
13
|
+
* This collection stores BOTH memories AND relationships using doc_type discriminator.
|
|
14
|
+
* This unified approach enables:
|
|
15
|
+
* - Single query for memories with relationships
|
|
16
|
+
* - Semantic search across both memories and relationship observations
|
|
17
|
+
* - Better RAG context (LLM gets memories + connections together)
|
|
18
|
+
*
|
|
19
|
+
* @param userId - User identifier
|
|
20
|
+
*/
|
|
21
|
+
export async function createMemoryCollection(userId: string): Promise<void> {
|
|
22
|
+
const client = getWeaviateClient();
|
|
23
|
+
const collectionName = `Memory_${sanitizeUserId(userId)}`;
|
|
24
|
+
|
|
25
|
+
// Check if collection already exists
|
|
26
|
+
const exists = await client.collections.exists(collectionName);
|
|
27
|
+
if (exists) {
|
|
28
|
+
console.log(`[Weaviate] Collection ${collectionName} already exists`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log(`[Weaviate] Creating collection ${collectionName}...`);
|
|
33
|
+
|
|
34
|
+
// Create collection with schema
|
|
35
|
+
await client.collections.create({
|
|
36
|
+
name: collectionName,
|
|
37
|
+
|
|
38
|
+
// Vectorizer configuration
|
|
39
|
+
vectorizers: weaviate.configure.vectorizer.text2VecOpenAI({
|
|
40
|
+
model: 'text-embedding-3-small',
|
|
41
|
+
// Vectorize both memory content and relationship observations
|
|
42
|
+
sourceProperties: ['content', 'observation'],
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
properties: [
|
|
46
|
+
// Discriminator
|
|
47
|
+
{
|
|
48
|
+
name: 'doc_type',
|
|
49
|
+
dataType: 'text' as any,
|
|
50
|
+
description: 'Document type: "memory" or "relationship"',
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// Core identity
|
|
54
|
+
{
|
|
55
|
+
name: 'user_id',
|
|
56
|
+
dataType: 'text' as any,
|
|
57
|
+
description: 'User who owns this document',
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// Memory fields
|
|
61
|
+
{
|
|
62
|
+
name: 'content',
|
|
63
|
+
dataType: 'text' as any,
|
|
64
|
+
description: 'Main memory content (vectorized)',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'title',
|
|
68
|
+
dataType: 'text' as any,
|
|
69
|
+
description: 'Optional short title',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'summary',
|
|
73
|
+
dataType: 'text' as any,
|
|
74
|
+
description: 'Optional brief summary',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'type',
|
|
78
|
+
dataType: 'text' as any,
|
|
79
|
+
description: 'Content type (note, event, person, etc.)',
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
// Scoring fields
|
|
83
|
+
{
|
|
84
|
+
name: 'weight',
|
|
85
|
+
dataType: 'number' as any,
|
|
86
|
+
description: 'Significance/priority (0-1)',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'trust',
|
|
90
|
+
dataType: 'number' as any,
|
|
91
|
+
description: 'Access control level (0-1)',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'confidence',
|
|
95
|
+
dataType: 'number' as any,
|
|
96
|
+
description: 'System confidence in accuracy (0-1)',
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// Location fields (flattened for Weaviate)
|
|
100
|
+
{
|
|
101
|
+
name: 'location_gps_lat',
|
|
102
|
+
dataType: 'number' as any,
|
|
103
|
+
description: 'GPS latitude',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'location_gps_lng',
|
|
107
|
+
dataType: 'number' as any,
|
|
108
|
+
description: 'GPS longitude',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'location_address',
|
|
112
|
+
dataType: 'text' as any,
|
|
113
|
+
description: 'Formatted address',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'location_city',
|
|
117
|
+
dataType: 'text' as any,
|
|
118
|
+
description: 'City name',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'location_country',
|
|
122
|
+
dataType: 'text' as any,
|
|
123
|
+
description: 'Country name',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'location_source',
|
|
127
|
+
dataType: 'text' as any,
|
|
128
|
+
description: 'Location source (gps, ip, manual, etc.)',
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
// Locale fields
|
|
132
|
+
{
|
|
133
|
+
name: 'locale_language',
|
|
134
|
+
dataType: 'text' as any,
|
|
135
|
+
description: 'Language code (e.g., en, es, fr)',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'locale_timezone',
|
|
139
|
+
dataType: 'text' as any,
|
|
140
|
+
description: 'Timezone (e.g., America/Los_Angeles)',
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
// Context fields
|
|
144
|
+
{
|
|
145
|
+
name: 'context_conversation_id',
|
|
146
|
+
dataType: 'text' as any,
|
|
147
|
+
description: 'Conversation ID',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'context_summary',
|
|
151
|
+
dataType: 'text' as any,
|
|
152
|
+
description: 'Brief context summary',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'context_timestamp',
|
|
156
|
+
dataType: 'date' as any,
|
|
157
|
+
description: 'Context timestamp',
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
// Relationships
|
|
161
|
+
{
|
|
162
|
+
name: 'relationships',
|
|
163
|
+
dataType: 'text[]' as any,
|
|
164
|
+
description: 'Array of relationship IDs',
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
// Access tracking
|
|
168
|
+
{
|
|
169
|
+
name: 'access_count',
|
|
170
|
+
dataType: 'number' as any,
|
|
171
|
+
description: 'Total times accessed',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'last_accessed_at',
|
|
175
|
+
dataType: 'date' as any,
|
|
176
|
+
description: 'Most recent access timestamp',
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
// Metadata
|
|
180
|
+
{
|
|
181
|
+
name: 'tags',
|
|
182
|
+
dataType: 'text[]' as any,
|
|
183
|
+
description: 'Tags for organization',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'references',
|
|
187
|
+
dataType: 'text[]' as any,
|
|
188
|
+
description: 'Source URLs',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'created_at',
|
|
192
|
+
dataType: 'date' as any,
|
|
193
|
+
description: 'Creation timestamp',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'updated_at',
|
|
197
|
+
dataType: 'date' as any,
|
|
198
|
+
description: 'Last update timestamp',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'version',
|
|
202
|
+
dataType: 'number' as any,
|
|
203
|
+
description: 'Version number',
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
// Template fields
|
|
207
|
+
{
|
|
208
|
+
name: 'template_id',
|
|
209
|
+
dataType: 'text' as any,
|
|
210
|
+
description: 'Template ID if using template',
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
// Relationship-specific fields
|
|
214
|
+
{
|
|
215
|
+
name: 'memory_ids',
|
|
216
|
+
dataType: 'text[]' as any,
|
|
217
|
+
description: 'Connected memory IDs (for relationships)',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: 'relationship_type',
|
|
221
|
+
dataType: 'text' as any,
|
|
222
|
+
description: 'Relationship type (for relationships)',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'observation',
|
|
226
|
+
dataType: 'text' as any,
|
|
227
|
+
description: 'Relationship observation (vectorized)',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'strength',
|
|
231
|
+
dataType: 'number' as any,
|
|
232
|
+
description: 'Relationship strength (0-1)',
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
// Computed fields
|
|
236
|
+
{
|
|
237
|
+
name: 'base_weight',
|
|
238
|
+
dataType: 'number' as any,
|
|
239
|
+
description: 'User-specified weight',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: 'computed_weight',
|
|
243
|
+
dataType: 'number' as any,
|
|
244
|
+
description: 'Calculated effective weight',
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
console.log(`[Weaviate] Collection ${collectionName} created successfully`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Ensure Memory collection exists for user (lazy creation)
|
|
254
|
+
*/
|
|
255
|
+
export async function ensureMemoryCollection(userId: string): Promise<void> {
|
|
256
|
+
const client = getWeaviateClient();
|
|
257
|
+
const collectionName = `Memory_${sanitizeUserId(userId)}`;
|
|
258
|
+
|
|
259
|
+
const exists = await client.collections.exists(collectionName);
|
|
260
|
+
|
|
261
|
+
if (!exists) {
|
|
262
|
+
await createMemoryCollection(userId);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Get Memory collection for user
|
|
268
|
+
*/
|
|
269
|
+
export function getMemoryCollection(userId: string) {
|
|
270
|
+
const client = getWeaviateClient();
|
|
271
|
+
const collectionName = `Memory_${sanitizeUserId(userId)}`;
|
|
272
|
+
return client.collections.get(collectionName);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Delete Memory collection for user (use with caution!)
|
|
277
|
+
*/
|
|
278
|
+
export async function deleteMemoryCollection(userId: string): Promise<void> {
|
|
279
|
+
const client = getWeaviateClient();
|
|
280
|
+
const collectionName = `Memory_${sanitizeUserId(userId)}`;
|
|
281
|
+
|
|
282
|
+
const exists = await client.collections.exists(collectionName);
|
|
283
|
+
|
|
284
|
+
if (exists) {
|
|
285
|
+
await client.collections.delete(collectionName);
|
|
286
|
+
console.log(`[Weaviate] Collection ${collectionName} deleted`);
|
|
287
|
+
}
|
|
288
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"outDir": "./dist",
|
|
14
|
+
"rootDir": "./src",
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"declarationMap": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"types": ["node"],
|
|
19
|
+
"baseUrl": ".",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": ["src/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*"],
|
|
25
|
+
"exclude": ["node_modules", "dist", "tests"]
|
|
26
|
+
}
|