@prmichaelsen/remember-mcp 3.20.1 → 4.0.1

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 (46) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/agent/milestones/milestone-23-trust-level-protection.md +122 -0
  3. package/agent/progress.yaml +96 -3
  4. package/agent/tasks/milestone-23-trust-level-protection/task-525-remove-trust-from-create-update.md +69 -0
  5. package/agent/tasks/milestone-23-trust-level-protection/task-526-add-request-set-trust-level-tool.md +108 -0
  6. package/agent/tasks/milestone-23-trust-level-protection/task-527-update-confirm-deny-secret-token.md +60 -0
  7. package/agent/tasks/milestone-23-trust-level-protection/task-528-update-trust-scale-references.md +73 -0
  8. package/agent/tasks/milestone-23-trust-level-protection/task-529-version-bump-and-release.md +87 -0
  9. package/dist/server-factory.js +151 -47
  10. package/dist/server.js +150 -42
  11. package/dist/services/trust-validator.d.ts +16 -14
  12. package/dist/tools/confirm.d.ts +1 -0
  13. package/dist/tools/confirm.spec.d.ts +5 -0
  14. package/dist/tools/create-internal-memory.d.ts +0 -7
  15. package/dist/tools/create-memory.d.ts +0 -7
  16. package/dist/tools/deny.d.ts +1 -0
  17. package/dist/tools/deny.spec.d.ts +5 -0
  18. package/dist/tools/query-memory.d.ts +2 -0
  19. package/dist/tools/request-set-trust-level.d.ts +32 -0
  20. package/dist/tools/request-set-trust-level.spec.d.ts +2 -0
  21. package/dist/tools/search-memory.d.ts +2 -0
  22. package/dist/tools/update-internal-memory.d.ts +0 -6
  23. package/dist/tools/update-memory.d.ts +0 -7
  24. package/package.json +2 -2
  25. package/src/server-factory.ts +6 -0
  26. package/src/server.ts +6 -0
  27. package/src/services/trust-validator.spec.ts +57 -51
  28. package/src/services/trust-validator.ts +28 -26
  29. package/src/tools/confirm.spec.ts +108 -0
  30. package/src/tools/confirm.ts +24 -1
  31. package/src/tools/create-internal-memory.ts +0 -3
  32. package/src/tools/create-memory.spec.ts +6 -2
  33. package/src/tools/create-memory.ts +1 -9
  34. package/src/tools/deny.spec.ts +59 -0
  35. package/src/tools/deny.ts +6 -1
  36. package/src/tools/ghost-config.ts +19 -19
  37. package/src/tools/publish.ts +2 -0
  38. package/src/tools/query-memory.ts +4 -2
  39. package/src/tools/request-set-trust-level.spec.ts +87 -0
  40. package/src/tools/request-set-trust-level.ts +109 -0
  41. package/src/tools/retract.ts +2 -0
  42. package/src/tools/revise.ts +2 -0
  43. package/src/tools/search-memory.ts +4 -2
  44. package/src/tools/update-internal-memory.ts +0 -3
  45. package/src/tools/update-memory.ts +0 -8
  46. package/src/types/memory.ts +1 -1
