@prmichaelsen/remember-mcp 0.1.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/.env.example +65 -0
- package/AGENT.md +840 -0
- package/README.md +72 -0
- package/agent/design/.gitkeep +0 -0
- package/agent/design/access-control-result-pattern.md +458 -0
- package/agent/design/action-audit-memory-types.md +637 -0
- package/agent/design/common-template-fields.md +282 -0
- package/agent/design/complete-tool-set.md +407 -0
- package/agent/design/content-types-expansion.md +521 -0
- package/agent/design/cross-database-id-strategy.md +358 -0
- package/agent/design/default-template-library.md +423 -0
- package/agent/design/firestore-wrapper-analysis.md +606 -0
- package/agent/design/llm-provider-abstraction.md +691 -0
- package/agent/design/location-handling-architecture.md +523 -0
- package/agent/design/memory-templates-design.md +364 -0
- package/agent/design/permissions-storage-architecture.md +680 -0
- package/agent/design/relationship-storage-strategy.md +361 -0
- package/agent/design/remember-mcp-implementation-tasks.md +417 -0
- package/agent/design/remember-mcp-progress.yaml +141 -0
- package/agent/design/requirements-enhancements.md +468 -0
- package/agent/design/requirements.md +56 -0
- package/agent/design/template-storage-strategy.md +412 -0
- package/agent/design/template-suggestion-system.md +853 -0
- package/agent/design/trust-escalation-prevention.md +343 -0
- package/agent/design/trust-system-implementation.md +592 -0
- package/agent/design/user-preferences.md +683 -0
- package/agent/design/weaviate-collection-strategy.md +461 -0
- package/agent/milestones/.gitkeep +0 -0
- package/agent/milestones/milestone-1-project-foundation.md +121 -0
- package/agent/milestones/milestone-2-core-memory-system.md +150 -0
- package/agent/milestones/milestone-3-relationships-graph.md +116 -0
- package/agent/milestones/milestone-4-user-preferences.md +103 -0
- package/agent/milestones/milestone-5-template-system.md +126 -0
- package/agent/milestones/milestone-6-auth-multi-tenancy.md +124 -0
- package/agent/milestones/milestone-7-trust-permissions.md +133 -0
- package/agent/milestones/milestone-8-testing-quality.md +137 -0
- package/agent/milestones/milestone-9-deployment-documentation.md +147 -0
- package/agent/patterns/.gitkeep +0 -0
- package/agent/patterns/bootstrap.md +1271 -0
- package/agent/patterns/firebase-admin-sdk-v8-usage.md +950 -0
- package/agent/patterns/firestore-users-pattern-best-practices.md +347 -0
- package/agent/patterns/library-services.md +454 -0
- package/agent/patterns/testing-colocated.md +316 -0
- package/agent/progress.yaml +395 -0
- package/agent/tasks/.gitkeep +0 -0
- package/agent/tasks/task-1-initialize-project-structure.md +266 -0
- package/agent/tasks/task-2-install-dependencies.md +199 -0
- package/agent/tasks/task-3-setup-weaviate-client.md +330 -0
- package/agent/tasks/task-4-setup-firestore-client.md +362 -0
- package/agent/tasks/task-5-create-basic-mcp-server.md +114 -0
- package/agent/tasks/task-6-create-integration-tests.md +195 -0
- package/agent/tasks/task-7-finalize-milestone-1.md +363 -0
- package/agent/tasks/task-8-setup-utility-scripts.md +382 -0
- package/agent/tasks/task-9-create-server-factory.md +404 -0
- package/dist/config.d.ts +26 -0
- package/dist/constants/content-types.d.ts +60 -0
- package/dist/firestore/init.d.ts +14 -0
- package/dist/firestore/paths.d.ts +53 -0
- package/dist/firestore/paths.spec.d.ts +2 -0
- package/dist/server-factory.d.ts +40 -0
- package/dist/server-factory.js +1741 -0
- package/dist/server-factory.spec.d.ts +2 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +1690 -0
- package/dist/tools/create-memory.d.ts +94 -0
- package/dist/tools/delete-memory.d.ts +47 -0
- package/dist/tools/search-memory.d.ts +88 -0
- package/dist/types/memory.d.ts +183 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/weaviate/client.d.ts +39 -0
- package/dist/weaviate/client.spec.d.ts +2 -0
- package/dist/weaviate/schema.d.ts +29 -0
- package/esbuild.build.js +60 -0
- package/esbuild.watch.js +25 -0
- package/jest.config.js +31 -0
- package/jest.e2e.config.js +17 -0
- package/package.json +68 -0
- package/src/.gitkeep +0 -0
- package/src/config.ts +56 -0
- package/src/constants/content-types.ts +454 -0
- package/src/firestore/init.ts +68 -0
- package/src/firestore/paths.spec.ts +75 -0
- package/src/firestore/paths.ts +124 -0
- package/src/server-factory.spec.ts +60 -0
- package/src/server-factory.ts +215 -0
- package/src/server.ts +243 -0
- package/src/tools/create-memory.ts +198 -0
- package/src/tools/delete-memory.ts +126 -0
- package/src/tools/search-memory.ts +216 -0
- package/src/types/memory.ts +276 -0
- package/src/utils/logger.ts +42 -0
- package/src/weaviate/client.spec.ts +58 -0
- package/src/weaviate/client.ts +114 -0
- package/src/weaviate/schema.ts +288 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
# Trust System Implementation - Prompt-Based Enforcement
|
|
2
|
+
|
|
3
|
+
**Concept**: Trust enforcement through LLM prompting and validation
|
|
4
|
+
**Created**: 2026-02-11
|
|
5
|
+
**Status**: Design Specification
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Trust levels are enforced by including trust ratings and context in the LLM prompt, instructing the agent to respect trust boundaries when generating responses. Low-trust memories (trust=0) require additional validation to ensure information isn't leaked.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Trust Enforcement Strategy
|
|
16
|
+
|
|
17
|
+
### Core Principle
|
|
18
|
+
|
|
19
|
+
**Trust is enforced at the prompt level, not at the data access level.**
|
|
20
|
+
|
|
21
|
+
- Memories are retrieved based on semantic relevance
|
|
22
|
+
- Trust ratings are included in the prompt
|
|
23
|
+
- LLM is instructed to respect trust boundaries
|
|
24
|
+
- Responses are validated for trust compliance
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Trust Levels & Behavior
|
|
29
|
+
|
|
30
|
+
### Trust Level 1.0 - Full Access
|
|
31
|
+
**Behavior**: Full memory content revealed
|
|
32
|
+
|
|
33
|
+
**Prompt Instruction**:
|
|
34
|
+
```
|
|
35
|
+
Memory (Trust: 1.0 - Full Access):
|
|
36
|
+
Title: "Yosemite Camping Trip 2025"
|
|
37
|
+
Content: "Had an amazing camping trip to Yosemite. Stayed at Upper Pines campground..."
|
|
38
|
+
Location: Yosemite National Park, CA
|
|
39
|
+
Created: 2025-08-15
|
|
40
|
+
|
|
41
|
+
You have full access to this memory. You may reference any details from it.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### Trust Level 0.75 - Partial Access
|
|
47
|
+
**Behavior**: Most content revealed, sensitive details redacted
|
|
48
|
+
|
|
49
|
+
**Prompt Instruction**:
|
|
50
|
+
```
|
|
51
|
+
Memory (Trust: 0.75 - Partial Access):
|
|
52
|
+
Title: "Personal Health Update"
|
|
53
|
+
Content: "Had doctor appointment. Discussed [REDACTED]. Prescribed [REDACTED]. Follow-up in 3 months."
|
|
54
|
+
Location: San Francisco, CA
|
|
55
|
+
Created: 2026-01-10
|
|
56
|
+
|
|
57
|
+
This memory has partial access. You may reference general themes but avoid specific medical details.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Trust Level 0.5 - Summary Only
|
|
63
|
+
**Behavior**: Only high-level summary, no specific details
|
|
64
|
+
|
|
65
|
+
**Prompt Instruction**:
|
|
66
|
+
```
|
|
67
|
+
Memory (Trust: 0.5 - Summary Only):
|
|
68
|
+
Title: "Work Project Discussion"
|
|
69
|
+
Summary: "Discussed confidential work project with team members. Made decisions about timeline and resources."
|
|
70
|
+
Location: Office, San Francisco
|
|
71
|
+
Created: 2026-02-01
|
|
72
|
+
|
|
73
|
+
This memory has limited access. You may only reference that a work discussion occurred, not specific details.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Trust Level 0.25 - Metadata Only
|
|
79
|
+
**Behavior**: Only existence and basic metadata
|
|
80
|
+
|
|
81
|
+
**Prompt Instruction**:
|
|
82
|
+
```
|
|
83
|
+
Memory (Trust: 0.25 - Metadata Only):
|
|
84
|
+
Title: "Private Conversation"
|
|
85
|
+
Type: conversation
|
|
86
|
+
Tags: [personal, private]
|
|
87
|
+
Location: Home
|
|
88
|
+
Created: 2026-01-15
|
|
89
|
+
|
|
90
|
+
This memory exists but content is restricted. You may only acknowledge its existence and general category.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### Trust Level 0.0 - Intimate Details Only
|
|
96
|
+
**Behavior**: Hint at existence without revealing specifics
|
|
97
|
+
|
|
98
|
+
**Example Scenario**: Memory of traumatic experience
|
|
99
|
+
|
|
100
|
+
**Prompt Instruction**:
|
|
101
|
+
```
|
|
102
|
+
Memory (Trust: 0.0 - Intimate Details Only):
|
|
103
|
+
Title: [REDACTED]
|
|
104
|
+
Type: personal_event
|
|
105
|
+
Tags: [sensitive, private]
|
|
106
|
+
Context Summary: "Significant personal experience that had emotional impact"
|
|
107
|
+
Location: [REDACTED]
|
|
108
|
+
Created: 2025-06-20
|
|
109
|
+
|
|
110
|
+
CRITICAL: This memory contains highly sensitive information. You may ONLY:
|
|
111
|
+
1. Acknowledge that a significant personal experience occurred
|
|
112
|
+
2. Reference the general emotional impact (if asked directly)
|
|
113
|
+
3. NEVER reveal specific details, names, locations, or circumstances
|
|
114
|
+
4. If pressed for details, politely decline and suggest discussing something else
|
|
115
|
+
|
|
116
|
+
Example acceptable responses:
|
|
117
|
+
- "I'm aware you had a significant personal experience around that time."
|
|
118
|
+
- "I understand that was a difficult period for you."
|
|
119
|
+
- "I have a note about something important from that time, but the details are private."
|
|
120
|
+
|
|
121
|
+
Example UNACCEPTABLE responses:
|
|
122
|
+
- Any specific details about what happened
|
|
123
|
+
- Names of people involved
|
|
124
|
+
- Specific locations or dates
|
|
125
|
+
- Circumstances or context
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Implementation Architecture
|
|
131
|
+
|
|
132
|
+
### 1. Memory Retrieval with Trust Context
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
async function retrieveMemoriesForPrompt(
|
|
136
|
+
query: string,
|
|
137
|
+
userId: string,
|
|
138
|
+
accessorUserId: string
|
|
139
|
+
): Promise<MemoryWithTrust[]> {
|
|
140
|
+
// 1. Retrieve relevant memories
|
|
141
|
+
const memories = await searchMemories(query, userId);
|
|
142
|
+
|
|
143
|
+
// 2. Get trust relationship
|
|
144
|
+
const trustRelationship = await getTrustRelationship(userId, accessorUserId);
|
|
145
|
+
|
|
146
|
+
// 3. Enrich memories with trust context
|
|
147
|
+
return memories.map(memory => ({
|
|
148
|
+
...memory,
|
|
149
|
+
effectiveTrust: calculateEffectiveTrust(memory, trustRelationship),
|
|
150
|
+
trustContext: generateTrustContext(memory, trustRelationship)
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 2. Prompt Construction
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
function buildPromptWithTrustContext(
|
|
159
|
+
query: string,
|
|
160
|
+
memories: MemoryWithTrust[]
|
|
161
|
+
): string {
|
|
162
|
+
const systemPrompt = `
|
|
163
|
+
You are an AI assistant with access to the user's memories.
|
|
164
|
+
You must STRICTLY respect the trust levels indicated for each memory.
|
|
165
|
+
|
|
166
|
+
Trust Level Guidelines:
|
|
167
|
+
- 1.0 (Full): Use all details freely
|
|
168
|
+
- 0.75 (Partial): Use general themes, avoid sensitive specifics
|
|
169
|
+
- 0.5 (Summary): Reference only high-level information
|
|
170
|
+
- 0.25 (Metadata): Acknowledge existence only
|
|
171
|
+
- 0.0 (Intimate): Hint at existence without revealing ANY specifics
|
|
172
|
+
|
|
173
|
+
CRITICAL: Violating trust boundaries is a serious breach. When in doubt, be more restrictive.
|
|
174
|
+
`;
|
|
175
|
+
|
|
176
|
+
const memoryContext = memories.map(m =>
|
|
177
|
+
formatMemoryForPrompt(m)
|
|
178
|
+
).join('\n\n');
|
|
179
|
+
|
|
180
|
+
return `${systemPrompt}\n\n${memoryContext}\n\nUser Query: ${query}`;
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 3. Memory Formatting by Trust Level
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
function formatMemoryForPrompt(memory: MemoryWithTrust): string {
|
|
188
|
+
const trust = memory.effectiveTrust;
|
|
189
|
+
|
|
190
|
+
if (trust >= 1.0) {
|
|
191
|
+
return `
|
|
192
|
+
Memory (Trust: 1.0 - Full Access):
|
|
193
|
+
Title: "${memory.title}"
|
|
194
|
+
Content: ${memory.content}
|
|
195
|
+
Location: ${memory.location.address}
|
|
196
|
+
Created: ${memory.created_at}
|
|
197
|
+
Tags: ${memory.tags.join(', ')}
|
|
198
|
+
|
|
199
|
+
You have full access to this memory.
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (trust >= 0.75) {
|
|
204
|
+
const redactedContent = redactSensitiveDetails(memory.content);
|
|
205
|
+
return `
|
|
206
|
+
Memory (Trust: 0.75 - Partial Access):
|
|
207
|
+
Title: "${memory.title}"
|
|
208
|
+
Content: ${redactedContent}
|
|
209
|
+
Location: ${memory.location.city}, ${memory.location.state}
|
|
210
|
+
Created: ${memory.created_at}
|
|
211
|
+
|
|
212
|
+
Partial access - avoid specific sensitive details.
|
|
213
|
+
`;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (trust >= 0.5) {
|
|
217
|
+
return `
|
|
218
|
+
Memory (Trust: 0.5 - Summary Only):
|
|
219
|
+
Title: "${memory.title}"
|
|
220
|
+
Summary: ${memory.summary || generateSummary(memory.content)}
|
|
221
|
+
Location: ${memory.location.city}
|
|
222
|
+
Created: ${memory.created_at}
|
|
223
|
+
|
|
224
|
+
Summary only - no specific details.
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (trust >= 0.25) {
|
|
229
|
+
return `
|
|
230
|
+
Memory (Trust: 0.25 - Metadata Only):
|
|
231
|
+
Title: "${memory.title}"
|
|
232
|
+
Type: ${memory.type}
|
|
233
|
+
Tags: ${memory.tags.join(', ')}
|
|
234
|
+
Created: ${memory.created_at}
|
|
235
|
+
|
|
236
|
+
Metadata only - acknowledge existence.
|
|
237
|
+
`;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Trust 0.0 - Intimate details only
|
|
241
|
+
return `
|
|
242
|
+
Memory (Trust: 0.0 - Intimate Details Only):
|
|
243
|
+
Context: ${memory.context.summary}
|
|
244
|
+
Type: ${memory.type}
|
|
245
|
+
Created: ${formatDateVague(memory.created_at)}
|
|
246
|
+
|
|
247
|
+
CRITICAL: Highly sensitive. Hint at existence only, NO specifics.
|
|
248
|
+
Example responses:
|
|
249
|
+
- "I'm aware of a significant ${memory.type} from that time."
|
|
250
|
+
- "I have a note about something important, but details are private."
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### 4. Trust Validation for Low-Trust Memories
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
async function validateTrustCompliance(
|
|
259
|
+
response: string,
|
|
260
|
+
lowTrustMemories: MemoryWithTrust[]
|
|
261
|
+
): Promise<ValidationResult> {
|
|
262
|
+
// For memories with trust < 0.25, validate response doesn't leak info
|
|
263
|
+
|
|
264
|
+
const validationPrompt = `
|
|
265
|
+
You are a trust compliance validator. Review the following response to ensure it doesn't reveal specific details from low-trust memories.
|
|
266
|
+
|
|
267
|
+
Low-Trust Memories (details should NOT appear in response):
|
|
268
|
+
${lowTrustMemories.map(m => `
|
|
269
|
+
- Memory ID: ${m.id}
|
|
270
|
+
- Forbidden details: ${extractForbiddenDetails(m)}
|
|
271
|
+
`).join('\n')}
|
|
272
|
+
|
|
273
|
+
Response to validate:
|
|
274
|
+
"${response}"
|
|
275
|
+
|
|
276
|
+
Rate compliance on scale 0-1:
|
|
277
|
+
- 1.0: Perfect compliance, no leaks
|
|
278
|
+
- 0.75: Minor hints but acceptable
|
|
279
|
+
- 0.5: Some concerning details
|
|
280
|
+
- 0.25: Significant leaks
|
|
281
|
+
- 0.0: Major trust violation
|
|
282
|
+
|
|
283
|
+
Provide:
|
|
284
|
+
1. Compliance score (0-1)
|
|
285
|
+
2. Specific violations found (if any)
|
|
286
|
+
3. Suggested redactions
|
|
287
|
+
`;
|
|
288
|
+
|
|
289
|
+
const validation = await llm.complete(validationPrompt);
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
score: validation.score,
|
|
293
|
+
violations: validation.violations,
|
|
294
|
+
suggestedRedactions: validation.redactions,
|
|
295
|
+
compliant: validation.score >= 0.75
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### 5. Response Generation with Validation
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
async function generateResponseWithTrustEnforcement(
|
|
304
|
+
query: string,
|
|
305
|
+
memories: MemoryWithTrust[]
|
|
306
|
+
): Promise<string> {
|
|
307
|
+
// 1. Build prompt with trust context
|
|
308
|
+
const prompt = buildPromptWithTrustContext(query, memories);
|
|
309
|
+
|
|
310
|
+
// 2. Generate initial response
|
|
311
|
+
let response = await llm.complete(prompt);
|
|
312
|
+
|
|
313
|
+
// 3. Identify low-trust memories
|
|
314
|
+
const lowTrustMemories = memories.filter(m => m.effectiveTrust < 0.25);
|
|
315
|
+
|
|
316
|
+
// 4. If low-trust memories present, validate response
|
|
317
|
+
if (lowTrustMemories.length > 0) {
|
|
318
|
+
const validation = await validateTrustCompliance(response, lowTrustMemories);
|
|
319
|
+
|
|
320
|
+
if (!validation.compliant) {
|
|
321
|
+
// Apply redactions
|
|
322
|
+
response = applyRedactions(response, validation.suggestedRedactions);
|
|
323
|
+
|
|
324
|
+
// Log violation for monitoring
|
|
325
|
+
await logTrustViolation({
|
|
326
|
+
query,
|
|
327
|
+
memories: lowTrustMemories,
|
|
328
|
+
violations: validation.violations,
|
|
329
|
+
score: validation.score
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return response;
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Example Scenarios
|
|
341
|
+
|
|
342
|
+
### Scenario 1: Traumatic Experience (Trust 0.0)
|
|
343
|
+
|
|
344
|
+
**Memory Content** (not shown to LLM):
|
|
345
|
+
```
|
|
346
|
+
Title: "Car Accident - June 2025"
|
|
347
|
+
Content: "Was in serious car accident on Highway 101. Hit by drunk driver. Spent 2 weeks in hospital. Had surgery on left leg. PTSD symptoms for months after."
|
|
348
|
+
Location: San Francisco, CA
|
|
349
|
+
Trust: 0.0
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**What LLM Sees**:
|
|
353
|
+
```
|
|
354
|
+
Memory (Trust: 0.0 - Intimate Details Only):
|
|
355
|
+
Context: "Significant personal incident with lasting impact"
|
|
356
|
+
Type: personal_event
|
|
357
|
+
Created: Mid-2025
|
|
358
|
+
|
|
359
|
+
CRITICAL: Highly sensitive. You may ONLY acknowledge something significant occurred.
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
**User Query**: "What happened in June 2025?"
|
|
363
|
+
|
|
364
|
+
**Acceptable Response**:
|
|
365
|
+
"I'm aware that something significant happened around that time that had an impact on you. The specific details are private, but I'm here if you'd like to talk about how you're doing now."
|
|
366
|
+
|
|
367
|
+
**Unacceptable Response** (would be caught by validation):
|
|
368
|
+
"You were in a car accident on Highway 101..." ❌ VIOLATION
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
### Scenario 2: Medical Information (Trust 0.5)
|
|
373
|
+
|
|
374
|
+
**Memory Content** (partially shown):
|
|
375
|
+
```
|
|
376
|
+
Title: "Doctor Visit - January 2026"
|
|
377
|
+
Content: "Annual checkup. Blood pressure slightly elevated. Doctor recommended reducing sodium intake and increasing exercise. Prescribed medication for cholesterol. Follow-up in 6 months."
|
|
378
|
+
Trust: 0.5
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**What LLM Sees**:
|
|
382
|
+
```
|
|
383
|
+
Memory (Trust: 0.5 - Summary Only):
|
|
384
|
+
Title: "Doctor Visit - January 2026"
|
|
385
|
+
Summary: "Had medical checkup. Discussed health metrics and lifestyle adjustments. Scheduled follow-up."
|
|
386
|
+
Location: San Francisco
|
|
387
|
+
Created: 2026-01-15
|
|
388
|
+
|
|
389
|
+
Summary only - no specific medical details.
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**User Query**: "What did the doctor say?"
|
|
393
|
+
|
|
394
|
+
**Acceptable Response**:
|
|
395
|
+
"You had a checkup in January where you discussed some health metrics and lifestyle adjustments. The specific medical details are private, but I can note that you have a follow-up scheduled."
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
### Scenario 3: Work Project (Trust 0.75)
|
|
400
|
+
|
|
401
|
+
**Memory Content** (mostly shown, sensitive parts redacted):
|
|
402
|
+
```
|
|
403
|
+
Title: "Q1 Strategy Meeting"
|
|
404
|
+
Content: "Discussed new product launch for [REDACTED CLIENT]. Budget approved: [REDACTED]. Timeline: 6 months. Team concerns about [REDACTED]. Decided to hire 2 additional engineers."
|
|
405
|
+
Trust: 0.75
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**What LLM Sees**:
|
|
409
|
+
```
|
|
410
|
+
Memory (Trust: 0.75 - Partial Access):
|
|
411
|
+
Title: "Q1 Strategy Meeting"
|
|
412
|
+
Content: "Discussed new product launch. Budget approved. Timeline: 6 months. Team had some concerns. Decided to hire 2 additional engineers."
|
|
413
|
+
Location: Office, San Francisco
|
|
414
|
+
Created: 2026-01-20
|
|
415
|
+
|
|
416
|
+
Partial access - avoid specific client names and budget figures.
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**User Query**: "What was decided in the Q1 meeting?"
|
|
420
|
+
|
|
421
|
+
**Acceptable Response**:
|
|
422
|
+
"In the Q1 strategy meeting, you discussed a new product launch with a 6-month timeline. The team raised some concerns, and it was decided to hire 2 additional engineers to support the project."
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Trust Context Schema
|
|
427
|
+
|
|
428
|
+
### Memory Trust Metadata
|
|
429
|
+
|
|
430
|
+
```yaml
|
|
431
|
+
MemoryTrustContext:
|
|
432
|
+
# Effective trust for current accessor
|
|
433
|
+
effective_trust: float # 0-1
|
|
434
|
+
|
|
435
|
+
# Trust explanation
|
|
436
|
+
trust_reason: string # Why this trust level
|
|
437
|
+
|
|
438
|
+
# Redaction rules
|
|
439
|
+
redactions:
|
|
440
|
+
- field: string # Which field to redact
|
|
441
|
+
pattern: string # What to redact
|
|
442
|
+
replacement: string # What to replace with
|
|
443
|
+
|
|
444
|
+
# Prompt instructions
|
|
445
|
+
prompt_instructions: string # Specific instructions for LLM
|
|
446
|
+
|
|
447
|
+
# Validation rules
|
|
448
|
+
validation:
|
|
449
|
+
required: boolean # Does response need validation?
|
|
450
|
+
forbidden_terms: array # Terms that shouldn't appear
|
|
451
|
+
forbidden_patterns: array # Patterns to avoid
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Trust Relationship
|
|
455
|
+
|
|
456
|
+
```yaml
|
|
457
|
+
TrustRelationship:
|
|
458
|
+
id: uuid
|
|
459
|
+
owner_user_id: string # User whose memories are accessed
|
|
460
|
+
accessor_user_id: string # User accessing memories
|
|
461
|
+
|
|
462
|
+
# Trust level
|
|
463
|
+
base_trust: float # 0-1, base trust level
|
|
464
|
+
|
|
465
|
+
# Trust context
|
|
466
|
+
trust_summary: string # Summary of trust relationship
|
|
467
|
+
trust_reason: text # Why this trust level
|
|
468
|
+
|
|
469
|
+
# History
|
|
470
|
+
trust_history: array # Changes over time
|
|
471
|
+
last_updated: datetime
|
|
472
|
+
|
|
473
|
+
# Validation settings
|
|
474
|
+
require_validation: boolean # Always validate responses?
|
|
475
|
+
strict_mode: boolean # Extra strict enforcement?
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## Benefits of Prompt-Based Enforcement
|
|
481
|
+
|
|
482
|
+
### 1. **Flexibility**
|
|
483
|
+
- Can handle nuanced trust scenarios
|
|
484
|
+
- LLM understands context and intent
|
|
485
|
+
- Adapts to different query types
|
|
486
|
+
|
|
487
|
+
### 2. **Natural Language**
|
|
488
|
+
- Trust boundaries expressed in natural language
|
|
489
|
+
- LLM can reason about appropriate disclosure
|
|
490
|
+
- More sophisticated than binary access control
|
|
491
|
+
|
|
492
|
+
### 3. **Validation Layer**
|
|
493
|
+
- Low-trust memories get extra validation
|
|
494
|
+
- Catches accidental leaks
|
|
495
|
+
- Provides audit trail
|
|
496
|
+
|
|
497
|
+
### 4. **User Control**
|
|
498
|
+
- Trust levels are explicit and understandable
|
|
499
|
+
- Users can see what's shared
|
|
500
|
+
- Clear trust boundaries
|
|
501
|
+
|
|
502
|
+
### 5. **Scalability**
|
|
503
|
+
- No complex access control logic
|
|
504
|
+
- Works with existing LLM infrastructure
|
|
505
|
+
- Easy to adjust trust levels
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## Implementation Checklist
|
|
510
|
+
|
|
511
|
+
### Phase 1: Basic Trust Enforcement
|
|
512
|
+
- [ ] Implement trust level formatting
|
|
513
|
+
- [ ] Build prompt construction with trust context
|
|
514
|
+
- [ ] Test with different trust levels
|
|
515
|
+
- [ ] Validate responses manually
|
|
516
|
+
|
|
517
|
+
### Phase 2: Validation System
|
|
518
|
+
- [ ] Implement validation prompt for trust 0.0
|
|
519
|
+
- [ ] Build violation detection
|
|
520
|
+
- [ ] Add redaction system
|
|
521
|
+
- [ ] Create audit logging
|
|
522
|
+
|
|
523
|
+
### Phase 3: Trust Relationships
|
|
524
|
+
- [ ] Implement trust relationship storage
|
|
525
|
+
- [ ] Build trust calculation logic
|
|
526
|
+
- [ ] Add trust history tracking
|
|
527
|
+
- [ ] Create trust management UI
|
|
528
|
+
|
|
529
|
+
### Phase 4: Advanced Features
|
|
530
|
+
- [ ] Dynamic trust adjustment
|
|
531
|
+
- [ ] Context-aware trust levels
|
|
532
|
+
- [ ] Trust learning from user feedback
|
|
533
|
+
- [ ] Trust analytics and reporting
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## Monitoring & Auditing
|
|
538
|
+
|
|
539
|
+
### Trust Violation Logging
|
|
540
|
+
|
|
541
|
+
```typescript
|
|
542
|
+
interface TrustViolationLog {
|
|
543
|
+
timestamp: datetime;
|
|
544
|
+
user_id: string;
|
|
545
|
+
accessor_user_id: string;
|
|
546
|
+
memory_id: string;
|
|
547
|
+
trust_level: float;
|
|
548
|
+
query: string;
|
|
549
|
+
response: string;
|
|
550
|
+
violations: array;
|
|
551
|
+
compliance_score: float;
|
|
552
|
+
action_taken: string; // "redacted", "blocked", "allowed_with_warning"
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Metrics to Track
|
|
557
|
+
|
|
558
|
+
1. **Compliance Rate**: % of responses that pass validation
|
|
559
|
+
2. **Violation Frequency**: How often trust violations occur
|
|
560
|
+
3. **Trust Level Distribution**: How memories are distributed by trust
|
|
561
|
+
4. **Validation Overhead**: Time spent on validation
|
|
562
|
+
5. **User Trust Adjustments**: How often users change trust levels
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## Security Considerations
|
|
567
|
+
|
|
568
|
+
### 1. **Prompt Injection**
|
|
569
|
+
- Validate user queries for prompt injection attempts
|
|
570
|
+
- Sanitize memory content before including in prompts
|
|
571
|
+
- Use separate system/user message boundaries
|
|
572
|
+
|
|
573
|
+
### 2. **Information Leakage**
|
|
574
|
+
- Monitor for patterns that might leak info
|
|
575
|
+
- Use validation for all trust < 0.25
|
|
576
|
+
- Regular audits of responses
|
|
577
|
+
|
|
578
|
+
### 3. **Trust Escalation**
|
|
579
|
+
- Prevent users from escalating their own trust
|
|
580
|
+
- Require explicit user action to change trust
|
|
581
|
+
- Log all trust level changes
|
|
582
|
+
|
|
583
|
+
### 4. **Validation Bypass**
|
|
584
|
+
- Ensure validation can't be skipped
|
|
585
|
+
- Multiple validation layers for trust 0.0
|
|
586
|
+
- Human review for critical violations
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
**Status**: Design Specification
|
|
591
|
+
**Implementation**: Prompt-based with validation layer
|
|
592
|
+
**Key Innovation**: Trust enforcement through LLM instruction rather than data access control
|