@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.
Files changed (95) hide show
  1. package/.env.example +65 -0
  2. package/AGENT.md +840 -0
  3. package/README.md +72 -0
  4. package/agent/design/.gitkeep +0 -0
  5. package/agent/design/access-control-result-pattern.md +458 -0
  6. package/agent/design/action-audit-memory-types.md +637 -0
  7. package/agent/design/common-template-fields.md +282 -0
  8. package/agent/design/complete-tool-set.md +407 -0
  9. package/agent/design/content-types-expansion.md +521 -0
  10. package/agent/design/cross-database-id-strategy.md +358 -0
  11. package/agent/design/default-template-library.md +423 -0
  12. package/agent/design/firestore-wrapper-analysis.md +606 -0
  13. package/agent/design/llm-provider-abstraction.md +691 -0
  14. package/agent/design/location-handling-architecture.md +523 -0
  15. package/agent/design/memory-templates-design.md +364 -0
  16. package/agent/design/permissions-storage-architecture.md +680 -0
  17. package/agent/design/relationship-storage-strategy.md +361 -0
  18. package/agent/design/remember-mcp-implementation-tasks.md +417 -0
  19. package/agent/design/remember-mcp-progress.yaml +141 -0
  20. package/agent/design/requirements-enhancements.md +468 -0
  21. package/agent/design/requirements.md +56 -0
  22. package/agent/design/template-storage-strategy.md +412 -0
  23. package/agent/design/template-suggestion-system.md +853 -0
  24. package/agent/design/trust-escalation-prevention.md +343 -0
  25. package/agent/design/trust-system-implementation.md +592 -0
  26. package/agent/design/user-preferences.md +683 -0
  27. package/agent/design/weaviate-collection-strategy.md +461 -0
  28. package/agent/milestones/.gitkeep +0 -0
  29. package/agent/milestones/milestone-1-project-foundation.md +121 -0
  30. package/agent/milestones/milestone-2-core-memory-system.md +150 -0
  31. package/agent/milestones/milestone-3-relationships-graph.md +116 -0
  32. package/agent/milestones/milestone-4-user-preferences.md +103 -0
  33. package/agent/milestones/milestone-5-template-system.md +126 -0
  34. package/agent/milestones/milestone-6-auth-multi-tenancy.md +124 -0
  35. package/agent/milestones/milestone-7-trust-permissions.md +133 -0
  36. package/agent/milestones/milestone-8-testing-quality.md +137 -0
  37. package/agent/milestones/milestone-9-deployment-documentation.md +147 -0
  38. package/agent/patterns/.gitkeep +0 -0
  39. package/agent/patterns/bootstrap.md +1271 -0
  40. package/agent/patterns/firebase-admin-sdk-v8-usage.md +950 -0
  41. package/agent/patterns/firestore-users-pattern-best-practices.md +347 -0
  42. package/agent/patterns/library-services.md +454 -0
  43. package/agent/patterns/testing-colocated.md +316 -0
  44. package/agent/progress.yaml +395 -0
  45. package/agent/tasks/.gitkeep +0 -0
  46. package/agent/tasks/task-1-initialize-project-structure.md +266 -0
  47. package/agent/tasks/task-2-install-dependencies.md +199 -0
  48. package/agent/tasks/task-3-setup-weaviate-client.md +330 -0
  49. package/agent/tasks/task-4-setup-firestore-client.md +362 -0
  50. package/agent/tasks/task-5-create-basic-mcp-server.md +114 -0
  51. package/agent/tasks/task-6-create-integration-tests.md +195 -0
  52. package/agent/tasks/task-7-finalize-milestone-1.md +363 -0
  53. package/agent/tasks/task-8-setup-utility-scripts.md +382 -0
  54. package/agent/tasks/task-9-create-server-factory.md +404 -0
  55. package/dist/config.d.ts +26 -0
  56. package/dist/constants/content-types.d.ts +60 -0
  57. package/dist/firestore/init.d.ts +14 -0
  58. package/dist/firestore/paths.d.ts +53 -0
  59. package/dist/firestore/paths.spec.d.ts +2 -0
  60. package/dist/server-factory.d.ts +40 -0
  61. package/dist/server-factory.js +1741 -0
  62. package/dist/server-factory.spec.d.ts +2 -0
  63. package/dist/server.d.ts +3 -0
  64. package/dist/server.js +1690 -0
  65. package/dist/tools/create-memory.d.ts +94 -0
  66. package/dist/tools/delete-memory.d.ts +47 -0
  67. package/dist/tools/search-memory.d.ts +88 -0
  68. package/dist/types/memory.d.ts +183 -0
  69. package/dist/utils/logger.d.ts +7 -0
  70. package/dist/weaviate/client.d.ts +39 -0
  71. package/dist/weaviate/client.spec.d.ts +2 -0
  72. package/dist/weaviate/schema.d.ts +29 -0
  73. package/esbuild.build.js +60 -0
  74. package/esbuild.watch.js +25 -0
  75. package/jest.config.js +31 -0
  76. package/jest.e2e.config.js +17 -0
  77. package/package.json +68 -0
  78. package/src/.gitkeep +0 -0
  79. package/src/config.ts +56 -0
  80. package/src/constants/content-types.ts +454 -0
  81. package/src/firestore/init.ts +68 -0
  82. package/src/firestore/paths.spec.ts +75 -0
  83. package/src/firestore/paths.ts +124 -0
  84. package/src/server-factory.spec.ts +60 -0
  85. package/src/server-factory.ts +215 -0
  86. package/src/server.ts +243 -0
  87. package/src/tools/create-memory.ts +198 -0
  88. package/src/tools/delete-memory.ts +126 -0
  89. package/src/tools/search-memory.ts +216 -0
  90. package/src/types/memory.ts +276 -0
  91. package/src/utils/logger.ts +42 -0
  92. package/src/weaviate/client.spec.ts +58 -0
  93. package/src/weaviate/client.ts +114 -0
  94. package/src/weaviate/schema.ts +288 -0
  95. package/tsconfig.json +26 -0
