@prmichaelsen/remember-mcp 2.3.0 → 2.3.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/dist/server.js CHANGED
@@ -1253,6 +1253,13 @@ var createMemoryTool = {
1253
1253
  Each memory has a weight (significance 0-1) and trust level (access control 0-1).
1254
1254
  Location and context are automatically captured from the request.
1255
1255
 
1256
+ **IMPORTANT - Content vs Summary**:
1257
+ - **content**: MUST be EXACT user-provided text. DO NOT paraphrase or modify.
1258
+ - **summary**: Use for AI-generated summaries or interpretations.
1259
+ - Example: User says "Remember: Meeting at 3pm tomorrow"
1260
+ \u2192 content: "Meeting at 3pm tomorrow" (EXACT)
1261
+ \u2192 summary: "User has meeting on 2026-02-17 at 15:00" (AI interpretation)
1262
+
1256
1263
  Examples:
1257
1264
  - "Remember that I met Sarah at the conference"
1258
1265
  - "Save this recipe for chocolate chip cookies"
@@ -3290,7 +3297,18 @@ var ConfirmationTokenService = class {
3290
3297
  status: "pending"
3291
3298
  };
3292
3299
  const collectionPath = `users/${userId}/requests`;
3300
+ console.log("[ConfirmationTokenService] Creating request:", {
3301
+ userId,
3302
+ action,
3303
+ targetCollection,
3304
+ collectionPath
3305
+ });
3293
3306
  const docRef = await addDocument(collectionPath, request);
3307
+ console.log("[ConfirmationTokenService] Request created:", {
3308
+ requestId: docRef.id,
3309
+ token,
3310
+ expiresAt: request.expires_at
3311
+ });
3294
3312
  return { requestId: docRef.id, token };
3295
3313
  }
3296
3314
  /**
@@ -3302,6 +3320,11 @@ var ConfirmationTokenService = class {
3302
3320
  */
