@prmichaelsen/remember-mcp 3.20.1 → 4.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.
- package/CHANGELOG.md +19 -0
- package/agent/milestones/milestone-23-trust-level-protection.md +122 -0
- package/agent/progress.yaml +96 -3
- package/agent/tasks/milestone-23-trust-level-protection/task-525-remove-trust-from-create-update.md +69 -0
- package/agent/tasks/milestone-23-trust-level-protection/task-526-add-request-set-trust-level-tool.md +108 -0
- package/agent/tasks/milestone-23-trust-level-protection/task-527-update-confirm-deny-secret-token.md +60 -0
- package/agent/tasks/milestone-23-trust-level-protection/task-528-update-trust-scale-references.md +73 -0
- package/agent/tasks/milestone-23-trust-level-protection/task-529-version-bump-and-release.md +87 -0
- package/dist/server-factory.js +142 -46
- package/dist/server.js +141 -41
- package/dist/services/trust-validator.d.ts +16 -14
- package/dist/tools/confirm.d.ts +1 -0
- package/dist/tools/confirm.spec.d.ts +5 -0
- package/dist/tools/create-internal-memory.d.ts +0 -7
- package/dist/tools/create-memory.d.ts +0 -7
- package/dist/tools/deny.d.ts +1 -0
- package/dist/tools/deny.spec.d.ts +5 -0
- package/dist/tools/query-memory.d.ts +2 -0
- package/dist/tools/request-set-trust-level.d.ts +32 -0
- package/dist/tools/request-set-trust-level.spec.d.ts +2 -0
- package/dist/tools/search-memory.d.ts +2 -0
- package/dist/tools/update-internal-memory.d.ts +0 -6
- package/dist/tools/update-memory.d.ts +0 -7
- package/package.json +2 -2
- package/src/server-factory.ts +6 -0
- package/src/server.ts +6 -0
- package/src/services/trust-validator.spec.ts +57 -51
- package/src/services/trust-validator.ts +28 -26
- package/src/tools/confirm.spec.ts +108 -0
- package/src/tools/confirm.ts +24 -1
- package/src/tools/create-internal-memory.ts +0 -3
- package/src/tools/create-memory.spec.ts +6 -2
- package/src/tools/create-memory.ts +1 -9
- package/src/tools/deny.spec.ts +59 -0
- package/src/tools/deny.ts +6 -1
- package/src/tools/ghost-config.ts +19 -19
- package/src/tools/query-memory.ts +4 -2
- package/src/tools/request-set-trust-level.spec.ts +87 -0
- package/src/tools/request-set-trust-level.ts +107 -0
- package/src/tools/search-memory.ts +4 -2
- package/src/tools/update-internal-memory.ts +0 -3
- package/src/tools/update-memory.ts +0 -8
- package/src/types/memory.ts +1 -1
package/dist/server-factory.js
CHANGED
|
@@ -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)
|
|
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: "
|
|
1220
|
-
description: "Minimum trust level (
|
|
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: "
|
|
1756
|
-
description: "Minimum trust level (
|
|
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",
|
|
@@ -2748,6 +2738,10 @@ Violating these requirements bypasses user consent and is a security violation.`
|
|
|
2748
2738
|
token: {
|
|
2749
2739
|
type: "string",
|
|
2750
2740
|
description: "The confirmation token from the action tool"
|
|
2741
|
+
},
|
|
2742
|
+
secret_token: {
|
|
2743
|
+
type: "string",
|
|
2744
|
+
description: "HMAC secret token for guard-protected operations. Only required when confirmation guard is enabled on the server."
|
|
2751
2745
|
}
|
|
2752
2746
|
},
|
|
2753
2747
|
required: ["token"]
|
|
@@ -2810,7 +2804,23 @@ async function handleConfirm(args, userId, authContext) {
|
|
|
2810
2804
|
2
|
|
2811
2805
|
);
|
|
2812
2806
|
}
|
|
2813
|
-
|
|
2807
|
+
if (request.action === "set_trust_level") {
|
|
2808
|
+
const { memory } = createCoreServices(userId);
|
|
2809
|
+
const result2 = await memory.confirmSetTrustLevel(args.token);
|
|
2810
|
+
return JSON.stringify(
|
|
2811
|
+
{
|
|
2812
|
+
success: true,
|
|
2813
|
+
memory_id: result2.memory_id,
|
|
2814
|
+
previous_trust_level: result2.previous_trust_level,
|
|
2815
|
+
new_trust_level: result2.new_trust_level,
|
|
2816
|
+
updated_at: result2.updated_at,
|
|
2817
|
+
message: `Trust level changed from ${result2.previous_trust_level} to ${result2.new_trust_level}`
|
|
2818
|
+
},
|
|
2819
|
+
null,
|
|
2820
|
+
2
|
|
2821
|
+
);
|
|
2822
|
+
}
|
|
2823
|
+
const result = await space.confirm({ token: args.token, secret_token: args.secret_token });
|
|
2814
2824
|
if (result.action === "retract_memory") {
|
|
2815
2825
|
return JSON.stringify(
|
|
2816
2826
|
{
|
|
@@ -2895,6 +2905,10 @@ This ensures proper user consent workflow is followed.`,
|
|
|
2895
2905
|
token: {
|
|
2896
2906
|
type: "string",
|
|
2897
2907
|
description: "The confirmation token from the action tool"
|
|
2908
|
+
},
|
|
2909
|
+
secret_token: {
|
|
2910
|
+
type: "string",
|
|
2911
|
+
description: "HMAC secret token for guard-protected operations. Only required when confirmation guard is enabled on the server."
|
|
2898
2912
|
}
|
|
2899
2913
|
},
|
|
2900
2914
|
required: ["token"]
|
|
@@ -2906,7 +2920,7 @@ async function handleDeny(args, userId, authContext) {
|
|
|
2906
2920
|
debug.info("Tool invoked");
|
|
2907
2921
|
debug.trace("Arguments", { args });
|
|
2908
2922
|
const { space } = createCoreServices(userId);
|
|
2909
|
-
const result = await space.deny({ token: args.token });
|
|
2923
|
+
const result = await space.deny({ token: args.token, secret_token: args.secret_token });
|
|
2910
2924
|
return JSON.stringify(
|
|
2911
2925
|
{
|
|
2912
2926
|
success: result.success
|
|
@@ -3485,17 +3499,17 @@ var ghostConfigTool = {
|
|
|
3485
3499
|
Actions:
|
|
3486
3500
|
- get: View current ghost configuration
|
|
3487
3501
|
- set: Update ghost settings (enabled, trust defaults, enforcement mode)
|
|
3488
|
-
- set_trust: Set a per-user trust level override (
|
|
3502
|
+
- set_trust: Set a per-user trust level override (1-5 integer)
|
|
3489
3503
|
- remove_trust: Remove a per-user trust override (revert to default)
|
|
3490
3504
|
- block: Block a user from ghost access entirely
|
|
3491
3505
|
- unblock: Unblock a previously blocked user
|
|
3492
3506
|
|
|
3493
|
-
Trust levels control what information your ghost can share:
|
|
3494
|
-
-
|
|
3495
|
-
-
|
|
3496
|
-
-
|
|
3497
|
-
-
|
|
3498
|
-
-
|
|
3507
|
+
Trust levels (1-5 integer scale) control what information your ghost can share:
|
|
3508
|
+
- 1 (PUBLIC): Full access (all content revealed)
|
|
3509
|
+
- 2 (INTERNAL): Partial access (content with sensitive fields redacted)
|
|
3510
|
+
- 3 (CONFIDENTIAL): Summary only (AI-generated summary, no raw content)
|
|
3511
|
+
- 4 (RESTRICTED): Metadata only (tags, type, dates \u2014 no content)
|
|
3512
|
+
- 5 (SECRET): Existence only ("A memory exists about this")
|
|
3499
3513
|
|
|
3500
3514
|
Ghost is disabled by default. Enable it to allow others to chat with your AI representation.`,
|
|
3501
3515
|
inputSchema: {
|
|
@@ -3516,16 +3530,16 @@ Ghost is disabled by default. Enable it to allow others to chat with your AI rep
|
|
|
3516
3530
|
description: 'Allow non-friends to chat with ghost (for "set" action)'
|
|
3517
3531
|
},
|
|
3518
3532
|
default_friend_trust: {
|
|
3519
|
-
type: "
|
|
3520
|
-
description: 'Default trust level for friends (
|
|
3521
|
-
minimum:
|
|
3522
|
-
maximum:
|
|
3533
|
+
type: "integer",
|
|
3534
|
+
description: 'Default trust level for friends (1-5 integer, for "set" action)',
|
|
3535
|
+
minimum: 1,
|
|
3536
|
+
maximum: 5
|
|
3523
3537
|
},
|
|
3524
3538
|
default_public_trust: {
|
|
3525
|
-
type: "
|
|
3526
|
-
description: 'Default trust level for strangers (
|
|
3527
|
-
minimum:
|
|
3528
|
-
maximum:
|
|
3539
|
+
type: "integer",
|
|
3540
|
+
description: 'Default trust level for strangers (1-5 integer, for "set" action)',
|
|
3541
|
+
minimum: 1,
|
|
3542
|
+
maximum: 5
|
|
3529
3543
|
},
|
|
3530
3544
|
enforcement_mode: {
|
|
3531
3545
|
type: "string",
|
|
@@ -3538,10 +3552,10 @@ Ghost is disabled by default. Enable it to allow others to chat with your AI rep
|
|
|
3538
3552
|
description: "Target user ID (for set_trust, remove_trust, block, unblock)"
|
|
3539
3553
|
},
|
|
3540
3554
|
trust_level: {
|
|
3541
|
-
type: "
|
|
3542
|
-
description: 'Trust level to assign (
|
|
3543
|
-
minimum:
|
|
3544
|
-
maximum:
|
|
3555
|
+
type: "integer",
|
|
3556
|
+
description: 'Trust level to assign (1-5 integer, for "set_trust" action)',
|
|
3557
|
+
minimum: 1,
|
|
3558
|
+
maximum: 5
|
|
3545
3559
|
}
|
|
3546
3560
|
},
|
|
3547
3561
|
required: ["action"]
|
|
@@ -3653,6 +3667,88 @@ async function handleGhostConfig(args, userId, authContext) {
|
|
|
3653
3667
|
}
|
|
3654
3668
|
}
|
|
3655
3669
|
|
|
3670
|
+
// src/tools/request-set-trust-level.ts
|
|
3671
|
+
var requestSetTrustLevelTool = {
|
|
3672
|
+
name: "remember_request_set_trust_level",
|
|
3673
|
+
description: `Request a trust level change for a memory. Returns a confirmation token.
|
|
3674
|
+
|
|
3675
|
+
Trust levels (1-5 integer scale):
|
|
3676
|
+
1 = PUBLIC \u2014 anyone can see
|
|
3677
|
+
2 = INTERNAL \u2014 friends/known users
|
|
3678
|
+
3 = CONFIDENTIAL \u2014 trusted friends
|
|
3679
|
+
4 = RESTRICTED \u2014 close/intimate contacts
|
|
3680
|
+
5 = SECRET \u2014 owner only (default for new memories)
|
|
3681
|
+
|
|
3682
|
+
After requesting, use remember_confirm with the returned token to apply the change.
|
|
3683
|
+
Lowering trust (e.g. 5\u21921) makes the memory MORE visible. Raising trust makes it LESS visible.
|
|
3684
|
+
|
|
3685
|
+
This is the ONLY way to change a memory's trust level. Trust cannot be set during creation or update.`,
|
|
3686
|
+
inputSchema: {
|
|
3687
|
+
type: "object",
|
|
3688
|
+
properties: {
|
|
3689
|
+
memory_id: {
|
|
3690
|
+
type: "string",
|
|
3691
|
+
description: "ID of the memory to change trust level for"
|
|
3692
|
+
},
|
|
3693
|
+
trust_level: {
|
|
3694
|
+
type: "integer",
|
|
3695
|
+
description: "New trust level (1-5)",
|
|
3696
|
+
minimum: 1,
|
|
3697
|
+
maximum: 5
|
|
3698
|
+
}
|
|
3699
|
+
},
|
|
3700
|
+
required: ["memory_id", "trust_level"]
|
|
3701
|
+
}
|
|
3702
|
+
};
|
|
3703
|
+
async function handleRequestSetTrustLevel(args, userId, authContext) {
|
|
3704
|
+
const debug = createDebugLogger({
|
|
3705
|
+
tool: "remember_request_set_trust_level",
|
|
3706
|
+
userId,
|
|
3707
|
+
operation: "request set trust level"
|
|
3708
|
+
});
|
|
3709
|
+
try {
|
|
3710
|
+
debug.info("Tool invoked");
|
|
3711
|
+
debug.trace("Arguments", { args });
|
|
3712
|
+
if (!Number.isInteger(args.trust_level) || args.trust_level < 1 || args.trust_level > 5) {
|
|
3713
|
+
return JSON.stringify({
|
|
3714
|
+
error: "Invalid trust level",
|
|
3715
|
+
message: "Trust level must be an integer from 1 (PUBLIC) to 5 (SECRET)."
|
|
3716
|
+
}, null, 2);
|
|
3717
|
+
}
|
|
3718
|
+
const { memory } = createCoreServices(userId);
|
|
3719
|
+
const result = await memory.requestSetTrustLevel({
|
|
3720
|
+
memory_id: args.memory_id,
|
|
3721
|
+
trust_level: args.trust_level
|
|
3722
|
+
});
|
|
3723
|
+
const TRUST_NAMES = {
|
|
3724
|
+
1: "PUBLIC",
|
|
3725
|
+
2: "INTERNAL",
|
|
3726
|
+
3: "CONFIDENTIAL",
|
|
3727
|
+
4: "RESTRICTED",
|
|
3728
|
+
5: "SECRET"
|
|
3729
|
+
};
|
|
3730
|
+
return JSON.stringify({
|
|
3731
|
+
token: result.token,
|
|
3732
|
+
memory_id: result.memory_id,
|
|
3733
|
+
current_trust_level: result.current_trust_level,
|
|
3734
|
+
requested_trust_level: result.requested_trust_level,
|
|
3735
|
+
current_trust_name: TRUST_NAMES[result.current_trust_level] || "UNKNOWN",
|
|
3736
|
+
requested_trust_name: TRUST_NAMES[result.requested_trust_level] || "UNKNOWN",
|
|
3737
|
+
expires_at: result.expires_at,
|
|
3738
|
+
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.`
|
|
3739
|
+
}, null, 2);
|
|
3740
|
+
} catch (error) {
|
|
3741
|
+
debug.error("Tool failed", { error: error instanceof Error ? error.message : String(error) });
|
|
3742
|
+
handleToolError(error, {
|
|
3743
|
+
toolName: "remember_request_set_trust_level",
|
|
3744
|
+
operation: "request set trust level",
|
|
3745
|
+
userId,
|
|
3746
|
+
memoryId: args.memory_id
|
|
3747
|
+
});
|
|
3748
|
+
return JSON.stringify({ error: "Unexpected error" });
|
|
3749
|
+
}
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3656
3752
|
// src/tools/search-by.ts
|
|
3657
3753
|
var searchByTool = {
|
|
3658
3754
|
name: "remember_search_by",
|
|
@@ -3945,7 +4041,6 @@ var createInternalMemoryTool = {
|
|
|
3945
4041
|
title: { type: "string", description: "Optional title" },
|
|
3946
4042
|
tags: { type: "array", items: { type: "string" }, description: "Additional tags (internal tags added automatically)" },
|
|
3947
4043
|
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
4044
|
feel_salience: { type: "number", minimum: 0, maximum: 1 },
|
|
3950
4045
|
feel_social_weight: { type: "number", minimum: 0, maximum: 1 },
|
|
3951
4046
|
feel_narrative_importance: { type: "number", minimum: 0, maximum: 1 }
|
|
@@ -3976,7 +4071,6 @@ async function handleCreateInternalMemory(args, userId, authContext) {
|
|
|
3976
4071
|
title: args.title,
|
|
3977
4072
|
type: ctx.type,
|
|
3978
4073
|
weight: args.weight,
|
|
3979
|
-
trust: args.trust,
|
|
3980
4074
|
tags: mergedTags,
|
|
3981
4075
|
context_summary: `Internal memory created via MCP (${ctx.type})`,
|
|
3982
4076
|
...feelFields
|
|
@@ -4010,8 +4104,7 @@ var updateInternalMemoryTool = {
|
|
|
4010
4104
|
content: { type: "string" },
|
|
4011
4105
|
title: { type: "string" },
|
|
4012
4106
|
tags: { type: "array", items: { type: "string" } },
|
|
4013
|
-
weight: { type: "number", minimum: 0, maximum: 1 }
|
|
4014
|
-
trust: { type: "number", minimum: 0, maximum: 1 }
|
|
4107
|
+
weight: { type: "number", minimum: 0, maximum: 1 }
|
|
4015
4108
|
},
|
|
4016
4109
|
required: ["memory_id"]
|
|
4017
4110
|
}
|
|
@@ -4041,8 +4134,7 @@ async function handleUpdateInternalMemory(args, userId, authContext) {
|
|
|
4041
4134
|
content: args.content,
|
|
4042
4135
|
title: args.title,
|
|
4043
4136
|
tags: args.tags,
|
|
4044
|
-
weight: args.weight
|
|
4045
|
-
trust: args.trust
|
|
4137
|
+
weight: args.weight
|
|
4046
4138
|
});
|
|
4047
4139
|
return JSON.stringify({
|
|
4048
4140
|
memory_id: result.memory_id,
|
|
@@ -5186,6 +5278,7 @@ function registerHandlers(server, userId, accessToken, internalContext) {
|
|
|
5186
5278
|
querySpaceTool,
|
|
5187
5279
|
moderateTool,
|
|
5188
5280
|
ghostConfigTool,
|
|
5281
|
+
requestSetTrustLevelTool,
|
|
5189
5282
|
// Search modes
|
|
5190
5283
|
searchByTool,
|
|
5191
5284
|
// Unified internal memory tools
|
|
@@ -5274,6 +5367,9 @@ function registerHandlers(server, userId, accessToken, internalContext) {
|
|
|
5274
5367
|
case "remember_ghost_config":
|
|
5275
5368
|
result = await handleGhostConfig(args, userId, authContext);
|
|
5276
5369
|
break;
|
|
5370
|
+
case "remember_request_set_trust_level":
|
|
5371
|
+
result = await handleRequestSetTrustLevel(args, userId, authContext);
|
|
5372
|
+
break;
|
|
5277
5373
|
case "remember_search_by":
|
|
5278
5374
|
result = await handleSearchBy(args, userId, authContext);
|
|
5279
5375
|
break;
|
package/dist/server.js
CHANGED
|
@@ -945,7 +945,7 @@ var createMemoryTool = {
|
|
|
945
945
|
description: `Create a new memory with optional template.
|
|
946
946
|
|
|
947
947
|
Memories can store any type of information: notes, events, people, recipes, etc.
|
|
948
|
-
Each memory has a weight (significance 0-1)
|
|
948
|
+
Each memory has a weight (significance 0-1). Trust defaults to SECRET (level 5) and can be changed via remember_request_set_trust_level.
|
|
949
949
|
Location and context are automatically captured from the request.
|
|
950
950
|
|
|
951
951
|
**IMPORTANT - Content vs Summary**:
|
|
@@ -982,12 +982,6 @@ var createMemoryTool = {
|
|
|
982
982
|
minimum: 0,
|
|
983
983
|
maximum: 1
|
|
984
984
|
},
|
|
985
|
-
trust: {
|
|
986
|
-
type: "number",
|
|
987
|
-
description: "Access control level (0-1, default: 0.25)",
|
|
988
|
-
minimum: 0,
|
|
989
|
-
maximum: 1
|
|
990
|
-
},
|
|
991
985
|
tags: {
|
|
992
986
|
type: "array",
|
|
993
987
|
items: { type: "string" },
|
|
@@ -1083,7 +1077,6 @@ async function handleCreateMemory(args, userId, authContext, context) {
|
|
|
1083
1077
|
title: args.title,
|
|
1084
1078
|
type: args.type,
|
|
1085
1079
|
weight: args.weight,
|
|
1086
|
-
trust: args.trust,
|
|
1087
1080
|
tags: args.tags,
|
|
1088
1081
|
references: args.references,
|
|
1089
1082
|
template_id: args.template_id,
|
|
@@ -1204,8 +1197,10 @@ var searchMemoryTool = {
|
|
|
1204
1197
|
description: "Minimum weight (0-1)"
|
|
1205
1198
|
},
|
|
1206
1199
|
trust_min: {
|
|
1207
|
-
type: "
|
|
1208
|
-
description: "Minimum trust level (
|
|
1200
|
+
type: "integer",
|
|
1201
|
+
description: "Minimum trust level (1-5: 1=PUBLIC, 2=INTERNAL, 3=CONFIDENTIAL, 4=RESTRICTED, 5=SECRET)",
|
|
1202
|
+
minimum: 1,
|
|
1203
|
+
maximum: 5
|
|
1209
1204
|
},
|
|
1210
1205
|
date_from: {
|
|
1211
1206
|
type: "string",
|
|
@@ -1440,12 +1435,6 @@ var updateMemoryTool = {
|
|
|
1440
1435
|
minimum: 0,
|
|
1441
1436
|
maximum: 1
|
|
1442
1437
|
},
|
|
1443
|
-
trust: {
|
|
1444
|
-
type: "number",
|
|
1445
|
-
description: "Updated access control level (0-1)",
|
|
1446
|
-
minimum: 0,
|
|
1447
|
-
maximum: 1
|
|
1448
|
-
},
|
|
1449
1438
|
tags: {
|
|
1450
1439
|
type: "array",
|
|
1451
1440
|
items: { type: "string" },
|
|
@@ -1536,7 +1525,6 @@ async function handleUpdateMemory(args, userId, authContext) {
|
|
|
1536
1525
|
title: args.title,
|
|
1537
1526
|
type: args.type,
|
|
1538
1527
|
weight: args.weight,
|
|
1539
|
-
trust: args.trust,
|
|
1540
1528
|
tags: args.tags,
|
|
1541
1529
|
references: args.references,
|
|
1542
1530
|
parent_id: args.parent_id,
|
|
@@ -1740,8 +1728,10 @@ var queryMemoryTool = {
|
|
|
1740
1728
|
description: "Minimum weight (0-1)"
|
|
1741
1729
|
},
|
|
1742
1730
|
trust_min: {
|
|
1743
|
-
type: "
|
|
1744
|
-
description: "Minimum trust level (
|
|
1731
|
+
type: "integer",
|
|
1732
|
+
description: "Minimum trust level (1-5: 1=PUBLIC, 2=INTERNAL, 3=CONFIDENTIAL, 4=RESTRICTED, 5=SECRET)",
|
|
1733
|
+
minimum: 1,
|
|
1734
|
+
maximum: 5
|
|
1745
1735
|
},
|
|
1746
1736
|
date_from: {
|
|
1747
1737
|
type: "string",
|
|
@@ -2736,6 +2726,10 @@ Violating these requirements bypasses user consent and is a security violation.`
|
|
|
2736
2726
|
token: {
|
|
2737
2727
|
type: "string",
|
|
2738
2728
|
description: "The confirmation token from the action tool"
|
|
2729
|
+
},
|
|
2730
|
+
secret_token: {
|
|
2731
|
+
type: "string",
|
|
2732
|
+
description: "HMAC secret token for guard-protected operations. Only required when confirmation guard is enabled on the server."
|
|
2739
2733
|
}
|
|
2740
2734
|
},
|
|
2741
2735
|
required: ["token"]
|
|
@@ -2798,7 +2792,23 @@ async function handleConfirm(args, userId, authContext) {
|
|
|
2798
2792
|
2
|
|
2799
2793
|
);
|
|
2800
2794
|
}
|
|
2801
|
-
|
|
2795
|
+
if (request.action === "set_trust_level") {
|
|
2796
|
+
const { memory } = createCoreServices(userId);
|
|
2797
|
+
const result2 = await memory.confirmSetTrustLevel(args.token);
|
|
2798
|
+
return JSON.stringify(
|
|
2799
|
+
{
|
|
2800
|
+
success: true,
|
|
2801
|
+
memory_id: result2.memory_id,
|
|
2802
|
+
previous_trust_level: result2.previous_trust_level,
|
|
2803
|
+
new_trust_level: result2.new_trust_level,
|
|
2804
|
+
updated_at: result2.updated_at,
|
|
2805
|
+
message: `Trust level changed from ${result2.previous_trust_level} to ${result2.new_trust_level}`
|
|
2806
|
+
},
|
|
2807
|
+
null,
|
|
2808
|
+
2
|
|
2809
|
+
);
|
|
2810
|
+
}
|
|
2811
|
+
const result = await space.confirm({ token: args.token, secret_token: args.secret_token });
|
|
2802
2812
|
if (result.action === "retract_memory") {
|
|
2803
2813
|
return JSON.stringify(
|
|
2804
2814
|
{
|
|
@@ -2883,6 +2893,10 @@ This ensures proper user consent workflow is followed.`,
|
|
|
2883
2893
|
token: {
|
|
2884
2894
|
type: "string",
|
|
2885
2895
|
description: "The confirmation token from the action tool"
|
|
2896
|
+
},
|
|
2897
|
+
secret_token: {
|
|
2898
|
+
type: "string",
|
|
2899
|
+
description: "HMAC secret token for guard-protected operations. Only required when confirmation guard is enabled on the server."
|
|
2886
2900
|
}
|
|
2887
2901
|
},
|
|
2888
2902
|
required: ["token"]
|
|
@@ -2894,7 +2908,7 @@ async function handleDeny(args, userId, authContext) {
|
|
|
2894
2908
|
debug.info("Tool invoked");
|
|
2895
2909
|
debug.trace("Arguments", { args });
|
|
2896
2910
|
const { space } = createCoreServices(userId);
|
|
2897
|
-
const result = await space.deny({ token: args.token });
|
|
2911
|
+
const result = await space.deny({ token: args.token, secret_token: args.secret_token });
|
|
2898
2912
|
return JSON.stringify(
|
|
2899
2913
|
{
|
|
2900
2914
|
success: result.success
|
|
@@ -3470,17 +3484,17 @@ var ghostConfigTool = {
|
|
|
3470
3484
|
Actions:
|
|
3471
3485
|
- get: View current ghost configuration
|
|
3472
3486
|
- set: Update ghost settings (enabled, trust defaults, enforcement mode)
|
|
3473
|
-
- set_trust: Set a per-user trust level override (
|
|
3487
|
+
- set_trust: Set a per-user trust level override (1-5 integer)
|
|
3474
3488
|
- remove_trust: Remove a per-user trust override (revert to default)
|
|
3475
3489
|
- block: Block a user from ghost access entirely
|
|
3476
3490
|
- unblock: Unblock a previously blocked user
|
|
3477
3491
|
|
|
3478
|
-
Trust levels control what information your ghost can share:
|
|
3479
|
-
-
|
|
3480
|
-
-
|
|
3481
|
-
-
|
|
3482
|
-
-
|
|
3483
|
-
-
|
|
3492
|
+
Trust levels (1-5 integer scale) control what information your ghost can share:
|
|
3493
|
+
- 1 (PUBLIC): Full access (all content revealed)
|
|
3494
|
+
- 2 (INTERNAL): Partial access (content with sensitive fields redacted)
|
|
3495
|
+
- 3 (CONFIDENTIAL): Summary only (AI-generated summary, no raw content)
|
|
3496
|
+
- 4 (RESTRICTED): Metadata only (tags, type, dates \u2014 no content)
|
|
3497
|
+
- 5 (SECRET): Existence only ("A memory exists about this")
|
|
3484
3498
|
|
|
3485
3499
|
Ghost is disabled by default. Enable it to allow others to chat with your AI representation.`,
|
|
3486
3500
|
inputSchema: {
|
|
@@ -3501,16 +3515,16 @@ Ghost is disabled by default. Enable it to allow others to chat with your AI rep
|
|
|
3501
3515
|
description: 'Allow non-friends to chat with ghost (for "set" action)'
|
|
3502
3516
|
},
|
|
3503
3517
|
default_friend_trust: {
|
|
3504
|
-
type: "
|
|
3505
|
-
description: 'Default trust level for friends (
|
|
3506
|
-
minimum:
|
|
3507
|
-
maximum:
|
|
3518
|
+
type: "integer",
|
|
3519
|
+
description: 'Default trust level for friends (1-5 integer, for "set" action)',
|
|
3520
|
+
minimum: 1,
|
|
3521
|
+
maximum: 5
|
|
3508
3522
|
},
|
|
3509
3523
|
default_public_trust: {
|
|
3510
|
-
type: "
|
|
3511
|
-
description: 'Default trust level for strangers (
|
|
3512
|
-
minimum:
|
|
3513
|
-
maximum:
|
|
3524
|
+
type: "integer",
|
|
3525
|
+
description: 'Default trust level for strangers (1-5 integer, for "set" action)',
|
|
3526
|
+
minimum: 1,
|
|
3527
|
+
maximum: 5
|
|
3514
3528
|
},
|
|
3515
3529
|
enforcement_mode: {
|
|
3516
3530
|
type: "string",
|
|
@@ -3523,10 +3537,10 @@ Ghost is disabled by default. Enable it to allow others to chat with your AI rep
|
|
|
3523
3537
|
description: "Target user ID (for set_trust, remove_trust, block, unblock)"
|
|
3524
3538
|
},
|
|
3525
3539
|
trust_level: {
|
|
3526
|
-
type: "
|
|
3527
|
-
description: 'Trust level to assign (
|
|
3528
|
-
minimum:
|
|
3529
|
-
maximum:
|
|
3540
|
+
type: "integer",
|
|
3541
|
+
description: 'Trust level to assign (1-5 integer, for "set_trust" action)',
|
|
3542
|
+
minimum: 1,
|
|
3543
|
+
maximum: 5
|
|
3530
3544
|
}
|
|
3531
3545
|
},
|
|
3532
3546
|
required: ["action"]
|
|
@@ -3638,6 +3652,88 @@ async function handleGhostConfig(args, userId, authContext) {
|
|
|
3638
3652
|
}
|
|
3639
3653
|
}
|
|
3640
3654
|
|
|
3655
|
+
// src/tools/request-set-trust-level.ts
|
|
3656
|
+
var requestSetTrustLevelTool = {
|
|
3657
|
+
name: "remember_request_set_trust_level",
|
|
3658
|
+
description: `Request a trust level change for a memory. Returns a confirmation token.
|
|
3659
|
+
|
|
3660
|
+
Trust levels (1-5 integer scale):
|
|
3661
|
+
1 = PUBLIC \u2014 anyone can see
|
|
3662
|
+
2 = INTERNAL \u2014 friends/known users
|
|
3663
|
+
3 = CONFIDENTIAL \u2014 trusted friends
|
|
3664
|
+
4 = RESTRICTED \u2014 close/intimate contacts
|
|
3665
|
+
5 = SECRET \u2014 owner only (default for new memories)
|
|
3666
|
+
|
|
3667
|
+
After requesting, use remember_confirm with the returned token to apply the change.
|
|
3668
|
+
Lowering trust (e.g. 5\u21921) makes the memory MORE visible. Raising trust makes it LESS visible.
|
|
3669
|
+
|
|
3670
|
+
This is the ONLY way to change a memory's trust level. Trust cannot be set during creation or update.`,
|
|
3671
|
+
inputSchema: {
|
|
3672
|
+
type: "object",
|
|
3673
|
+
properties: {
|
|
3674
|
+
memory_id: {
|
|
3675
|
+
type: "string",
|
|
3676
|
+
description: "ID of the memory to change trust level for"
|
|
3677
|
+
},
|
|
3678
|
+
trust_level: {
|
|
3679
|
+
type: "integer",
|
|
3680
|
+
description: "New trust level (1-5)",
|
|
3681
|
+
minimum: 1,
|
|
3682
|
+
maximum: 5
|
|
3683
|
+
}
|
|
3684
|
+
},
|
|
3685
|
+
required: ["memory_id", "trust_level"]
|
|
3686
|
+
}
|
|
3687
|
+
};
|
|
3688
|
+
async function handleRequestSetTrustLevel(args, userId, authContext) {
|
|
3689
|
+
const debug = createDebugLogger({
|
|
3690
|
+
tool: "remember_request_set_trust_level",
|
|
3691
|
+
userId,
|
|
3692
|
+
operation: "request set trust level"
|
|
3693
|
+
});
|
|
3694
|
+
try {
|
|
3695
|
+
debug.info("Tool invoked");
|
|
3696
|
+
debug.trace("Arguments", { args });
|
|
3697
|
+
if (!Number.isInteger(args.trust_level) || args.trust_level < 1 || args.trust_level > 5) {
|
|
3698
|
+
return JSON.stringify({
|
|
3699
|
+
error: "Invalid trust level",
|
|
3700
|
+
message: "Trust level must be an integer from 1 (PUBLIC) to 5 (SECRET)."
|
|
3701
|
+
}, null, 2);
|
|
3702
|
+
}
|
|
3703
|
+
const { memory } = createCoreServices(userId);
|
|
3704
|
+
const result = await memory.requestSetTrustLevel({
|
|
3705
|
+
memory_id: args.memory_id,
|
|
3706
|
+
trust_level: args.trust_level
|
|
3707
|
+
});
|
|
3708
|
+
const TRUST_NAMES = {
|
|
3709
|
+
1: "PUBLIC",
|
|
3710
|
+
2: "INTERNAL",
|
|
3711
|
+
3: "CONFIDENTIAL",
|
|
3712
|
+
4: "RESTRICTED",
|
|
3713
|
+
5: "SECRET"
|
|
3714
|
+
};
|
|
3715
|
+
return JSON.stringify({
|
|
3716
|
+
token: result.token,
|
|
3717
|
+
memory_id: result.memory_id,
|
|
3718
|
+
current_trust_level: result.current_trust_level,
|
|
3719
|
+
requested_trust_level: result.requested_trust_level,
|
|
3720
|
+
current_trust_name: TRUST_NAMES[result.current_trust_level] || "UNKNOWN",
|
|
3721
|
+
requested_trust_name: TRUST_NAMES[result.requested_trust_level] || "UNKNOWN",
|
|
3722
|
+
expires_at: result.expires_at,
|
|
3723
|
+
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.`
|
|
3724
|
+
}, null, 2);
|
|
3725
|
+
} catch (error) {
|
|
3726
|
+
debug.error("Tool failed", { error: error instanceof Error ? error.message : String(error) });
|
|
3727
|
+
handleToolError(error, {
|
|
3728
|
+
toolName: "remember_request_set_trust_level",
|
|
3729
|
+
operation: "request set trust level",
|
|
3730
|
+
userId,
|
|
3731
|
+
memoryId: args.memory_id
|
|
3732
|
+
});
|
|
3733
|
+
return JSON.stringify({ error: "Unexpected error" });
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3641
3737
|
// src/server.ts
|
|
3642
3738
|
async function initServer() {
|
|
3643
3739
|
logger.info("Initializing remember-mcp server...");
|
|
@@ -3696,7 +3792,8 @@ function registerHandlers(server) {
|
|
|
3696
3792
|
searchSpaceTool,
|
|
3697
3793
|
querySpaceTool,
|
|
3698
3794
|
moderateTool,
|
|
3699
|
-
ghostConfigTool
|
|
3795
|
+
ghostConfigTool,
|
|
3796
|
+
requestSetTrustLevelTool
|
|
3700
3797
|
]
|
|
3701
3798
|
};
|
|
3702
3799
|
});
|
|
@@ -3770,6 +3867,9 @@ function registerHandlers(server) {
|
|
|
3770
3867
|
case "remember_ghost_config":
|
|
3771
3868
|
result = await handleGhostConfig(args, userId, authContext);
|
|
3772
3869
|
break;
|
|
3870
|
+
case "remember_request_set_trust_level":
|
|
3871
|
+
result = await handleRequestSetTrustLevel(args, userId, authContext);
|
|
3872
|
+
break;
|
|
3773
3873
|
default:
|
|
3774
3874
|
throw new McpError(
|
|
3775
3875
|
ErrorCode.MethodNotFound,
|