@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.
- package/AGENT.md +296 -250
- package/CHANGELOG.md +358 -0
- package/README.md +68 -45
- package/agent/commands/acp.clarification-create.md +382 -0
- package/agent/commands/acp.project-info.md +309 -0
- package/agent/commands/acp.project-remove.md +379 -0
- package/agent/commands/acp.project-update.md +296 -0
- package/agent/commands/acp.task-create.md +17 -9
- package/agent/commands/git.commit.md +13 -1
- package/agent/design/comment-memory-type.md +2 -2
- package/agent/design/local.collaborative-memory-sync.md +265 -0
- package/agent/design/local.content-flags.md +210 -0
- package/agent/design/local.ghost-persona-system.md +273 -0
- package/agent/design/local.group-acl-integration.md +338 -0
- package/agent/design/local.memory-acl-schema.md +352 -0
- package/agent/design/local.memory-collection-pattern-v2.md +348 -0
- package/agent/design/local.moderation-and-space-config.md +257 -0
- package/agent/design/local.v2-api-reference.md +621 -0
- package/agent/design/local.v2-migration-guide.md +191 -0
- package/agent/design/local.v2-usage-examples.md +265 -0
- package/agent/design/permissions-storage-architecture.md +11 -3
- package/agent/design/trust-escalation-prevention.md +9 -2
- package/agent/design/trust-system-implementation.md +12 -3
- package/agent/milestones/milestone-14-memory-collection-v2.md +182 -0
- package/agent/milestones/milestone-15-moderation-space-config.md +126 -0
- package/agent/progress.yaml +628 -49
- package/agent/scripts/acp.common.sh +2 -0
- package/agent/scripts/acp.install.sh +11 -1
- package/agent/scripts/acp.package-install-optimized.sh +454 -0
- package/agent/scripts/acp.package-install.sh +247 -300
- package/agent/scripts/acp.project-info.sh +218 -0
- package/agent/scripts/acp.project-remove.sh +302 -0
- package/agent/scripts/acp.project-update.sh +296 -0
- package/agent/scripts/acp.yaml-parser.sh +128 -10
- package/agent/tasks/milestone-14-memory-collection-v2/task-165-core-infrastructure-setup.md +171 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-166-update-remember-publish.md +191 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-167-update-remember-retract.md +186 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-168-implement-remember-revise.md +184 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-169-update-remember-search-space.md +179 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-170-update-remember-create-update.md +139 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-172-performance-testing-optimization.md +161 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-173-documentation-examples.md +258 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-174-add-moderation-schema-fields.md +57 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-175-create-space-config-service.md +64 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-176-wire-moderation-publish-flow.md +45 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-177-add-moderation-search-filters.md +70 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-178-create-remember-moderate-tool.md +69 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-179-documentation-integration-tests.md +58 -0
- package/agent/tasks/milestone-16-ghost-system/task-187-ghost-config-firestore.md +41 -0
- package/agent/tasks/milestone-16-ghost-system/task-188-trust-filter-integration.md +44 -0
- package/agent/tasks/milestone-16-ghost-system/task-189-ghost-memory-filtering.md +43 -0
- package/agent/tasks/milestone-16-ghost-system/task-190-ghost-config-tools.md +45 -0
- package/agent/tasks/milestone-16-ghost-system/task-191-escalation-firestore.md +38 -0
- package/agent/tasks/milestone-16-ghost-system/task-192-documentation-verification.md +39 -0
- package/agent/tasks/milestone-7-trust-permissions/task-180-access-result-permission-types.md +69 -0
- package/agent/tasks/milestone-7-trust-permissions/task-181-firestore-permissions-access-logs.md +56 -0
- package/agent/tasks/milestone-7-trust-permissions/task-182-trust-enforcement-service.md +68 -0
- package/agent/tasks/milestone-7-trust-permissions/task-183-access-control-service.md +70 -0
- package/agent/tasks/milestone-7-trust-permissions/task-184-permission-tools.md +79 -0
- package/agent/tasks/milestone-7-trust-permissions/task-185-wire-trust-into-search-query.md +55 -0
- package/agent/tasks/milestone-7-trust-permissions/task-186-documentation-verification.md +56 -0
- package/agent/tasks/task-76-fix-indexnullstate-schema-bug.md +197 -0
- package/dist/collections/composite-ids.d.ts +106 -0
- package/dist/collections/core-infrastructure.spec.d.ts +11 -0
- package/dist/collections/dot-notation.d.ts +106 -0
- package/dist/collections/tracking-arrays.d.ts +176 -0
- package/dist/constants/content-types.d.ts +1 -0
- package/dist/schema/v2-collections-comments.spec.d.ts +8 -0
- package/dist/schema/v2-collections.d.ts +210 -0
- package/dist/server-factory.d.ts +15 -0
- package/dist/server-factory.js +2798 -1029
- package/dist/server.js +2526 -1012
- package/dist/services/access-control.d.ts +103 -0
- package/dist/services/access-control.spec.d.ts +2 -0
- package/dist/services/credentials-provider.d.ts +24 -0
- package/dist/services/credentials-provider.spec.d.ts +2 -0
- package/dist/services/escalation.service.d.ts +22 -0
- package/dist/services/escalation.service.spec.d.ts +2 -0
- package/dist/services/ghost-config.service.d.ts +55 -0
- package/dist/services/ghost-config.service.spec.d.ts +2 -0
- package/dist/services/space-config.service.d.ts +23 -0
- package/dist/services/space-config.service.spec.d.ts +2 -0
- package/dist/services/trust-enforcement.d.ts +83 -0
- package/dist/services/trust-enforcement.spec.d.ts +2 -0
- package/dist/services/trust-validator.d.ts +43 -0
- package/dist/services/trust-validator.spec.d.ts +2 -0
- package/dist/tools/confirm-publish-moderation.spec.d.ts +8 -0
- package/dist/tools/confirm.d.ts +8 -1
- package/dist/tools/create-memory.d.ts +2 -1
- package/dist/tools/create-memory.spec.d.ts +10 -0
- package/dist/tools/create-relationship.d.ts +2 -1
- package/dist/tools/delete-memory.d.ts +2 -1
- package/dist/tools/delete-relationship.d.ts +2 -1
- package/dist/tools/deny.d.ts +2 -1
- package/dist/tools/find-similar.d.ts +2 -1
- package/dist/tools/get-preferences.d.ts +2 -1
- package/dist/tools/ghost-config.d.ts +27 -0
- package/dist/tools/ghost-config.spec.d.ts +2 -0
- package/dist/tools/moderate.d.ts +20 -0
- package/dist/tools/moderate.spec.d.ts +5 -0
- package/dist/tools/publish.d.ts +11 -3
- package/dist/tools/query-memory.d.ts +3 -1
- package/dist/tools/query-space.d.ts +4 -1
- package/dist/tools/retract.d.ts +29 -0
- package/dist/tools/revise.d.ts +45 -0
- package/dist/tools/revise.spec.d.ts +8 -0
- package/dist/tools/search-memory.d.ts +2 -1
- package/dist/tools/search-relationship.d.ts +2 -1
- package/dist/tools/search-space.d.ts +25 -5
- package/dist/tools/search-space.spec.d.ts +9 -0
- package/dist/tools/set-preference.d.ts +2 -1
- package/dist/tools/update-memory.d.ts +2 -1
- package/dist/tools/update-relationship.d.ts +2 -1
- package/dist/types/access-result.d.ts +48 -0
- package/dist/types/access-result.spec.d.ts +2 -0
- package/dist/types/auth.d.ts +46 -0
- package/dist/types/ghost-config.d.ts +36 -0
- package/dist/types/memory.d.ts +3 -1
- package/dist/types/preferences.d.ts +1 -1
- package/dist/utils/auth-helpers.d.ts +14 -0
- package/dist/utils/auth-helpers.spec.d.ts +2 -0
- package/dist/utils/test-data-generator.d.ts +124 -0
- package/dist/utils/test-data-generator.spec.d.ts +12 -0
- package/dist/v2-performance.e2e.d.ts +17 -0
- package/dist/v2-smoke.e2e.d.ts +14 -0
- package/dist/weaviate/client.d.ts +5 -8
- package/dist/weaviate/space-schema.d.ts +2 -2
- package/docs/performance/v2-benchmarks.md +80 -0
- package/jest.e2e.config.js +14 -3
- package/package.json +1 -1
- package/scripts/.collection-recreation-state.yaml +16 -0
- package/scripts/.gitkeep +5 -0
- package/scripts/README-collection-recreation.md +224 -0
- package/scripts/README.md +51 -0
- package/scripts/backup-collections.ts +543 -0
- package/scripts/delete-collection.ts +137 -0
- package/scripts/migrate-recreate-collections.ts +578 -0
- package/scripts/migrate-v1-to-v2.ts +1094 -0
- package/scripts/package-lock.json +1113 -0
- package/scripts/package.json +27 -0
- package/src/collections/composite-ids.ts +193 -0
- package/src/collections/core-infrastructure.spec.ts +353 -0
- package/src/collections/dot-notation.ts +212 -0
- package/src/collections/tracking-arrays.ts +298 -0
- package/src/constants/content-types.ts +20 -0
- package/src/schema/v2-collections-comments.spec.ts +141 -0
- package/src/schema/v2-collections.ts +433 -0
- package/src/server-factory.ts +89 -20
- package/src/server.ts +45 -17
- package/src/services/access-control.spec.ts +383 -0
- package/src/services/access-control.ts +291 -0
- package/src/services/credentials-provider.spec.ts +22 -0
- package/src/services/credentials-provider.ts +34 -0
- package/src/services/escalation.service.spec.ts +183 -0
- package/src/services/escalation.service.ts +150 -0
- package/src/services/ghost-config.service.spec.ts +339 -0
- package/src/services/ghost-config.service.ts +219 -0
- package/src/services/space-config.service.spec.ts +102 -0
- package/src/services/space-config.service.ts +79 -0
- package/src/services/trust-enforcement.spec.ts +309 -0
- package/src/services/trust-enforcement.ts +197 -0
- package/src/services/trust-validator.spec.ts +108 -0
- package/src/services/trust-validator.ts +105 -0
- package/src/tools/confirm-publish-moderation.spec.ts +240 -0
- package/src/tools/confirm.ts +869 -135
- package/src/tools/create-memory.spec.ts +126 -0
- package/src/tools/create-memory.ts +20 -27
- package/src/tools/create-relationship.ts +17 -8
- package/src/tools/delete-memory.ts +13 -6
- package/src/tools/delete-relationship.ts +15 -6
- package/src/tools/deny.ts +8 -1
- package/src/tools/find-similar.ts +21 -8
- package/src/tools/get-preferences.ts +10 -1
- package/src/tools/ghost-config.spec.ts +180 -0
- package/src/tools/ghost-config.ts +230 -0
- package/src/tools/moderate.spec.ts +277 -0
- package/src/tools/moderate.ts +219 -0
- package/src/tools/publish.ts +99 -41
- package/src/tools/query-memory.ts +28 -6
- package/src/tools/query-space.ts +39 -4
- package/src/tools/retract.ts +292 -0
- package/src/tools/revise.spec.ts +146 -0
- package/src/tools/revise.ts +283 -0
- package/src/tools/search-memory.ts +30 -7
- package/src/tools/search-relationship.ts +11 -2
- package/src/tools/search-space.spec.ts +341 -0
- package/src/tools/search-space.ts +323 -99
- package/src/tools/set-preference.ts +10 -1
- package/src/tools/update-memory.ts +16 -5
- package/src/tools/update-relationship.ts +10 -1
- package/src/types/access-result.spec.ts +193 -0
- package/src/types/access-result.ts +62 -0
- package/src/types/auth.ts +52 -0
- package/src/types/ghost-config.ts +46 -0
- package/src/types/memory.ts +9 -1
- package/src/types/preferences.ts +2 -2
- package/src/utils/auth-helpers.spec.ts +75 -0
- package/src/utils/auth-helpers.ts +25 -0
- package/src/utils/test-data-generator.spec.ts +317 -0
- package/src/utils/test-data-generator.ts +292 -0
- package/src/utils/weaviate-filters.ts +4 -4
- package/src/v2-performance.e2e.ts +173 -0
- package/src/v2-smoke.e2e.ts +401 -0
- package/src/weaviate/client.spec.ts +5 -5
- package/src/weaviate/client.ts +51 -36
- package/src/weaviate/schema.ts +11 -256
- package/src/weaviate/space-schema.spec.ts +24 -24
- package/src/weaviate/space-schema.ts +18 -6
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Moderation System & Per-Space Configuration
|
|
2
|
+
|
|
3
|
+
**Concept**: Content moderation workflow with per-space/group behavioral config, owned by remember-mcp
|
|
4
|
+
**Created**: 2026-02-27
|
|
5
|
+
**Status**: Implemented
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Published memories in shared spaces and groups currently have no moderation workflow — anything published is immediately visible. This design introduces a moderation status lifecycle for published memories and a per-space/group configuration system that controls behavioral rules like whether moderation is required.
|
|
12
|
+
|
|
13
|
+
The key architectural decision is **separation of concerns**:
|
|
14
|
+
- **agentbase.me** owns ACL: "Who are you, and what are you allowed to do?" (identity, membership, `can_moderate`, `can_publish`)
|
|
15
|
+
- **remember-mcp** owns behavior: "When you do it, what happens?" (require moderation, default visibility, retention rules)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Problem Statement
|
|
20
|
+
|
|
21
|
+
- Published memories are immediately visible to all users in a space/group — no review step exists
|
|
22
|
+
- No mechanism to flag, reject, or remove inappropriate content
|
|
23
|
+
- Existing `moderation_flags: TEXT_ARRAY` field (from M12) is a flat array with no status lifecycle
|
|
24
|
+
- No per-space/group behavioral configuration — all spaces behave identically
|
|
25
|
+
- Moderators have no way to search for pending or rejected content
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Solution
|
|
30
|
+
|
|
31
|
+
### 1. Moderation Status Lifecycle
|
|
32
|
+
|
|
33
|
+
Replace the flat `moderation_flags` concept with structured moderation fields on published memories:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pending → approved → removed
|
|
37
|
+
pending → rejected
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- **pending**: Published but awaiting moderator review (when `require_moderation: true`)
|
|
41
|
+
- **approved**: Visible in default searches (set automatically or by moderator)
|
|
42
|
+
- **rejected**: Moderator declined — invisible in all default searches
|
|
43
|
+
- **removed**: Was approved, then removed by moderator post-publication
|
|
44
|
+
|
|
45
|
+
### 2. Flat Weaviate Fields (Not JSON)
|
|
46
|
+
|
|
47
|
+
Weaviate cannot efficiently filter on nested objects. Use flat fields for queryability:
|
|
48
|
+
|
|
49
|
+
| Field | Type | Description |
|
|
50
|
+
|-------|------|-------------|
|
|
51
|
+
| `moderation_status` | TEXT | `pending` \| `approved` \| `rejected` \| `removed` |
|
|
52
|
+
| `moderation_flags` | TEXT_ARRAY | Free-form flags (existing field, keep for tagging) |
|
|
53
|
+
| `moderated_by` | TEXT | userId of the moderator who last acted |
|
|
54
|
+
| `moderated_at` | DATE | Timestamp of last moderation action |
|
|
55
|
+
|
|
56
|
+
All nullable. `null` status treated as `approved` (backward compat with existing published memories).
|
|
57
|
+
|
|
58
|
+
### 3. `can_moderate` Permission
|
|
59
|
+
|
|
60
|
+
Add to `GroupPermissions` in `src/types/auth.ts`:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
export interface GroupPermissions {
|
|
64
|
+
can_read: boolean;
|
|
65
|
+
can_publish: boolean;
|
|
66
|
+
can_revise: boolean;
|
|
67
|
+
can_propose: boolean;
|
|
68
|
+
can_overwrite: boolean;
|
|
69
|
+
can_comment: boolean;
|
|
70
|
+
can_retract_own: boolean;
|
|
71
|
+
can_retract_any: boolean;
|
|
72
|
+
can_manage_members: boolean;
|
|
73
|
+
can_moderate: boolean; // NEW
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Returned by agentbase.me in the credentials response. remember-mcp checks this permission before allowing moderation actions.
|
|
78
|
+
|
|
79
|
+
### 4. Per-Space/Group Config in Firestore
|
|
80
|
+
|
|
81
|
+
Firestore document at `spaces/{spaceId}/config` or `groups/{groupId}/config`:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
interface SpaceConfig {
|
|
85
|
+
require_moderation: boolean; // false = auto-approve on publish
|
|
86
|
+
default_write_mode: WriteMode; // 'owner_only' | 'group_editors' | 'anyone'
|
|
87
|
+
// future:
|
|
88
|
+
// retention_days?: number;
|
|
89
|
+
// max_memories?: number;
|
|
90
|
+
// allowed_content_types?: string[];
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Default** (when no config document exists): `{ require_moderation: false, default_write_mode: 'owner_only' }` — backward compatible, all existing spaces continue to work.
|
|
95
|
+
|
|
96
|
+
### 5. Search Visibility Rules
|
|
97
|
+
|
|
98
|
+
| moderation_status | Default search | Moderator search |
|
|
99
|
+
|-------------------|---------------|-----------------|
|
|
100
|
+
| `approved` (or null) | visible | visible |
|
|
101
|
+
| `pending` | hidden | visible |
|
|
102
|
+
| `rejected` | hidden | visible |
|
|
103
|
+
| `removed` | hidden | visible |
|
|
104
|
+
|
|
105
|
+
- `remember_search_space` and `remember_query_space` add `moderation_status` filter
|
|
106
|
+
- Default behavior: only return `approved` or `null` (backward compat)
|
|
107
|
+
- New parameter: `moderation_filter?: 'approved' | 'pending' | 'rejected' | 'removed' | 'all'`
|
|
108
|
+
- `pending`/`rejected`/`removed`/`all` require `can_moderate` permission (checked via `authContext`)
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Implementation
|
|
113
|
+
|
|
114
|
+
### Schema Changes — `src/schema/v2-collections.ts`
|
|
115
|
+
|
|
116
|
+
Add to `PUBLISHED_MEMORY_PROPERTIES`:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
// Moderation
|
|
120
|
+
{ name: 'moderation_status', dataType: configure.dataType.TEXT },
|
|
121
|
+
{ name: 'moderated_by', dataType: configure.dataType.TEXT },
|
|
122
|
+
{ name: 'moderated_at', dataType: configure.dataType.DATE },
|
|
123
|
+
// moderation_flags already exists in COMMON_MEMORY_PROPERTIES
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Publish Flow Changes
|
|
127
|
+
|
|
128
|
+
In `confirm.ts` `executePublishMemory()`:
|
|
129
|
+
|
|
130
|
+
1. Read space/group config from Firestore
|
|
131
|
+
2. If `require_moderation: true` → set `moderation_status: 'pending'`
|
|
132
|
+
3. If `require_moderation: false` (or no config) → set `moderation_status: 'approved'`
|
|
133
|
+
|
|
134
|
+
### Search Filter Changes
|
|
135
|
+
|
|
136
|
+
In `search-space.ts` and `query-space.ts`:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// Default: only show approved (or null for backward compat)
|
|
140
|
+
const moderationFilter = Filters.or(
|
|
141
|
+
collection.filter.byProperty('moderation_status').equal('approved'),
|
|
142
|
+
collection.filter.byProperty('moderation_status').isNull(true)
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
// If moderator requests non-approved:
|
|
146
|
+
// 1. Check authContext.credentials for can_moderate on the target group
|
|
147
|
+
// 2. Apply requested moderation_status filter instead
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Firestore Config Service
|
|
151
|
+
|
|
152
|
+
New service `src/services/space-config.service.ts`:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
export interface SpaceConfig {
|
|
156
|
+
require_moderation: boolean;
|
|
157
|
+
default_write_mode: WriteMode;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const DEFAULT_CONFIG: SpaceConfig = {
|
|
161
|
+
require_moderation: false,
|
|
162
|
+
default_write_mode: 'owner_only',
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export async function getSpaceConfig(spaceOrGroupId: string, type: 'space' | 'group'): Promise<SpaceConfig> {
|
|
166
|
+
const path = type === 'space' ? `spaces/${spaceOrGroupId}/config` : `groups/${spaceOrGroupId}/config`;
|
|
167
|
+
const doc = await getDocument(path, 'settings');
|
|
168
|
+
return doc ? { ...DEFAULT_CONFIG, ...doc } : DEFAULT_CONFIG;
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Moderation Tool (Future)
|
|
173
|
+
|
|
174
|
+
Not in scope for initial implementation, but the shape would be:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// remember_moderate — set moderation status on a published memory
|
|
178
|
+
{
|
|
179
|
+
memory_id: string;
|
|
180
|
+
space_id?: string;
|
|
181
|
+
group_id?: string;
|
|
182
|
+
action: 'approve' | 'reject' | 'remove';
|
|
183
|
+
reason?: string;
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
This could reuse the confirmation flow or be a direct-action tool (moderators have already been granted elevated trust).
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Benefits
|
|
192
|
+
|
|
193
|
+
- **Content safety**: Spaces/groups can require review before content is visible
|
|
194
|
+
- **Backward compatible**: Null moderation_status treated as approved — existing memories unaffected
|
|
195
|
+
- **Filterable**: Flat Weaviate fields enable efficient query-level filtering
|
|
196
|
+
- **Clean separation**: agentbase.me manages who can moderate; remember-mcp manages what moderation means
|
|
197
|
+
- **Extensible**: SpaceConfig pattern supports future behavioral knobs (retention, quotas, content type restrictions)
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Trade-offs
|
|
202
|
+
|
|
203
|
+
- **Latency**: Publish flow gains a Firestore read for space config (mitigated by caching or co-locating with existing Firestore reads)
|
|
204
|
+
- **Complexity**: Search tools gain a new filter parameter and permission check
|
|
205
|
+
- **No moderation tool yet**: Initial implementation only sets status during publish; explicit moderator actions (approve/reject/remove) require a future tool
|
|
206
|
+
- **Flat fields**: Less flexible than a JSON object, but necessary for Weaviate filterability
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Dependencies
|
|
211
|
+
|
|
212
|
+
- **v3.9.0 AuthContext foundations** (completed): `AuthContext` threaded through all handlers, `GroupPermissions` type exists
|
|
213
|
+
- **agentbase.me credentials endpoint**: Must return `can_moderate` permission in group memberships
|
|
214
|
+
- **Firestore**: Already initialized, used for confirmation tokens and preferences
|
|
215
|
+
- **local.memory-acl-schema.md**: ACL fields (`write_mode`, `owner_id`) already added to schema in v3.9.0
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Testing Strategy
|
|
220
|
+
|
|
221
|
+
- **Unit tests**: SpaceConfig service with default fallback, config override
|
|
222
|
+
- **Unit tests**: Publish flow sets correct moderation_status based on config
|
|
223
|
+
- **Unit tests**: Search filters apply moderation_status correctly
|
|
224
|
+
- **Unit tests**: Non-moderators cannot search for pending/rejected/removed content
|
|
225
|
+
- **Integration test**: End-to-end publish → moderate → search flow
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Migration Path
|
|
230
|
+
|
|
231
|
+
1. **Add schema fields** (`moderation_status`, `moderated_by`, `moderated_at`) — nullable, zero backfill
|
|
232
|
+
2. **Add SpaceConfig service** — reads from Firestore with defaults
|
|
233
|
+
3. **Update publish flow** — check config, set initial moderation_status
|
|
234
|
+
4. **Update search tools** — filter on moderation_status (default: approved/null)
|
|
235
|
+
5. **Add `can_moderate` to GroupPermissions** — type change only until enforcement
|
|
236
|
+
6. **Future**: Add `remember_moderate` tool for explicit moderator actions
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Future Considerations
|
|
241
|
+
|
|
242
|
+
- `remember_moderate` tool for approve/reject/remove actions
|
|
243
|
+
- Moderation queue UI (list pending items for a space/group)
|
|
244
|
+
- **Automated moderation rules** — separate Firestore document (`groups/{groupId}/config/moderation-rules`) with rules like `auto_approve_trusted` (trust_score > threshold), `auto_approve_editors`, `blocked_content_types`. Runs during publish to resolve `pending` status without human intervention. The current design supports this without changes — `require_moderation: true` sets status to `pending`, and what resolves it (human or automated) is orthogonal.
|
|
245
|
+
- Moderation audit log (who moderated what, when, why)
|
|
246
|
+
- Notification system for moderation decisions
|
|
247
|
+
- Appeal workflow (author can contest a rejection)
|
|
248
|
+
- SpaceConfig management tool (`remember_configure_space`)
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
**Status**: Proposal
|
|
253
|
+
**Recommendation**: Implement alongside M7 Trust & Permissions — schema fields and SpaceConfig service first, search filtering second, moderation tool third
|
|
254
|
+
**Related Documents**:
|
|
255
|
+
- [local.memory-acl-schema.md](local.memory-acl-schema.md) — ACL field design (write_mode, owner_id)
|
|
256
|
+
- [local.group-credentials-for-remember-mcp.md](local.group-credentials-for-remember-mcp.md) — Credentials endpoint contract
|
|
257
|
+
- [local.memory-collection-pattern-v2.md](local.memory-collection-pattern-v2.md) — v2 collection architecture
|