3303
3321
  async validateToken(userId, token) {
3304
3322
  const collectionPath = `users/${userId}/requests`;
3323
+ console.log("[ConfirmationTokenService] Validating token:", {
3324
+ userId,
3325
+ token,
3326
+ collectionPath
3327
+ });
3305
3328
  const queryOptions = {
3306
3329
  where: [
3307
3330
  { field: "token", op: "==", value: token },
@@ -3310,13 +3333,25 @@ var ConfirmationTokenService = class {
3310
3333
  limit: 1
3311
3334
  };
3312
3335
  const results = await queryDocuments(collectionPath, queryOptions);
3336
+ console.log("[ConfirmationTokenService] Query results:", {
3337
+ resultsFound: results.length,
3338
+ hasResults: results.length > 0
3339
+ });
3313
3340
  if (results.length === 0) {
3341
+ console.log("[ConfirmationTokenService] Token not found or not pending");
3314
3342
  return null;
3315
3343
  }
3316
3344
  const doc = results[0];
3317
3345
  const request = doc.data;
3346
+ console.log("[ConfirmationTokenService] Request found:", {
3347
+ requestId: doc.id,
3348
+ action: request.action,
3349
+ status: request.status,
3350
+ expiresAt: request.expires_at
3351
+ });
3318
3352
  const expiresAt = new Date(request.expires_at);
3319
3353
  if (expiresAt.getTime() < Date.now()) {
3354
+ console.log("[ConfirmationTokenService] Token expired");
3320
3355
  await this.updateStatus(userId, doc.id, "expired");
3321
3356
  return null;
3322
3357
  }
@@ -3615,7 +3650,14 @@ var publishTool = {
3615
3650
  };
3616
3651
  async function handlePublish(args, userId) {
3617
3652
  try {
3653
+ console.log("[remember_publish] Starting publish request:", {
3654
+ userId,
3655
+ memoryId: args.memory_id,
3656
+ target: args.target,
3657
+ additionalTags: args.additional_tags?.length || 0
3658
+ });
3618
3659
  if (!isValidSpaceId(args.target)) {
3660
+ console.log("[remember_publish] Invalid space ID:", args.target);
3619
3661
  return JSON.stringify(
3620
3662
  {
3621
3663
  success: false,
@@ -3631,11 +3673,16 @@ async function handlePublish(args, userId) {
3631
3673
  );
3632
3674
  }
3633
3675
  const weaviateClient = getWeaviateClient();
3634
- const userCollection = weaviateClient.collections.get(
3635
- getMemoryCollectionName(userId)
3636
- );
3676
+ const collectionName = getMemoryCollectionName(userId);
3677
+ console.log("[remember_publish] Fetching memory from collection:", collectionName);
3678
+ const userCollection = weaviateClient.collections.get(collectionName);
3637
3679
  const memory = await userCollection.query.fetchObjectById(args.memory_id);
3680
+ console.log("[remember_publish] Memory fetch result:", {
3681
+ found: !!memory,
3682
+ memoryId: args.memory_id
3683
+ });
3638
3684
  if (!memory) {
3685
+ console.log("[remember_publish] Memory not found");
3639
3686
  return JSON.stringify(
3640
3687
  {
3641
3688
  success: false,
@@ -3685,12 +3732,18 @@ async function handlePublish(args, userId) {
3685
3732
  memory_id: args.memory_id,
3686
3733
  additional_tags: args.additional_tags || []
3687
3734
  };
3735
+ console.log("[remember_publish] Generating confirmation token");
3688
3736
  const { requestId, token } = await confirmationTokenService.createRequest(
3689
3737
  userId,
3690
3738
  "publish_memory",
3691
3739
  payload,
3692
3740
  args.target
3693
3741
  );
3742
+ console.log("[remember_publish] Token generated:", {
3743
+ requestId,
3744
+ token,
3745
+ action: "publish_memory"
3746
+ });
3694
3747
  return JSON.stringify(
3695
3748
  {
3696
3749
  success: true,
@@ -3727,8 +3780,17 @@ var confirmTool = {
3727
3780
  };
3728
3781
  async function handleConfirm(args, userId) {
3729
3782
  try {
3783
+ console.log("[remember_confirm] Starting confirmation:", {
3784
+ userId,
3785
+ token: args.token
3786
+ });
3730
3787
  const request = await confirmationTokenService.confirmRequest(userId, args.token);
3788
+ console.log("[remember_confirm] Token validation result:", {
3789
+ requestFound: !!request,
3790
+ action: request?.action
3791
+ });
3731
3792
  if (!request) {
3793
+ console.log("[remember_confirm] Token invalid or expired");
3732
3794
  return JSON.stringify(
3733
3795
  {
3734
3796
  success: false,
@@ -3739,6 +3801,7 @@ async function handleConfirm(args, userId) {
3739
3801
  2
3740
3802
  );
3741
3803
  }
3804
+ console.log("[remember_confirm] Executing action:", request.action);
3742
3805
  if (request.action === "publish_memory") {
3743
3806
  return await executePublishMemory(request, userId);
3744
3807
  }
@@ -3754,14 +3817,25 @@ async function handleConfirm(args, userId) {
3754
3817
  }
3755
3818
  async function executePublishMemory(request, userId) {
3756
3819
  try {
3820
+ console.log("[executePublishMemory] Starting execution:", {
3821
+ userId,
3822
+ memoryId: request.payload.memory_id,
3823
+ targetSpace: request.target_collection
3824
+ });
3757
3825
  const weaviateClient = getWeaviateClient();
3758
3826
  const userCollection = weaviateClient.collections.get(
3759
3827
  getMemoryCollectionName(userId)
3760
3828
  );
3829
+ console.log("[executePublishMemory] Fetching original memory from:", getMemoryCollectionName(userId));
3761
3830
  const originalMemory = await userCollection.query.fetchObjectById(
3762
3831
  request.payload.memory_id
3763
3832
  );
3833
+ console.log("[executePublishMemory] Original memory fetch result:", {
3834
+ found: !!originalMemory,
3835
+ memoryId: request.payload.memory_id
3836
+ });
3764
3837
  if (!originalMemory) {
3838
+ console.log("[executePublishMemory] Memory not found");
3765
3839
  return JSON.stringify(
3766
3840
  {
3767
3841
  success: false,
@@ -3773,6 +3847,7 @@ async function executePublishMemory(request, userId) {
3773
3847
  );
3774
3848
  }
3775
3849
  if (originalMemory.properties.user_id !== userId) {
3850
+ console.log("[executePublishMemory] Permission denied - wrong owner");
3776
3851
  return JSON.stringify(
3777
3852
  {
3778
3853
  success: false,
@@ -3783,18 +3858,20 @@ async function executePublishMemory(request, userId) {
3783
3858
  2
3784
3859
  );
3785
3860
  }
3861
+ console.log("[executePublishMemory] Ensuring space collection:", request.target_collection || "the_void");
3786
3862
  const targetCollection = await ensureSpaceCollection(
3787
3863
  weaviateClient,
3788
3864
  request.target_collection || "the_void"
3789
3865
  );
3866
+ console.log("[executePublishMemory] Space collection ready");
3790
3867
  const originalTags = Array.isArray(originalMemory.properties.tags) ? originalMemory.properties.tags : [];
3791
3868
  const additionalTags = Array.isArray(request.payload.additional_tags) ? request.payload.additional_tags : [];
3792
3869
  const publishedMemory = {
3793
3870
  ...originalMemory.properties,
3794
- // Override specific fields
3871
+ // Add space-specific fields
3795
3872
  space_id: request.target_collection || "the_void",
3796
3873
  author_id: userId,
3797
- // Always attributed
3874
+ // Track original author
3798
3875
  published_at: (/* @__PURE__ */ new Date()).toISOString(),
3799
3876
  discovery_count: 0,
3800
3877
  doc_type: "space_memory",
@@ -3806,8 +3883,17 @@ async function executePublishMemory(request, userId) {
3806
3883
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
3807
3884
  version: 1
3808
3885
  };
3809
- const result = await targetCollection.data.insert({
3810
- properties: publishedMemory
3886
+ console.log("[executePublishMemory] Inserting into space collection:", {
3887
+ spaceId: request.target_collection || "the_void",
3888
+ memoryId: request.payload.memory_id,
3889
+ hasUserId: !!publishedMemory.user_id,
3890
+ hasAuthorId: !!publishedMemory.author_id,
3891
+ hasSpaceId: !!publishedMemory.space_id
3892
+ });
3893
+ const result = await targetCollection.data.insert(publishedMemory);
3894
+ console.log("[executePublishMemory] Insert result:", {
3895
+ success: !!result,
3896
+ spaceMemoryId: result
3811
3897
  });
3812
3898
  return JSON.stringify(
3813
3899
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prmichaelsen/remember-mcp",
3
- "version": "2.3.0",
3
+ "version": "2.3.4",
4
4
  "description": "Multi-tenant memory system MCP server with vector search and relationships",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
@@ -68,7 +68,20 @@ export class ConfirmationTokenService {
68
68
 
69
69
  // Add document to Firestore (auto-generates ID)
70
70
  const collectionPath = `users/${userId}/requests`;
71
+ console.log('[ConfirmationTokenService] Creating request:', {
72
+ userId,
73
+ action,
74
+ targetCollection,
75
+ collectionPath,
76
+ });
77
+
71
78
  const docRef = await addDocument(collectionPath, request);
79
+
80
+ console.log('[ConfirmationTokenService] Request created:', {
81
+ requestId: docRef.id,
82
+ token,
83
+ expiresAt: request.expires_at,
84
+ });
72
85
 
73
86
  return { requestId: docRef.id, token };
74
87
  }
@@ -85,6 +98,12 @@ export class ConfirmationTokenService {
85
98
  token: string
86
99
  ): Promise<(ConfirmationRequest & { request_id: string }) | null> {
87
100
  const collectionPath = `users/${userId}/requests`;
101
+
102
+ console.log('[ConfirmationTokenService] Validating token:', {
103
+ userId,
104
+ token,
105
+ collectionPath,
106
+ });
88
107
 
89
108
  // Query for the token
90
109
  const queryOptions: QueryOptions = {
@@ -96,17 +115,31 @@ export class ConfirmationTokenService {
96
115
  };
97
116
 
98
117
  const results = await queryDocuments(collectionPath, queryOptions);
118
+
119
+ console.log('[ConfirmationTokenService] Query results:', {
120
+ resultsFound: results.length,
121
+ hasResults: results.length > 0,
122
+ });
99
123
 
100
124
  if (results.length === 0) {
125
+ console.log('[ConfirmationTokenService] Token not found or not pending');
101
126
  return null;
102
127
  }
103
128
 
104
129
  const doc = results[0];
105
130
  const request = doc.data as ConfirmationRequest;
131
+
132
+ console.log('[ConfirmationTokenService] Request found:', {
133
+ requestId: doc.id,
134
+ action: request.action,
135
+ status: request.status,
136
+ expiresAt: request.expires_at,
137
+ });
106
138
 
107
139
  // Check expiry
108
140
  const expiresAt = new Date(request.expires_at);
109
141
  if (expiresAt.getTime() < Date.now()) {
142
+ console.log('[ConfirmationTokenService] Token expired');
110
143
  await this.updateStatus(userId, doc.id, 'expired');
111
144
  return null;
112
145
  }
@@ -41,10 +41,21 @@ export async function handleConfirm(
41
41
  userId: string
42
42
  ): Promise<string> {
43
43
  try {
44
+ console.log('[remember_confirm] Starting confirmation:', {
45
+ userId,
46
+ token: args.token,
47
+ });
48
+
44
49
  // Validate and confirm token
45
50
  const request = await confirmationTokenService.confirmRequest(userId, args.token);
51
+
52
+ console.log('[remember_confirm] Token validation result:', {
53
+ requestFound: !!request,
54
+ action: request?.action,
55
+ });
46
56
 
47
57
  if (!request) {
58
+ console.log('[remember_confirm] Token invalid or expired');
48
59
  return JSON.stringify(
49
60
  {
50
61
  success: false,
@@ -56,6 +67,8 @@ export async function handleConfirm(
56
67
  );
57
68
  }
58
69
 
70
+ console.log('[remember_confirm] Executing action:', request.action);
71
+
59
72
  // GENERIC: Execute action based on type
60
73
  // This is where the generic pattern delegates to action-specific executors
61
74
  if (request.action === 'publish_memory') {
@@ -86,17 +99,31 @@ async function executePublishMemory(
86
99
  userId: string
87
100
  ): Promise<string> {
88
101
  try {
102
+ console.log('[executePublishMemory] Starting execution:', {
103
+ userId,
104
+ memoryId: request.payload.memory_id,
105
+ targetSpace: request.target_collection,
106
+ });
107
+
89
108
  // Fetch the memory NOW (during confirmation, not from stored payload)
90
109
  const weaviateClient = getWeaviateClient();
91
110
  const userCollection = weaviateClient.collections.get(
92
111
  getMemoryCollectionName(userId)
93
112
  );
113
+
114
+ console.log('[executePublishMemory] Fetching original memory from:', getMemoryCollectionName(userId));
94
115
 
95
116
  const originalMemory = await userCollection.query.fetchObjectById(
96
117
  request.payload.memory_id
97
118
  );
119
+
120
+ console.log('[executePublishMemory] Original memory fetch result:', {
121
+ found: !!originalMemory,
122
+ memoryId: request.payload.memory_id,
123
+ });
98
124
 
99
125
  if (!originalMemory) {
126
+ console.log('[executePublishMemory] Memory not found');
100
127
  return JSON.stringify(
101
128
  {
102
129
  success: false,
@@ -110,6 +137,7 @@ async function executePublishMemory(
110
137
 
111
138
  // Verify ownership again
112
139
  if (originalMemory.properties.user_id !== userId) {
140
+ console.log('[executePublishMemory] Permission denied - wrong owner');
113
141
  return JSON.stringify(
114
142
  {
115
143
  success: false,
@@ -120,12 +148,16 @@ async function executePublishMemory(
120
148
  2
121
149
  );
122
150
  }
151
+
152
+ console.log('[executePublishMemory] Ensuring space collection:', request.target_collection || 'the_void');
123
153
 
124
154
  // Get target collection
125
155
  const targetCollection = await ensureSpaceCollection(
126
156
  weaviateClient,
127
157
  request.target_collection || 'the_void'
128
158
  );
159
+
160
+ console.log('[executePublishMemory] Space collection ready');
129
161
 
130
162
  // Create published memory (copy with modifications)
131
163
  const originalTags = Array.isArray(originalMemory.properties.tags)
@@ -135,11 +167,12 @@ async function executePublishMemory(
135
167
  ? request.payload.additional_tags
136
168
  : [];
137
169
 
170
+ // Create published memory with space-specific fields
138
171
  const publishedMemory = {
139
172
  ...originalMemory.properties,
140
- // Override specific fields
173
+ // Add space-specific fields
141
174
  space_id: request.target_collection || 'the_void',
142
- author_id: userId, // Always attributed
175
+ author_id: userId, // Track original author
143
176
  published_at: new Date().toISOString(),
144
177
  discovery_count: 0,
145
178
  doc_type: 'space_memory',
@@ -152,8 +185,20 @@ async function executePublishMemory(
152
185
  version: 1,
153
186
  };
154
187
 
155
- const result = await targetCollection.data.insert({
156
- properties: publishedMemory as any,
188
+ console.log('[executePublishMemory] Inserting into space collection:', {
189
+ spaceId: request.target_collection || 'the_void',
190
+ memoryId: request.payload.memory_id,
191
+ hasUserId: !!(publishedMemory as any).user_id,
192
+ hasAuthorId: !!publishedMemory.author_id,
193
+ hasSpaceId: !!publishedMemory.space_id,
194
+ });
195
+
196
+ // Insert directly - publishedMemory is already the properties object
197
+ const result = await targetCollection.data.insert(publishedMemory as any);
198
+
199
+ console.log('[executePublishMemory] Insert result:', {
200
+ success: !!result,
201
+ spaceMemoryId: result,
157
202
  });
158
203
 
159
204
  // Return minimal response - agent already knows original memory
@@ -20,6 +20,13 @@ export const createMemoryTool = {
20
20
  Each memory has a weight (significance 0-1) and trust level (access control 0-1).
21
21
  Location and context are automatically captured from the request.
22
22
 
23
+ **IMPORTANT - Content vs Summary**:
24
+ - **content**: MUST be EXACT user-provided text. DO NOT paraphrase or modify.
25
+ - **summary**: Use for AI-generated summaries or interpretations.
26
+ - Example: User says "Remember: Meeting at 3pm tomorrow"
27
+ → content: "Meeting at 3pm tomorrow" (EXACT)
28
+ → summary: "User has meeting on 2026-02-17 at 15:00" (AI interpretation)
29
+
23
30
  Examples:
24
31
  - "Remember that I met Sarah at the conference"
25
32
  - "Save this recipe for chocolate chip cookies"
@@ -56,8 +56,16 @@ export async function handlePublish(
56
56
  userId: string
57
57
  ): Promise<string> {
58
58
  try {
59
+ console.log('[remember_publish] Starting publish request:', {
60
+ userId,
61
+ memoryId: args.memory_id,
62
+ target: args.target,
63
+ additionalTags: args.additional_tags?.length || 0,
64
+ });
65
+
59
66
  // Validate space ID
60
67
  if (!isValidSpaceId(args.target)) {
68
+ console.log('[remember_publish] Invalid space ID:', args.target);
61
69
  return JSON.stringify(
62
70
  {
63
71
  success: false,
@@ -75,13 +83,20 @@ export async function handlePublish(
75
83
 
76
84
  // Verify memory exists and user owns it
77
85
  const weaviateClient = getWeaviateClient();
78
- const userCollection = weaviateClient.collections.get(
79
- getMemoryCollectionName(userId)
80
- );
86
+ const collectionName = getMemoryCollectionName(userId);
87
+ console.log('[remember_publish] Fetching memory from collection:', collectionName);
88
+
89
+ const userCollection = weaviateClient.collections.get(collectionName);
81
90
 
82
91
  const memory = await userCollection.query.fetchObjectById(args.memory_id);
92
+
93
+ console.log('[remember_publish] Memory fetch result:', {
94
+ found: !!memory,
95
+ memoryId: args.memory_id,
96
+ });
83
97
 
84
98
  if (!memory) {
99
+ console.log('[remember_publish] Memory not found');
85
100
  return JSON.stringify(
86
101
  {
87
102
  success: false,
@@ -138,6 +153,8 @@ export async function handlePublish(
138
153
  additional_tags: args.additional_tags || [],
139
154
  };
140
155
 
156
+ console.log('[remember_publish] Generating confirmation token');
157
+
141
158
  // Generate confirmation token
142
159
  const { requestId, token } = await confirmationTokenService.createRequest(
143
160
  userId,
@@ -145,6 +162,12 @@ export async function handlePublish(
145
162
  payload,
146
163
  args.target
147
164
  );
165
+
166
+ console.log('[remember_publish] Token generated:', {
167
+ requestId,
168
+ token,
169
+ action: 'publish_memory',
170
+ });
148
171
 
149
172
  // Return minimal response - agent already knows memory details
150
173
  return JSON.stringify(