@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,258 @@
1
+ # Task 173: Documentation and Examples
2
+
3
+ **Milestone**: Milestone 14 - Memory Collection Pattern v2
4
+ **Estimated Time**: 4-6 hours
5
+ **Dependencies**: All previous tasks
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Create comprehensive documentation for Memory Collection Pattern v2, including API documentation, migration guide, architecture documentation, and usage examples.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Create API Documentation
19
+
20
+ **File**: `docs/api/v2-tools.md`
21
+
22
+ **Actions**:
23
+ - Document all updated tools (publish, retract, revise, search, create, update)
24
+ - Include input schemas
25
+ - Include output formats
26
+ - Include error codes
27
+ - Provide code examples for each tool
28
+
29
+ **Expected Content**:
30
+ ```markdown
31
+ # Memory Collection Pattern v2 - API Documentation
32
+
33
+ ## remember_publish
34
+
35
+ Publish a memory to multiple spaces and/or groups.
36
+
37
+ **Input Schema**:
38
+ ```typescript
39
+ {
40
+ memory_id: string,
41
+ spaces?: string[],
42
+ groups?: string[],
43
+ user_id?: string
44
+ }
45
+ ```
46
+
47
+ **Example**:
48
+ ```typescript
49
+ remember_publish({
50
+ memory_id: "my-recipe",
51
+ spaces: ["cooking", "recipes"],
52
+ groups: ["{foodie-group}"]
53
+ })
54
+ ```
55
+
56
+ [... continue for all tools ...]
57
+ ```
58
+
59
+ ### 2. Create Migration Guide
60
+
61
+ **File**: `docs/migration/v2-migration-guide.md`
62
+
63
+ **Actions**:
64
+ - Explain what changed in v2
65
+ - Provide step-by-step migration instructions
66
+ - Include dry-run example
67
+ - Include rollback instructions
68
+ - Document breaking changes
69
+ - Provide troubleshooting tips
70
+
71
+ **Expected Content**:
72
+ ```markdown
73
+ # Migration Guide: v1 → v2
74
+
75
+ ## What Changed
76
+
77
+ Memory Collection Pattern v2 introduces:
78
+ - Dot notation collections (Memory.users, Memory.spaces, Memory.groups)
79
+ - Composite IDs ({userId}.{memoryId})
80
+ - Tracking arrays (space_ids, group_ids)
81
+ - Multi-space/group publication
82
+ - Revision support
83
+
84
+ ## Migration Steps
85
+
86
+ ### 1. Backup Your Data
87
+ ```bash
88
+ npm run migrate:backup
89
+ ```
90
+
91
+ ### 2. Run Dry-Run
92
+ ```bash
93
+ npm run migrate:dry-run
94
+ ```
95
+
96
+ ### 3. Review Preview
97
+ [... detailed instructions ...]
98
+ ```
99
+
100
+ ### 3. Create Architecture Documentation
101
+
102
+ **File**: `docs/architecture/v2-architecture.md`
103
+
104
+ **Actions**:
105
+ - Explain three-tier collection structure
106
+ - Document composite ID format
107
+ - Explain tracking arrays
108
+ - Document dual publication pattern
109
+ - Include diagrams
110
+
111
+ **Expected Content**:
112
+ ```markdown
113
+ # Memory Collection Pattern v2 - Architecture
114
+
115
+ ## Collection Structure
116
+
117
+ ### Memory.users.{userId}
118
+ Private user memories with simple IDs.
119
+
120
+ ### Memory.spaces.public
121
+ All public space memories with composite IDs.
122
+
123
+ ### Memory.groups.{groupId}
124
+ Group memories with composite IDs.
125
+
126
+ [... detailed architecture ...]
127
+ ```
128
+
129
+ ### 4. Create Usage Examples
130
+
131
+ **File**: `docs/examples/v2-usage-examples.md`
132
+
133
+ **Actions**:
134
+ - Provide real-world usage scenarios
135
+ - Include code examples
136
+ - Show common patterns
137
+ - Demonstrate best practices
138
+
139
+ **Expected Content**:
140
+ ```markdown
141
+ # Usage Examples
142
+
143
+ ## Example 1: Publishing a Recipe to Multiple Spaces
144
+
145
+ ```typescript
146
+ // Create recipe
147
+ const recipe = await remember_create_memory({
148
+ content: "My famous pasta recipe...",
149
+ content_type: "recipe"
150
+ })
151
+
152
+ // Publish to cooking and recipes spaces
153
+ await remember_publish({
154
+ memory_id: recipe.id,
155
+ spaces: ["cooking", "recipes"]
156
+ })
157
+
158
+ // Later, update the recipe
159
+ await remember_update_memory({
160
+ id: recipe.id,
161
+ content: "Updated recipe with new ingredient..."
162
+ })
163
+
164
+ // Sync changes to all published locations
165
+ await remember_revise({
166
+ memory_id: recipe.id
167
+ })
168
+ ```
169
+
170
+ [... more examples ...]
171
+ ```
172
+
173
+ ### 5. Update README
174
+
175
+ **File**: `README.md`
176
+
177
+ **Actions**:
178
+ - Update version to v2
179
+ - Update feature list
180
+ - Update quick start guide
181
+ - Add migration notice
182
+ - Update examples
183
+
184
+ ### 6. Create CHANGELOG Entry
185
+
186
+ **File**: `CHANGELOG.md`
187
+
188
+ **Actions**:
189
+ - Document v2.0.0 release
190
+ - List all breaking changes
191
+ - List all new features
192
+ - List all improvements
193
+ - Include migration instructions link
194
+
195
+ **Expected Content**:
196
+ ```markdown
197
+ # Changelog
198
+
199
+ ## [2.0.0] - 2026-XX-XX
200
+
201
+ ### Breaking Changes
202
+ - Memory collections now use dot notation (Memory.users, Memory.spaces, Memory.groups)
203
+ - Published memories now use composite IDs ({userId}.{memoryId})
204
+ - remember_publish now accepts arrays for spaces and groups
205
+ - remember_search_space now filters by space_ids array
206
+
207
+ ### Added
208
+ - remember_revise tool for syncing published memories
209
+ - Multi-space publication support
210
+ - Multi-group publication support
211
+ - Revision history tracking
212
+ - Orphaned memory support
213
+
214
+ ### Migration
215
+ See [Migration Guide](docs/migration/v2-migration-guide.md)
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Verification
221
+
222
+ - [ ] API documentation complete and accurate
223
+ - [ ] Migration guide clear and comprehensive
224
+ - [ ] Architecture documentation explains design
225
+ - [ ] Usage examples cover common scenarios
226
+ - [ ] README updated
227
+ - [ ] CHANGELOG entry created
228
+ - [ ] All documentation reviewed for accuracy
229
+ - [ ] Code examples tested and working
230
+
231
+ ---
232
+
233
+ ## Expected Output
234
+
235
+ ### Files Created
236
+ - `docs/api/v2-tools.md` (~300 lines)
237
+ - `docs/migration/v2-migration-guide.md` (~200 lines)
238
+ - `docs/architecture/v2-architecture.md` (~250 lines)
239
+ - `docs/examples/v2-usage-examples.md` (~200 lines)
240
+
241
+ ### Files Modified
242
+ - `README.md` (updated for v2)
243
+ - `CHANGELOG.md` (v2.0.0 entry added)
244
+
245
+ ---
246
+
247
+ ## Notes
248
+
249
+ - Documentation should be clear and beginner-friendly
250
+ - Examples should be practical and realistic
251
+ - Migration guide critical for smooth transition
252
+ - Consider creating video tutorial (future)
253
+ - Keep documentation in sync with code changes
254
+
255
+ ---
256
+
257
+ **Status**: Not Started
258
+ **Next Milestone**: [Milestone 20: Memory Feed API Implementation](../../milestones/milestone-20-memory-feed-api.md)
@@ -0,0 +1,57 @@
1
+ # Task 174: Add Moderation Schema Fields
2
+
3
+ **Milestone**: M15 - Moderation & Space Config
4
+ **Estimated Hours**: 2-3
5
+ **Dependencies**: None (builds on v3.9.0 foundations)
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Add moderation-related fields to the Weaviate published memory schema and the `can_moderate` permission to the GroupPermissions type.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Add schema fields to `src/schema/v2-collections.ts`
19
+
20
+ Add to `PUBLISHED_MEMORY_PROPERTIES`:
21
+
22
+ ```typescript
23
+ // Moderation
24
+ { name: 'moderation_status', dataType: configure.dataType.TEXT },
25
+ { name: 'moderated_by', dataType: configure.dataType.TEXT },
26
+ { name: 'moderated_at', dataType: configure.dataType.DATE },
27
+ ```
28
+
29
+ Note: `moderation_flags` already exists in `COMMON_MEMORY_PROPERTIES` as TEXT_ARRAY.
30
+
31
+ ### 2. Add `can_moderate` to GroupPermissions in `src/types/auth.ts`
32
+
33
+ ```typescript
34
+ export interface GroupPermissions {
35
+ // ... existing fields ...
36
+ can_moderate: boolean;
37
+ }
38
+ ```
39
+
40
+ ### 3. Update StubCredentialsProvider if needed
41
+
42
+ Ensure the stub doesn't break with the new permission field (it returns empty memberships, so no change needed).
43
+
44
+ ### 4. Add tests
45
+
46
+ - Verify `getPublishedCollectionProperties()` includes the new fields
47
+ - Verify GroupPermissions type includes `can_moderate`
48
+
49
+ ---
50
+
51
+ ## Verification
52
+
53
+ - [ ] `moderation_status`, `moderated_by`, `moderated_at` in PUBLISHED_MEMORY_PROPERTIES
54
+ - [ ] `can_moderate` in GroupPermissions interface
55
+ - [ ] `npm run typecheck` passes
56
+ - [ ] `npm test` passes
57
+ - [ ] Existing tests unaffected
@@ -0,0 +1,64 @@
1
+ # Task 175: Create SpaceConfig Service
2
+
3
+ **Milestone**: M15 - Moderation & Space Config
4
+ **Estimated Hours**: 3-4
5
+ **Dependencies**: None
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Create a Firestore-backed service for per-space/group behavioral configuration with sensible defaults.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Create `src/services/space-config.service.ts`
19
+
20
+ ```typescript
21
+ export interface SpaceConfig {
22
+ require_moderation: boolean;
23
+ default_write_mode: WriteMode;
24
+ }
25
+
26
+ const DEFAULT_CONFIG: SpaceConfig = {
27
+ require_moderation: false,
28
+ default_write_mode: 'owner_only',
29
+ };
30
+
31
+ export async function getSpaceConfig(
32
+ id: string,
33
+ type: 'space' | 'group'
34
+ ): Promise<SpaceConfig>;
35
+
36
+ export async function setSpaceConfig(
37
+ id: string,
38
+ type: 'space' | 'group',
39
+ config: Partial<SpaceConfig>
40
+ ): Promise<void>;
41
+ ```
42
+
43
+ - Firestore path: `spaces/{spaceId}/config/settings` or `groups/{groupId}/config/settings`
44
+ - Default fallback when no document exists
45
+ - Partial updates via `setSpaceConfig`
46
+
47
+ ### 2. Create `src/services/space-config.service.spec.ts`
48
+
49
+ Tests:
50
+ - `getSpaceConfig` returns defaults when no Firestore doc exists
51
+ - `getSpaceConfig` returns merged config when doc exists (partial override)
52
+ - `setSpaceConfig` writes to correct Firestore path
53
+ - Correct Firestore paths for spaces vs groups
54
+
55
+ ---
56
+
57
+ ## Verification
58
+
59
+ - [ ] `getSpaceConfig()` returns defaults when no config exists
60
+ - [ ] `getSpaceConfig()` merges partial config with defaults
61
+ - [ ] `setSpaceConfig()` writes to Firestore
62
+ - [ ] Space vs group paths are correct
63
+ - [ ] `npm run typecheck` passes
64
+ - [ ] `npm test` passes
@@ -0,0 +1,45 @@
1
+ # Task 176: Wire Moderation into Publish Flow
2
+
3
+ **Milestone**: M15 - Moderation & Space Config
4
+ **Estimated Hours**: 3-4
5
+ **Dependencies**: Task 174, Task 175
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Update the publish confirmation flow to set `moderation_status` on published memories based on space/group config.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Update `executePublishMemory()` in `src/tools/confirm.ts`
19
+
20
+ In the publish execution handler:
21
+
22
+ 1. For each target space/group, read config via `getSpaceConfig()`
23
+ 2. If `require_moderation: true` -> set `moderation_status: 'pending'`
24
+ 3. If `require_moderation: false` (or no config) -> set `moderation_status: 'approved'`
25
+ 4. Set `moderated_by: null`, `moderated_at: null` (will be set by moderator later)
26
+
27
+ ### 2. Update the published memory properties written to Weaviate
28
+
29
+ Ensure `moderation_status` is included in the properties object when creating the published copy.
30
+
31
+ ### 3. Update existing publish tests
32
+
33
+ - Test publish to unmoderated space -> `moderation_status: 'approved'`
34
+ - Test publish to moderated space -> `moderation_status: 'pending'`
35
+ - Test publish to group with config -> correct status
36
+
37
+ ---
38
+
39
+ ## Verification
40
+
41
+ - [ ] Unmoderated spaces: published memories get `moderation_status: 'approved'`
42
+ - [ ] Moderated spaces: published memories get `moderation_status: 'pending'`
43
+ - [ ] Default (no config): treated as unmoderated
44
+ - [ ] `npm run typecheck` passes
45
+ - [ ] `npm test` passes
@@ -0,0 +1,70 @@
1
+ # Task 177: Add Moderation Filters to Search Tools
2
+
3
+ **Milestone**: M15 - Moderation & Space Config
4
+ **Estimated Hours**: 4-6
5
+ **Dependencies**: Task 174
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Update `remember_search_space` and `remember_query_space` to filter by moderation_status, defaulting to approved/null for regular users and allowing moderators to see all statuses.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Update `src/tools/search-space.ts`
19
+
20
+ Add `moderation_filter` parameter to tool definition:
21
+ - Type: `'approved' | 'pending' | 'rejected' | 'removed' | 'all'`
22
+ - Default: `'approved'`
23
+
24
+ Build Weaviate filter:
25
+ ```typescript
26
+ // Default: approved OR null (backward compat)
27
+ const moderationFilter = Filters.or(
28
+ collection.filter.byProperty('moderation_status').equal('approved'),
29
+ collection.filter.byProperty('moderation_status').isNull(true)
30
+ );
31
+ ```
32
+
33
+ For non-approved filters, check `authContext` for `can_moderate` permission on the target group. Return error if not authorized.
34
+
35
+ ### 2. Update `src/tools/query-space.ts`
36
+
37
+ Same logic as search-space — add `moderation_filter` parameter and permission check.
38
+
39
+ ### 3. Create permission check helper
40
+
41
+ Create a helper function (possibly in `src/utils/` or inline) that checks if the user has `can_moderate` for a given group:
42
+
43
+ ```typescript
44
+ function canModerate(authContext: AuthContext, groupId: string): boolean {
45
+ if (!authContext?.credentials) return false;
46
+ const membership = authContext.credentials.group_memberships
47
+ .find(m => m.group_id === groupId);
48
+ return membership?.permissions.can_moderate ?? false;
49
+ }
50
+ ```
51
+
52
+ ### 4. Add tests
53
+
54
+ - Default search returns only approved/null memories
55
+ - `moderation_filter: 'pending'` with moderator returns pending
56
+ - `moderation_filter: 'pending'` without moderator returns error
57
+ - `moderation_filter: 'all'` with moderator returns all statuses
58
+ - Null moderation_status treated as approved
59
+
60
+ ---
61
+
62
+ ## Verification
63
+
64
+ - [ ] Default search excludes pending/rejected/removed memories
65
+ - [ ] Null moderation_status memories visible in default search
66
+ - [ ] Moderators can filter by any status
67
+ - [ ] Non-moderators blocked from non-approved filters
68
+ - [ ] Tool definitions include moderation_filter parameter
69
+ - [ ] `npm run typecheck` passes
70
+ - [ ] `npm test` passes
@@ -0,0 +1,69 @@
1
+ # Task 178: Create remember_moderate Tool
2
+
3
+ **Milestone**: M15 - Moderation & Space Config
4
+ **Estimated Hours**: 4-6
5
+ **Dependencies**: Task 174, Task 177
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Create a new MCP tool (`remember_moderate`) that allows moderators to approve, reject, or remove published memories.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Create `src/tools/moderate.ts`
19
+
20
+ Tool definition:
21
+ ```typescript
22
+ export const moderateTool = {
23
+ name: 'remember_moderate',
24
+ description: 'Approve, reject, or remove a published memory (requires can_moderate permission)',
25
+ inputSchema: {
26
+ type: 'object',
27
+ properties: {
28
+ memory_id: { type: 'string', description: 'UUID of published memory' },
29
+ space_id: { type: 'string', description: 'Space containing the memory (optional)' },
30
+ group_id: { type: 'string', description: 'Group containing the memory (optional)' },
31
+ action: { type: 'string', enum: ['approve', 'reject', 'remove'], description: 'Moderation action' },
32
+ reason: { type: 'string', description: 'Optional reason for the action' },
33
+ },
34
+ required: ['memory_id', 'action'],
35
+ },
36
+ };
37
+ ```
38
+
39
+ Handler:
40
+ 1. Check `authContext` for `can_moderate` permission on target group
41
+ 2. Look up the memory in the target collection
42
+ 3. Update `moderation_status`, `moderated_by` (userId), `moderated_at` (now)
43
+ 4. Return confirmation message
44
+
45
+ ### 2. Register in `src/server.ts` and `src/server-factory.ts`
46
+
47
+ Add import, tool definition to ListTools, and case in switch statement (20th tool).
48
+
49
+ ### 3. Create `src/tools/moderate.spec.ts`
50
+
51
+ Tests:
52
+ - Approve sets status to `approved`
53
+ - Reject sets status to `rejected`
54
+ - Remove sets status to `removed`
55
+ - Non-moderator gets permission error
56
+ - Missing memory returns error
57
+ - Sets `moderated_by` and `moderated_at` correctly
58
+
59
+ ---
60
+
61
+ ## Verification
62
+
63
+ - [ ] `remember_moderate` registered in both servers
64
+ - [ ] approve/reject/remove actions work correctly
65
+ - [ ] Permission check enforced via authContext
66
+ - [ ] `moderated_by` and `moderated_at` set on action
67
+ - [ ] Error handling for missing memory, bad permissions
68
+ - [ ] `npm run typecheck` passes
69
+ - [ ] `npm test` passes
@@ -0,0 +1,58 @@
1
+ # Task 179: Documentation and Integration Tests
2
+
3
+ **Milestone**: M15 - Moderation & Space Config
4
+ **Estimated Hours**: 2-3
5
+ **Dependencies**: Tasks 174-178
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Update documentation, CHANGELOG, and create integration test scenarios for the moderation system.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Update CHANGELOG.md
19
+
20
+ Add entry for the new version (likely v3.10.0 or v4.0.0 depending on scope):
21
+ - New `remember_moderate` tool
22
+ - Moderation status lifecycle
23
+ - Per-space/group configuration
24
+ - Search filter changes (default to approved)
25
+
26
+ ### 2. Update README.md
27
+
28
+ - Add moderation workflow section
29
+ - Update tool count (19 -> 20)
30
+ - Add `remember_moderate` to tool listing
31
+
32
+ ### 3. Update design doc status
33
+
34
+ Set `local.moderation-and-space-config.md` status to `Implemented`.
35
+
36
+ ### 4. Update progress.yaml
37
+
38
+ - Mark M15 as completed
39
+ - Add recent_work entry
40
+ - Update implementation percentage
41
+
42
+ ### 5. Verify all tests pass
43
+
44
+ - `npm run typecheck` — no type errors
45
+ - `npm run build` — compiles without errors
46
+ - `npm test` — all tests pass
47
+
48
+ ---
49
+
50
+ ## Verification
51
+
52
+ - [ ] CHANGELOG.md has new version entry
53
+ - [ ] README.md updated with moderation workflow and tool count
54
+ - [ ] Design doc status set to Implemented
55
+ - [ ] progress.yaml updated
56
+ - [ ] `npm run typecheck` passes
57
+ - [ ] `npm run build` passes
58
+ - [ ] `npm test` passes
@@ -0,0 +1,41 @@
1
+ # Task 187: GhostConfig Firestore CRUD
2
+
3
+ **Milestone**: M16 — Ghost System
4
+ **Status**: not_started
5
+ **Dependencies**: Task 180 (GhostConfig types — done)
6
+
7
+ ---
8
+
9
+ ## Objective
10
+
11
+ Implement Firestore CRUD operations for GhostConfig, enabling users to enable/disable their ghost, set trust levels, and manage blocked users.
12
+
13
+ ## Deliverables
14
+
15
+ ### 1. Create `src/services/ghost-config.service.ts`
16
+
17
+ - `getGhostConfig(ownerUserId: string): Promise<GhostConfig | null>` — read from Firestore
18
+ - `setGhostConfig(ownerUserId: string, config: Partial<GhostConfig>): Promise<GhostConfig>` — upsert
19
+ - `setUserTrust(ownerUserId: string, targetUserId: string, trustLevel: number): Promise<void>` — set per-user trust
20
+ - `blockUser(ownerUserId: string, targetUserId: string): Promise<void>` — add to blocked_users
21
+ - `unblockUser(ownerUserId: string, targetUserId: string): Promise<void>` — remove from blocked_users
22
+ - `isGhostEnabled(ownerUserId: string): Promise<boolean>` — convenience check
23
+
24
+ **Firestore path**: `users/{ownerUserId}/ghost_config` (single document)
25
+
26
+ ### 2. Wire into access-control.ts
27
+
28
+ - Replace `StubGhostConfigProvider` with `FirestoreGhostConfigProvider` that uses the service
29
+ - Keep `StubGhostConfigProvider` for tests
30
+
31
+ ### 3. Tests
32
+
33
+ - `src/services/ghost-config.service.spec.ts` — unit tests with Firestore mocks
34
+
35
+ ## Acceptance Criteria
36
+
37
+ - [ ] GhostConfig CRUD operations work against Firestore
38
+ - [ ] Default values applied when config doesn't exist
39
+ - [ ] Per-user trust overrides work
40
+ - [ ] Blocked user management works
41
+ - [ ] Tests pass
@@ -0,0 +1,44 @@
1
+ # Task 188: Trust Filter Integration into Search/Query Tools
2
+
3
+ **Milestone**: M16 — Ghost System
4
+ **Status**: not_started
5
+ **Dependencies**: Task 187 (GhostConfig Firestore), Task 182 (trust enforcement — done)
6
+
7
+ ---
8
+
9
+ ## Objective
10
+
11
+ Wire trust enforcement into search and query tools so ghost conversations get trust-filtered results.
12
+
13
+ ## Deliverables
14
+
15
+ ### 1. Add `ghostContext` parameter to search/query handlers
16
+
17
+ - `search-memory.ts` — accept optional `ghostContext: { ownerUserId, accessorUserId, accessorTrustLevel }`
18
+ - `query-memory.ts` — same ghostContext parameter
19
+ - When ghostContext present: apply `buildTrustFilter` to Weaviate query
20
+ - When ghostContext absent: current self-access behavior (no change)
21
+
22
+ ### 2. Wire into server-factory.ts
23
+
24
+ - Ghost context passed from agentbase.me via the tool call arguments
25
+ - server-factory resolves ghost config and computes accessor trust level
26
+ - Passes ghostContext to tool handlers
27
+
28
+ ### 3. Format results by trust level
29
+
30
+ - When ghostContext present, run results through `formatMemoryForPrompt`
31
+ - Self-access (no ghostContext) returns full content as before
32
+
33
+ ### 4. Tests
34
+
35
+ - Trust-filtered search returns only accessible memories
36
+ - Self-access unchanged
37
+ - Format tiers work correctly
38
+
39
+ ## Acceptance Criteria
40
+
41
+ - [ ] Ghost searches filter by trust_score <= accessorTrustLevel
42
+ - [ ] Self-access unchanged (no regression)
43
+ - [ ] Results formatted by trust tier
44
+ - [ ] Tests pass