@@ -957,7 +957,7 @@ var createMemoryTool = {
957
957
  description: `Create a new memory with optional template.
958
958
 
959
959
  Memories can store any type of information: notes, events, people, recipes, etc.
960
- Each memory has a weight (significance 0-1) and trust level (access control 0-1).
960
+ Each memory has a weight (significance 0-1). Trust defaults to SECRET (level 5) and can be changed via remember_request_set_trust_level.
961
961
  Location and context are automatically captured from the request.
962
962
 
963
963
  **IMPORTANT - Content vs Summary**:
@@ -994,12 +994,6 @@ var createMemoryTool = {
994
994
  minimum: 0,
995
995
  maximum: 1
996
996
  },
997
- trust: {
998
- type: "number",
999
- description: "Access control level (0-1, default: 0.25)",
1000
- minimum: 0,
1001
- maximum: 1
1002
- },
1003
997
  tags: {
1004
998
  type: "array",
1005
999
  items: { type: "string" },
@@ -1095,7 +1089,6 @@ async function handleCreateMemory(args, userId, authContext, context) {
1095
1089
  title: args.title,
1096
1090
  type: args.type,
1097
1091
  weight: args.weight,
1098
- trust: args.trust,
1099
1092
  tags: args.tags,
1100
1093
  references: args.references,
1101
1094
  template_id: args.template_id,
@@ -1216,8 +1209,10 @@ var searchMemoryTool = {
1216
1209
  description: "Minimum weight (0-1)"
1217
1210
  },
1218
1211
  trust_min: {
1219
- type: "number",
1220
- description: "Minimum trust level (0-1)"
1212
+ type: "integer",
1213
+ description: "Minimum trust level (1-5: 1=PUBLIC, 2=INTERNAL, 3=CONFIDENTIAL, 4=RESTRICTED, 5=SECRET)",
1214
+ minimum: 1,
1215
+ maximum: 5
1221
1216
  },
1222
1217
  date_from: {
1223
1218
  type: "string",
@@ -1452,12 +1447,6 @@ var updateMemoryTool = {
1452
1447
  minimum: 0,
1453
1448
  maximum: 1
1454
1449
  },
1455
- trust: {
1456
- type: "number",
1457
- description: "Updated access control level (0-1)",
1458
- minimum: 0,
1459
- maximum: 1
1460
- },
1461
1450
  tags: {
1462
1451
  type: "array",
1463
1452
  items: { type: "string" },
@@ -1548,7 +1537,6 @@ async function handleUpdateMemory(args, userId, authContext) {
1548
1537
  title: args.title,
1549
1538
  type: args.type,
1550
1539
  weight: args.weight,
1551
- trust: args.trust,
1552
1540
  tags: args.tags,
1553
1541
  references: args.references,
1554
1542
  parent_id: args.parent_id,
@@ -1752,8 +1740,10 @@ var queryMemoryTool = {
1752
1740
  description: "Minimum weight (0-1)"
1753
1741
  },
1754
1742
  trust_min: {
1755
- type: "number",
1756
- description: "Minimum trust level (0-1)"
1743
+ type: "integer",
1744
+ description: "Minimum trust level (1-5: 1=PUBLIC, 2=INTERNAL, 3=CONFIDENTIAL, 4=RESTRICTED, 5=SECRET)",
1745
+ minimum: 1,
1746
+ maximum: 5
1757
1747
  },
1758
1748
  date_from: {
1759
1749
  type: "string",
@@ -2562,7 +2552,9 @@ async function handlePublish(args, userId, authContext) {
2562
2552
  return JSON.stringify(
2563
2553
  {
2564
2554
  success: true,
2565
- token: result.token
2555
+ token: result.token,
2556
+ request_id: result.request_id,
2557
+ created_at: result.created_at
2566
2558
  },
2567
2559
  null,
2568
2560
  2
@@ -2638,6 +2630,8 @@ async function handleRetract(args, userId, authContext) {
2638
2630
  {
2639
2631
  success: true,
2640
2632
  token: result.token,
2633
+ request_id: result.request_id,
2634
+ created_at: result.created_at,
2641
2635
  action: "retract_memory",
2642
2636
  memory_id: args.memory_id,
2643
2637
  confirmation_required: true
@@ -2707,6 +2701,8 @@ async function handleRevise(args, userId, authContext) {
2707
2701
  {
2708
2702
  success: true,
2709
2703
  token: result.token,
2704
+ request_id: result.request_id,
2705
+ created_at: result.created_at,
2710
2706
  action: "revise_memory",
2711
2707
  memory_id: args.memory_id,
2712
2708
  confirmation_required: true
@@ -2748,6 +2744,10 @@ Violating these requirements bypasses user consent and is a security violation.`
2748
2744
  token: {
2749
2745
  type: "string",
2750
2746
  description: "The confirmation token from the action tool"
2747
+ },
2748
+ secret_token: {
2749
+ type: "string",
2750
+ description: "HMAC secret token for guard-protected operations. Only required when confirmation guard is enabled on the server."
2751
2751
  }
2752
2752
  },
2753
2753
  required: ["token"]
@@ -2810,7 +2810,23 @@ async function handleConfirm(args, userId, authContext) {
2810
2810
  2
2811
2811
  );
2812
2812
  }
