@prmichaelsen/remember-mcp 2.8.0 → 3.0.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.
Files changed (74) hide show
  1. package/AGENT.md +1 -1
  2. package/CHANGELOG.md +130 -0
  3. package/README.md +95 -1
  4. package/agent/commands/acp.command-create.md +0 -1
  5. package/agent/commands/acp.design-create.md +0 -1
  6. package/agent/commands/acp.init.md +0 -1
  7. package/agent/commands/acp.package-create.md +0 -1
  8. package/agent/commands/acp.package-info.md +0 -1
  9. package/agent/commands/acp.package-install.md +0 -1
  10. package/agent/commands/acp.package-list.md +0 -1
  11. package/agent/commands/acp.package-publish.md +0 -1
  12. package/agent/commands/acp.package-remove.md +0 -1
  13. package/agent/commands/acp.package-search.md +0 -1
  14. package/agent/commands/acp.package-update.md +0 -1
  15. package/agent/commands/acp.package-validate.md +0 -1
  16. package/agent/commands/acp.pattern-create.md +0 -1
  17. package/agent/commands/acp.plan.md +0 -1
  18. package/agent/commands/acp.proceed.md +0 -1
  19. package/agent/commands/acp.project-create.md +0 -1
  20. package/agent/commands/acp.project-list.md +0 -1
  21. package/agent/commands/acp.project-set.md +0 -1
  22. package/agent/commands/acp.report.md +0 -1
  23. package/agent/commands/acp.resume.md +0 -1
  24. package/agent/commands/acp.status.md +0 -1
  25. package/agent/commands/acp.sync.md +0 -1
  26. package/agent/commands/acp.task-create.md +0 -1
  27. package/agent/commands/acp.update.md +0 -1
  28. package/agent/commands/acp.validate.md +0 -1
  29. package/agent/commands/acp.version-check-for-updates.md +0 -1
  30. package/agent/commands/acp.version-check.md +0 -1
  31. package/agent/commands/acp.version-update.md +0 -1
  32. package/agent/commands/command.template.md +0 -5
  33. package/agent/commands/git.commit.md +0 -1
  34. package/agent/commands/git.init.md +0 -1
  35. package/agent/design/soft-delete-system.md +291 -0
  36. package/agent/milestones/milestone-13-soft-delete-system.md +306 -0
  37. package/agent/package.template.yaml +0 -17
  38. package/agent/progress.yaml +136 -2
  39. package/agent/scripts/acp.install.sh +4 -84
  40. package/agent/scripts/acp.package-install.sh +33 -112
  41. package/agent/scripts/acp.package-validate.sh +0 -99
  42. package/agent/tasks/task-70-add-soft-delete-schema-fields.md +165 -0
  43. package/agent/tasks/task-71-implement-delete-confirmation-flow.md +257 -0
  44. package/agent/tasks/task-72-add-deleted-filter-to-search-tools.md +18 -0
  45. package/agent/tasks/task-73-update-relationship-handling.md +18 -0
  46. package/agent/tasks/task-74-add-unit-tests-soft-delete.md +18 -0
  47. package/agent/tasks/task-75-update-documentation-changelog.md +26 -0
  48. package/dist/server-factory.js +677 -501
  49. package/dist/server.js +677 -501
  50. package/dist/tools/delete-memory.d.ts +5 -30
  51. package/dist/tools/find-similar.d.ts +8 -1
  52. package/dist/tools/query-memory.d.ts +8 -1
  53. package/dist/tools/search-memory.d.ts +6 -0
  54. package/dist/tools/search-relationship.d.ts +8 -1
  55. package/dist/types/memory.d.ts +8 -0
  56. package/dist/types/space-memory.d.ts +3 -0
  57. package/dist/utils/weaviate-filters.d.ts +19 -0
  58. package/dist/weaviate/client.d.ts +1 -1
  59. package/package.json +1 -1
  60. package/src/tools/confirm.ts +65 -1
  61. package/src/tools/create-relationship.ts +14 -1
  62. package/src/tools/delete-memory.ts +91 -63
  63. package/src/tools/find-similar.ts +30 -5
  64. package/src/tools/query-memory.ts +18 -5
  65. package/src/tools/search-memory.ts +18 -5
  66. package/src/tools/search-relationship.ts +19 -5
  67. package/src/tools/update-memory.ts +8 -0
  68. package/src/types/memory.ts +11 -0
  69. package/src/types/space-memory.ts +5 -0
  70. package/src/utils/weaviate-filters.ts +28 -1
  71. package/src/weaviate/client.ts +5 -0
  72. package/src/weaviate/schema.ts +17 -0
  73. package/src/weaviate/space-schema.spec.ts +5 -2
  74. package/src/weaviate/space-schema.ts +17 -5
