@prmichaelsen/remember-mcp 2.6.8 → 2.6.10
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/CHANGELOG.md +34 -0
- package/agent/tasks/task-67-migrate-memory-public-schema.md +226 -0
- package/dist/server-factory.js +13 -4
- package/dist/server.js +13 -4
- package/dist/weaviate/client.d.ts +6 -1
- package/package.json +1 -1
- package/src/tools/update-memory.ts +3 -1
- package/src/weaviate/client.ts +23 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,40 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.6.10] - 2026-02-17
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **CRITICAL: `fetchMemoryWithAllProperties()` Graceful Fallback**: Fixed memory content not being copied during publish
|
|
13
|
+
- Added try-catch wrapper around property fetch with fallback
|
|
14
|
+
- If fetching with ALL_MEMORY_PROPERTIES fails, falls back to fetching without property specification
|
|
15
|
+
- Weaviate returns all properties that actually exist on the record when no returnProperties specified
|
|
16
|
+
- Fixes issue where `remember_confirm` → `executePublishMemory()` only copied comment fields
|
|
17
|
+
- Published memories now include all content (title, content, tags, etc.)
|
|
18
|
+
- Prevents data loss during memory publication to shared spaces
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## [2.6.9] - 2026-02-17
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **`remember_update_memory` Query Issue**: Fixed "Memory not found" error for existing memories
|
|
27
|
+
- Reduced property query from 6 properties to only 3 essential properties (`user_id`, `doc_type`, `version`)
|
|
28
|
+
- Removed queries for optional properties (`type`, `weight`, `base_weight`) that may not exist on all records
|
|
29
|
+
- Weaviate gRPC fails when querying properties that exist in schema but not on specific records
|
|
30
|
+
- Only fetch properties actually needed for validation (ownership, doc type, version)
|
|
31
|
+
- Fixes issue where memories with missing optional properties were reported as "not found"
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- **Task 67: Migrate Memory_public Schema**
|
|
36
|
+
- Created migration plan documentation for updating production `Memory_public` collection
|
|
37
|
+
- Addresses schema mismatch: only `moderation_flags` present, missing `parent_id` and `thread_root_id`
|
|
38
|
+
- Documents safe migration approach using `Memory_public_v2` with zero data loss
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
8
42
|
## [2.6.8] - 2026-02-17
|
|
9
43
|
|
|
10
44
|
### 🐛 Fixed
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Task 67: Migrate Memory_public Collection Schema
|
|
2
|
+
|
|
3
|
+
**Milestone**: M12 (Comment System)
|
|
4
|
+
**Estimated Time**: 1 hour
|
|
5
|
+
**Dependencies**: Task 55, Task 66
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
**Priority**: High
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Update the existing `Memory_public` collection in Weaviate Cloud to include the missing comment fields (`parent_id` and `thread_root_id`). Currently, only `moderation_flags` exists in the production schema.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Problem
|
|
18
|
+
|
|
19
|
+
The `Memory_public` collection was created before comment fields were added to the schema. Weaviate doesn't support adding properties to existing collections, so we need to migrate the data.
|
|
20
|
+
|
|
21
|
+
**Current State** (Production):
|
|
22
|
+
- ✅ `moderation_flags` field exists
|
|
23
|
+
- ❌ `parent_id` field missing
|
|
24
|
+
- ❌ `thread_root_id` field missing
|
|
25
|
+
|
|
26
|
+
**Expected State** (Code):
|
|
27
|
+
- ✅ All three fields defined in `src/weaviate/space-schema.ts` (lines 261-275)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Impact
|
|
32
|
+
|
|
33
|
+
**Without Migration**:
|
|
34
|
+
- Cannot create comments in shared spaces
|
|
35
|
+
- Cannot thread discussions
|
|
36
|
+
- Published memories missing comment fields
|
|
37
|
+
- Schema mismatch between code and production
|
|
38
|
+
|
|
39
|
+
**With Migration**:
|
|
40
|
+
- Full comment system functionality in shared spaces
|
|
41
|
+
- Threaded discussions work correctly
|
|
42
|
+
- Schema matches code definition
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Migration Options
|
|
47
|
+
|
|
48
|
+
### Option 1: Delete and Recreate (DESTRUCTIVE)
|
|
49
|
+
|
|
50
|
+
**Steps**:
|
|
51
|
+
1. Backup all data from `Memory_public`
|
|
52
|
+
2. Delete `Memory_public` collection
|
|
53
|
+
3. Recreate with updated schema (automatic via `ensurePublicCollection`)
|
|
54
|
+
4. Restore data with new fields initialized
|
|
55
|
+
|
|
56
|
+
**Pros**:
|
|
57
|
+
- Clean schema
|
|
58
|
+
- Simple process
|
|
59
|
+
|
|
60
|
+
**Cons**:
|
|
61
|
+
- ⚠️ **LOSES ALL DATA** if backup fails
|
|
62
|
+
- Downtime during migration
|
|
63
|
+
- Risky for production
|
|
64
|
+
|
|
65
|
+
### Option 2: Create New Collection and Migrate (SAFE)
|
|
66
|
+
|
|
67
|
+
**Steps**:
|
|
68
|
+
1. Create `Memory_public_v2` with updated schema
|
|
69
|
+
2. Copy all data from `Memory_public` to `Memory_public_v2`
|
|
70
|
+
3. Initialize comment fields: `parent_id: null`, `thread_root_id: null`, `moderation_flags: []`
|
|
71
|
+
4. Test `Memory_public_v2` thoroughly
|
|
72
|
+
5. Update code to use `Memory_public_v2`
|
|
73
|
+
6. Delete old `Memory_public` after verification
|
|
74
|
+
|
|
75
|
+
**Pros**:
|
|
76
|
+
- ✅ Zero data loss
|
|
77
|
+
- ✅ Can rollback if issues
|
|
78
|
+
- ✅ Test before switching
|
|
79
|
+
|
|
80
|
+
**Cons**:
|
|
81
|
+
- More complex
|
|
82
|
+
- Temporary storage duplication
|
|
83
|
+
|
|
84
|
+
### Option 3: Live with Current Schema (NOT RECOMMENDED)
|
|
85
|
+
|
|
86
|
+
**Steps**:
|
|
87
|
+
- Do nothing
|
|
88
|
+
- Comment system only works for personal memories
|
|
89
|
+
- Shared spaces don't support comments
|
|
90
|
+
|
|
91
|
+
**Pros**:
|
|
92
|
+
- No migration needed
|
|
93
|
+
|
|
94
|
+
**Cons**:
|
|
95
|
+
- ❌ Incomplete feature
|
|
96
|
+
- ❌ Schema mismatch
|
|
97
|
+
- ❌ Technical debt
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Recommended Approach: Option 2 (Safe Migration)
|
|
102
|
+
|
|
103
|
+
### Step 1: Create Backup Collection
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// Create Memory_public_v2 with full schema
|
|
107
|
+
const client = getWeaviateClient();
|
|
108
|
+
await client.collections.create({
|
|
109
|
+
name: 'Memory_public_v2',
|
|
110
|
+
// ... full schema from space-schema.ts including comment fields
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Step 2: Migrate Data
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// Fetch all objects from Memory_public
|
|
118
|
+
const oldCollection = client.collections.get('Memory_public');
|
|
119
|
+
const objects = await oldCollection.query.fetchObjects({ limit: 10000 });
|
|
120
|
+
|
|
121
|
+
// Insert into Memory_public_v2 with comment fields
|
|
122
|
+
const newCollection = client.collections.get('Memory_public_v2');
|
|
123
|
+
for (const obj of objects.objects) {
|
|
124
|
+
await newCollection.data.insert({
|
|
125
|
+
...obj.properties,
|
|
126
|
+
parent_id: null, // Initialize to null
|
|
127
|
+
thread_root_id: null, // Initialize to null
|
|
128
|
+
moderation_flags: obj.properties.moderation_flags || [], // Preserve existing
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 3: Update Code
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// src/weaviate/space-schema.ts
|
|
137
|
+
export const PUBLIC_COLLECTION_NAME = 'Memory_public_v2'; // Changed from 'Memory_public'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Step 4: Verify and Cleanup
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Test the new collection
|
|
144
|
+
# Verify all data migrated correctly
|
|
145
|
+
# Check comment fields exist
|
|
146
|
+
|
|
147
|
+
# After verification (wait 24-48 hours):
|
|
148
|
+
# Delete old Memory_public collection
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Verification
|
|
154
|
+
|
|
155
|
+
- [ ] `Memory_public_v2` collection created with full schema
|
|
156
|
+
- [ ] All data migrated from `Memory_public`
|
|
157
|
+
- [ ] Comment fields present: `parent_id`, `thread_root_id`, `moderation_flags`
|
|
158
|
+
- [ ] All existing memories have `parent_id: null`, `thread_root_id: null`
|
|
159
|
+
- [ ] `moderation_flags` preserved from original data
|
|
160
|
+
- [ ] Code updated to use `Memory_public_v2`
|
|
161
|
+
- [ ] All tests passing
|
|
162
|
+
- [ ] Can create comments in shared spaces
|
|
163
|
+
- [ ] Can publish memories with comment fields
|
|
164
|
+
- [ ] Old `Memory_public` collection deleted (after verification period)
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Rollback Plan
|
|
169
|
+
|
|
170
|
+
If issues occur:
|
|
171
|
+
|
|
172
|
+
1. **Immediate Rollback**:
|
|
173
|
+
```typescript
|
|
174
|
+
export const PUBLIC_COLLECTION_NAME = 'Memory_public'; // Revert to old
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
2. **Keep Both Collections**:
|
|
178
|
+
- Old collection still exists
|
|
179
|
+
- Can switch back instantly
|
|
180
|
+
- No data loss
|
|
181
|
+
|
|
182
|
+
3. **After Verification**:
|
|
183
|
+
- Only delete old collection after 24-48 hours
|
|
184
|
+
- Ensure new collection works correctly
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Alternative: Manual Schema Update (If Supported)
|
|
189
|
+
|
|
190
|
+
**Note**: Weaviate typically doesn't support adding properties to existing collections. Check Weaviate documentation for your version to see if schema evolution is supported.
|
|
191
|
+
|
|
192
|
+
If supported:
|
|
193
|
+
```bash
|
|
194
|
+
# Use Weaviate API to add properties
|
|
195
|
+
# This is version-dependent and may not be available
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Production Checklist
|
|
201
|
+
|
|
202
|
+
- [ ] Backup current `Memory_public` data
|
|
203
|
+
- [ ] Create `Memory_public_v2` with full schema
|
|
204
|
+
- [ ] Migrate all data with comment fields initialized
|
|
205
|
+
- [ ] Test new collection thoroughly
|
|
206
|
+
- [ ] Update `PUBLIC_COLLECTION_NAME` constant
|
|
207
|
+
- [ ] Deploy updated code
|
|
208
|
+
- [ ] Verify in production
|
|
209
|
+
- [ ] Monitor for 24-48 hours
|
|
210
|
+
- [ ] Delete old `Memory_public` collection
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Notes
|
|
215
|
+
|
|
216
|
+
- This migration is required for comment system to work in shared spaces
|
|
217
|
+
- Personal memory collections (`Memory_{user_id}`) don't need migration if created after Task 55
|
|
218
|
+
- Old personal collections may also need migration (separate task)
|
|
219
|
+
- Consider running migration during low-traffic period
|
|
220
|
+
- Document migration in CHANGELOG.md
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
**Status**: Not Started
|
|
225
|
+
**Recommendation**: Execute Option 2 (safe migration) during next deployment window
|
|
226
|
+
**Priority**: High - Blocks comment system in shared spaces
|
package/dist/server-factory.js
CHANGED
|
@@ -617,9 +617,18 @@ var ALL_MEMORY_PROPERTIES = [
|
|
|
617
617
|
"moderation_flags"
|
|
618
618
|
];
|
|
619
619
|
async function fetchMemoryWithAllProperties(collection, memoryId) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
620
|
+
try {
|
|
621
|
+
return await collection.query.fetchObjectById(memoryId, {
|
|
622
|
+
returnProperties: ALL_MEMORY_PROPERTIES
|
|
623
|
+
});
|
|
624
|
+
} catch (error) {
|
|
625
|
+
logger.warn("Failed to fetch with all properties, falling back to unspecified fetch", {
|
|
626
|
+
module: "weaviate-client",
|
|
627
|
+
memoryId,
|
|
628
|
+
error: error instanceof Error ? error.message : String(error)
|
|
629
|
+
});
|
|
630
|
+
return await collection.query.fetchObjectById(memoryId);
|
|
631
|
+
}
|
|
623
632
|
}
|
|
624
633
|
|
|
625
634
|
// src/firestore/init.ts
|
|
@@ -1940,7 +1949,7 @@ async function handleUpdateMemory(args, userId) {
|
|
|
1940
1949
|
let existingMemory;
|
|
1941
1950
|
try {
|
|
1942
1951
|
existingMemory = await collection.query.fetchObjectById(args.memory_id, {
|
|
1943
|
-
returnProperties: ["user_id", "doc_type", "version"
|
|
1952
|
+
returnProperties: ["user_id", "doc_type", "version"]
|
|
1944
1953
|
});
|
|
1945
1954
|
} catch (fetchError) {
|
|
1946
1955
|
const fetchErrorMsg = fetchError instanceof Error ? fetchError.message : String(fetchError);
|
package/dist/server.js
CHANGED
|
@@ -663,9 +663,18 @@ var ALL_MEMORY_PROPERTIES = [
|
|
|
663
663
|
"moderation_flags"
|
|
664
664
|
];
|
|
665
665
|
async function fetchMemoryWithAllProperties(collection, memoryId) {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
666
|
+
try {
|
|
667
|
+
return await collection.query.fetchObjectById(memoryId, {
|
|
668
|
+
returnProperties: ALL_MEMORY_PROPERTIES
|
|
669
|
+
});
|
|
670
|
+
} catch (error) {
|
|
671
|
+
logger.warn("Failed to fetch with all properties, falling back to unspecified fetch", {
|
|
672
|
+
module: "weaviate-client",
|
|
673
|
+
memoryId,
|
|
674
|
+
error: error instanceof Error ? error.message : String(error)
|
|
675
|
+
});
|
|
676
|
+
return await collection.query.fetchObjectById(memoryId);
|
|
677
|
+
}
|
|
669
678
|
}
|
|
670
679
|
|
|
671
680
|
// src/firestore/init.ts
|
|
@@ -2008,7 +2017,7 @@ async function handleUpdateMemory(args, userId) {
|
|
|
2008
2017
|
let existingMemory;
|
|
2009
2018
|
try {
|
|
2010
2019
|
existingMemory = await collection.query.fetchObjectById(args.memory_id, {
|
|
2011
|
-
returnProperties: ["user_id", "doc_type", "version"
|
|
2020
|
+
returnProperties: ["user_id", "doc_type", "version"]
|
|
2012
2021
|
});
|
|
2013
2022
|
} catch (fetchError) {
|
|
2014
2023
|
const fetchErrorMsg = fetchError instanceof Error ? fetchError.message : String(fetchError);
|
|
@@ -48,9 +48,14 @@ export declare const ALL_MEMORY_PROPERTIES: readonly ["user_id", "doc_type", "co
|
|
|
48
48
|
* This utility ensures all memory properties are fetched consistently
|
|
49
49
|
* across all tools, preventing bugs where properties are missing.
|
|
50
50
|
*
|
|
51
|
+
* NOTE: Some properties may not exist on all records (e.g., old records
|
|
52
|
+
* created before schema updates). This function handles that gracefully
|
|
53
|
+
* by falling back to fetching without property specification if the
|
|
54
|
+
* full property query fails.
|
|
55
|
+
*
|
|
51
56
|
* @param collection - Weaviate collection
|
|
52
57
|
* @param memoryId - Memory ID to fetch
|
|
53
|
-
* @returns Memory object with all properties
|
|
58
|
+
* @returns Memory object with all properties that exist on the record
|
|
54
59
|
*/
|
|
55
60
|
export declare function fetchMemoryWithAllProperties(collection: any, memoryId: string): Promise<any>;
|
|
56
61
|
/**
|
package/package.json
CHANGED
|
@@ -131,10 +131,12 @@ export async function handleUpdateMemory(
|
|
|
131
131
|
const collection = getMemoryCollection(userId);
|
|
132
132
|
|
|
133
133
|
// Get existing memory to verify ownership and get current version
|
|
134
|
+
// Only fetch minimal properties needed for validation - don't query optional properties
|
|
135
|
+
// that may not exist on all records (causes Weaviate gRPC errors)
|
|
134
136
|
let existingMemory;
|
|
135
137
|
try {
|
|
136
138
|
existingMemory = await collection.query.fetchObjectById(args.memory_id, {
|
|
137
|
-
returnProperties: ['user_id', 'doc_type', 'version'
|
|
139
|
+
returnProperties: ['user_id', 'doc_type', 'version'],
|
|
138
140
|
});
|
|
139
141
|
} catch (fetchError) {
|
|
140
142
|
const fetchErrorMsg = fetchError instanceof Error ? fetchError.message : String(fetchError);
|
package/src/weaviate/client.ts
CHANGED
|
@@ -215,17 +215,36 @@ export const ALL_MEMORY_PROPERTIES = [
|
|
|
215
215
|
* This utility ensures all memory properties are fetched consistently
|
|
216
216
|
* across all tools, preventing bugs where properties are missing.
|
|
217
217
|
*
|
|
218
|
+
* NOTE: Some properties may not exist on all records (e.g., old records
|
|
219
|
+
* created before schema updates). This function handles that gracefully
|
|
220
|
+
* by falling back to fetching without property specification if the
|
|
221
|
+
* full property query fails.
|
|
222
|
+
*
|
|
218
223
|
* @param collection - Weaviate collection
|
|
219
224
|
* @param memoryId - Memory ID to fetch
|
|
220
|
-
* @returns Memory object with all properties
|
|
225
|
+
* @returns Memory object with all properties that exist on the record
|
|
221
226
|
*/
|
|
222
227
|
export async function fetchMemoryWithAllProperties(
|
|
223
228
|
collection: any,
|
|
224
229
|
memoryId: string
|
|
225
230
|
) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
try {
|
|
232
|
+
// Try to fetch with all properties specified
|
|
233
|
+
return await collection.query.fetchObjectById(memoryId, {
|
|
234
|
+
returnProperties: ALL_MEMORY_PROPERTIES,
|
|
235
|
+
});
|
|
236
|
+
} catch (error) {
|
|
237
|
+
// If that fails (e.g., property doesn't exist on this record),
|
|
238
|
+
// fetch without specifying properties - Weaviate will return
|
|
239
|
+
// all properties that actually exist on the record
|
|
240
|
+
logger.warn('Failed to fetch with all properties, falling back to unspecified fetch', {
|
|
241
|
+
module: 'weaviate-client',
|
|
242
|
+
memoryId,
|
|
243
|
+
error: error instanceof Error ? error.message : String(error),
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
return await collection.query.fetchObjectById(memoryId);
|
|
247
|
+
}
|
|
229
248
|
}
|
|
230
249
|
|
|
231
250
|
/**
|