@prmichaelsen/remember-mcp 3.0.0 → 3.12.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 +338 -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,621 @@
1
+ # Memory Collection Pattern v2 — API Reference
2
+
3
+ **Concept**: Complete API documentation for all v2 MCP tools
4
+ **Created**: 2026-02-27
5
+ **Status**: Implemented
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This document provides complete API reference for the 6 implemented tools and 2 proposed tools in Memory Collection Pattern v2. Each tool listing includes input schema, output format, error cases, and usage examples.
12
+
13
+ All tools operate on the three-tier collection structure:
14
+ - `Memory_users_{userId}` — Private user memories (simple IDs)
15
+ - `Memory_spaces_public` — All public space memories (composite IDs)
16
+ - `Memory_groups_{groupId}` — Group memories (composite IDs)
17
+
18
+ ---
19
+
20
+ ## Tools
21
+
22
+ ### remember_create_memory
23
+
24
+ Creates a new memory in the user's personal collection.
25
+
26
+ **Input Schema**:
27
+
28
+ | Parameter | Type | Required | Default | Description |
29
+ |-----------|------|----------|---------|-------------|
30
+ | `content` | string | Yes | — | Memory content (MUST be exact user-provided text) |
31
+ | `title` | string | No | — | Short title |
32
+ | `type` | string | No | `"note"` | Content type (note, event, person, recipe, etc.) |
33
+ | `weight` | number | No | `0.5` | Significance/priority (0-1) |
34
+ | `trust` | number | No | `0.5` | Access control level (0-1) |
35
+ | `tags` | string[] | No | `[]` | Tags for organization |
36
+ | `references` | string[] | No | `[]` | Source URLs |
37
+ | `template_id` | string | No | — | Template ID to use |
38
+ | `skip_template_suggestion` | boolean | No | `false` | Skip template suggestion |
39
+ | `parent_id` | string | No | `null` | Parent memory ID for threading |
40
+ | `thread_root_id` | string | No | `null` | Root memory ID for thread |
41
+ | `moderation_flags` | string[] | No | `[]` | Format: `"{space_id}:{flag_type}"` |
42
+
43
+ **v2 Behavior**: New memories are initialized with empty tracking arrays (`space_ids: []`, `group_ids: []`). These arrays are managed exclusively by `remember_publish` and `remember_retract`.
44
+
45
+ **Output**:
46
+ ```json
47
+ {
48
+ "memory_id": "generated-uuid",
49
+ "created_at": "2026-02-27T12:34:56.000Z",
50
+ "message": "Memory created successfully with ID: generated-uuid"
51
+ }
52
+ ```
53
+
54
+ **Example**:
55
+ ```
56
+ remember_create_memory({
57
+ content: "Grandma's famous pasta recipe with secret ingredient",
58
+ type: "recipe",
59
+ tags: ["cooking", "family"],
60
+ weight: 0.8
61
+ })
62
+ ```
63
+
64
+ ---
65
+
66
+ ### remember_update_memory
67
+
68
+ Updates an existing memory with partial updates. Version incremented automatically.
69
+
70
+ **Input Schema**:
71
+
72
+ | Parameter | Type | Required | Default | Description |
73
+ |-----------|------|----------|---------|-------------|
74
+ | `memory_id` | string | Yes | — | ID of memory to update |
75
+ | `content` | string | No | — | Updated content |
76
+ | `title` | string | No | — | Updated title |
77
+ | `type` | string | No | — | Updated content type |
78
+ | `weight` | number | No | — | Updated significance (0-1) |
79
+ | `trust` | number | No | — | Updated access level (0-1) |
80
+ | `tags` | string[] | No | — | Updated tags (replaces existing) |
81
+ | `references` | string[] | No | — | Updated URLs (replaces existing) |
82
+ | `structured_content` | object | No | — | Updated structured content |
83
+ | `parent_id` | string | No | — | Updated parent ID |
84
+ | `thread_root_id` | string | No | — | Updated thread root ID |
85
+ | `moderation_flags` | string[] | No | — | Updated moderation flags |
86
+
87
+ **v2 Behavior**: `space_ids` and `group_ids` are intentionally NOT exposed — managed exclusively by `remember_publish`/`remember_retract`. Existing tracking arrays are preserved on update via spread.
88
+
89
+ **Output**:
90
+ ```json
91
+ {
92
+ "memory_id": "memory-id",
93
+ "updated_at": "2026-02-27T12:34:56.000Z",
94
+ "version": 2,
95
+ "updated_fields": ["content", "title"],
96
+ "message": "Memory updated successfully. Updated fields: content, title"
97
+ }
98
+ ```
99
+
100
+ **Validation**:
101
+ - Memory must exist and be owned by user
102
+ - Memory must not be soft-deleted
103
+ - At least one field must be provided
104
+ - Content type, weight, trust validated if provided
105
+
106
+ **Error Cases**:
107
+ - `Memory not found` — Invalid memory_id
108
+ - `Ownership verification failed` — User doesn't own this memory
109
+ - `Memory is soft-deleted` — Cannot update deleted memories
110
+ - `Invalid content type` — Unrecognized content type
111
+ - `No fields provided` — Must update at least one field
112
+
113
+ ---
114
+
115
+ ### remember_publish
116
+
117
+ Publishes a memory to one or more shared spaces and/or groups. Uses two-phase confirmation flow.
118
+
119
+ **Input Schema**:
120
+
121
+ | Parameter | Type | Required | Default | Description |
122
+ |-----------|------|----------|---------|-------------|
123
+ | `memory_id` | string | Yes | — | ID of memory from personal collection |
124
+ | `spaces` | string[] | No | `["the_void"]` | Spaces to publish to (must be in SUPPORTED_SPACES) |
125
+ | `groups` | string[] | No | `[]` | Group IDs to publish to |
126
+ | `additional_tags` | string[] | No | `[]` | Extra tags for discovery |
127
+
128
+ **Confirmation Flow**: Returns a token that must be confirmed via `remember_confirm` before the publish executes.
129
+
130
+ **Output** (token generation):
131
+ ```json
132
+ {
133
+ "success": true,
134
+ "token": "<confirmation_token>"
135
+ }
136
+ ```
137
+
138
+ **What happens on confirmation**:
139
+ 1. Memory is COPIED (not moved) from `Memory_users_{userId}` to target collections
140
+ 2. Composite ID `{userId}.{memoryId}` is generated for published copies
141
+ 3. Source memory's `space_ids` and `group_ids` arrays are updated
142
+ 4. `published_at` timestamp is set on copies
143
+
144
+ **Validation**:
145
+ - At least one destination (space or group) required
146
+ - Space IDs must be in SUPPORTED_SPACES enum
147
+ - Group IDs must not contain dots or be empty
148
+ - Memory must exist and be owned by user
149
+ - Only memories (not relationships) can be published
150
+
151
+ **Error Cases**:
152
+ - `No destinations provided` — Both spaces and groups are empty
153
+ - `Invalid space IDs` — Not in SUPPORTED_SPACES
154
+ - `Invalid group IDs` — Contains dots or whitespace
155
+ - `Memory not found` — Invalid memory_id
156
+ - `Ownership verification failed` — User doesn't own this memory
157
+
158
+ **Example**:
159
+ ```
160
+ remember_publish({
161
+ memory_id: "my-recipe",
162
+ spaces: ["cooking", "recipes"],
163
+ groups: ["foodie-group"],
164
+ additional_tags: ["pasta", "italian"]
165
+ })
166
+ ```
167
+
168
+ ---
169
+
170
+ ### remember_retract
171
+
172
+ Retracts a memory from specific spaces and/or groups. Uses two-phase confirmation flow with orphan strategy.
173
+
174
+ **Input Schema**:
175
+
176
+ | Parameter | Type | Required | Default | Description |
177
+ |-----------|------|----------|---------|-------------|
178
+ | `memory_id` | string | Yes | — | ID of memory to retract |
179
+ | `spaces` | string[] | No | `[]` | Spaces to retract from |
180
+ | `groups` | string[] | No | `[]` | Group IDs to retract from |
181
+
182
+ **Orphan Strategy**: Retracted memories remain in target collections with cleared tracking arrays. They are kept for historical reference (e.g., if other users commented on them).
183
+
184
+ **Output** (token generation):
185
+ ```json
186
+ {
187
+ "success": true,
188
+ "message": "Retraction request created. Please confirm to proceed.",
189
+ "action": "retract_memory",
190
+ "memory_id": "my-recipe",
191
+ "destinations": "spaces: cooking, recipes; groups: foodie-group",
192
+ "retraction_details": {
193
+ "spaces": {
194
+ "action": "orphan",
195
+ "description": "Memory will remain in Memory_spaces_public with updated tracking arrays",
196
+ "spaces": ["cooking", "recipes"]
197
+ },
198
+ "groups": {
199
+ "action": "orphan",
200
+ "description": "Memory will remain in Memory_groups_{groupId} with updated tracking arrays",
201
+ "groups": ["foodie-group"]
202
+ }
203
+ },
204
+ "confirmation_required": true
205
+ }
206
+ ```
207
+
208
+ **What happens on confirmation**:
209
+ 1. Published copy's `space_ids`/`group_ids` arrays are updated (retracted spaces/groups removed)
210
+ 2. Source memory's tracking arrays are updated
211
+ 3. Published copies remain in collections (orphaned, not deleted)
212
+
213
+ **Validation**:
214
+ - At least one destination required
215
+ - Group IDs must not contain dots
216
+ - Memory must exist and be owned by user
217
+ - Memory must be currently published to specified destinations
218
+
219
+ **Example**:
220
+ ```
221
+ remember_retract({
222
+ memory_id: "my-recipe",
223
+ spaces: ["cooking"]
224
+ })
225
+ ```
226
+
227
+ ---
228
+
229
+ ### remember_revise
230
+
231
+ Syncs updated content from source memory to all published copies. Uses two-phase confirmation flow.
232
+
233
+ **Input Schema**:
234
+
235
+ | Parameter | Type | Required | Default | Description |
236
+ |-----------|------|----------|---------|-------------|
237
+ | `memory_id` | string | Yes | — | ID of source memory to sync |
238
+
239
+ **Confirmation Flow**: Returns a token that must be confirmed via `remember_confirm` before the revision executes.
240
+
241
+ **Output** (token generation):
242
+ ```json
243
+ {
244
+ "success": true,
245
+ "token": "<confirmation_token>",
246
+ "message": "Revision request created. Please confirm to sync content to all published copies.",
247
+ "action": "revise_memory",
248
+ "memory_id": "my-recipe",
249
+ "destinations": "spaces: cooking, recipes; groups: foodie-group",
250
+ "revision_details": {
251
+ "space_ids": ["cooking", "recipes"],
252
+ "group_ids": ["foodie-group"],
253
+ "total_locations": 2
254
+ },
255
+ "confirmation_required": true
256
+ }
257
+ ```
258
+
259
+ **Output** (after confirmation):
260
+ ```json
261
+ {
262
+ "success": true,
263
+ "composite_id": "user123.my-recipe",
264
+ "revised_at": "2026-02-27T12:34:56.000Z",
265
+ "summary": {
266
+ "total": 2,
267
+ "success": 2,
268
+ "failed": 0,
269
+ "skipped": 0
270
+ },
271
+ "results": [
272
+ { "location": "Memory_spaces_public", "status": "success" },
273
+ { "location": "Memory_groups_foodie-group", "status": "success" }
274
+ ]
275
+ }
276
+ ```
277
+
278
+ **Revision History**: Previous content is preserved in `revision_history` (max 10 entries). Each entry contains `{ content: string, revised_at: string }`.
279
+
280
+ **What happens on confirmation**:
281
+ 1. Fetches source memory from `Memory_users_{userId}`
282
+ 2. For each space in `space_ids` → updates `Memory_spaces_public`
283
+ 3. For each group in `group_ids` → updates `Memory_groups_{groupId}`
284
+ 4. Each update: old content → `revision_history`, `revision_count++`, `revised_at` set
285
+
286
+ **Validation**:
287
+ - Source memory must exist and be owned by user
288
+ - Memory must be published to at least one location
289
+
290
+ **Supports partial success** — some locations may fail while others succeed.
291
+
292
+ **Example** (typical workflow):
293
+ ```
294
+ // 1. Update source memory
295
+ remember_update_memory({
296
+ memory_id: "my-recipe",
297
+ content: "Updated recipe with new secret ingredient"
298
+ })
299
+
300
+ // 2. Request revision (generates token)
301
+ remember_revise({ memory_id: "my-recipe" })
302
+ // → { success: true, token: "tok_xyz", ... }
303
+
304
+ // 3. Confirm revision
305
+ remember_confirm({ token: "tok_xyz" })
306
+ // → { success: true, summary: { total: 2, success: 2, ... } }
307
+ ```
308
+
309
+ ---
310
+
311
+ ### remember_search_space
312
+
313
+ Searches shared spaces and/or groups to discover memories from other users.
314
+
315
+ **Input Schema**:
316
+
317
+ | Parameter | Type | Required | Default | Description |
318
+ |-----------|------|----------|---------|-------------|
319
+ | `query` | string | Yes | — | Search query |
320
+ | `spaces` | string[] | No | — | Spaces to search (omit for all-public) |
321
+ | `groups` | string[] | No | — | Group IDs to search |
322
+ | `search_type` | enum | No | `"hybrid"` | `"hybrid"`, `"bm25"`, or `"semantic"` |
323
+ | `content_type` | string | No | — | Filter by content type |
324
+ | `tags` | string[] | No | — | Filter by tags (AND semantics) |
325
+ | `min_weight` | number | No | — | Minimum significance (0-1) |
326
+ | `max_weight` | number | No | — | Maximum significance (0-1) |
327
+ | `date_from` | string | No | — | ISO 8601 minimum date |
328
+ | `date_to` | string | No | — | ISO 8601 maximum date |
329
+ | `include_comments` | boolean | No | `false` | Include comments in results |
330
+ | `limit` | number | No | `10` | Max results |
331
+ | `offset` | number | No | `0` | Pagination offset |
332
+
333
+ **Search Behavior**:
334
+ - If `spaces` provided → searches `Memory_spaces_public` filtered by `space_ids.containsAny()`
335
+ - If `groups` provided → searches each `Memory_groups_{groupId}` separately
336
+ - If neither → searches all of `Memory_spaces_public` (all-public fallback)
337
+ - Results are merged, deduplicated by UUID, and sorted by relevance score
338
+
339
+ **Search Types**:
340
+ - `hybrid` — Combined BM25 keyword + semantic vector search (default, recommended)
341
+ - `bm25` — Keyword-only search
342
+ - `semantic` — Vector-only search via `nearText()`
343
+
344
+ **Base Filters** (always applied):
345
+ - Excludes soft-deleted memories (`deleted_at IS NULL`)
346
+ - Only returns memories (`doc_type = 'memory'`)
347
+ - Excludes comments unless `include_comments: true`
348
+
349
+ **Output**:
350
+ ```json
351
+ {
352
+ "spaces_searched": ["cooking", "recipes"],
353
+ "groups_searched": ["foodie-group"],
354
+ "query": "pasta recipe",
355
+ "search_type": "hybrid",
356
+ "memories": [
357
+ {
358
+ "id": "user123.my-recipe",
359
+ "content": "Grandma's famous pasta recipe...",
360
+ "title": "Secret Pasta",
361
+ "weight": 0.8,
362
+ "_score": 0.95
363
+ }
364
+ ],
365
+ "total": 1,
366
+ "offset": 0,
367
+ "limit": 10
368
+ }
369
+ ```
370
+
371
+ **Example**:
372
+ ```
373
+ // Search specific space
374
+ remember_search_space({
375
+ query: "pasta recipe",
376
+ spaces: ["cooking"],
377
+ search_type: "hybrid",
378
+ tags: ["italian"],
379
+ limit: 20
380
+ })
381
+
382
+ // Search group
383
+ remember_search_space({
384
+ query: "meeting notes",
385
+ groups: ["team-alpha"]
386
+ })
387
+
388
+ // Search all public memories
389
+ remember_search_space({
390
+ query: "hiking trails"
391
+ })
392
+ ```
393
+
394
+ ---
395
+
396
+ ### remember_sync *(Proposed)*
397
+
398
+ Detects conflicts between a source memory and its published copies. Call before `remember_revise` in shared-editing contexts to check for divergent content.
399
+
400
+ **Status**: Proposal — depends on shared write permission system (M7 Trust & Permissions)
401
+
402
+ **Input Schema**:
403
+
404
+ | Parameter | Type | Required | Default | Description |
405
+ |-----------|------|----------|---------|-------------|
406
+ | `memory_id` | string | Yes | — | Source memory ID from personal collection |
407
+ | `location` | string | No | — | Specific location to sync (omit for all published locations) |
408
+
409
+ **Output — Clean** (no conflicts):
410
+ ```json
411
+ {
412
+ "status": "clean",
413
+ "message": "Published copies are in sync. Safe to remember_revise.",
414
+ "locations_checked": 3
415
+ }
416
+ ```
417
+
418
+ **Output — Conflict detected**:
419
+ ```json
420
+ {
421
+ "status": "conflict",
422
+ "message": "Published copy has been modified since your last revision.",
423
+ "conflicts": [
424
+ {
425
+ "location": "Memory_spaces_public",
426
+ "local_content": "Your version...",
427
+ "remote_content": "Published version (modified by user456)...",
428
+ "local_updated_at": "2026-02-27T10:00:00Z",
429
+ "remote_revised_at": "2026-02-27T11:30:00Z",
430
+ "remote_revised_by": "user456"
431
+ }
432
+ ],
433
+ "merge_options": ["keep_local", "keep_remote", "manual"]
434
+ }
435
+ ```
436
+
437
+ **Conflict Detection Logic**:
438
+ - If published `revised_at` > source `updated_at` → **CONFLICT** (someone else revised the published copy)
439
+ - If source content === published content → **CLEAN** (already in sync)
440
+ - If source `updated_at` > published `revised_at` and content differs → **CLEAN** (user's own changes pending)
441
+
442
+ **Merge Strategies**:
443
+ - `keep_local` — Use source memory content, discard remote changes, then call `remember_revise`
444
+ - `keep_remote` — Update source memory from published copy content (no revise needed)
445
+ - `manual` — User edits source memory to reconcile, then calls `remember_revise`
446
+
447
+ **Validation**:
448
+ - Source memory must exist and be owned by user
449
+ - Memory must be published to at least one location
450
+
451
+ **Error Cases**:
452
+ - `Memory not found` — Invalid memory_id
453
+ - `Ownership verification failed` — User doesn't own this memory
454
+ - `Not published` — Memory has no published copies to sync
455
+
456
+ **Example**:
457
+ ```
458
+ // Check for conflicts before revising
459
+ remember_sync({ memory_id: "my-recipe" })
460
+ // → { status: "clean", locations_checked: 2 }
461
+
462
+ // Safe to revise
463
+ remember_revise({ memory_id: "my-recipe" })
464
+
465
+ // Or if conflict detected:
466
+ remember_sync({ memory_id: "my-recipe" })
467
+ // → { status: "conflict", conflicts: [...], merge_options: [...] }
468
+ // User resolves conflict, then revises
469
+ ```
470
+
471
+ ---
472
+
473
+ ### remember_overwrite *(Proposed)*
474
+
475
+ Force-replaces published copies with source memory content, bypassing conflict detection. Requires overwrite permission on the target document. Uses two-phase confirmation flow.
476
+
477
+ **Status**: Proposal — depends on shared write permission system (M7 Trust & Permissions)
478
+
479
+ **Input Schema**:
480
+
481
+ | Parameter | Type | Required | Default | Description |
482
+ |-----------|------|----------|---------|-------------|
483
+ | `memory_id` | string | Yes | — | Source memory ID from personal collection |
484
+ | `locations` | object | No | — | Specific locations to overwrite (omit for all) |
485
+ | `locations.spaces` | string[] | No | — | Spaces to overwrite |
486
+ | `locations.groups` | string[] | No | — | Groups to overwrite |
487
+
488
+ **Confirmation Flow**: Returns a token that must be confirmed via `remember_confirm` before the overwrite executes.
489
+
490
+ **Output** (token generation):
491
+ ```json
492
+ {
493
+ "success": true,
494
+ "token": "<confirmation_token>",
495
+ "message": "Overwrite request created. This will replace published content unconditionally.",
496
+ "action": "overwrite_memory",
497
+ "memory_id": "my-recipe",
498
+ "warning": "This will discard any remote changes made by other users.",
499
+ "confirmation_required": true
500
+ }
501
+ ```
502
+
503
+ **What happens on confirmation**:
504
+ 1. Source memory content replaces published copy content unconditionally
505
+ 2. Old published content preserved in `revision_history` (max 10 entries)
506
+ 3. `revision_count` incremented, `revised_at` updated
507
+ 4. `last_revised_by` set to overwriting user's ID
508
+
509
+ **Permission Model**: Overwrite permission is a document-level flag. Only the original author or users with explicit overwrite access can use this tool.
510
+
511
+ **Validation**:
512
+ - Source memory must exist and be owned by user
513
+ - Memory must be published to at least one location
514
+ - User must have overwrite permission on the target document
515
+
516
+ **Error Cases**:
517
+ - `Memory not found` — Invalid memory_id
518
+ - `Ownership verification failed` — User doesn't own this memory
519
+ - `Not published` — Memory has no published copies
520
+ - `Permission denied` — User lacks overwrite permission on target
521
+
522
+ **Example**:
523
+ ```
524
+ // Force-replace all published copies
525
+ remember_overwrite({ memory_id: "my-recipe" })
526
+ // → { success: true, token: "tok_xyz", warning: "..." }
527
+
528
+ remember_confirm({ token: "tok_xyz" })
529
+ // → Published copies replaced unconditionally
530
+
531
+ // Overwrite specific locations only
532
+ remember_overwrite({
533
+ memory_id: "my-recipe",
534
+ locations: { spaces: ["cooking"] }
535
+ })
536
+ ```
537
+
538
+ ---
539
+
540
+ ## Utility Modules
541
+
542
+ ### Composite IDs (`src/collections/composite-ids.ts`)
543
+
544
+ Format: `{userId}.{memoryId}` (e.g., `user123.my-recipe`)
545
+
546
+ | Function | Signature | Description |
547
+ |----------|-----------|-------------|
548
+ | `generateCompositeId` | `(userId, memoryId) → string` | Creates composite ID |
549
+ | `parseCompositeId` | `(compositeId) → { userId, memoryId }` | Splits into components |
550
+ | `isCompositeId` | `(id) → boolean` | Checks format validity |
551
+ | `belongsToUser` | `(compositeId, userId) → boolean` | Ownership check |
552
+ | `getUserIdFromComposite` | `(compositeId) → string` | Extracts userId |
553
+ | `getMemoryIdFromComposite` | `(compositeId) → string` | Extracts memoryId |
554
+
555
+ Constraints: No dots allowed in userId or memoryId components.
556
+
557
+ ### Tracking Arrays (`src/collections/tracking-arrays.ts`)
558
+
559
+ All functions are immutable (return new objects).
560
+
561
+ | Function | Signature | Description |
562
+ |----------|-----------|-------------|
563
+ | `addToSpaceIds` | `(memory, spaceId) → memory` | Add space (deduped) |
564
+ | `removeFromSpaceIds` | `(memory, spaceId) → memory` | Remove space |
565
+ | `addToGroupIds` | `(memory, groupId) → memory` | Add group (deduped) |
566
+ | `removeFromGroupIds` | `(memory, groupId) → memory` | Remove group |
567
+ | `addMultipleSpaceIds` | `(memory, spaceIds[]) → memory` | Bulk add (O(n+m) Set) |
568
+ | `addMultipleGroupIds` | `(memory, groupIds[]) → memory` | Bulk add (O(n+m) Set) |
569
+ | `isPublished` | `(memory) → boolean` | Any publications? |
570
+ | `isPublishedToSpace` | `(memory, spaceId) → boolean` | Published to space? |
571
+ | `isPublishedToGroup` | `(memory, groupId) → boolean` | Published to group? |
572
+ | `getPublishedLocations` | `(memory) → { spaces, groups }` | All locations |
573
+ | `getPublishedCount` | `(memory) → number` | Total count |
574
+ | `initializeTracking` | `(memory) → memory` | Ensure arrays exist |
575
+
576
+ ### Dot Notation (`src/collections/dot-notation.ts`)
577
+
578
+ | Function | Signature | Description |
579
+ |----------|-----------|-------------|
580
+ | `getCollectionName` | `(type, id?) → string` | Build collection name |
581
+ | `parseCollectionName` | `(name) → { type, id, name }` | Parse collection name |
582
+ | `validateCollectionName` | `(name) → boolean` | Validate format |
583
+ | `isUserCollection` | `(name) → boolean` | Is `Memory_users_*`? |
584
+ | `isSpacesCollection` | `(name) → boolean` | Is `Memory_spaces_public`? |
585
+ | `isGroupCollection` | `(name) → boolean` | Is `Memory_groups_*`? |
586
+
587
+ Collection types: `USERS`, `SPACES`, `GROUPS`
588
+
589
+ ---
590
+
591
+ ---
592
+
593
+ ## Upcoming: Memory-Level ACL Fields
594
+
595
+ Four new fields will be added to `PUBLISHED_MEMORY_PROPERTIES` to support collaborative editing and group-based permissions:
596
+
597
+ | Field | Type | Default | Purpose |
598
+ |-------|------|---------|---------|
599
+ | `write_mode` | text | `null` (→ `"owner_only"`) | Controls who can revise: `"owner_only"` / `"group_editors"` / `"anyone"` |
600
+ | `overwrite_allowed_ids` | text[] | `[]` | Per-memory explicit overwrite grants (user IDs) |
601
+ | `last_revised_by` | text | `null` | User ID of last reviser — enables conflict detection |
602
+ | `owner_id` | text | `null` (→ `author_id`) | Supports ownership transfer |
603
+
604
+ All fields are nullable with zero-migration deployment. Existing memories continue to work unchanged (`write_mode: null` → `"owner_only"` semantics).
605
+
606
+ **Impact on existing tools**:
607
+ - `remember_publish` — can optionally set `write_mode` and `owner_id`
608
+ - `remember_revise` — sets `last_revised_by`, checks write permissions
609
+ - `remember_overwrite` — checks overwrite permissions via `overwrite_allowed_ids` and group credentials
610
+ - `remember_sync` — uses `last_revised_by` for conflict detection
611
+
612
+ See [Memory ACL Schema](local.memory-acl-schema.md) for full specification.
613
+
614
+ ---
615
+
616
+ **Status**: Implemented (v3.1.0–v3.7.0), with 2 proposed tools (remember_sync, remember_overwrite)
617
+ **Recommendation**: Reference this document when integrating with remember-mcp v2 tools
618
+ **Related Documents**:
619
+ - [Memory Collection Pattern v2](local.memory-collection-pattern-v2.md) — Architecture and design rationale
620
+ - [Collaborative Memory Sync](local.collaborative-memory-sync.md) — Design proposal for remember_sync and remember_overwrite
621
+ - [Memory ACL Schema](local.memory-acl-schema.md) — Memory-level access control fields and permission resolution