@@ -0,0 +1,165 @@
1
+ # Task 70: Add Soft Delete Schema Fields
2
+
3
+ **Milestone**: M13 (Soft Delete System)
4
+ **Estimated Time**: 2-3 hours
5
+ **Dependencies**: None
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Add three new fields to the Weaviate schema to support soft delete functionality: `deleted_at` (timestamp), `deleted_by` (user ID), and `deletion_reason` (optional text). These fields enable tracking when memories are deleted, who deleted them, and why, while keeping the data in the database for potential future recovery.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Update Memory Schema ([`src/weaviate/schema.ts`](../../src/weaviate/schema.ts))
19
+
20
+ Add three new properties to the `createMemoryCollection` function:
21
+
22
+ ```typescript
23
+ // After existing properties (around line 150)
24
+
25
+ // Soft delete fields
26
+ {
27
+ name: 'deleted_at',
28
+ dataType: 'date' as any,
29
+ description: 'Timestamp when memory was soft-deleted (null = not deleted)',
30
+ },
31
+ {
32
+ name: 'deleted_by',
33
+ dataType: 'text' as any,
34
+ description: 'User ID who deleted the memory',
35
+ },
36
+ {
37
+ name: 'deletion_reason',
38
+ dataType: 'text' as any,
39
+ description: 'Optional reason for deletion',
40
+ },
41
+ ```
42
+
43
+ **Note**: `deleted_at` is nullable. Missing or `null` value means memory is not deleted.
44
+
45
+ ### 2. Update Public Collection Schema ([`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts))
46
+
47
+ Add the same three fields to `ensurePublicCollection` function:
48
+
49
+ ```typescript
50
+ // After existing properties
51
+
52
+ // Soft delete fields
53
+ {
54
+ name: 'deleted_at',
55
+ dataType: 'date' as any,
56
+ description: 'Timestamp when memory was soft-deleted (null = not deleted)',
57
+ },
58
+ {
59
+ name: 'deleted_by',
60
+ dataType: 'text' as any,
61
+ description: 'User ID who deleted the memory',
62
+ },
63
+ {
64
+ name: 'deletion_reason',
65
+ dataType: 'text' as any,
66
+ description: 'Optional reason for deletion',
67
+ },
68
+ ```
69
+
70
+ ### 3. Update Memory Type Definitions ([`src/types/memory.ts`](../../src/types/memory.ts))
71
+
72
+ Add fields to `Memory` interface:
73
+
74
+ ```typescript
75
+ export interface Memory {
76
+ // ... existing fields
77
+
78
+ // Soft delete fields
79
+ deleted_at?: Date | null;
80
+ deleted_by?: string;
81
+ deletion_reason?: string;
82
+ }
83
+ ```
84
+
85
+ ### 4. Update SpaceMemory Type ([`src/types/space-memory.ts`](../../src/types/space-memory.ts))
86
+
87
+ Add fields to `SpaceMemory` interface:
88
+
89
+ ```typescript
90
+ export interface SpaceMemory {
91
+ // ... existing fields
92
+
93
+ // Soft delete fields
94
+ deleted_at?: Date | null;
95
+ deleted_by?: string;
96
+ deletion_reason?: string;
97
+ }
98
+ ```
99
+
100
+ ### 5. Update ALL_MEMORY_PROPERTIES Constant ([`src/weaviate/client.ts`](../../src/weaviate/client.ts))
101
+
102
+ Add new fields to the properties array:
103
+
104
+ ```typescript
105
+ const ALL_MEMORY_PROPERTIES = [
106
+ // ... existing properties
107
+ 'deleted_at',
108
+ 'deleted_by',
109
+ 'deletion_reason',
110
+ ];
111
+ ```
112
+
113
+ ### 6. Build and Test
114
+
115
+ ```bash
116
+ npm run build
117
+ ```
118
+
119
+ **Expected**: TypeScript compiles without errors
120
+
121
+ ---
122
+
123
+ ## Verification
124
+
125
+ - [ ] `deleted_at` field added to Memory schema (date, nullable)
126
+ - [ ] `deleted_by` field added to Memory schema (text)
127
+ - [ ] `deletion_reason` field added to Memory schema (text)
128
+ - [ ] Same 3 fields added to Memory_public schema
129
+ - [ ] Fields added to Memory interface in types
130
+ - [ ] Fields added to SpaceMemory interface in types
131
+ - [ ] Fields added to ALL_MEMORY_PROPERTIES constant
132
+ - [ ] TypeScript compiles without errors
133
+ - [ ] Build successful
134
+ - [ ] No breaking changes to existing code
135
+
136
+ ---
137
+
138
+ ## Files Modified
139
+
140
+ - [`src/weaviate/schema.ts`](../../src/weaviate/schema.ts) - Add 3 fields to Memory schema
141
+ - [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts) - Add 3 fields to public collection
142
+ - [`src/types/memory.ts`](../../src/types/memory.ts) - Add fields to Memory interface
143
+ - [`src/types/space-memory.ts`](../../src/types/space-memory.ts) - Add fields to SpaceMemory interface
144
+ - [`src/weaviate/client.ts`](../../src/weaviate/client.ts) - Add fields to ALL_MEMORY_PROPERTIES
145
+
146
+ ---
147
+
148
+ ## Files Created
149
+
150
+ None
151
+
152
+ ---
153
+
154
+ ## Notes
155
+
156
+ - **Nullable Field**: `deleted_at` being nullable is critical. Missing or `null` = not deleted.
157
+ - **No Migration Needed**: Existing memories will implicitly have `deleted_at: null`
158
+ - **Weaviate Behavior**: `isNull(true)` filter correctly handles missing fields
159
+ - **Optional Fields**: `deleted_by` and `deletion_reason` are optional in TypeScript but will be set when memory is deleted
160
+
161
+ ---
162
+
163
+ ## Next Task
164
+
165
+ Task 71: Implement Delete Confirmation Flow
@@ -0,0 +1,257 @@
1
+ # Task 71: Implement Delete Confirmation Flow
2
+
3
+ **Milestone**: M13 (Soft Delete System)
4
+ **Estimated Time**: 4-5 hours
5
+ **Dependencies**: Task 70 (Schema fields must exist)
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Modify `remember_delete_memory` to create a confirmation token instead of immediately deleting the memory, and enhance `remember_confirm` to handle the `delete_memory` action. Include a preview of what will be deleted (content, relationship count, orphaned relationships).
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Update Delete Memory Tool ([`src/tools/delete-memory.ts`](../../src/tools/delete-memory.ts))
19
+
20
+ **Current Behavior**: Immediately deletes memory from Weaviate
21
+
22
+ **New Behavior**: Creates confirmation token and returns preview
23
+
24
+ ```typescript
25
+ import { ConfirmationTokenService } from '../services/confirmation-token.service.js';
26
+
27
+ export const deleteMemoryTool: Tool = {
28
+ name: 'remember_delete_memory',
29
+ description: `Request to delete a memory. Requires confirmation via remember_confirm.
30
+
31
+ ⚠️ **IMPORTANT**: This is a two-step process:
32
+ 1. Call remember_delete_memory to request deletion (returns token)
33
+ 2. User must confirm via remember_confirm with the token
34
+
35
+ The memory will be soft-deleted (marked as deleted but not removed from database).`,
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ memory_id: {
40
+ type: 'string',
41
+ description: 'ID of memory to delete',
42
+ },
43
+ reason: {
44
+ type: 'string',
45
+ description: 'Optional reason for deletion',
46
+ },
47
+ },
48
+ required: ['memory_id'],
49
+ },
50
+ };
51
+
52
+ export async function handleDeleteMemory(
53
+ args: { memory_id: string; reason?: string },
54
+ userId: string
55
+ ): Promise<any> {
56
+ try {
57
+ const { memory_id, reason } = args;
58
+ const client = getWeaviateClient();
59
+ const collectionName = `Memory_${sanitizeUserId(userId)}`;
60
+
61
+ // Fetch memory to verify ownership and get preview
62
+ const memory = await client.collections
63
+ .get(collectionName)
64
+ .query.fetchObjectById(memory_id, {
65
+ includeVector: false,
66
+ });
67
+
68
+ if (!memory) {
69
+ throw new McpError(
70
+ ErrorCode.InvalidRequest,
71
+ `Memory not found: ${memory_id}`
72
+ );
73
+ }
74
+
75
+ // Verify ownership
76
+ if (memory.properties.user_id !== userId) {
77
+ throw new McpError(
78
+ ErrorCode.InvalidRequest,
79
+ `Cannot delete memory: not owned by user ${userId}`
80
+ );
81
+ }
82
+
83
+ // Check if already deleted
84
+ if (memory.properties.deleted_at) {
85
+ throw new McpError(
86
+ ErrorCode.InvalidRequest,
87
+ `Memory ${memory_id} is already deleted`
88
+ );
89
+ }
90
+
91
+ // Find relationships that will be orphaned
92
+ const relationships = await client.collections
93
+ .get(collectionName)
94
+ .query.fetchObjects({
95
+ filters: Filters.and(
96
+ collection.filter.byProperty('doc_type').equal('relationship'),
97
+ collection.filter.byProperty('memory_ids').containsAny([memory_id])
98
+ ),
99
+ limit: 100,
100
+ });
101
+
102
+ const orphanedRelationships = relationships.objects.map(r => r.uuid);
103
+
104
+ // Create confirmation token
105
+ const tokenService = new ConfirmationTokenService();
106
+ const { token, expiresAt } = await tokenService.createRequest(
107
+ userId,
108
+ 'delete_memory',
109
+ {
110
+ memory_id,
111
+ reason,
112
+ }
113
+ );
114
+
115
+ return {
116
+ content: [
117
+ {
118
+ type: 'text',
119
+ text: JSON.stringify({
120
+ success: true,
121
+ token,
122
+ expires_at: expiresAt.toISOString(),
123
+ preview: {
124
+ memory_id,
125
+ content: memory.properties.content?.substring(0, 200) + '...',
126
+ type: memory.properties.type,
127
+ relationships_count: orphanedRelationships.length,
128
+ will_orphan: orphanedRelationships,
129
+ },
130
+ message: `Deletion requested. Use remember_confirm with token to complete deletion. Token expires in 5 minutes.`,
131
+ }, null, 2),
132
+ },
133
+ ],
134
+ };
135
+ } catch (error) {
136
+ return handleToolError('remember_delete_memory', error, { userId, memory_id: args.memory_id });
137
+ }
138
+ }
139
+ ```
140
+
141
+ ### 2. Enhance Confirm Tool ([`src/tools/confirm.ts`](../../src/tools/confirm.ts))
142
+
143
+ Add handling for `delete_memory` action:
144
+
145
+ ```typescript
146
+ // In handleConfirm function, add new case
147
+
148
+ if (request.action === 'delete_memory') {
149
+ const { memory_id, reason } = request.payload;
150
+
151
+ // Soft delete the memory
152
+ const client = getWeaviateClient();
153
+ const collectionName = `Memory_${sanitizeUserId(userId)}`;
154
+
155
+ await client.collections
156
+ .get(collectionName)
157
+ .data.update({
158
+ id: memory_id,
159
+ properties: {
160
+ deleted_at: new Date().toISOString(),
161
+ deleted_by: userId,
162
+ deletion_reason: reason || null,
163
+ },
164
+ });
165
+
166
+ // Mark request as confirmed
167
+ await tokenService.confirmRequest(userId, token);
168
+
169
+ return {
170
+ content: [
171
+ {
172
+ type: 'text',
173
+ text: JSON.stringify({
174
+ success: true,
175
+ memory_id,
176
+ message: 'Memory deleted successfully',
177
+ }, null, 2),
178
+ },
179
+ ],
180
+ };
181
+ }
182
+ ```
183
+
184
+ ### 3. Update Confirmation Token Service Types
185
+
186
+ Ensure `delete_memory` is a valid action type in [`src/services/confirmation-token.service.ts`](../../src/services/confirmation-token.service.ts):
187
+
188
+ ```typescript
189
+ type ConfirmationAction = 'publish_memory' | 'delete_memory';
190
+ ```
191
+
192
+ ### 4. Build and Test
193
+
194
+ ```bash
195
+ npm run build
196
+ npm test
197
+ ```
198
+
199
+ **Expected**:
200
+ - TypeScript compiles without errors
201
+ - All existing tests pass
202
+ - Build successful
203
+
204
+ ---
205
+
206
+ ## Verification
207
+
208
+ - [ ] `remember_delete_memory` creates confirmation token (not immediate delete)
209
+ - [ ] Token includes preview with content, type, relationship count
210
+ - [ ] Preview shows which relationships will be orphaned
211
+ - [ ] `remember_confirm` handles `delete_memory` action
212
+ - [ ] Confirmation sets `deleted_at`, `deleted_by`, `deletion_reason`
213
+ - [ ] Cannot delete already-deleted memory (returns error)
214
+ - [ ] Cannot delete memory owned by another user (returns error)
215
+ - [ ] Token expires after 5 minutes
216
+ - [ ] TypeScript compiles without errors
217
+ - [ ] Build successful
218
+ - [ ] All existing tests still passing
219
+
220
+ ---
221
+
222
+ ## Files Modified
223
+
224
+ - [`src/tools/delete-memory.ts`](../../src/tools/delete-memory.ts) - Change to confirmation flow
225
+ - [`src/tools/confirm.ts`](../../src/tools/confirm.ts) - Add delete_memory action handling
226
+ - [`src/services/confirmation-token.service.ts`](../../src/services/confirmation-token.service.ts) - Add delete_memory to action types
227
+
228
+ ---
229
+
230
+ ## Files Created
231
+
232
+ None
233
+
234
+ ---
235
+
236
+ ## Testing Notes
237
+
238
+ **Manual Testing**:
239
+ ```typescript
240
+ // 1. Request deletion
241
+ remember_delete_memory({ memory_id: "abc123", reason: "No longer needed" })
242
+ // Returns: { token: "xyz789", preview: {...} }
243
+
244
+ // 2. Confirm deletion
245
+ remember_confirm({ token: "xyz789" })
246
+ // Returns: { success: true, memory_id: "abc123" }
247
+
248
+ // 3. Verify memory is soft-deleted
249
+ remember_search_memory({ query: "test", deleted_filter: "only" })
250
+ // Should find the deleted memory
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Next Task
256
+
257
+ Task 72: Add deleted_filter to Search Tools
@@ -0,0 +1,18 @@
1
+ # Task 72: Add deleted_filter to Search Tools
2
+
3
+ **Milestone**: M13 (Soft Delete System)
4
+ **Estimated Time**: 4-5 hours
5
+ **Dependencies**: Task 70 (Schema fields must exist)
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Add \`deleted_filter\` parameter to all search tools to control whether deleted memories are included in search results. Default behavior excludes deleted memories.
13
+
14
+ ---
15
+
16
+ ## Next Task
17
+
18
+ Task 73: Update Relationship Handling for Deleted Memories
@@ -0,0 +1,18 @@
1
+ # Task 73: Update Relationship Handling for Deleted Memories
2
+
3
+ **Milestone**: M13 (Soft Delete System)
4
+ **Estimated Time**: 3-4 hours
5
+ **Dependencies**: Task 70, Task 72
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Prevent creating relationships with deleted memories and return clear error messages when attempting to update deleted memories.
13
+
14
+ ---
15
+
16
+ ## Next Task
17
+
18
+ Task 74: Add Unit Tests for Soft Delete
@@ -0,0 +1,18 @@
1
+ # Task 74: Add Unit Tests for Soft Delete
2
+
3
+ **Milestone**: M13 (Soft Delete System)
4
+ **Estimated Time**: 4-5 hours
5
+ **Dependencies**: Tasks 70-73
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Create comprehensive unit tests for soft delete functionality.
13
+
14
+ ---
15
+
16
+ ## Next Task
17
+
18
+ Task 75: Update Documentation and CHANGELOG
@@ -0,0 +1,26 @@
1
+ # Task 75: Update Documentation and CHANGELOG
2
+
3
+ **Milestone**: M13 (Soft Delete System)
4
+ **Estimated Time**: 2-3 hours
5
+ **Dependencies**: Tasks 70-74
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Update README.md with new deletion workflow, document breaking changes in CHANGELOG.md (v3.0.0), and update all tool descriptions.
13
+
14
+ ---
15
+
16
+ ## Files to Update
17
+
18
+ - README.md - Add deletion workflow examples
19
+ - CHANGELOG.md - Document v3.0.0 breaking changes
20
+ - Tool descriptions - Update all affected tools
21
+
22
+ ---
23
+
24
+ ## Next Milestone
25
+
26
+ M5: Template System (deferred until M13 complete)