@@ -0,0 +1,637 @@
1
+ # Action & Audit Memory Types - Design Proposal
2
+
3
+ **Concept**: Memory types for tracking agent actions, events, and system history
4
+ **Created**: 2026-02-11
5
+ **Status**: Proposal
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ Action, event-log, audit, and history memory types serve to track significant actions taken by the agent, creating a transparent record of agent behavior and decision-making. This addresses both functionality and trust/safety requirements.
12
+
13
+ ---
14
+
15
+ ## Memory Type Proposals
16
+
17
+ ### 1. **`action` Memory Type**
18
+
19
+ **Purpose**: Track significant actions the agent took on behalf of the user
20
+
21
+ **Use Cases**:
22
+ - Agent sent an email
23
+ - Agent created a calendar event
24
+ - Agent made a purchase
25
+ - Agent modified user data
26
+ - Agent executed a command
27
+ - Agent made an API call
28
+
29
+ **Schema**:
30
+ ```yaml
31
+ ActionMemory:
32
+ # Core Identity
33
+ id: uuid
34
+ user_id: string
35
+ type: "action"
36
+
37
+ # Action Details
38
+ action_type: enum # email_sent, event_created, data_modified, command_executed, api_called
39
+ action_name: string # Human-readable action name
40
+ action_description: text # What the agent did
41
+
42
+ # Context
43
+ triggered_by: string # User request, scheduled task, automated rule
44
+ conversation_id: string # Link to conversation
45
+ user_intent: text # What user asked for
46
+
47
+ # Execution
48
+ status: enum # success, failed, partial, cancelled
49
+ executed_at: datetime
50
+ duration_ms: int
51
+
52
+ # Details
53
+ parameters: object # Action parameters
54
+ result: object # Action result
55
+ error: object # Error details if failed
56
+
57
+ # Impact
58
+ resources_affected: array # What was changed/accessed
59
+ side_effects: array # Other impacts
60
+ reversible: boolean # Can this be undone?
61
+ undo_action_id: uuid # Link to undo action if performed
62
+
63
+ # Metadata
64
+ weight: float # Significance (0-1)
65
+ trust: float # Trust level required to view
66
+ tags: array
67
+ ```
68
+
69
+ **Example**:
70
+ ```yaml
71
+ action:
72
+ action_type: "email_sent"
73
+ action_name: "Sent meeting invitation"
74
+ action_description: "Sent calendar invitation for team sync to 5 recipients"
75
+ triggered_by: "user_request"
76
+ conversation_id: "conv_abc123"
77
+ user_intent: "Schedule a team meeting for next week"
78
+ status: "success"
79
+ executed_at: "2026-02-11T15:30:00Z"
80
+ parameters:
81
+ recipients: ["alice@example.com", "bob@example.com"]
82
+ subject: "Team Sync - Feb 18"
83
+ date: "2026-02-18T14:00:00Z"
84
+ result:
85
+ event_id: "evt_xyz789"
86
+ sent_count: 5
87
+ resources_affected: ["calendar", "email"]
88
+ reversible: true
89
+ weight: 0.7
90
+ ```
91
+
92
+ ### 2. **`audit` Memory Type**
93
+
94
+ **Purpose**: Compliance and security audit trail
95
+
96
+ **Use Cases**:
97
+ - Authentication events
98
+ - Permission changes
99
+ - Data access logs
100
+ - Security-relevant actions
101
+ - Compliance-required tracking
102
+
103
+ **Schema**:
104
+ ```yaml
105
+ AuditMemory:
106
+ # Core Identity
107
+ id: uuid
108
+ user_id: string
109
+ type: "audit"
110
+
111
+ # Audit Details
112
+ event_type: enum # auth, permission, access, security, compliance
113
+ event_category: string # login, logout, data_access, permission_grant, etc.
114
+ severity: enum # info, warning, critical
115
+
116
+ # Actor
117
+ actor_id: string # Who performed the action
118
+ actor_type: enum # user, agent, system, external
119
+ actor_ip: string
120
+ actor_location: object
121
+
122
+ # Target
123
+ target_resource: string # What was accessed/modified
124
+ target_type: string # memory, template, relationship, system
125
+ target_id: uuid
126
+
127
+ # Action
128
+ action: string # read, write, delete, execute, grant, revoke
129
+ action_result: enum # success, denied, failed
130
+
131
+ # Context
132
+ timestamp: datetime
133
+ session_id: string
134
+ request_id: string
135
+
136
+ # Security
137
+ authentication_method: string
138
+ authorization_level: string
139
+ risk_score: float # 0-1, how risky was this action
140
+
141
+ # Compliance
142
+ compliance_tags: array # GDPR, HIPAA, SOC2, etc.
143
+ retention_required_until: datetime
144
+
145
+ # Metadata
146
+ weight: 1.0 # Audit logs always high weight
147
+ trust: 0.0 # ✅ Only owner can see their own audit logs (cross-user blocked)
148
+ immutable: true # Cannot be modified
149
+ ```
150
+
151
+ **Example**:
152
+ ```yaml
153
+ audit:
154
+ event_type: "access"
155
+ event_category: "sensitive_data_access"
156
+ severity: "info"
157
+ actor_id: "agent_assistant"
158
+ actor_type: "agent"
159
+ target_resource: "memory"
160
+ target_id: "mem_sensitive_123"
161
+ action: "read"
162
+ action_result: "success"
163
+ timestamp: "2026-02-11T15:30:00Z"
164
+ authentication_method: "firebase_jwt"
165
+ authorization_level: "user_authorized"
166
+ risk_score: 0.2
167
+ compliance_tags: ["GDPR"]
168
+ immutable: true
169
+ ```
170
+
171
+ ### 3. **`event-log` Memory Type**
172
+
173
+ **Purpose**: General system events and state changes
174
+
175
+ **Use Cases**:
176
+ - System state changes
177
+ - Background processes
178
+ - Scheduled tasks
179
+ - Integration events
180
+ - Workflow milestones
181
+
182
+ **Schema**:
183
+ ```yaml
184
+ EventLogMemory:
185
+ # Core Identity
186
+ id: uuid
187
+ user_id: string
188
+ type: "event-log"
189
+
190
+ # Event Details
191
+ event_name: string
192
+ event_type: enum # system, integration, workflow, scheduled, user_triggered
193
+ event_category: string
194
+
195
+ # Timing
196
+ occurred_at: datetime
197
+ detected_at: datetime
198
+ processed_at: datetime
199
+
200
+ # Source
201
+ source_system: string
202
+ source_component: string
203
+ source_version: string
204
+
205
+ # Event Data
206
+ event_data: object
207
+ previous_state: object # State before event
208
+ new_state: object # State after event
209
+
210
+ # Relationships
211
+ parent_event_id: uuid # For event chains
212
+ related_events: array # Related event IDs
213
+ correlation_id: string # For distributed tracing
214
+
215
+ # Impact
216
+ affected_resources: array
217
+ downstream_events: array
218
+
219
+ # Metadata
220
+ weight: float
221
+ trust: float
222
+ tags: array
223
+ ```
224
+
225
+ ### 4. **`history` Memory Type**
226
+
227
+ **Purpose**: Track changes to memories and relationships over time
228
+
229
+ **Use Cases**:
230
+ - Memory edit history
231
+ - Relationship changes
232
+ - Template evolution
233
+ - User preference changes
234
+
235
+ **Schema**:
236
+ ```yaml
237
+ HistoryMemory:
238
+ # Core Identity
239
+ id: uuid
240
+ user_id: string
241
+ type: "history"
242
+
243
+ # Target
244
+ target_type: enum # memory, relationship, template, preference
245
+ target_id: uuid
246
+
247
+ # Change Details
248
+ change_type: enum # created, updated, deleted, restored
249
+ changed_at: datetime
250
+ changed_by: string # user_id or agent_id
251
+
252
+ # Changes
253
+ fields_changed: array
254
+ previous_values: object
255
+ new_values: object
256
+ diff: object # Structured diff
257
+
258
+ # Context
259
+ change_reason: text
260
+ conversation_id: string
261
+
262
+ # Version
263
+ version_number: int
264
+ version_tag: string
265
+
266
+ # Metadata
267
+ weight: 0.3 # History typically lower weight
268
+ trust: 0.0 # ✅ Only owner sees their own history (cross-user blocked)
269
+ tags: array
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Cost & Storage Considerations
275
+
276
+ ### Storage Cost Analysis
277
+
278
+ **Assumptions**:
279
+ - Average action memory: ~2KB
280
+ - Average audit memory: ~1KB
281
+ - Average event-log memory: ~1.5KB
282
+ - Average history memory: ~1KB
283
+
284
+ **Scenarios**:
285
+
286
+ #### Light User (100 actions/month)
287
+ ```
288
+ Actions: 100 × 2KB = 200KB/month = 2.4MB/year
289
+ Audit: 200 × 1KB = 200KB/month = 2.4MB/year
290
+ Event-log: 50 × 1.5KB = 75KB/month = 900KB/year
291
+ History: 150 × 1KB = 150KB/month = 1.8MB/year
292
+ Total: ~7.5MB/year
293
+ Cost: ~$0.75/year (at $0.10/GB)
294
+ ```
295
+
296
+ #### Active User (1000 actions/month)
297
+ ```
298
+ Actions: 1000 × 2KB = 2MB/month = 24MB/year
299
+ Audit: 2000 × 1KB = 2MB/month = 24MB/year
300
+ Event-log: 500 × 1.5KB = 750KB/month = 9MB/year
301
+ History: 1500 × 1KB = 1.5MB/month = 18MB/year
302
+ Total: ~75MB/year
303
+ Cost: ~$7.50/year
304
+ ```
305
+
306
+ #### Power User (10,000 actions/month)
307
+ ```
308
+ Actions: 10,000 × 2KB = 20MB/month = 240MB/year
309
+ Audit: 20,000 × 1KB = 20MB/month = 240MB/year
310
+ Event-log: 5,000 × 1.5KB = 7.5MB/month = 90MB/year
311
+ History: 15,000 × 1KB = 15MB/month = 180MB/year
312
+ Total: ~750MB/year
313
+ Cost: ~$75/year
314
+ ```
315
+
316
+ ### Cost Mitigation Strategies
317
+
318
+ #### 1. **Retention Policies**
319
+ ```yaml
320
+ RetentionPolicy:
321
+ action:
322
+ default_retention: 90_days
323
+ important_retention: 1_year # weight > 0.7
324
+ archive_after: 1_year
325
+
326
+ audit:
327
+ default_retention: 1_year # Compliance requirement
328
+ compliance_retention: 7_years # For specific compliance tags
329
+ never_delete: true # For critical security events
330
+
331
+ event-log:
332
+ default_retention: 30_days
333
+ error_retention: 90_days
334
+ archive_after: 90_days
335
+
336
+ history:
337
+ default_retention: 180_days
338
+ keep_major_versions: true # Keep v1.0, v2.0, etc.
339
+ compress_after: 90_days
340
+ ```
341
+
342
+ #### 2. **Selective Logging**
343
+ ```yaml
344
+ LoggingPolicy:
345
+ # Only log significant actions
346
+ action:
347
+ min_weight: 0.3 # Don't log trivial actions
348
+ skip_types: ["read_only", "view"]
349
+
350
+ # Audit everything security-related
351
+ audit:
352
+ always_log: ["auth", "permission", "security"]
353
+ sample_rate: 0.1 # Sample 10% of routine events
354
+
355
+ # Event-log sampling
356
+ event-log:
357
+ sample_rate: 0.2 # Log 20% of routine events
358
+ always_log_errors: true
359
+ ```
360
+
361
+ #### 3. **Compression & Archival**
362
+ ```yaml
363
+ ArchivalStrategy:
364
+ # Compress old memories
365
+ compress_after_days: 90
366
+ compression_ratio: 0.3 # 70% size reduction
367
+
368
+ # Move to cold storage
369
+ archive_after_days: 365
370
+ cold_storage_cost: 0.01 # $0.01/GB vs $0.10/GB
371
+
372
+ # Aggregate old data
373
+ aggregate_after_days: 180
374
+ aggregation_level: "daily" # Daily summaries instead of individual events
375
+ ```
376
+
377
+ #### 4. **Smart Summarization**
378
+ ```yaml
379
+ SummarizationStrategy:
380
+ # Summarize old action sequences
381
+ summarize_after_days: 60
382
+ summary_format: "daily_digest"
383
+
384
+ # Example: Instead of 100 individual "email_sent" actions
385
+ # Store: "Sent 100 emails in February 2026"
386
+
387
+ keep_original: false # Delete originals after summarization
388
+ keep_important: true # Keep high-weight originals
389
+ ```
390
+
391
+ ### Recommendation: **Hybrid Approach**
392
+
393
+ ```yaml
394
+ RecommendedStrategy:
395
+ # Critical for trust & transparency
396
+ action:
397
+ enabled: true
398
+ retention: 90_days
399
+ min_weight: 0.4
400
+ archive: true
401
+
402
+ # Required for compliance
403
+ audit:
404
+ enabled: true
405
+ retention: 1_year
406
+ compliance_retention: 7_years
407
+ never_delete_critical: true
408
+
409
+ # Optional, can be disabled
410
+ event-log:
411
+ enabled: false # Disable by default
412
+ enable_for_debugging: true
413
+ sample_rate: 0.1
414
+
415
+ # Useful but expensive
416
+ history:
417
+ enabled: true
418
+ retention: 180_days
419
+ keep_major_versions_only: true
420
+ compress_after: 30_days
421
+ ```
422
+
423
+ **Estimated Cost for Typical User**:
424
+ - Actions (filtered): ~5MB/year
425
+ - Audit (required): ~10MB/year
426
+ - Event-log (disabled): 0MB/year
427
+ - History (compressed): ~2MB/year
428
+ - **Total: ~17MB/year = ~$1.70/year**
429
+
430
+ ---
431
+
432
+ ## Access Count Weighting in Search
433
+
434
+ ### Current Weight Formula Enhancement
435
+
436
+ **Original Weight Factors** (from requirements):
437
+ ```
438
+ weight = user_specified_weight (0-1)
439
+ ```
440
+
441
+ **Enhanced Weight Formula**:
442
+ ```typescript
443
+ effective_weight = base_weight * access_multiplier * recency_multiplier * relationship_multiplier
444
+
445
+ where:
446
+ base_weight = user_specified_weight (0-1)
447
+
448
+ access_multiplier = 1 + (access_count / max_access_count) * 0.5
449
+ // Frequently accessed memories get up to 50% boost
450
+
451
+ recency_multiplier = 1 + (days_since_access < 7 ? 0.3 : 0)
452
+ // Recently accessed memories get 30% boost
453
+
454
+ relationship_multiplier = 1 + (relationship_count / 10) * 0.2
455
+ // Well-connected memories get up to 20% boost
456
+ ```
457
+
458
+ ### Access Count Tracking
459
+
460
+ **Memory Schema Addition**:
461
+ ```yaml
462
+ Memory:
463
+ # ... existing fields ...
464
+
465
+ # Access Tracking
466
+ access_count: int # Total times accessed
467
+ last_accessed_at: datetime # Most recent access
468
+ access_frequency: float # Accesses per day
469
+ access_history: array # Recent access timestamps (last 100)
470
+
471
+ # Computed Weight
472
+ base_weight: float # User-specified (0-1)
473
+ computed_weight: float # Calculated effective weight
474
+ weight_factors: object # Breakdown of weight calculation
475
+ ```
476
+
477
+ ### Search Ranking Algorithm
478
+
479
+ ```typescript
480
+ function rankSearchResults(results: Memory[], query: string): Memory[] {
481
+ return results
482
+ .map(memory => ({
483
+ memory,
484
+ score: calculateScore(memory, query)
485
+ }))
486
+ .sort((a, b) => b.score - a.score)
487
+ .map(item => item.memory);
488
+ }
489
+
490
+ function calculateScore(memory: Memory, query: string): number {
491
+ // Base semantic similarity score (0-1)
492
+ const semanticScore = memory.embedding_similarity;
493
+
494
+ // Weight multiplier (0.5 - 2.0)
495
+ const weightMultiplier = 0.5 + (memory.computed_weight * 1.5);
496
+
497
+ // Access frequency boost (0-0.3)
498
+ const accessBoost = Math.min(memory.access_frequency / 10, 0.3);
499
+
500
+ // Recency boost (0-0.2)
501
+ const daysSinceAccess = daysBetween(now(), memory.last_accessed_at);
502
+ const recencyBoost = daysSinceAccess < 7 ? 0.2 :
503
+ daysSinceAccess < 30 ? 0.1 : 0;
504
+
505
+ // Relationship boost (0-0.2)
506
+ const relationshipBoost = Math.min(memory.relationships.length / 20, 0.2);
507
+
508
+ // Final score
509
+ return semanticScore * weightMultiplier + accessBoost + recencyBoost + relationshipBoost;
510
+ }
511
+ ```
512
+
513
+ ### Access Count Update Strategy
514
+
515
+ **When to Increment Access Count**:
516
+ ```typescript
517
+ AccessCountPolicy:
518
+ increment_on:
519
+ - remember_search_memory: true # Found in search results
520
+ - remember_find_similar: true # Used as reference
521
+ - remember_query_memory: true # Returned in GraphQL query
522
+ - remember_update_memory: false # Don't count updates
523
+ - remember_delete_memory: false # Don't count deletes
524
+
525
+ increment_rules:
526
+ - only_if_in_top_results: true # Only count if in top 10 results
527
+ - only_if_user_viewed: true # Only if user actually viewed it
528
+ - debounce_seconds: 60 # Don't count multiple accesses within 60s
529
+ ```
530
+
531
+ ### Weight Decay Over Time
532
+
533
+ ```typescript
534
+ WeightDecayPolicy:
535
+ enabled: true
536
+ decay_function: "exponential"
537
+ half_life_days: 90 # Weight halves every 90 days without access
538
+
539
+ // Example: Memory with base_weight=0.8, not accessed for 90 days
540
+ // effective_weight = 0.8 * 0.5 = 0.4
541
+ // After 180 days: 0.8 * 0.25 = 0.2
542
+
543
+ prevent_decay_if:
544
+ - has_relationships: true # Connected memories don't decay
545
+ - marked_permanent: true # User can mark as permanent
546
+ - access_count > 100 # Frequently accessed memories don't decay
547
+ ```
548
+
549
+ ### Example Search with Access Weighting
550
+
551
+ ```typescript
552
+ // User searches for "camping"
553
+ remember_search_memory({
554
+ query: "camping",
555
+ limit: 10
556
+ })
557
+
558
+ // Results ranked by:
559
+ // 1. "Yosemite camping trip 2025"
560
+ // - semantic_score: 0.95
561
+ // - base_weight: 0.7
562
+ // - access_count: 45 (accessed many times)
563
+ // - last_accessed: 2 days ago
564
+ // - relationships: 8
565
+ // - FINAL SCORE: 1.82
566
+
567
+ // 2. "Camping gear checklist"
568
+ // - semantic_score: 0.90
569
+ // - base_weight: 0.8
570
+ // - access_count: 120 (template, heavily used)
571
+ // - last_accessed: 1 day ago
572
+ // - relationships: 3
573
+ // - FINAL SCORE: 1.75
574
+
575
+ // 3. "Camping trip ideas 2024"
576
+ // - semantic_score: 0.85
577
+ // - base_weight: 0.5
578
+ // - access_count: 2 (rarely accessed)
579
+ // - last_accessed: 180 days ago
580
+ // - relationships: 0
581
+ // - FINAL SCORE: 0.92
582
+ ```
583
+
584
+ ---
585
+
586
+ ## Implementation Recommendations
587
+
588
+ ### Phase 1: Core Action Tracking
589
+ 1. Implement `action` memory type
590
+ 2. Add access count tracking to Memory schema
591
+ 3. Implement basic weight calculation with access multiplier
592
+ 4. Add retention policies
593
+
594
+ ### Phase 2: Audit & Compliance
595
+ 1. Implement `audit` memory type
596
+ 2. Add compliance tagging
597
+ 3. Implement retention policies for audit logs
598
+ 4. Add immutability for audit records
599
+
600
+ ### Phase 3: Advanced Features
601
+ 1. Implement `history` memory type
602
+ 2. Add weight decay algorithm
603
+ 3. Implement compression and archival
604
+ 4. Add smart summarization
605
+
606
+ ### Phase 4: Optional Event Logging
607
+ 1. Implement `event-log` memory type (opt-in)
608
+ 2. Add sampling and filtering
609
+ 3. Implement aggregation strategies
610
+
611
+ ---
612
+
613
+ ## Benefits
614
+
615
+ ### For Users
616
+ - **Transparency**: See what the agent did
617
+ - **Trust**: Audit trail builds confidence
618
+ - **Learning**: Understand agent behavior patterns
619
+ - **Control**: Review and manage agent actions
620
+
621
+ ### For System
622
+ - **Debugging**: Track down issues
623
+ - **Optimization**: Identify frequently accessed memories
624
+ - **Compliance**: Meet regulatory requirements
625
+ - **Security**: Detect anomalous behavior
626
+
627
+ ### For Search
628
+ - **Relevance**: Frequently accessed memories rank higher
629
+ - **Personalization**: Learn user preferences from access patterns
630
+ - **Freshness**: Recently accessed memories stay relevant
631
+ - **Context**: Connected memories surface together
632
+
633
+ ---
634
+
635
+ **Status**: Proposal for Review
636
+ **Estimated Additional Cost**: $1-2/user/year with recommended strategy
637
+ **Recommendation**: Implement action + audit types, make event-log optional