@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,461 @@
|
|
|
1
|
+
# Weaviate Collection Strategy
|
|
2
|
+
|
|
3
|
+
**Concept**: Single vs multiple collections for different document types
|
|
4
|
+
**Created**: 2026-02-11
|
|
5
|
+
**Updated**: 2026-02-11 (Final decision based on RAG requirements)
|
|
6
|
+
**Status**: Design Specification (FINAL)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## The Question
|
|
11
|
+
|
|
12
|
+
Do we need separate Weaviate collections for:
|
|
13
|
+
- Memories (user content)
|
|
14
|
+
- Templates (structure definitions)
|
|
15
|
+
- Audit logs (system events)
|
|
16
|
+
- Relationships (memory connections)
|
|
17
|
+
|
|
18
|
+
Or can we use a single collection with type discrimination?
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Analysis
|
|
23
|
+
|
|
24
|
+
### Option 1: Multiple Collections (Current Plan)
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Weaviate Collections:
|
|
28
|
+
├── Memory_{user_id} # User memories
|
|
29
|
+
├── Template_system # Default templates
|
|
30
|
+
├── Template_{user_id} # User templates
|
|
31
|
+
├── Audit_{user_id} # Audit logs
|
|
32
|
+
└── Relationship_{user_id} # Relationships
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Pros**:
|
|
36
|
+
- ✅ Clear separation of concerns
|
|
37
|
+
- ✅ Different schemas per collection
|
|
38
|
+
- ✅ Optimized indexes per type
|
|
39
|
+
- ✅ Easier to manage collection-specific settings
|
|
40
|
+
- ✅ Better performance (smaller collections)
|
|
41
|
+
- ✅ Simpler queries (no type filtering needed)
|
|
42
|
+
|
|
43
|
+
**Cons**:
|
|
44
|
+
- ❌ More collections to manage
|
|
45
|
+
- ❌ Weaviate collection limits (check pricing tier)
|
|
46
|
+
- ❌ More complex cross-type queries
|
|
47
|
+
- ❌ Duplication of user_id collections
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### Option 2: Single Collection Per User
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Weaviate Collections:
|
|
55
|
+
└── User_{user_id} # All user data
|
|
56
|
+
├── type: "memory"
|
|
57
|
+
├── type: "template"
|
|
58
|
+
├── type: "audit"
|
|
59
|
+
└── type: "relationship"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Pros**:
|
|
63
|
+
- ✅ Fewer collections (one per user)
|
|
64
|
+
- ✅ Easier cross-type queries
|
|
65
|
+
- ✅ Single collection management
|
|
66
|
+
- ✅ No collection limit concerns
|
|
67
|
+
|
|
68
|
+
**Cons**:
|
|
69
|
+
- ❌ Mixed schemas in one collection
|
|
70
|
+
- ❌ Less optimized indexes
|
|
71
|
+
- ❌ Slower queries (need type filtering)
|
|
72
|
+
- ❌ Harder to manage different retention policies
|
|
73
|
+
- ❌ Mixing concerns (memories with audit logs)
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Option 3: Hybrid - Separate by Purpose
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Weaviate Collections:
|
|
81
|
+
├── Memory_{user_id} # User memories (searchable content)
|
|
82
|
+
├── Template_system # System templates (shared resource)
|
|
83
|
+
└── System_{user_id} # System data (audit, history, etc.)
|
|
84
|
+
├── type: "audit"
|
|
85
|
+
├── type: "history"
|
|
86
|
+
└── type: "action"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Pros**:
|
|
90
|
+
- ✅ Separates user content from system data
|
|
91
|
+
- ✅ Optimized for different use cases
|
|
92
|
+
- ✅ Fewer collections than Option 1
|
|
93
|
+
- ✅ Clear purpose per collection
|
|
94
|
+
|
|
95
|
+
**Cons**:
|
|
96
|
+
- ❌ Still multiple collections
|
|
97
|
+
- ❌ Relationships unclear (separate or in Memory?)
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Final Decision: Hybrid Approach
|
|
102
|
+
|
|
103
|
+
### Final Collection Structure (IMPLEMENTED)
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Weaviate Collections:
|
|
107
|
+
|
|
108
|
+
1. Memory_{user_id}
|
|
109
|
+
- Stores BOTH memories AND relationships ✅
|
|
110
|
+
- doc_type: "memory" or "relationship"
|
|
111
|
+
- Unified semantic search
|
|
112
|
+
- Essential for RAG context
|
|
113
|
+
- Single query gets memories with relationships
|
|
114
|
+
|
|
115
|
+
2. Template_system
|
|
116
|
+
- Default templates (shared across all users)
|
|
117
|
+
- Immutable, curated by platform
|
|
118
|
+
- Separate because shared resource
|
|
119
|
+
|
|
120
|
+
3. Template_{user_id} (lazy create)
|
|
121
|
+
- User-created templates
|
|
122
|
+
- Private to user
|
|
123
|
+
- Created only when user makes custom template
|
|
124
|
+
|
|
125
|
+
4. Audit_{user_id} (optional, lazy create)
|
|
126
|
+
- Audit logs, action logs, history
|
|
127
|
+
- Separate retention policies
|
|
128
|
+
- Created only if user enables audit logging
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Key Change**: Relationships are NOT in a separate collection - they're stored in Memory_{user_id} with doc_type discriminator.
|
|
132
|
+
|
|
133
|
+
### Rationale
|
|
134
|
+
|
|
135
|
+
**Memory_{user_id} - Unified Collection**:
|
|
136
|
+
- Stores BOTH memories and relationships
|
|
137
|
+
- Essential for RAG: LLM needs both together
|
|
138
|
+
- Unified semantic search across memories and relationship observations
|
|
139
|
+
- Single query gets memory with its connections
|
|
140
|
+
- doc_type field discriminates between memory and relationship
|
|
141
|
+
|
|
142
|
+
**Template_system - Shared Collection**:
|
|
143
|
+
- Default templates available to all users
|
|
144
|
+
- Immutable, curated by platform
|
|
145
|
+
- Separate because it's a shared resource
|
|
146
|
+
|
|
147
|
+
**Template_{user_id} - Per-User Collection** (lazy):
|
|
148
|
+
- User's custom templates
|
|
149
|
+
- Private to user
|
|
150
|
+
- Created only when user makes first custom template
|
|
151
|
+
|
|
152
|
+
**Audit_{user_id} - Per-User Collection** (optional, lazy):
|
|
153
|
+
- Audit logs, action logs, history
|
|
154
|
+
- Different retention policies
|
|
155
|
+
- Less frequently searched
|
|
156
|
+
- Created only if user enables audit logging
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Schema Comparison
|
|
161
|
+
|
|
162
|
+
### Memory Schema
|
|
163
|
+
```yaml
|
|
164
|
+
Memory:
|
|
165
|
+
content: text (LARGE, vectorized)
|
|
166
|
+
title: string
|
|
167
|
+
type: string
|
|
168
|
+
weight: float
|
|
169
|
+
trust: float
|
|
170
|
+
location: object
|
|
171
|
+
context: object
|
|
172
|
+
relationships: array (IDs)
|
|
173
|
+
# Optimized for: Semantic search, content retrieval
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Relationship Schema
|
|
177
|
+
```yaml
|
|
178
|
+
Relationship:
|
|
179
|
+
memory_ids: array (2...N IDs)
|
|
180
|
+
type: string
|
|
181
|
+
observation: text (SMALL)
|
|
182
|
+
strength: float
|
|
183
|
+
confidence: float
|
|
184
|
+
context: object
|
|
185
|
+
# Optimized for: Graph traversal, relationship queries
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Template Schema
|
|
189
|
+
```yaml
|
|
190
|
+
Template:
|
|
191
|
+
template_name: string
|
|
192
|
+
fields: array (field definitions)
|
|
193
|
+
trigger_keywords: array
|
|
194
|
+
trigger_context: object
|
|
195
|
+
# Optimized for: Template matching, field validation
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Audit Schema
|
|
199
|
+
```yaml
|
|
200
|
+
Audit:
|
|
201
|
+
event_type: string
|
|
202
|
+
action: string
|
|
203
|
+
target_id: string
|
|
204
|
+
timestamp: datetime
|
|
205
|
+
# Optimized for: Time-series queries, compliance
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Conclusion**: These are fundamentally different data types with different schemas and access patterns. Separate collections make sense.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Collection Limit Considerations
|
|
213
|
+
|
|
214
|
+
### Weaviate Cloud Limits
|
|
215
|
+
|
|
216
|
+
**Typical Limits** (varies by tier):
|
|
217
|
+
- Free tier: ~10 collections
|
|
218
|
+
- Standard tier: ~100 collections
|
|
219
|
+
- Enterprise: ~1000+ collections
|
|
220
|
+
|
|
221
|
+
### Our Usage
|
|
222
|
+
|
|
223
|
+
**Per User** (assuming 1000 users):
|
|
224
|
+
- Memory_{user_id}: 1000 collections
|
|
225
|
+
- Relationship_{user_id}: 1000 collections
|
|
226
|
+
- Template_{user_id}: 1000 collections
|
|
227
|
+
- Audit_{user_id}: 1000 collections (optional)
|
|
228
|
+
- **Total**: 3000-4000 collections
|
|
229
|
+
|
|
230
|
+
**Shared**:
|
|
231
|
+
- Template_system: 1 collection
|
|
232
|
+
|
|
233
|
+
**Potential Issue**: May exceed collection limits on lower tiers
|
|
234
|
+
|
|
235
|
+
### Mitigation Strategies
|
|
236
|
+
|
|
237
|
+
#### Strategy A: Single Collection with Type Filter (If Limits Hit)
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
Weaviate Collections:
|
|
241
|
+
└── User_{user_id}
|
|
242
|
+
├── doc_type: "memory"
|
|
243
|
+
├── doc_type: "relationship"
|
|
244
|
+
├── doc_type: "template"
|
|
245
|
+
└── doc_type: "audit"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Trade-off**: Slower queries, but works within limits
|
|
249
|
+
|
|
250
|
+
#### Strategy B: Selective Collections
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
Weaviate Collections:
|
|
254
|
+
├── Memory_{user_id} # Always separate (most important)
|
|
255
|
+
├── Template_system # Shared (always separate)
|
|
256
|
+
└── Meta_{user_id} # Combined: relationships, audit, templates
|
|
257
|
+
├── doc_type: "relationship"
|
|
258
|
+
├── doc_type: "audit"
|
|
259
|
+
└── doc_type: "template"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Trade-off**: Memories optimized, others combined
|
|
263
|
+
|
|
264
|
+
#### Strategy C: Lazy Collection Creation
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
// Only create collections when needed
|
|
268
|
+
async function ensureCollection(user_id: string, type: string): Promise<void> {
|
|
269
|
+
const collectionName = `${type}_${user_id}`;
|
|
270
|
+
|
|
271
|
+
const exists = await weaviateClient.collections.exists(collectionName);
|
|
272
|
+
|
|
273
|
+
if (!exists) {
|
|
274
|
+
await weaviateClient.collections.create({
|
|
275
|
+
name: collectionName,
|
|
276
|
+
// ... schema
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Don't create Audit_{user_id} unless user enables audit logging
|
|
282
|
+
// Don't create Template_{user_id} unless user creates custom template
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Recommendation
|
|
288
|
+
|
|
289
|
+
### Phase 1 (MVP): Minimal Collections
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
Weaviate Collections:
|
|
293
|
+
├── Memory_{user_id} # User memories
|
|
294
|
+
├── Template_system # Default templates only
|
|
295
|
+
└── (no user templates yet)
|
|
296
|
+
└── (no separate relationships yet - store in memory)
|
|
297
|
+
└── (no audit logs yet)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Rationale**: Start simple, add collections as needed
|
|
301
|
+
|
|
302
|
+
### Phase 2: Add Relationships
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
Weaviate Collections:
|
|
306
|
+
├── Memory_{user_id} # User memories
|
|
307
|
+
├── Relationship_{user_id} # Memory relationships
|
|
308
|
+
└── Template_system # Default templates
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Phase 3: Add User Templates & Audit
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
Weaviate Collections:
|
|
315
|
+
├── Memory_{user_id} # User memories
|
|
316
|
+
├── Relationship_{user_id} # Memory relationships
|
|
317
|
+
├── Template_system # Default templates
|
|
318
|
+
├── Template_{user_id} # User templates (lazy create)
|
|
319
|
+
└── Audit_{user_id} # Audit logs (lazy create, optional)
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Alternative: Relationships in Memory Collection
|
|
325
|
+
|
|
326
|
+
### Store Relationships as Special Memories
|
|
327
|
+
|
|
328
|
+
```yaml
|
|
329
|
+
Memory_{user_id}:
|
|
330
|
+
# Regular memory
|
|
331
|
+
- id: mem_123
|
|
332
|
+
doc_type: "memory"
|
|
333
|
+
content: "Camping trip to Yosemite"
|
|
334
|
+
|
|
335
|
+
# Relationship stored as special memory
|
|
336
|
+
- id: rel_456
|
|
337
|
+
doc_type: "relationship"
|
|
338
|
+
memory_ids: [mem_123, mem_789]
|
|
339
|
+
relationship_type: "inspired_by"
|
|
340
|
+
observation: "Yosemite trip inspired planning for Sequoia"
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**Benefits**:
|
|
344
|
+
- ✅ Fewer collections
|
|
345
|
+
- ✅ Relationships searchable with memories
|
|
346
|
+
- ✅ Single collection per user
|
|
347
|
+
|
|
348
|
+
**Drawbacks**:
|
|
349
|
+
- ❌ Mixed document types
|
|
350
|
+
- ❌ Need type filtering on every query
|
|
351
|
+
- ❌ Less optimized
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Final Recommendation: Hybrid Approach
|
|
356
|
+
|
|
357
|
+
**Decision**: Store relationships in Memory collection, separate collections for templates and audit
|
|
358
|
+
|
|
359
|
+
### Final Collection Structure
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
Weaviate Collections:
|
|
363
|
+
|
|
364
|
+
1. Memory_{user_id}
|
|
365
|
+
- Stores BOTH memories AND relationships
|
|
366
|
+
- doc_type: "memory" or "relationship"
|
|
367
|
+
- ✅ Unified semantic search
|
|
368
|
+
- ✅ Essential for RAG context
|
|
369
|
+
- ✅ Single query gets memories with relationships
|
|
370
|
+
|
|
371
|
+
2. Template_system
|
|
372
|
+
- Default templates (shared across all users)
|
|
373
|
+
- Immutable, curated by platform
|
|
374
|
+
- Separate because shared resource
|
|
375
|
+
|
|
376
|
+
3. Template_{user_id} (lazy create)
|
|
377
|
+
- User-created templates
|
|
378
|
+
- Private to user
|
|
379
|
+
- Created only when user makes custom template
|
|
380
|
+
|
|
381
|
+
4. Audit_{user_id} (optional, lazy create)
|
|
382
|
+
- Audit logs, action logs, history
|
|
383
|
+
- Separate retention policies
|
|
384
|
+
- Created only if user enables audit logging
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Rationale
|
|
388
|
+
|
|
389
|
+
**Relationships in Memory Collection** ✅:
|
|
390
|
+
1. **RAG Context**: LLM needs memories AND relationships together
|
|
391
|
+
2. **Unified Search**: Search relationship observations semantically
|
|
392
|
+
3. **Single Query**: Get memory with its connections efficiently
|
|
393
|
+
4. **Graph Context**: Relationships explain memory connections
|
|
394
|
+
|
|
395
|
+
**Example RAG Query**:
|
|
396
|
+
```
|
|
397
|
+
User: "What inspired my Sequoia trip?"
|
|
398
|
+
|
|
399
|
+
Single query to Memory_{user_id}:
|
|
400
|
+
- Returns: Yosemite memory + "inspired_by" relationship
|
|
401
|
+
- LLM sees full context in one retrieval
|
|
402
|
+
- No need to join separate collections
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**Separate Template Collections** ✅:
|
|
406
|
+
- Template_system is shared (can't be per-user)
|
|
407
|
+
- Different schema and purpose
|
|
408
|
+
- Template matching is separate operation
|
|
409
|
+
|
|
410
|
+
**Separate Audit Collection** ✅:
|
|
411
|
+
- Different retention policies
|
|
412
|
+
- Less frequently searched
|
|
413
|
+
- Optional feature
|
|
414
|
+
|
|
415
|
+
### Collection Limits
|
|
416
|
+
|
|
417
|
+
**Self-Hosted Weaviate**: No collection limits ✅
|
|
418
|
+
|
|
419
|
+
**Per User** (1000 users):
|
|
420
|
+
- Memory_{user_id}: 1000 collections
|
|
421
|
+
- Template_{user_id}: ~200 collections (lazy, only if user creates templates)
|
|
422
|
+
- Audit_{user_id}: ~100 collections (lazy, only if enabled)
|
|
423
|
+
- **Total**: ~1300 collections
|
|
424
|
+
|
|
425
|
+
**Shared**:
|
|
426
|
+
- Template_system: 1 collection
|
|
427
|
+
|
|
428
|
+
**No Concerns**: Self-hosted Weaviate handles this easily
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Benefits of Hybrid Approach
|
|
433
|
+
|
|
434
|
+
### 1. **RAG Optimization**
|
|
435
|
+
- Memories and relationships retrieved together
|
|
436
|
+
- LLM gets full context in single query
|
|
437
|
+
- Relationship observations are semantically searchable
|
|
438
|
+
- Graph structure naturally included
|
|
439
|
+
|
|
440
|
+
### 2. **Performance**
|
|
441
|
+
- Single query for memory + relationships
|
|
442
|
+
- No joins needed
|
|
443
|
+
- Faster RAG context building
|
|
444
|
+
- Efficient graph traversal
|
|
445
|
+
|
|
446
|
+
### 3. **Simplicity**
|
|
447
|
+
- Fewer collections than full separation
|
|
448
|
+
- Clear purpose per collection
|
|
449
|
+
- Easy to understand
|
|
450
|
+
|
|
451
|
+
### 4. **Scalability**
|
|
452
|
+
- No collection limit concerns (self-hosted)
|
|
453
|
+
- Lazy creation reduces actual collection count
|
|
454
|
+
- Can scale to millions of users
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
**Status**: Design Specification (FINAL)
|
|
459
|
+
**Strategy**: Hybrid - relationships in Memory, separate templates and audit
|
|
460
|
+
**Deployment**: Self-hosted Weaviate (no collection limits)
|
|
461
|
+
**Key Benefit**: Optimized for RAG with unified memory+relationship search
|
|
File without changes
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Milestone 1: Project Foundation
|
|
2
|
+
|
|
3
|
+
**Goal**: Set up new remember-mcp project with basic infrastructure
|
|
4
|
+
**Duration**: 1 week
|
|
5
|
+
**Dependencies**: None
|
|
6
|
+
**Status**: In Progress (71% complete - 5/8 tasks)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Initialize the remember-mcp project from scratch with all necessary infrastructure, build tools, and database connections.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Deliverables
|
|
17
|
+
|
|
18
|
+
### 1. Project Structure
|
|
19
|
+
- New `remember-mcp/` directory (separate from index)
|
|
20
|
+
- package.json with project metadata
|
|
21
|
+
- TypeScript configuration (tsconfig.json)
|
|
22
|
+
- Build system using esbuild
|
|
23
|
+
- Directory structure: src/, tests/, agent/
|
|
24
|
+
- .gitignore file
|
|
25
|
+
- README.md with project overview
|
|
26
|
+
|
|
27
|
+
### 2. Dependencies
|
|
28
|
+
- @modelcontextprotocol/sdk - MCP protocol
|
|
29
|
+
- weaviate-client - Vector database
|
|
30
|
+
- firebase-admin - Firestore access
|
|
31
|
+
- firebase-auth-cloudflare-workers - JWT validation
|
|
32
|
+
- dotenv - Environment variables
|
|
33
|
+
- Dev dependencies: typescript, tsx, vitest, eslint
|
|
34
|
+
|
|
35
|
+
### 3. Database Connections
|
|
36
|
+
- Weaviate client wrapper
|
|
37
|
+
- Firestore client wrapper
|
|
38
|
+
- Connection testing utilities
|
|
39
|
+
- Environment variable configuration
|
|
40
|
+
|
|
41
|
+
### 4. Basic MCP Server
|
|
42
|
+
- Server initialization
|
|
43
|
+
- Stdio transport (for testing)
|
|
44
|
+
- Health check endpoint
|
|
45
|
+
- Basic error handling
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Success Criteria
|
|
50
|
+
|
|
51
|
+
- [x] Project builds successfully (`npm run build`)
|
|
52
|
+
- [x] Can connect to Weaviate instance (client ready)
|
|
53
|
+
- [x] Can connect to Firestore (client ready)
|
|
54
|
+
- [x] Basic MCP server responds to requests
|
|
55
|
+
- [x] TypeScript compiles without errors
|
|
56
|
+
- [x] All dependencies installed correctly
|
|
57
|
+
- [ ] Integration tests passing
|
|
58
|
+
- [ ] Server factory created for mcp-auth compatibility
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Key Files to Create
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
remember-mcp/
|
|
66
|
+
├── package.json
|
|
67
|
+
├── tsconfig.json
|
|
68
|
+
├── esbuild.build.js
|
|
69
|
+
├── .gitignore
|
|
70
|
+
├── .env.example
|
|
71
|
+
├── README.md
|
|
72
|
+
├── src/
|
|
73
|
+
│ ├── server.ts
|
|
74
|
+
│ ├── weaviate/
|
|
75
|
+
│ │ └── client.ts
|
|
76
|
+
│ ├── firestore/
|
|
77
|
+
│ │ └── client.ts
|
|
78
|
+
│ ├── types/
|
|
79
|
+
│ │ ├── memory.ts
|
|
80
|
+
│ │ ├── context.ts
|
|
81
|
+
│ │ └── config.ts
|
|
82
|
+
│ └── utils/
|
|
83
|
+
│ └── logger.ts
|
|
84
|
+
└── tests/
|
|
85
|
+
└── setup.test.ts
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Environment Variables
|
|
91
|
+
|
|
92
|
+
```env
|
|
93
|
+
# Weaviate
|
|
94
|
+
WEAVIATE_URL=http://localhost:8080
|
|
95
|
+
WEAVIATE_API_KEY=
|
|
96
|
+
|
|
97
|
+
# OpenAI
|
|
98
|
+
OPENAI_APIKEY=sk-...
|
|
99
|
+
|
|
100
|
+
# Firebase
|
|
101
|
+
FIREBASE_PROJECT_ID=remember-mcp-dev
|
|
102
|
+
GOOGLE_APPLICATION_CREDENTIALS=./serviceAccount.json
|
|
103
|
+
|
|
104
|
+
# Server
|
|
105
|
+
PORT=3000
|
|
106
|
+
NODE_ENV=development
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Testing
|
|
112
|
+
|
|
113
|
+
- [ ] Weaviate connection test
|
|
114
|
+
- [ ] Firestore connection test
|
|
115
|
+
- [ ] MCP server initialization test
|
|
116
|
+
- [ ] Environment variable loading test
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
**Next Milestone**: M2 - Core Memory System
|
|
121
|
+
**Blockers**: None
|