2813
- const result = await space.confirm({ token: args.token });
2813
+ if (request.action === "set_trust_level") {
2814
+ const { memory } = createCoreServices(userId);
2815
+ const result2 = await memory.confirmSetTrustLevel(args.token);
2816
+ return JSON.stringify(
2817
+ {
2818
+ success: true,
2819
+ memory_id: result2.memory_id,
2820
+ previous_trust_level: result2.previous_trust_level,
2821
+ new_trust_level: result2.new_trust_level,
2822
+ updated_at: result2.updated_at,
2823
+ message: `Trust level changed from ${result2.previous_trust_level} to ${result2.new_trust_level}`
2824
+ },
2825
+ null,
2826
+ 2
2827
+ );
2828
+ }
2829
+ const result = await space.confirm({ token: args.token, secret_token: args.secret_token });
2814
2830
  if (result.action === "retract_memory") {
2815
2831
  return JSON.stringify(
2816
2832
  {
@@ -2895,6 +2911,10 @@ This ensures proper user consent workflow is followed.`,
2895
2911
  token: {
2896
2912
  type: "string",
2897
2913
  description: "The confirmation token from the action tool"
2914
+ },
2915
+ secret_token: {
2916
+ type: "string",
2917
+ description: "HMAC secret token for guard-protected operations. Only required when confirmation guard is enabled on the server."
2898
2918
  }
2899
2919
  },
2900
2920
  required: ["token"]
@@ -2906,7 +2926,7 @@ async function handleDeny(args, userId, authContext) {
2906
2926
  debug.info("Tool invoked");
2907
2927
  debug.trace("Arguments", { args });
2908
2928
  const { space } = createCoreServices(userId);
2909
- const result = await space.deny({ token: args.token });
2929
+ const result = await space.deny({ token: args.token, secret_token: args.secret_token });
2910
2930
  return JSON.stringify(
2911
2931
  {
2912
2932
  success: result.success
@@ -3485,17 +3505,17 @@ var ghostConfigTool = {
3485
3505
  Actions:
3486
3506
  - get: View current ghost configuration
3487
3507
  - set: Update ghost settings (enabled, trust defaults, enforcement mode)
3488
- - set_trust: Set a per-user trust level override (0-1)
3508
+ - set_trust: Set a per-user trust level override (1-5 integer)
3489
3509
  - remove_trust: Remove a per-user trust override (revert to default)
3490
3510
  - block: Block a user from ghost access entirely
3491
3511
  - unblock: Unblock a previously blocked user
3492
3512
 
3493
- Trust levels control what information your ghost can share:
3494
- - 0.0: Existence only ("A memory exists about this")
3495
- - 0.25: Metadata only (tags, type, dates \u2014 no content)
3496
- - 0.5: Summary only (AI-generated summary, no raw content)
3497
- - 0.75: Partial access (content with sensitive fields redacted)
3498
- - 1.0: Full access (all content revealed)
3513
+ Trust levels (1-5 integer scale) control what information your ghost can share:
3514
+ - 1 (PUBLIC): Full access (all content revealed)
3515
+ - 2 (INTERNAL): Partial access (content with sensitive fields redacted)
3516
+ - 3 (CONFIDENTIAL): Summary only (AI-generated summary, no raw content)
3517
+ - 4 (RESTRICTED): Metadata only (tags, type, dates \u2014 no content)
3518
+ - 5 (SECRET): Existence only ("A memory exists about this")
3499
3519
 
3500
3520
  Ghost is disabled by default. Enable it to allow others to chat with your AI representation.`,
3501
3521
  inputSchema: {
@@ -3516,16 +3536,16 @@ Ghost is disabled by default. Enable it to allow others to chat with your AI rep
3516
3536
  description: 'Allow non-friends to chat with ghost (for "set" action)'
3517
3537
  },
3518
3538
  default_friend_trust: {
3519
- type: "number",
3520
- description: 'Default trust level for friends (0-1, for "set" action)',
3521
- minimum: 0,
3522
- maximum: 1
3539
+ type: "integer",
3540
+ description: 'Default trust level for friends (1-5 integer, for "set" action)',
3541
+ minimum: 1,
3542
+ maximum: 5
3523
3543
  },
3524
3544
  default_public_trust: {
3525
- type: "number",
3526
- description: 'Default trust level for strangers (0-1, for "set" action)',
3527
- minimum: 0,
3528
- maximum: 1
3545
+ type: "integer",
3546
+ description: 'Default trust level for strangers (1-5 integer, for "set" action)',
3547
+ minimum: 1,
3548
+ maximum: 5
3529
3549
  },
3530
3550
  enforcement_mode: {
3531
3551
  type: "string",
@@ -3538,10 +3558,10 @@ Ghost is disabled by default. Enable it to allow others to chat with your AI rep
3538
3558
  description: "Target user ID (for set_trust, remove_trust, block, unblock)"
3539
3559
  },
3540
3560
  trust_level: {
3541
- type: "number",
3542
- description: 'Trust level to assign (0-1, for "set_trust" action)',
3543
- minimum: 0,
3544
- maximum: 1
3561
+ type: "integer",
3562
+ description: 'Trust level to assign (1-5 integer, for "set_trust" action)',
3563
+ minimum: 1,
3564
+ maximum: 5
3545
3565
  }
3546
3566
  },
3547
3567
  required: ["action"]
@@ -3653,6 +3673,90 @@ async function handleGhostConfig(args, userId, authContext) {
3653
3673
  }
3654
3674
  }
3655
3675
 
3676
+ // src/tools/request-set-trust-level.ts
3677
+ var requestSetTrustLevelTool = {
3678
+ name: "remember_request_set_trust_level",
3679
+ description: `Request a trust level change for a memory. Returns a confirmation token.
3680
+
3681
+ Trust levels (1-5 integer scale):
3682
+ 1 = PUBLIC \u2014 anyone can see
3683
+ 2 = INTERNAL \u2014 friends/known users
3684
+ 3 = CONFIDENTIAL \u2014 trusted friends
3685
+ 4 = RESTRICTED \u2014 close/intimate contacts
3686
+ 5 = SECRET \u2014 owner only (default for new memories)
3687
+
3688
+ After requesting, use remember_confirm with the returned token to apply the change.
3689
+ Lowering trust (e.g. 5\u21921) makes the memory MORE visible. Raising trust makes it LESS visible.
3690
+
3691
+ This is the ONLY way to change a memory's trust level. Trust cannot be set during creation or update.`,
3692
+ inputSchema: {
3693
+ type: "object",
3694
+ properties: {
3695
+ memory_id: {
3696
+ type: "string",
3697
+ description: "ID of the memory to change trust level for"
3698
+ },
3699
+ trust_level: {
3700
+ type: "integer",
3701
+ description: "New trust level (1-5)",
3702
+ minimum: 1,
3703
+ maximum: 5
3704
+ }
3705
+ },
3706
+ required: ["memory_id", "trust_level"]
3707
+ }
3708
+ };
3709
+ async function handleRequestSetTrustLevel(args, userId, authContext) {
3710
+ const debug = createDebugLogger({
3711
+ tool: "remember_request_set_trust_level",
3712
+ userId,
3713
+ operation: "request set trust level"
3714
+ });
3715
+ try {
3716
+ debug.info("Tool invoked");
3717
+ debug.trace("Arguments", { args });
3718
+ if (!Number.isInteger(args.trust_level) || args.trust_level < 1 || args.trust_level > 5) {
3719
+ return JSON.stringify({
3720
+ error: "Invalid trust level",
3721
+ message: "Trust level must be an integer from 1 (PUBLIC) to 5 (SECRET)."
3722
+ }, null, 2);
3723
+ }
3724
+ const { memory } = createCoreServices(userId);
3725
+ const result = await memory.requestSetTrustLevel({
3726
+ memory_id: args.memory_id,
3727
+ trust_level: args.trust_level
3728
+ });
3729
+ const TRUST_NAMES = {
3730
+ 1: "PUBLIC",
3731
+ 2: "INTERNAL",
3732
+ 3: "CONFIDENTIAL",
3733
+ 4: "RESTRICTED",
3734
+ 5: "SECRET"
3735
+ };
3736
+ return JSON.stringify({
3737
+ token: result.token,
3738
+ request_id: result.request_id,
3739
+ created_at: result.created_at,
3740
+ memory_id: result.memory_id,
3741
+ current_trust_level: result.current_trust_level,
3742
+ requested_trust_level: result.requested_trust_level,
3743
+ current_trust_name: TRUST_NAMES[result.current_trust_level] || "UNKNOWN",
3744
+ requested_trust_name: TRUST_NAMES[result.requested_trust_level] || "UNKNOWN",
3745
+ expires_at: result.expires_at,
3746
+ message: `Trust level change requested: ${TRUST_NAMES[result.current_trust_level] || result.current_trust_level} (${result.current_trust_level}) \u2192 ${TRUST_NAMES[result.requested_trust_level] || result.requested_trust_level} (${result.requested_trust_level}). Confirm with token to apply.`
3747
+ }, null, 2);
3748
+ } catch (error) {
3749
+ debug.error("Tool failed", { error: error instanceof Error ? error.message : String(error) });
3750
+ handleToolError(error, {
3751
+ toolName: "remember_request_set_trust_level",
3752
+ operation: "request set trust level",
3753
+ userId,
3754
+ memoryId: args.memory_id
3755
+ });
3756
+ return JSON.stringify({ error: "Unexpected error" });
3757
+ }
3758
+ }
3759
+
3656
3760
  // src/tools/search-by.ts
3657
3761
  var searchByTool = {
3658
3762
  name: "remember_search_by",
@@ -3945,7 +4049,6 @@ var createInternalMemoryTool = {
3945
4049
  title: { type: "string", description: "Optional title" },
3946
4050
  tags: { type: "array", items: { type: "string" }, description: "Additional tags (internal tags added automatically)" },
3947
4051
  weight: { type: "number", minimum: 0, maximum: 1, description: "Significance (0-1)" },
3948
- trust: { type: "number", minimum: 0, maximum: 1, description: "Trust level (0-1)" },
3949
4052
  feel_salience: { type: "number", minimum: 0, maximum: 1 },
3950
4053
  feel_social_weight: { type: "number", minimum: 0, maximum: 1 },
3951
4054
  feel_narrative_importance: { type: "number", minimum: 0, maximum: 1 }
@@ -3976,7 +4079,6 @@ async function handleCreateInternalMemory(args, userId, authContext) {
3976
4079
  title: args.title,
3977
4080
  type: ctx.type,
3978
4081
  weight: args.weight,
3979
- trust: args.trust,
3980
4082
  tags: mergedTags,
3981
4083
  context_summary: `Internal memory created via MCP (${ctx.type})`,
3982
4084
  ...feelFields
@@ -4010,8 +4112,7 @@ var updateInternalMemoryTool = {
4010
4112
  content: { type: "string" },
4011
4113
  title: { type: "string" },
4012
4114
  tags: { type: "array", items: { type: "string" } },
4013
- weight: { type: "number", minimum: 0, maximum: 1 },
4014
- trust: { type: "number", minimum: 0, maximum: 1 }
4115
+ weight: { type: "number", minimum: 0, maximum: 1 }
4015
4116
  },
4016
4117
  required: ["memory_id"]
4017
4118
  }
@@ -4041,8 +4142,7 @@ async function handleUpdateInternalMemory(args, userId, authContext) {
4041
4142
  content: args.content,
4042
4143
  title: args.title,
4043
4144
  tags: args.tags,
4044
- weight: args.weight,
4045
- trust: args.trust
4145
+ weight: args.weight
4046
4146
  });
4047
4147
  return JSON.stringify({
4048
4148
  memory_id: result.memory_id,
@@ -5186,6 +5286,7 @@ function registerHandlers(server, userId, accessToken, internalContext) {
5186
5286
  querySpaceTool,
5187
5287
  moderateTool,
5188
5288
  ghostConfigTool,
5289
+ requestSetTrustLevelTool,
5189
5290
  // Search modes
5190
5291
  searchByTool,
5191
5292
  // Unified internal memory tools
@@ -5274,6 +5375,9 @@ function registerHandlers(server, userId, accessToken, internalContext) {
5274
5375
  case "remember_ghost_config":
5275
5376
  result = await handleGhostConfig(args, userId, authContext);
5276
5377
  break;
5378
+ case "remember_request_set_trust_level":
5379
+ result = await handleRequestSetTrustLevel(args, userId, authContext);
5380
+ break;
5277
5381
  case "remember_search_by":
5278
5382
  result = await handleSearchBy(args, userId, authContext);
5279
5383
  break;