@prmichaelsen/remember-mcp 3.0.0 → 3.13.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 (208) hide show
  1. package/AGENT.md +296 -250
  2. package/CHANGELOG.md +358 -0
  3. package/README.md +68 -45
  4. package/agent/commands/acp.clarification-create.md +382 -0
  5. package/agent/commands/acp.project-info.md +309 -0
  6. package/agent/commands/acp.project-remove.md +379 -0
  7. package/agent/commands/acp.project-update.md +296 -0
  8. package/agent/commands/acp.task-create.md +17 -9
  9. package/agent/commands/git.commit.md +13 -1
  10. package/agent/design/comment-memory-type.md +2 -2
  11. package/agent/design/local.collaborative-memory-sync.md +265 -0
  12. package/agent/design/local.content-flags.md +210 -0
  13. package/agent/design/local.ghost-persona-system.md +273 -0
  14. package/agent/design/local.group-acl-integration.md +338 -0
  15. package/agent/design/local.memory-acl-schema.md +352 -0
  16. package/agent/design/local.memory-collection-pattern-v2.md +348 -0
  17. package/agent/design/local.moderation-and-space-config.md +257 -0
  18. package/agent/design/local.v2-api-reference.md +621 -0
  19. package/agent/design/local.v2-migration-guide.md +191 -0
  20. package/agent/design/local.v2-usage-examples.md +265 -0
  21. package/agent/design/permissions-storage-architecture.md +11 -3
  22. package/agent/design/trust-escalation-prevention.md +9 -2
  23. package/agent/design/trust-system-implementation.md +12 -3
  24. package/agent/milestones/milestone-14-memory-collection-v2.md +182 -0
  25. package/agent/milestones/milestone-15-moderation-space-config.md +126 -0
  26. package/agent/progress.yaml +628 -49
  27. package/agent/scripts/acp.common.sh +2 -0
  28. package/agent/scripts/acp.install.sh +11 -1
  29. package/agent/scripts/acp.package-install-optimized.sh +454 -0
  30. package/agent/scripts/acp.package-install.sh +247 -300
  31. package/agent/scripts/acp.project-info.sh +218 -0
  32. package/agent/scripts/acp.project-remove.sh +302 -0
  33. package/agent/scripts/acp.project-update.sh +296 -0
  34. package/agent/scripts/acp.yaml-parser.sh +128 -10
  35. package/agent/tasks/milestone-14-memory-collection-v2/task-165-core-infrastructure-setup.md +171 -0
  36. package/agent/tasks/milestone-14-memory-collection-v2/task-166-update-remember-publish.md +191 -0
  37. package/agent/tasks/milestone-14-memory-collection-v2/task-167-update-remember-retract.md +186 -0
  38. package/agent/tasks/milestone-14-memory-collection-v2/task-168-implement-remember-revise.md +184 -0
  39. package/agent/tasks/milestone-14-memory-collection-v2/task-169-update-remember-search-space.md +179 -0
  40. package/agent/tasks/milestone-14-memory-collection-v2/task-170-update-remember-create-update.md +139 -0
  41. package/agent/tasks/milestone-14-memory-collection-v2/task-172-performance-testing-optimization.md +161 -0
  42. package/agent/tasks/milestone-14-memory-collection-v2/task-173-documentation-examples.md +258 -0
  43. package/agent/tasks/milestone-15-moderation-space-config/task-174-add-moderation-schema-fields.md +57 -0
  44. package/agent/tasks/milestone-15-moderation-space-config/task-175-create-space-config-service.md +64 -0
  45. package/agent/tasks/milestone-15-moderation-space-config/task-176-wire-moderation-publish-flow.md +45 -0
  46. package/agent/tasks/milestone-15-moderation-space-config/task-177-add-moderation-search-filters.md +70 -0
  47. package/agent/tasks/milestone-15-moderation-space-config/task-178-create-remember-moderate-tool.md +69 -0
  48. package/agent/tasks/milestone-15-moderation-space-config/task-179-documentation-integration-tests.md +58 -0
  49. package/agent/tasks/milestone-16-ghost-system/task-187-ghost-config-firestore.md +41 -0
  50. package/agent/tasks/milestone-16-ghost-system/task-188-trust-filter-integration.md +44 -0
  51. package/agent/tasks/milestone-16-ghost-system/task-189-ghost-memory-filtering.md +43 -0
  52. package/agent/tasks/milestone-16-ghost-system/task-190-ghost-config-tools.md +45 -0
  53. package/agent/tasks/milestone-16-ghost-system/task-191-escalation-firestore.md +38 -0
  54. package/agent/tasks/milestone-16-ghost-system/task-192-documentation-verification.md +39 -0
  55. package/agent/tasks/milestone-7-trust-permissions/task-180-access-result-permission-types.md +69 -0
  56. package/agent/tasks/milestone-7-trust-permissions/task-181-firestore-permissions-access-logs.md +56 -0
  57. package/agent/tasks/milestone-7-trust-permissions/task-182-trust-enforcement-service.md +68 -0
  58. package/agent/tasks/milestone-7-trust-permissions/task-183-access-control-service.md +70 -0
  59. package/agent/tasks/milestone-7-trust-permissions/task-184-permission-tools.md +79 -0
  60. package/agent/tasks/milestone-7-trust-permissions/task-185-wire-trust-into-search-query.md +55 -0
  61. package/agent/tasks/milestone-7-trust-permissions/task-186-documentation-verification.md +56 -0
  62. package/agent/tasks/task-76-fix-indexnullstate-schema-bug.md +197 -0
  63. package/dist/collections/composite-ids.d.ts +106 -0
  64. package/dist/collections/core-infrastructure.spec.d.ts +11 -0
  65. package/dist/collections/dot-notation.d.ts +106 -0
  66. package/dist/collections/tracking-arrays.d.ts +176 -0
  67. package/dist/constants/content-types.d.ts +1 -0
  68. package/dist/schema/v2-collections-comments.spec.d.ts +8 -0
  69. package/dist/schema/v2-collections.d.ts +210 -0
  70. package/dist/server-factory.d.ts +15 -0
  71. package/dist/server-factory.js +2798 -1029
  72. package/dist/server.js +2526 -1012
  73. package/dist/services/access-control.d.ts +103 -0
  74. package/dist/services/access-control.spec.d.ts +2 -0
  75. package/dist/services/credentials-provider.d.ts +24 -0
  76. package/dist/services/credentials-provider.spec.d.ts +2 -0
  77. package/dist/services/escalation.service.d.ts +22 -0
  78. package/dist/services/escalation.service.spec.d.ts +2 -0
  79. package/dist/services/ghost-config.service.d.ts +55 -0
  80. package/dist/services/ghost-config.service.spec.d.ts +2 -0
  81. package/dist/services/space-config.service.d.ts +23 -0
  82. package/dist/services/space-config.service.spec.d.ts +2 -0
  83. package/dist/services/trust-enforcement.d.ts +83 -0
  84. package/dist/services/trust-enforcement.spec.d.ts +2 -0
  85. package/dist/services/trust-validator.d.ts +43 -0
  86. package/dist/services/trust-validator.spec.d.ts +2 -0
  87. package/dist/tools/confirm-publish-moderation.spec.d.ts +8 -0
  88. package/dist/tools/confirm.d.ts +8 -1
  89. package/dist/tools/create-memory.d.ts +2 -1
  90. package/dist/tools/create-memory.spec.d.ts +10 -0
  91. package/dist/tools/create-relationship.d.ts +2 -1
  92. package/dist/tools/delete-memory.d.ts +2 -1
  93. package/dist/tools/delete-relationship.d.ts +2 -1
  94. package/dist/tools/deny.d.ts +2 -1
  95. package/dist/tools/find-similar.d.ts +2 -1
  96. package/dist/tools/get-preferences.d.ts +2 -1
  97. package/dist/tools/ghost-config.d.ts +27 -0
  98. package/dist/tools/ghost-config.spec.d.ts +2 -0
  99. package/dist/tools/moderate.d.ts +20 -0
  100. package/dist/tools/moderate.spec.d.ts +5 -0
  101. package/dist/tools/publish.d.ts +11 -3
  102. package/dist/tools/query-memory.d.ts +3 -1
  103. package/dist/tools/query-space.d.ts +4 -1
  104. package/dist/tools/retract.d.ts +29 -0
  105. package/dist/tools/revise.d.ts +45 -0
  106. package/dist/tools/revise.spec.d.ts +8 -0
  107. package/dist/tools/search-memory.d.ts +2 -1
  108. package/dist/tools/search-relationship.d.ts +2 -1
  109. package/dist/tools/search-space.d.ts +25 -5
  110. package/dist/tools/search-space.spec.d.ts +9 -0
  111. package/dist/tools/set-preference.d.ts +2 -1
  112. package/dist/tools/update-memory.d.ts +2 -1
  113. package/dist/tools/update-relationship.d.ts +2 -1
  114. package/dist/types/access-result.d.ts +48 -0
  115. package/dist/types/access-result.spec.d.ts +2 -0
  116. package/dist/types/auth.d.ts +46 -0
  117. package/dist/types/ghost-config.d.ts +36 -0
  118. package/dist/types/memory.d.ts +3 -1
  119. package/dist/types/preferences.d.ts +1 -1
  120. package/dist/utils/auth-helpers.d.ts +14 -0
  121. package/dist/utils/auth-helpers.spec.d.ts +2 -0
  122. package/dist/utils/test-data-generator.d.ts +124 -0
  123. package/dist/utils/test-data-generator.spec.d.ts +12 -0
  124. package/dist/v2-performance.e2e.d.ts +17 -0
  125. package/dist/v2-smoke.e2e.d.ts +14 -0
  126. package/dist/weaviate/client.d.ts +5 -8
  127. package/dist/weaviate/space-schema.d.ts +2 -2
  128. package/docs/performance/v2-benchmarks.md +80 -0
  129. package/jest.e2e.config.js +14 -3
  130. package/package.json +1 -1
  131. package/scripts/.collection-recreation-state.yaml +16 -0
  132. package/scripts/.gitkeep +5 -0
  133. package/scripts/README-collection-recreation.md +224 -0
  134. package/scripts/README.md +51 -0
  135. package/scripts/backup-collections.ts +543 -0
  136. package/scripts/delete-collection.ts +137 -0
  137. package/scripts/migrate-recreate-collections.ts +578 -0
  138. package/scripts/migrate-v1-to-v2.ts +1094 -0
  139. package/scripts/package-lock.json +1113 -0
  140. package/scripts/package.json +27 -0
  141. package/src/collections/composite-ids.ts +193 -0
  142. package/src/collections/core-infrastructure.spec.ts +353 -0
  143. package/src/collections/dot-notation.ts +212 -0
  144. package/src/collections/tracking-arrays.ts +298 -0
  145. package/src/constants/content-types.ts +20 -0
  146. package/src/schema/v2-collections-comments.spec.ts +141 -0
  147. package/src/schema/v2-collections.ts +433 -0
  148. package/src/server-factory.ts +89 -20
  149. package/src/server.ts +45 -17
  150. package/src/services/access-control.spec.ts +383 -0
  151. package/src/services/access-control.ts +291 -0
  152. package/src/services/credentials-provider.spec.ts +22 -0
  153. package/src/services/credentials-provider.ts +34 -0
  154. package/src/services/escalation.service.spec.ts +183 -0
  155. package/src/services/escalation.service.ts +150 -0
  156. package/src/services/ghost-config.service.spec.ts +339 -0
  157. package/src/services/ghost-config.service.ts +219 -0
  158. package/src/services/space-config.service.spec.ts +102 -0
  159. package/src/services/space-config.service.ts +79 -0
  160. package/src/services/trust-enforcement.spec.ts +309 -0
  161. package/src/services/trust-enforcement.ts +197 -0
  162. package/src/services/trust-validator.spec.ts +108 -0
  163. package/src/services/trust-validator.ts +105 -0
  164. package/src/tools/confirm-publish-moderation.spec.ts +240 -0
  165. package/src/tools/confirm.ts +869 -135
  166. package/src/tools/create-memory.spec.ts +126 -0
  167. package/src/tools/create-memory.ts +20 -27
  168. package/src/tools/create-relationship.ts +17 -8
  169. package/src/tools/delete-memory.ts +13 -6
  170. package/src/tools/delete-relationship.ts +15 -6
  171. package/src/tools/deny.ts +8 -1
  172. package/src/tools/find-similar.ts +21 -8
  173. package/src/tools/get-preferences.ts +10 -1
  174. package/src/tools/ghost-config.spec.ts +180 -0
  175. package/src/tools/ghost-config.ts +230 -0
  176. package/src/tools/moderate.spec.ts +277 -0
  177. package/src/tools/moderate.ts +219 -0
  178. package/src/tools/publish.ts +99 -41
  179. package/src/tools/query-memory.ts +28 -6
  180. package/src/tools/query-space.ts +39 -4
  181. package/src/tools/retract.ts +292 -0
  182. package/src/tools/revise.spec.ts +146 -0
  183. package/src/tools/revise.ts +283 -0
  184. package/src/tools/search-memory.ts +30 -7
  185. package/src/tools/search-relationship.ts +11 -2
  186. package/src/tools/search-space.spec.ts +341 -0
  187. package/src/tools/search-space.ts +323 -99
  188. package/src/tools/set-preference.ts +10 -1
  189. package/src/tools/update-memory.ts +16 -5
  190. package/src/tools/update-relationship.ts +10 -1
  191. package/src/types/access-result.spec.ts +193 -0
  192. package/src/types/access-result.ts +62 -0
  193. package/src/types/auth.ts +52 -0
  194. package/src/types/ghost-config.ts +46 -0
  195. package/src/types/memory.ts +9 -1
  196. package/src/types/preferences.ts +2 -2
  197. package/src/utils/auth-helpers.spec.ts +75 -0
  198. package/src/utils/auth-helpers.ts +25 -0
  199. package/src/utils/test-data-generator.spec.ts +317 -0
  200. package/src/utils/test-data-generator.ts +292 -0
  201. package/src/utils/weaviate-filters.ts +4 -4
  202. package/src/v2-performance.e2e.ts +173 -0
  203. package/src/v2-smoke.e2e.ts +401 -0
  204. package/src/weaviate/client.spec.ts +5 -5
  205. package/src/weaviate/client.ts +51 -36
  206. package/src/weaviate/schema.ts +11 -256
  207. package/src/weaviate/space-schema.spec.ts +24 -24
  208. package/src/weaviate/space-schema.ts +18 -6
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Access control service — per-memory access checks with escalation prevention.
3
+ *
4
+ * In ghost mode (default), query-level filtering handles trust at the Weaviate layer.
5
+ * This service is needed for:
6
+ * 1. Trust escalation penalty tracking
7
+ * 2. Block management
8
+ * 3. Prompt/hybrid enforcement modes (per-memory access checks)
9
+ * 4. Future direct access tools
10
+ *
11
+ * See agent/design/access-control-result-pattern.md
12
+ * See agent/design/local.ghost-persona-system.md
13
+ */
14
+ import type { Memory } from '../types/memory.js';
15
+ import type { AccessResult } from '../types/access-result.js';
16
+ import type { GhostConfig } from '../types/ghost-config.js';
17
+ /** Block record for a specific (accessor, memory) pair */
18
+ export interface MemoryBlock {
19
+ blocked_at: string;
20
+ reason: string;
21
+ attempt_count: number;
22
+ }
23
+ /** Attempt record for escalation tracking */
24
+ export interface AttemptRecord {
25
+ count: number;
26
+ last_attempt_at: string;
27
+ }
28
+ /**
29
+ * Provider interface for GhostConfig lookups.
30
+ * In-memory stub now, Firestore implementation in M16.
31
+ */
32
+ export interface GhostConfigProvider {
33
+ getGhostConfig(ownerUserId: string): Promise<GhostConfig | null>;
34
+ }
35
+ /**
36
+ * Provider interface for block and attempt tracking.
37
+ * In-memory stub now, Firestore implementation in M16.
38
+ */
39
+ export interface EscalationStore {
40
+ getBlock(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<MemoryBlock | null>;
41
+ setBlock(ownerUserId: string, accessorUserId: string, memoryId: string, block: MemoryBlock): Promise<void>;
42
+ removeBlock(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<void>;
43
+ getAttempts(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<AttemptRecord | null>;
44
+ incrementAttempts(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<AttemptRecord>;
45
+ }
46
+ /** Stub GhostConfig provider — returns null (ghost not configured) */
47
+ export declare class StubGhostConfigProvider implements GhostConfigProvider {
48
+ private configs;
49
+ getGhostConfig(ownerUserId: string): Promise<GhostConfig | null>;
50
+ /** Test helper: set a GhostConfig for a user */
51
+ setGhostConfig(ownerUserId: string, config: GhostConfig): void;
52
+ }
53
+ /** In-memory escalation store for development/testing */
54
+ export declare class InMemoryEscalationStore implements EscalationStore {
55
+ private blocks;
56
+ private attempts;
57
+ private key;
58
+ getBlock(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<MemoryBlock | null>;
59
+ setBlock(ownerUserId: string, accessorUserId: string, memoryId: string, block: MemoryBlock): Promise<void>;
60
+ removeBlock(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<void>;
61
+ getAttempts(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<AttemptRecord | null>;
62
+ incrementAttempts(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<AttemptRecord>;
63
+ }
64
+ /**
65
+ * Check if an accessor has permission to access a specific memory.
66
+ *
67
+ * Flow:
68
+ * 1. Self-access → always granted (owner)
69
+ * 2. Ghost not enabled → no_permission
70
+ * 3. Accessor blocked by owner → no_permission
71
+ * 4. Memory-specific block → blocked
72
+ * 5. Insufficient trust → insufficient_trust (+ penalty, possible block)
73
+ * 6. Sufficient trust → granted (trusted; trust 1.0 memories capped to existence-only by formatting layer)
74
+ */
75
+ export declare function checkMemoryAccess(accessorUserId: string, memory: Memory, ghostConfigProvider: GhostConfigProvider, escalationStore: EscalationStore): Promise<AccessResult>;
76
+ /**
77
+ * Handle an insufficient trust access attempt.
78
+ * Applies -0.1 penalty, blocks after 3 attempts.
79
+ */
80
+ export declare function handleInsufficientTrust(ownerUserId: string, accessorUserId: string, memoryId: string, requiredTrust: number, actualTrust: number, escalationStore: EscalationStore): Promise<AccessResult>;
81
+ /**
82
+ * Check if access to a specific memory is blocked.
83
+ */
84
+ export declare function isMemoryBlocked(ownerUserId: string, accessorUserId: string, memoryId: string, escalationStore: EscalationStore): Promise<boolean>;
85
+ /**
86
+ * Reset a memory-specific block (e.g., via grant_access).
87
+ */
88
+ export declare function resetBlock(ownerUserId: string, accessorUserId: string, memoryId: string, escalationStore: EscalationStore): Promise<void>;
89
+ /**
90
+ * Resolve the trust level for an accessor from GhostConfig.
91
+ *
92
+ * Priority: per_user_trust → default_friend_trust → default_public_trust → 0
93
+ *
94
+ * Note: "friend" vs "public" distinction will be determined by the calling
95
+ * context in M16 (friend list, social graph). For now, non-per_user accessors
96
+ * fall through to default_public_trust.
97
+ */
98
+ export declare function resolveAccessorTrustLevel(ghostConfig: GhostConfig, accessorUserId: string): number;
99
+ /**
100
+ * Format an AccessResult into a human-readable message.
101
+ */
102
+ export declare function formatAccessResultMessage(result: AccessResult): string;
103
+ //# sourceMappingURL=access-control.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=access-control.spec.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Credentials Provider
3
+ *
4
+ * Resolves user credentials (group memberships, permissions) from an access token.
5
+ * Currently uses a stub implementation; future: HTTP provider hitting /api/credentials/agentbase.
6
+ */
7
+ import type { CredentialsProvider, UserCredentials } from '../types/auth.js';
8
+ /**
9
+ * Stub credentials provider — returns empty group memberships.
10
+ * Used until an HTTP-based provider is wired up.
11
+ */
12
+ export declare class StubCredentialsProvider implements CredentialsProvider {
13
+ getCredentials(_accessToken: string, userId: string): Promise<UserCredentials>;
14
+ }
15
+ /**
16
+ * Factory to create the appropriate credentials provider.
17
+ * Future: reads config to pick stub vs HTTP implementation.
18
+ */
19
+ export declare function createCredentialsProvider(): CredentialsProvider;
20
+ /**
21
+ * Singleton credentials provider instance
22
+ */
23
+ export declare const credentialsProvider: CredentialsProvider;
24
+ //# sourceMappingURL=credentials-provider.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=credentials-provider.spec.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Firestore-backed Escalation Store
3
+ *
4
+ * Persists trust escalation tracking (attempt counts, blocks) to Firestore.
5
+ * Replaces InMemoryEscalationStore for production use.
6
+ *
7
+ * Firestore path: {BASE}.users/{ownerUserId}/ghost_escalation/{accessorUserId}:{memoryId}
8
+ *
9
+ * See agent/design/local.ghost-persona-system.md
10
+ */
11
+ import type { EscalationStore, MemoryBlock, AttemptRecord } from './access-control.js';
12
+ /**
13
+ * Firestore-backed escalation store for production use.
14
+ */
15
+ export declare class FirestoreEscalationStore implements EscalationStore {
16
+ getBlock(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<MemoryBlock | null>;
17
+ setBlock(ownerUserId: string, accessorUserId: string, memoryId: string, block: MemoryBlock): Promise<void>;
18
+ removeBlock(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<void>;
19
+ getAttempts(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<AttemptRecord | null>;
20
+ incrementAttempts(ownerUserId: string, accessorUserId: string, memoryId: string): Promise<AttemptRecord>;
21
+ }
22
+ //# sourceMappingURL=escalation.service.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=escalation.service.spec.d.ts.map
@@ -0,0 +1,55 @@
1
+ /**
2
+ * GhostConfig Firestore Service
3
+ *
4
+ * CRUD operations for ghost/persona configuration stored in Firestore.
5
+ * Implements GhostConfigProvider interface from access-control.ts.
6
+ *
7
+ * Firestore path: {BASE}.users/{ownerUserId}/ghost_config/settings
8
+ *
9
+ * See agent/design/local.ghost-persona-system.md
10
+ */
11
+ import type { GhostConfig } from '../types/ghost-config.js';
12
+ import type { GhostConfigProvider } from './access-control.js';
13
+ /**
14
+ * Get a user's ghost configuration.
15
+ * Returns defaults merged with stored config, or null if no config exists.
16
+ */
17
+ export declare function getGhostConfig(ownerUserId: string): Promise<GhostConfig>;
18
+ /**
19
+ * Set (upsert) a user's ghost configuration.
20
+ * Merges partial config with existing values.
21
+ */
22
+ export declare function setGhostConfigFields(ownerUserId: string, config: Partial<GhostConfig>): Promise<GhostConfig>;
23
+ /**
24
+ * Set a per-user trust level override.
25
+ */
26
+ export declare function setUserTrust(ownerUserId: string, targetUserId: string, trustLevel: number): Promise<void>;
27
+ /**
28
+ * Remove a per-user trust override (reverts to default).
29
+ */
30
+ export declare function removeUserTrust(ownerUserId: string, targetUserId: string): Promise<void>;
31
+ /**
32
+ * Block a user from ghost access.
33
+ */
34
+ export declare function blockUser(ownerUserId: string, targetUserId: string): Promise<void>;
35
+ /**
36
+ * Unblock a user from ghost access.
37
+ */
38
+ export declare function unblockUser(ownerUserId: string, targetUserId: string): Promise<void>;
39
+ /**
40
+ * Check if a user's ghost is enabled.
41
+ */
42
+ export declare function isGhostEnabled(ownerUserId: string): Promise<boolean>;
43
+ /**
44
+ * Validate a partial GhostConfig update.
45
+ * Throws if any field values are invalid.
46
+ */
47
+ export declare function validateGhostConfigUpdate(config: Partial<GhostConfig>): void;
48
+ /**
49
+ * Firestore-backed GhostConfigProvider implementation.
50
+ * Replaces StubGhostConfigProvider for production use.
51
+ */
52
+ export declare class FirestoreGhostConfigProvider implements GhostConfigProvider {
53
+ getGhostConfig(ownerUserId: string): Promise<GhostConfig | null>;
54
+ }
55
+ //# sourceMappingURL=ghost-config.service.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ghost-config.service.spec.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Space/Group Configuration Service
3
+ *
4
+ * Per-space and per-group behavioral configuration stored in Firestore.
5
+ * Controls moderation requirements, write modes, and other behavioral rules.
6
+ */
7
+ import type { WriteMode } from '../types/auth.js';
8
+ export interface SpaceConfig {
9
+ require_moderation: boolean;
10
+ default_write_mode: WriteMode;
11
+ }
12
+ export declare const DEFAULT_SPACE_CONFIG: SpaceConfig;
13
+ /**
14
+ * Get configuration for a space or group.
15
+ * Returns defaults merged with any stored config.
16
+ */
17
+ export declare function getSpaceConfig(id: string, type: 'space' | 'group'): Promise<SpaceConfig>;
18
+ /**
19
+ * Set configuration for a space or group.
20
+ * Merges partial config with existing values.
21
+ */
22
+ export declare function setSpaceConfig(id: string, type: 'space' | 'group', config: Partial<SpaceConfig>): Promise<void>;
23
+ //# sourceMappingURL=space-config.service.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=space-config.service.spec.d.ts.map
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Trust enforcement service — 3 configurable modes for cross-user memory access.
3
+ *
4
+ * - query mode (default): memories above trust threshold never returned from Weaviate
5
+ * - prompt mode: all memories returned, formatted/redacted by trust level
6
+ * - hybrid mode: query filter for trust 0.0, prompt filter for rest
7
+ *
8
+ * See agent/design/local.ghost-persona-system.md
9
+ */
10
+ import type { Memory } from '../types/memory.js';
11
+ import type { TrustEnforcementMode } from '../types/ghost-config.js';
12
+ /** Trust level thresholds mapping continuous 0-1 values to discrete behavior tiers */
13
+ export declare const TRUST_THRESHOLDS: {
14
+ readonly FULL_ACCESS: 1;
15
+ readonly PARTIAL_ACCESS: 0.75;
16
+ readonly SUMMARY_ONLY: 0.5;
17
+ readonly METADATA_ONLY: 0.25;
18
+ readonly EXISTENCE_ONLY: 0;
19
+ };
20
+ /**
21
+ * Build a Weaviate filter that restricts memories by trust score.
22
+ * Only returns memories where trust_score <= accessorTrustLevel.
23
+ *
24
+ * Trust 1.0 memories require accessor trust >= 1.0 to even appear in results.
25
+ * When they do appear, formatMemoryForPrompt caps output to existence-only.
26
+ *
27
+ * @param collection - Weaviate collection instance
28
+ * @param accessorTrustLevel - The accessor's trust level (0-1)
29
+ * @returns Weaviate filter object
30
+ */
31
+ export declare function buildTrustFilter(collection: any, accessorTrustLevel: number): any;
32
+ /**
33
+ * Formatted memory representation for prompt-level enforcement.
34
+ * Content is redacted/formatted based on trust level.
35
+ */
36
+ export interface FormattedMemory {
37
+ memory_id: string;
38
+ trust_tier: string;
39
+ content: string;
40
+ }
41
+ /**
42
+ * Format a memory for inclusion in an LLM prompt, redacted by trust level.
43
+ *
44
+ * Trust tiers:
45
+ * - 1.0 Full Access: full content, all details
46
+ * - 0.75 Partial Access: content with sensitive fields redacted
47
+ * - 0.5 Summary Only: title + summary, no content
48
+ * - 0.25 Metadata Only: type, date, tags — no content or summary
49
+ * - 0.0 Existence Only: "A memory exists about this topic"
50
+ *
51
+ * Trust 1.0 memories are always existence-only for cross-users, regardless of
52
+ * accessor trust level. Use `isSelfAccess = true` to bypass for owner access.
53
+ *
54
+ * @param memory - The memory to format
55
+ * @param accessorTrustLevel - The accessor's trust level (0-1)
56
+ * @param isSelfAccess - True if the accessor is the memory owner (bypasses trust 1.0 cap)
57
+ * @returns Formatted memory for prompt inclusion
58
+ */
59
+ export declare function formatMemoryForPrompt(memory: Memory, accessorTrustLevel: number, isSelfAccess?: boolean): FormattedMemory;
60
+ /**
61
+ * Get a human-readable label for a trust level.
62
+ */
63
+ export declare function getTrustLevelLabel(trust: number): string;
64
+ /**
65
+ * Get LLM instruction text describing what to reveal at a given trust level.
66
+ */
67
+ export declare function getTrustInstructions(trust: number): string;
68
+ /**
69
+ * Redact sensitive fields from a memory for partial access.
70
+ * Returns a copy with location, context, and references cleared.
71
+ */
72
+ export declare function redactSensitiveFields(memory: Memory, _trust: number): Memory;
73
+ /**
74
+ * Check whether an accessor's trust level is sufficient for a memory.
75
+ * Access is granted when accessorTrust >= memoryTrust.
76
+ */
77
+ export declare function isTrustSufficient(memoryTrust: number, accessorTrust: number): boolean;
78
+ /**
79
+ * Determine the enforcement mode to use.
80
+ * Convenience function that returns the mode from GhostConfig or falls back to 'query'.
81
+ */
82
+ export declare function resolveEnforcementMode(mode?: TrustEnforcementMode): TrustEnforcementMode;
83
+ //# sourceMappingURL=trust-enforcement.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=trust-enforcement.spec.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Trust validator — validation and suggestions for trust-sensitive operations.
3
+ *
4
+ * See agent/design/local.ghost-persona-system.md
5
+ */
6
+ import type { ContentType } from '../types/memory.js';
7
+ /**
8
+ * Validation result for trust assignment.
9
+ */
10
+ export interface TrustValidationResult {
11
+ valid: boolean;
12
+ warning?: string;
13
+ }
14
+ /**
15
+ * Validate a trust level assignment.
16
+ * Warns if trust < 0.25 (very private — existence-only for most accessors).
17
+ * Returns invalid for out-of-range values.
18
+ *
19
+ * @param trustLevel - The trust level being assigned (0-1)
20
+ * @param content - Optional content for context-aware validation
21
+ */
22
+ export declare function validateTrustAssignment(trustLevel: number, content?: string): TrustValidationResult;
23
+ /**
24
+ * Suggest an appropriate trust level based on content type and tags.
25
+ *
26
+ * Guidelines:
27
+ * - System/audit/action: 0.5 (internal, summary access for trusted users)
28
+ * - Personal (journal, memory, event): 0.75 (share with close friends)
29
+ * - Business (invoice, contract): 0.5 (summary only for collaborators)
30
+ * - Communication (email, conversation): 0.5 (summary only)
31
+ * - Creative/content: 0.25 (metadata for discovery, full access for trusted)
32
+ * - Default: 0.25 (conservative — metadata only)
33
+ *
34
+ * Tag overrides:
35
+ * - 'private' or 'secret': 0.1 (near-hidden)
36
+ * - 'public': 1.0 (open to all)
37
+ *
38
+ * @param contentType - The type of content
39
+ * @param tags - Optional tags that may affect suggestion
40
+ * @returns Suggested trust level (0-1)
41
+ */
42
+ export declare function suggestTrustLevel(contentType: ContentType, tags?: string[]): number;
43
+ //# sourceMappingURL=trust-validator.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=trust-validator.spec.d.ts.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tests for moderation status wiring in the publish flow.
3
+ *
4
+ * Verifies that executePublishMemory() sets moderation_status
5
+ * based on SpaceConfig.require_moderation for each destination.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=confirm-publish-moderation.spec.d.ts.map
@@ -3,8 +3,15 @@
3
3
  *
4
4
  * Generic confirmation tool that executes any pending action.
5
5
  * This is the second phase of the confirmation workflow.
6
+ *
7
+ * Memory Collection Pattern v2:
8
+ * - Multi-space publication to Memory_spaces_public
9
+ * - Multi-group publication to Memory_groups_{groupId}
10
+ * - Composite IDs ({userId}.{memoryId}) for published memories
11
+ * - Tracking arrays (space_ids, group_ids) on source and published memories
6
12
  */
7
13
  import type { Tool } from '@modelcontextprotocol/sdk/types.js';
14
+ import type { AuthContext } from '../types/auth.js';
8
15
  /**
9
16
  * Tool definition for remember_confirm
10
17
  *
@@ -27,6 +34,6 @@ interface ConfirmArgs {
27
34
  /**
28
35
  * Handle remember_confirm tool execution
29
36
  */
30
- export declare function handleConfirm(args: ConfirmArgs, userId: string): Promise<string>;
37
+ export declare function handleConfirm(args: ConfirmArgs, userId: string, authContext?: AuthContext): Promise<string>;
31
38
  export {};
32
39
  //# sourceMappingURL=confirm.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * Creates a new memory in the user's collection
4
4
  */
5
5
  import type { ContentType, MemoryContext } from '../types/memory.js';
6
+ import type { AuthContext } from '../types/auth.js';
6
7
  /**
7
8
  * Tool definition for remember_create_memory
8
9
  */
@@ -109,5 +110,5 @@ export interface CreateMemoryResult {
109
110
  /**
110
111
  * Handle remember_create_memory tool
111
112
  */
112
- export declare function handleCreateMemory(args: CreateMemoryArgs, userId: string, context?: Partial<MemoryContext>): Promise<string>;
113
+ export declare function handleCreateMemory(args: CreateMemoryArgs, userId: string, authContext?: AuthContext, context?: Partial<MemoryContext>): Promise<string>;
113
114
  //# sourceMappingURL=create-memory.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Unit tests for remember_create_memory and remember_update_memory tools (Task 170)
3
+ *
4
+ * Tests cover:
5
+ * - Tool definition schemas
6
+ * - Tracking arrays (space_ids, group_ids) are NOT user-settable via input schema
7
+ * - Required fields and optional fields
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=create-memory.spec.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * Create a relationship connecting 2...N memories
4
4
  */
5
5
  import type { MemoryContext } from '../types/memory.js';
6
+ import type { AuthContext } from '../types/auth.js';
6
7
  /**
7
8
  * Tool definition for remember_create_relationship
8
9
  */
@@ -75,5 +76,5 @@ export interface CreateRelationshipResult {
75
76
  /**
76
77
  * Handle remember_create_relationship tool
77
78
  */
78
- export declare function handleCreateRelationship(args: CreateRelationshipArgs, userId: string, context?: Partial<MemoryContext>): Promise<string>;
79
+ export declare function handleCreateRelationship(args: CreateRelationshipArgs, userId: string, authContext?: AuthContext, context?: Partial<MemoryContext>): Promise<string>;
79
80
  //# sourceMappingURL=create-relationship.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * Request to delete a memory (requires confirmation)
4
4
  */
5
5
  import type { Tool } from '@modelcontextprotocol/sdk/types.js';
6
+ import type { AuthContext } from '../types/auth.js';
6
7
  /**
7
8
  * Tool definition for remember_delete_memory
8
9
  */
@@ -18,5 +19,5 @@ export interface DeleteMemoryArgs {
18
19
  * Handle remember_delete_memory tool
19
20
  * Creates confirmation token and returns preview
20
21
  */
21
- export declare function handleDeleteMemory(args: DeleteMemoryArgs, userId: string): Promise<string>;
22
+ export declare function handleDeleteMemory(args: DeleteMemoryArgs, userId: string, authContext?: AuthContext): Promise<string>;
22
23
  //# sourceMappingURL=delete-memory.d.ts.map
@@ -2,6 +2,7 @@
2
2
  * remember_delete_relationship tool
3
3
  * Delete a relationship and clean up references in connected memories
4
4
  */
5
+ import type { AuthContext } from '../types/auth.js';
5
6
  /**
6
7
  * Tool definition for remember_delete_relationship
7
8
  */
@@ -37,5 +38,5 @@ export interface DeleteRelationshipResult {
37
38
  /**
38
39
  * Handle remember_delete_relationship tool
39
40
  */
40
- export declare function handleDeleteRelationship(args: DeleteRelationshipArgs, userId: string): Promise<string>;
41
+ export declare function handleDeleteRelationship(args: DeleteRelationshipArgs, userId: string, authContext?: AuthContext): Promise<string>;
41
42
  //# sourceMappingURL=delete-relationship.d.ts.map
@@ -4,6 +4,7 @@
4
4
  * Generic denial tool for any pending action.
5
5
  */
6
6
  import type { Tool } from '@modelcontextprotocol/sdk/types.js';
7
+ import type { AuthContext } from '../types/auth.js';
7
8
  /**
8
9
  * Tool definition for remember_deny
9
10
  *
@@ -26,6 +27,6 @@ interface DenyArgs {
26
27
  /**
27
28
  * Handle remember_deny tool execution
28
29
  */
29
- export declare function handleDeny(args: DenyArgs, userId: string): Promise<string>;
30
+ export declare function handleDeny(args: DenyArgs, userId: string, authContext?: AuthContext): Promise<string>;
30
31
  export {};
31
32
  //# sourceMappingURL=deny.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * Find similar memories using vector similarity search
4
4
  */
5
5
  import type { Memory, DeletedFilter } from '../types/memory.js';
6
+ import type { AuthContext } from '../types/auth.js';
6
7
  /**
7
8
  * Tool definition for remember_find_similar
8
9
  */
@@ -80,5 +81,5 @@ export interface FindSimilarResult {
80
81
  /**
81
82
  * Handle remember_find_similar tool
82
83
  */
83
- export declare function handleFindSimilar(args: FindSimilarArgs, userId: string): Promise<string>;
84
+ export declare function handleFindSimilar(args: FindSimilarArgs, userId: string, authContext?: AuthContext): Promise<string>;
84
85
  //# sourceMappingURL=find-similar.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * Retrieve user preferences with defaults
4
4
  */
5
5
  import { UserPreferences, PreferenceCategory } from '../types/preferences.js';
6
+ import type { AuthContext } from '../types/auth.js';
6
7
  /**
7
8
  * Tool definition for remember_get_preferences
8
9
  */
@@ -37,5 +38,5 @@ export interface GetPreferencesResult {
37
38
  /**
38
39
  * Handle remember_get_preferences tool
39
40
  */
40
- export declare function handleGetPreferences(args: GetPreferencesArgs, userId: string): Promise<string>;
41
+ export declare function handleGetPreferences(args: GetPreferencesArgs, userId: string, authContext?: AuthContext): Promise<string>;
41
42
  //# sourceMappingURL=get-preferences.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * remember_ghost_config tool
3
+ *
4
+ * Manage ghost/persona configuration: enable/disable ghost,
5
+ * set trust defaults, manage per-user trust, block/unblock users.
6
+ */
7
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
8
+ import type { AuthContext } from '../types/auth.js';
9
+ import type { TrustEnforcementMode } from '../types/ghost-config.js';
10
+ type GhostConfigAction = 'get' | 'set' | 'set_trust' | 'remove_trust' | 'block' | 'unblock';
11
+ export declare const ghostConfigTool: Tool;
12
+ interface GhostConfigArgs {
13
+ action: GhostConfigAction;
14
+ enabled?: boolean;
15
+ public_ghost_enabled?: boolean;
16
+ default_friend_trust?: number;
17
+ default_public_trust?: number;
18
+ enforcement_mode?: TrustEnforcementMode;
19
+ target_user_id?: string;
20
+ trust_level?: number;
21
+ }
22
+ /**
23
+ * Handle remember_ghost_config tool
24
+ */
25
+ export declare function handleGhostConfig(args: GhostConfigArgs, userId: string, authContext?: AuthContext): Promise<string>;
26
+ export {};
27
+ //# sourceMappingURL=ghost-config.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ghost-config.spec.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * remember_moderate tool
3
+ *
4
+ * Allows moderators to approve, reject, or remove published memories
5
+ * in spaces and groups. Requires can_moderate permission.
6
+ */
7
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
8
+ import type { AuthContext } from '../types/auth.js';
9
+ type ModerationAction = 'approve' | 'reject' | 'remove';
10
+ export declare const moderateTool: Tool;
11
+ interface ModerateArgs {
12
+ memory_id: string;
13
+ space_id?: string;
14
+ group_id?: string;
15
+ action: ModerationAction;
16
+ reason?: string;
17
+ }
18
+ export declare function handleModerate(args: ModerateArgs, userId: string, authContext?: AuthContext): Promise<string>;
19
+ export {};
20
+ //# sourceMappingURL=moderate.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for remember_moderate tool.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=moderate.spec.d.ts.map
@@ -1,22 +1,30 @@
1
1
  /**
2
2
  * remember_publish tool
3
3
  *
4
- * Generates a confirmation token for publishing a memory to a shared space.
4
+ * Generates a confirmation token for publishing a memory to shared spaces and/or groups.
5
5
  * This is the first phase of the two-phase publish workflow.
6
+ *
7
+ * Memory Collection Pattern v2:
8
+ * - Supports multi-space publication to Memory_spaces_public
9
+ * - Supports multi-group publication to Memory_groups_{groupId}
10
+ * - Uses composite IDs ({userId}.{memoryId}) for published memories
11
+ * - Maintains tracking arrays (space_ids, group_ids) on source memory
6
12
  */
7
13
  import type { Tool } from '@modelcontextprotocol/sdk/types.js';
14
+ import type { AuthContext } from '../types/auth.js';
8
15
  /**
9
16
  * Tool definition for remember_publish
10
17
  */
11
18
  export declare const publishTool: Tool;
12
19
  interface PublishArgs {
13
20
  memory_id: string;
14
- spaces: string[];
21
+ spaces?: string[];
22
+ groups?: string[];
15
23
  additional_tags?: string[];
16
24
  }
17
25
  /**
18
26
  * Handle remember_publish tool execution
19
27
  */
20
- export declare function handlePublish(args: PublishArgs, userId: string): Promise<string>;
28
+ export declare function handlePublish(args: PublishArgs, userId: string, authContext?: AuthContext): Promise<string>;
21
29
  export {};
22
30
  //# sourceMappingURL=publish.d.ts.map