@prmichaelsen/remember-mcp 2.6.2 → 2.6.4
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 +61 -0
- package/agent/progress.yaml +163 -13
- package/agent/tasks/task-62-fix-confirmation-response-storage.md +323 -0
- package/agent/tasks/task-63-fix-fetchobjectbyid-missing-properties.md +397 -0
- package/agent/tasks/task-64-prevent-implicit-content-type-filtering.md +289 -0
- package/dist/server-factory.js +67 -6
- package/dist/server.js +67 -6
- package/dist/weaviate/client.d.ts +16 -0
- package/package.json +1 -1
- package/src/tools/confirm.ts +7 -2
- package/src/tools/publish.ts +6 -2
- package/src/tools/query-memory.ts +5 -0
- package/src/tools/query-space.ts +8 -1
- package/src/tools/search-memory.ts +5 -0
- package/src/tools/search-space.ts +8 -1
- package/src/weaviate/client.ts +47 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# Task 63: Fix fetchObjectById Missing Properties in Publish Flow
|
|
2
|
+
|
|
3
|
+
**Milestone**: M12 (Bug Fixes)
|
|
4
|
+
**Estimated Time**: 1 hour
|
|
5
|
+
**Dependencies**: None
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
**Priority**: CRITICAL 🚨
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Fix critical bug where `remember_publish` and `remember_confirm` (executePublishMemory) fail to fetch all memory properties because they don't specify `returnProperties` parameter in `fetchObjectById()` calls. This causes published memories to be empty shells with only metadata and vectors.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Context
|
|
18
|
+
|
|
19
|
+
**Critical Bug Discovered**: Published memories in `Memory_public` have no content!
|
|
20
|
+
|
|
21
|
+
**Symptom**:
|
|
22
|
+
- Space memory created with ID ✅
|
|
23
|
+
- Vector embedding generated ✅
|
|
24
|
+
- Metadata exists ✅
|
|
25
|
+
- **All properties missing** ❌ (no title, content, tags, etc.)
|
|
26
|
+
|
|
27
|
+
**Root Cause**:
|
|
28
|
+
Weaviate v3 API `fetchObjectById()` requires explicit `returnProperties` parameter. Without it, only metadata is returned, not the actual property values.
|
|
29
|
+
|
|
30
|
+
**Affected Code**:
|
|
31
|
+
1. [`src/tools/publish.ts:125`](src/tools/publish.ts) - `remember_publish` tool
|
|
32
|
+
2. [`src/tools/confirm.ts:154`](src/tools/confirm.ts) - `executePublishMemory` function
|
|
33
|
+
|
|
34
|
+
**Evidence**:
|
|
35
|
+
All other tools correctly specify `returnProperties`:
|
|
36
|
+
- `update-relationship.ts:100` ✅ Specifies properties
|
|
37
|
+
- `create-relationship.ts:119` ✅ Specifies properties
|
|
38
|
+
- `find-similar.ts:120` ✅ Specifies properties
|
|
39
|
+
- `update-memory.ts:119` ✅ Specifies properties
|
|
40
|
+
- `delete-relationship.ts:66` ✅ Specifies properties
|
|
41
|
+
- `delete-memory.ts:72` ✅ Specifies properties
|
|
42
|
+
- **`publish.ts:125`** ❌ Missing returnProperties
|
|
43
|
+
- **`confirm.ts:154`** ❌ Missing returnProperties
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Steps
|
|
48
|
+
|
|
49
|
+
### 1. Create Utility Function for Consistent Property Fetching
|
|
50
|
+
|
|
51
|
+
Create a helper function to ensure all memory properties are always fetched:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// src/weaviate/client.ts (add after existing functions)
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* List of all memory properties to fetch
|
|
58
|
+
* Centralized to ensure consistency across all tools
|
|
59
|
+
*/
|
|
60
|
+
export const ALL_MEMORY_PROPERTIES = [
|
|
61
|
+
'user_id',
|
|
62
|
+
'doc_type',
|
|
63
|
+
'type',
|
|
64
|
+
'title',
|
|
65
|
+
'content',
|
|
66
|
+
'tags',
|
|
67
|
+
'weight',
|
|
68
|
+
'base_weight',
|
|
69
|
+
'trust_level',
|
|
70
|
+
'context',
|
|
71
|
+
'location',
|
|
72
|
+
'relationships',
|
|
73
|
+
'created_at',
|
|
74
|
+
'updated_at',
|
|
75
|
+
'version',
|
|
76
|
+
'attribution',
|
|
77
|
+
'source_url',
|
|
78
|
+
'author',
|
|
79
|
+
'parent_id',
|
|
80
|
+
'thread_root_id',
|
|
81
|
+
'moderation_flags',
|
|
82
|
+
] as const;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Fetch a memory object by ID with all properties
|
|
86
|
+
*
|
|
87
|
+
* @param collection - Weaviate collection
|
|
88
|
+
* @param memoryId - Memory ID to fetch
|
|
89
|
+
* @returns Memory object with all properties
|
|
90
|
+
*/
|
|
91
|
+
export async function fetchMemoryWithAllProperties(
|
|
92
|
+
collection: any,
|
|
93
|
+
memoryId: string
|
|
94
|
+
) {
|
|
95
|
+
return await collection.query.fetchObjectById(memoryId, {
|
|
96
|
+
returnProperties: ALL_MEMORY_PROPERTIES,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 2. Fix remember_publish Tool
|
|
102
|
+
|
|
103
|
+
Update `fetchObjectById` call to return all properties:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// src/tools/publish.ts (around line 125)
|
|
107
|
+
|
|
108
|
+
// BEFORE (BROKEN):
|
|
109
|
+
const memory = await userCollection.query.fetchObjectById(args.memory_id);
|
|
110
|
+
|
|
111
|
+
// AFTER (FIXED):
|
|
112
|
+
const memory = await userCollection.query.fetchObjectById(args.memory_id, {
|
|
113
|
+
returnProperties: [
|
|
114
|
+
'user_id',
|
|
115
|
+
'doc_type',
|
|
116
|
+
'type',
|
|
117
|
+
'title',
|
|
118
|
+
'content',
|
|
119
|
+
'tags',
|
|
120
|
+
'weight',
|
|
121
|
+
'base_weight',
|
|
122
|
+
'trust_level',
|
|
123
|
+
'context',
|
|
124
|
+
'location',
|
|
125
|
+
'relationships',
|
|
126
|
+
'created_at',
|
|
127
|
+
'updated_at',
|
|
128
|
+
'version',
|
|
129
|
+
'attribution',
|
|
130
|
+
'source_url',
|
|
131
|
+
'author',
|
|
132
|
+
'parent_id',
|
|
133
|
+
'thread_root_id',
|
|
134
|
+
'moderation_flags',
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 2. Fix executePublishMemory in remember_confirm
|
|
140
|
+
|
|
141
|
+
Update `fetchObjectById` call in confirm tool:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// src/tools/confirm.ts (around line 154)
|
|
145
|
+
|
|
146
|
+
// BEFORE (BROKEN):
|
|
147
|
+
const originalMemory = await userCollection.query.fetchObjectById(
|
|
148
|
+
request.payload.memory_id
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
// AFTER (FIXED):
|
|
152
|
+
const originalMemory = await userCollection.query.fetchObjectById(
|
|
153
|
+
request.payload.memory_id,
|
|
154
|
+
{
|
|
155
|
+
returnProperties: [
|
|
156
|
+
'user_id',
|
|
157
|
+
'doc_type',
|
|
158
|
+
'type',
|
|
159
|
+
'title',
|
|
160
|
+
'content',
|
|
161
|
+
'tags',
|
|
162
|
+
'weight',
|
|
163
|
+
'base_weight',
|
|
164
|
+
'trust_level',
|
|
165
|
+
'context',
|
|
166
|
+
'location',
|
|
167
|
+
'relationships',
|
|
168
|
+
'created_at',
|
|
169
|
+
'updated_at',
|
|
170
|
+
'version',
|
|
171
|
+
'attribution',
|
|
172
|
+
'source_url',
|
|
173
|
+
'author',
|
|
174
|
+
'parent_id',
|
|
175
|
+
'thread_root_id',
|
|
176
|
+
'moderation_flags',
|
|
177
|
+
],
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 3. Add Logging to Verify Properties
|
|
183
|
+
|
|
184
|
+
Add debug logging to confirm properties are fetched:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
// src/tools/confirm.ts (after fetch)
|
|
188
|
+
|
|
189
|
+
logger.debug('Original memory fetch result', {
|
|
190
|
+
function: 'executePublishMemory',
|
|
191
|
+
found: !!originalMemory,
|
|
192
|
+
memoryId: request.payload.memory_id,
|
|
193
|
+
hasProperties: !!originalMemory?.properties,
|
|
194
|
+
propertyCount: originalMemory?.properties ? Object.keys(originalMemory.properties).length : 0,
|
|
195
|
+
hasTitle: !!originalMemory?.properties?.title,
|
|
196
|
+
hasContent: !!originalMemory?.properties?.content,
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 4. Test the Fix
|
|
201
|
+
|
|
202
|
+
Manual test to verify properties are copied:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# 1. Create a test memory
|
|
206
|
+
remember_create_memory({
|
|
207
|
+
type: "note",
|
|
208
|
+
title: "Test Memory",
|
|
209
|
+
content: "This is test content",
|
|
210
|
+
tags: ["test"]
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
# 2. Publish it
|
|
214
|
+
remember_publish({
|
|
215
|
+
memory_id: "<memory_id>",
|
|
216
|
+
spaces: ["the_void"]
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
# 3. Confirm publication
|
|
220
|
+
remember_confirm({
|
|
221
|
+
token: "<token>"
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
# 4. Search for it
|
|
225
|
+
remember_search_space({
|
|
226
|
+
spaces: ["the_void"],
|
|
227
|
+
query: "test content",
|
|
228
|
+
include_comments: false
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
# 5. Verify result has title, content, tags
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 5. Update Tests
|
|
235
|
+
|
|
236
|
+
Add test case for property copying:
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
// tests/unit/publish.test.ts
|
|
240
|
+
|
|
241
|
+
describe('remember_publish', () => {
|
|
242
|
+
it('should fetch all memory properties', async () => {
|
|
243
|
+
const mockMemory = {
|
|
244
|
+
properties: {
|
|
245
|
+
user_id: 'test-user',
|
|
246
|
+
title: 'Test Title',
|
|
247
|
+
content: 'Test Content',
|
|
248
|
+
tags: ['tag1', 'tag2'],
|
|
249
|
+
// ... all properties
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
mockCollection.query.fetchObjectById.mockResolvedValue(mockMemory);
|
|
254
|
+
|
|
255
|
+
await handlePublish({ memory_id: 'test-id', spaces: ['the_void'] }, 'test-user');
|
|
256
|
+
|
|
257
|
+
expect(mockCollection.query.fetchObjectById).toHaveBeenCalledWith(
|
|
258
|
+
'test-id',
|
|
259
|
+
expect.objectContaining({
|
|
260
|
+
returnProperties: expect.arrayContaining([
|
|
261
|
+
'title',
|
|
262
|
+
'content',
|
|
263
|
+
'tags',
|
|
264
|
+
'user_id',
|
|
265
|
+
'doc_type',
|
|
266
|
+
]),
|
|
267
|
+
})
|
|
268
|
+
);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Verification
|
|
276
|
+
|
|
277
|
+
- [ ] Created `fetchMemoryWithAllProperties` utility function in `src/weaviate/client.ts`
|
|
278
|
+
- [ ] Created `ALL_MEMORY_PROPERTIES` constant with all 20+ properties
|
|
279
|
+
- [ ] `remember_publish` uses `fetchMemoryWithAllProperties`
|
|
280
|
+
- [ ] `executePublishMemory` uses `fetchMemoryWithAllProperties`
|
|
281
|
+
- [ ] Utility function exported from client module
|
|
282
|
+
- [ ] Debug logging shows property count > 0
|
|
283
|
+
- [ ] Debug logging shows `hasTitle: true` and `hasContent: true`
|
|
284
|
+
- [ ] Manual test: Published memory has title, content, tags
|
|
285
|
+
- [ ] Search returns published memory with full content
|
|
286
|
+
- [ ] TypeScript compiles without errors
|
|
287
|
+
- [ ] Build successful
|
|
288
|
+
- [ ] All tests passing
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Expected Output
|
|
293
|
+
|
|
294
|
+
**Before Fix** (Current - BROKEN):
|
|
295
|
+
```json
|
|
296
|
+
{
|
|
297
|
+
"id": "9b536938-1188-4e69-b3cd-4362d84fff1c",
|
|
298
|
+
"vector": [...],
|
|
299
|
+
// ❌ NO PROPERTIES - Empty shell
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**After Fix**:
|
|
304
|
+
```json
|
|
305
|
+
{
|
|
306
|
+
"id": "9b536938-1188-4e69-b3cd-4362d84fff1c",
|
|
307
|
+
"vector": [...],
|
|
308
|
+
"properties": {
|
|
309
|
+
"title": "Breaking the Mold of Boredom",
|
|
310
|
+
"content": "i feel like i'm boring...",
|
|
311
|
+
"type": "note",
|
|
312
|
+
"tags": ["self-discovery", "societal norms", "breaking free"],
|
|
313
|
+
"author_id": "MnOyIarhz5b8n06TsTovM582NSG2",
|
|
314
|
+
"spaces": ["the_void"],
|
|
315
|
+
"published_at": "2026-02-16T21:44:39Z",
|
|
316
|
+
// ... all other properties
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Impact Analysis
|
|
324
|
+
|
|
325
|
+
**Severity**: CRITICAL 🚨
|
|
326
|
+
|
|
327
|
+
**Affected Users**: ALL users who published memories since v2.4.0
|
|
328
|
+
|
|
329
|
+
**Data Loss**:
|
|
330
|
+
- All published memories are empty shells
|
|
331
|
+
- Content exists in user collections but not in public space
|
|
332
|
+
- Search returns no results (no content to match)
|
|
333
|
+
- Discovery completely broken
|
|
334
|
+
|
|
335
|
+
**Workaround**: None - memories must be re-published after fix
|
|
336
|
+
|
|
337
|
+
**Migration**:
|
|
338
|
+
- Option 1: Users re-publish memories manually
|
|
339
|
+
- Option 2: Create migration script to re-publish all memories
|
|
340
|
+
- Option 3: Backfill from user collections (requires tracking original IDs)
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Common Issues and Solutions
|
|
345
|
+
|
|
346
|
+
### Issue 1: TypeScript error about returnProperties
|
|
347
|
+
|
|
348
|
+
**Cause**: Type definition might not include all properties
|
|
349
|
+
**Solution**: Use `as any` if needed or update type definition
|
|
350
|
+
|
|
351
|
+
### Issue 2: Some properties still missing
|
|
352
|
+
|
|
353
|
+
**Cause**: Property list incomplete
|
|
354
|
+
**Solution**: Check schema.ts for all property names
|
|
355
|
+
|
|
356
|
+
### Issue 3: Old memories still empty
|
|
357
|
+
|
|
358
|
+
**Cause**: This fix only affects new publications
|
|
359
|
+
**Solution**: Users must re-publish or run migration script
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Resources
|
|
364
|
+
|
|
365
|
+
- [Weaviate v3 Query API](https://weaviate.io/developers/weaviate/api/graphql/get)
|
|
366
|
+
- [Memory Schema](../src/weaviate/schema.ts)
|
|
367
|
+
- [Space Schema](../src/weaviate/space-schema.ts)
|
|
368
|
+
- [Other fetchObjectById Examples](../src/tools/)
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Notes
|
|
373
|
+
|
|
374
|
+
- **This is more critical than Task 62** (response storage)
|
|
375
|
+
- Task 62 affects audit trail, Task 63 affects core functionality
|
|
376
|
+
- Without this fix, the entire publish/space feature is broken
|
|
377
|
+
- This bug has been in production since shared spaces were released
|
|
378
|
+
- All published memories need to be re-published after fix
|
|
379
|
+
- Consider adding integration test to catch this in future
|
|
380
|
+
- ✅ Created `fetchMemoryWithAllProperties` helper function
|
|
381
|
+
- This prevents the bug from recurring in future code
|
|
382
|
+
- Consider migrating other tools to use the utility function
|
|
383
|
+
- Consider adding ESLint rule to prevent direct `fetchObjectById` usage
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Related Tasks
|
|
388
|
+
|
|
389
|
+
- **Task 62**: Fix confirmation response storage (audit trail)
|
|
390
|
+
- **Task 58**: Add comment unit tests
|
|
391
|
+
- **Task 59**: Update documentation
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
**Status**: Not Started
|
|
396
|
+
**Recommendation**: FIX IMMEDIATELY - This breaks core functionality
|
|
397
|
+
**Priority**: CRITICAL - Must be fixed before any other M12 tasks
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# Task 64: Update Search/Query Tool Descriptions - No Implicit Content Type Filtering
|
|
2
|
+
|
|
3
|
+
**Milestone**: M12 (Bug Fixes / UX Improvements)
|
|
4
|
+
**Estimated Time**: 1 hour
|
|
5
|
+
**Dependencies**: None
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
**Priority**: High
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Update all search and query tool descriptions to explicitly instruct agents to NEVER add content_type filters unless the user explicitly requests filtering by content type. This prevents agents from over-filtering results and missing relevant memories.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Context
|
|
18
|
+
|
|
19
|
+
**Current Problem**:
|
|
20
|
+
Agents are adding `content_type` filters to search queries even when users don't request them. This causes:
|
|
21
|
+
- Missed results (memories with different content types excluded)
|
|
22
|
+
- Poor search experience (user searches for "hiking" but agent filters to only "note" type)
|
|
23
|
+
- Confusion (user doesn't understand why results are limited)
|
|
24
|
+
|
|
25
|
+
**Example Bad Behavior**:
|
|
26
|
+
```
|
|
27
|
+
User: "Search for memories about hiking"
|
|
28
|
+
Agent: remember_search_memory({ query: "hiking", content_type: "note" })
|
|
29
|
+
Result: Misses "event", "activity", "location" memories about hiking
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Expected Behavior**:
|
|
33
|
+
```
|
|
34
|
+
User: "Search for memories about hiking"
|
|
35
|
+
Agent: remember_search_memory({ query: "hiking" })
|
|
36
|
+
Result: Returns ALL memories about hiking regardless of type
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**When to Filter**:
|
|
40
|
+
```
|
|
41
|
+
User: "Search for note memories about hiking"
|
|
42
|
+
Agent: remember_search_memory({ query: "hiking", content_type: "note" })
|
|
43
|
+
Result: Correctly filters to only notes
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Steps
|
|
49
|
+
|
|
50
|
+
### 1. Update remember_search_memory Description
|
|
51
|
+
|
|
52
|
+
Add explicit instruction to tool description:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// src/tools/search-memory.ts
|
|
56
|
+
|
|
57
|
+
export const searchMemoryTool: Tool = {
|
|
58
|
+
name: 'remember_search_memory',
|
|
59
|
+
description: `Search your personal memories using hybrid search (semantic + keyword).
|
|
60
|
+
|
|
61
|
+
⚠️ IMPORTANT: Do NOT add content_type filter unless the user explicitly requests filtering by type.
|
|
62
|
+
- ✅ CORRECT: User says "search for hiking" → { query: "hiking" }
|
|
63
|
+
- ❌ WRONG: User says "search for hiking" → { query: "hiking", content_type: "note" }
|
|
64
|
+
- ✅ CORRECT: User says "search for note memories about hiking" → { query: "hiking", content_type: "note" }
|
|
65
|
+
|
|
66
|
+
Let the search algorithm find ALL relevant memories regardless of type unless explicitly requested.`,
|
|
67
|
+
// ... rest of tool definition
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Update remember_query_memory Description
|
|
72
|
+
|
|
73
|
+
Add same instruction:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
// src/tools/query-memory.ts
|
|
77
|
+
|
|
78
|
+
export const queryMemoryTool: Tool = {
|
|
79
|
+
name: 'remember_query_memory',
|
|
80
|
+
description: `Query your personal memories using natural language (RAG-optimized).
|
|
81
|
+
|
|
82
|
+
⚠️ IMPORTANT: Do NOT add content_type filter unless the user explicitly requests filtering by type.
|
|
83
|
+
- ✅ CORRECT: User says "what do I know about hiking?" → { query: "hiking" }
|
|
84
|
+
- ❌ WRONG: User says "what do I know about hiking?" → { query: "hiking", content_type: "note" }
|
|
85
|
+
- ✅ CORRECT: User says "what notes do I have about hiking?" → { query: "hiking", content_type: "note" }
|
|
86
|
+
|
|
87
|
+
Let the query algorithm find ALL relevant memories regardless of type unless explicitly requested.`,
|
|
88
|
+
// ... rest of tool definition
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 3. Update remember_search_space Description
|
|
93
|
+
|
|
94
|
+
Add same instruction:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// src/tools/search-space.ts
|
|
98
|
+
|
|
99
|
+
export const searchSpaceTool: Tool = {
|
|
100
|
+
name: 'remember_search_space',
|
|
101
|
+
description: `Search shared spaces for published memories.
|
|
102
|
+
|
|
103
|
+
⚠️ IMPORTANT: Do NOT add content_type filter unless the user explicitly requests filtering by type.
|
|
104
|
+
- ✅ CORRECT: User says "search The Void for hiking" → { spaces: ["the_void"], query: "hiking" }
|
|
105
|
+
- ❌ WRONG: User says "search The Void for hiking" → { spaces: ["the_void"], query: "hiking", content_type: "note" }
|
|
106
|
+
- ✅ CORRECT: User says "search The Void for note memories about hiking" → { spaces: ["the_void"], query: "hiking", content_type: "note" }
|
|
107
|
+
|
|
108
|
+
Let the search algorithm find ALL relevant memories regardless of type unless explicitly requested.`,
|
|
109
|
+
// ... rest of tool definition
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 4. Update remember_query_space Description
|
|
114
|
+
|
|
115
|
+
Add same instruction:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
// src/tools/query-space.ts
|
|
119
|
+
|
|
120
|
+
export const querySpaceTool: Tool = {
|
|
121
|
+
name: 'remember_query_space',
|
|
122
|
+
description: `Query shared spaces using natural language (RAG-optimized).
|
|
123
|
+
|
|
124
|
+
⚠️ IMPORTANT: Do NOT add content_type filter unless the user explicitly requests filtering by type.
|
|
125
|
+
- ✅ CORRECT: User says "what's in The Void about hiking?" → { spaces: ["the_void"], query: "hiking" }
|
|
126
|
+
- ❌ WRONG: User says "what's in The Void about hiking?" → { spaces: ["the_void"], query: "hiking", content_type: "note" }
|
|
127
|
+
- ✅ CORRECT: User says "what notes are in The Void about hiking?" → { spaces: ["the_void"], query: "hiking", content_type: "note" }
|
|
128
|
+
|
|
129
|
+
Let the query algorithm find ALL relevant memories regardless of type unless explicitly requested.`,
|
|
130
|
+
// ... rest of tool definition
|
|
131
|
+
};
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 5. Update remember_search_relationship Description (Optional)
|
|
135
|
+
|
|
136
|
+
Consider adding similar guidance:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// src/tools/search-relationship.ts
|
|
140
|
+
|
|
141
|
+
export const searchRelationshipTool: Tool = {
|
|
142
|
+
name: 'remember_search_relationship',
|
|
143
|
+
description: `Search for relationships between memories.
|
|
144
|
+
|
|
145
|
+
⚠️ IMPORTANT: Do NOT add relationship_type filter unless the user explicitly requests filtering by type.
|
|
146
|
+
- ✅ CORRECT: User says "find relationships about hiking" → { query: "hiking" }
|
|
147
|
+
- ❌ WRONG: User says "find relationships about hiking" → { query: "hiking", relationship_type: "inspired_by" }
|
|
148
|
+
|
|
149
|
+
Let the search algorithm find ALL relevant relationships regardless of type unless explicitly requested.`,
|
|
150
|
+
// ... rest of tool definition
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 6. Test Agent Behavior
|
|
155
|
+
|
|
156
|
+
Manual testing to verify agents follow instructions:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Test 1: Generic search (should NOT add content_type)
|
|
160
|
+
User: "Search for memories about hiking"
|
|
161
|
+
Expected: { query: "hiking" }
|
|
162
|
+
Wrong: { query: "hiking", content_type: "note" }
|
|
163
|
+
|
|
164
|
+
# Test 2: Explicit type request (should add content_type)
|
|
165
|
+
User: "Search for note memories about hiking"
|
|
166
|
+
Expected: { query: "hiking", content_type: "note" }
|
|
167
|
+
|
|
168
|
+
# Test 3: Space search (should NOT add content_type)
|
|
169
|
+
User: "Search The Void for hiking trails"
|
|
170
|
+
Expected: { spaces: ["the_void"], query: "hiking trails" }
|
|
171
|
+
Wrong: { spaces: ["the_void"], query: "hiking trails", content_type: "location" }
|
|
172
|
+
|
|
173
|
+
# Test 4: Explicit type in space (should add content_type)
|
|
174
|
+
User: "Search The Void for location memories about hiking"
|
|
175
|
+
Expected: { spaces: ["the_void"], query: "hiking", content_type: "location" }
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Verification
|
|
181
|
+
|
|
182
|
+
- [ ] `remember_search_memory` description includes "Do NOT add content_type filter" warning
|
|
183
|
+
- [ ] `remember_query_memory` description includes same warning
|
|
184
|
+
- [ ] `remember_search_space` description includes same warning
|
|
185
|
+
- [ ] `remember_query_space` description includes same warning
|
|
186
|
+
- [ ] Each tool has ✅ CORRECT and ❌ WRONG examples
|
|
187
|
+
- [ ] TypeScript compiles without errors
|
|
188
|
+
- [ ] Build successful
|
|
189
|
+
- [ ] Manual test: Agent doesn't add content_type for generic searches
|
|
190
|
+
- [ ] Manual test: Agent adds content_type when explicitly requested
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Expected Output
|
|
195
|
+
|
|
196
|
+
**Tool Descriptions Before**:
|
|
197
|
+
```
|
|
198
|
+
Search your personal memories using hybrid search (semantic + keyword).
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Tool Descriptions After**:
|
|
202
|
+
```
|
|
203
|
+
Search your personal memories using hybrid search (semantic + keyword).
|
|
204
|
+
|
|
205
|
+
⚠️ IMPORTANT: Do NOT add content_type filter unless the user explicitly requests filtering by type.
|
|
206
|
+
- ✅ CORRECT: User says "search for hiking" → { query: "hiking" }
|
|
207
|
+
- ❌ WRONG: User says "search for hiking" → { query: "hiking", content_type: "note" }
|
|
208
|
+
- ✅ CORRECT: User says "search for note memories about hiking" → { query: "hiking", content_type: "note" }
|
|
209
|
+
|
|
210
|
+
Let the search algorithm find ALL relevant memories regardless of type unless explicitly requested.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Impact Analysis
|
|
216
|
+
|
|
217
|
+
**Severity**: High (affects search quality and user experience)
|
|
218
|
+
|
|
219
|
+
**Affected Tools**: 4-5 tools
|
|
220
|
+
- `remember_search_memory`
|
|
221
|
+
- `remember_query_memory`
|
|
222
|
+
- `remember_search_space`
|
|
223
|
+
- `remember_query_space`
|
|
224
|
+
- `remember_search_relationship` (optional)
|
|
225
|
+
|
|
226
|
+
**User Impact**:
|
|
227
|
+
- Better search results (no over-filtering)
|
|
228
|
+
- More relevant memories returned
|
|
229
|
+
- Clearer agent behavior
|
|
230
|
+
- Improved user experience
|
|
231
|
+
|
|
232
|
+
**Agent Impact**:
|
|
233
|
+
- Clear guidance on when to filter
|
|
234
|
+
- Reduces confusion about content_type parameter
|
|
235
|
+
- Better alignment with user intent
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Common Issues and Solutions
|
|
240
|
+
|
|
241
|
+
### Issue 1: Agent still adds content_type filters
|
|
242
|
+
|
|
243
|
+
**Cause**: Agent's base model behavior overrides tool description
|
|
244
|
+
**Solution**: Make warning more prominent with ⚠️ emoji and examples
|
|
245
|
+
|
|
246
|
+
### Issue 2: Agent never adds content_type even when requested
|
|
247
|
+
|
|
248
|
+
**Cause**: Warning too strong, agent avoids parameter entirely
|
|
249
|
+
**Solution**: Include ✅ CORRECT examples showing when to use it
|
|
250
|
+
|
|
251
|
+
### Issue 3: Unclear when "explicit request" means
|
|
252
|
+
|
|
253
|
+
**Cause**: Ambiguous language in user query
|
|
254
|
+
**Solution**: Provide clear examples in tool description
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Resources
|
|
259
|
+
|
|
260
|
+
- [Tool Descriptions Best Practices](https://modelcontextprotocol.io/docs/concepts/tools)
|
|
261
|
+
- [remember_search_memory Tool](../src/tools/search-memory.ts)
|
|
262
|
+
- [remember_query_memory Tool](../src/tools/query-memory.ts)
|
|
263
|
+
- [remember_search_space Tool](../src/tools/search-space.ts)
|
|
264
|
+
- [remember_query_space Tool](../src/tools/query-space.ts)
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Notes
|
|
269
|
+
|
|
270
|
+
- This is a documentation-only change (no code logic changes)
|
|
271
|
+
- Affects agent behavior through tool description guidance
|
|
272
|
+
- May need iteration based on observed agent behavior
|
|
273
|
+
- Consider adding to system prompt if tool descriptions aren't sufficient
|
|
274
|
+
- Could be extended to other optional filter parameters (tags, weight, etc.)
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Related Tasks
|
|
279
|
+
|
|
280
|
+
- **Task 63**: Fix empty published memories (completed)
|
|
281
|
+
- **Task 62**: Fix confirmation response storage (pending)
|
|
282
|
+
- **Task 58**: Add comment unit tests (pending)
|
|
283
|
+
- **Task 59**: Update documentation (pending)
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
**Status**: Not Started
|
|
288
|
+
**Recommendation**: Implement after Task 62 to improve search UX
|
|
289
|
+
**Priority**: High - Directly impacts user experience and search quality
|