@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,191 @@
|
|
|
1
|
+
# Task 166: Implement remember_publish Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: Milestone 14 - Memory Collection Pattern v2
|
|
4
|
+
**Estimated Time**: 6-8 hours
|
|
5
|
+
**Dependencies**: [Task 165: Core Infrastructure Setup](task-165-core-infrastructure-setup.md)
|
|
6
|
+
**Status**: Completed
|
|
7
|
+
**Completed**: 2026-02-26
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement the `remember_publish` tool to support multi-space and multi-group publication with composite IDs and tracking arrays.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create Tool Schema
|
|
20
|
+
|
|
21
|
+
**File**: `src/tools/remember-publish.ts`
|
|
22
|
+
|
|
23
|
+
**Actions**:
|
|
24
|
+
- Update input schema to accept `spaces` array (multiple spaces)
|
|
25
|
+
- Update input schema to accept `groups` array (multiple groups)
|
|
26
|
+
- Keep `memory_id` parameter (source memory ID)
|
|
27
|
+
- Add optional `user_id` parameter (defaults to current user)
|
|
28
|
+
- Update tool description to explain multi-publication
|
|
29
|
+
|
|
30
|
+
**Expected Schema**:
|
|
31
|
+
```typescript
|
|
32
|
+
{
|
|
33
|
+
memory_id: string,
|
|
34
|
+
spaces?: string[], // ["cooking", "recipes"]
|
|
35
|
+
groups?: string[], // ["{group-id-1}", "{group-id-2}"]
|
|
36
|
+
user_id?: string // Defaults to current user
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. Implement Multi-Space Publication
|
|
41
|
+
|
|
42
|
+
**Actions**:
|
|
43
|
+
- Load source memory from `Memory_users_{userId}/{memory_id}`
|
|
44
|
+
- Generate composite ID: `{userId}.{memory_id}`
|
|
45
|
+
- For each space in `spaces` array:
|
|
46
|
+
- Check if memory already exists in `Memory_spaces_public` with composite ID
|
|
47
|
+
- If exists: Update `space_ids` array (add new space)
|
|
48
|
+
- If not exists: Create new memory with composite ID and `space_ids` array
|
|
49
|
+
- Update source memory's `space_ids` array
|
|
50
|
+
- Return success with published locations
|
|
51
|
+
|
|
52
|
+
**Expected Behavior**:
|
|
53
|
+
```typescript
|
|
54
|
+
// Publish to multiple spaces
|
|
55
|
+
remember_publish({
|
|
56
|
+
memory_id: "my-recipe",
|
|
57
|
+
spaces: ["cooking", "recipes"]
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
// Creates/updates:
|
|
61
|
+
// 1. Memory_spaces_public/user123.my-recipe with space_ids=["cooking", "recipes"]
|
|
62
|
+
// 2. Memory_users_user123/my-recipe with space_ids=["cooking", "recipes"]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 3. Implement Multi-Group Publication
|
|
66
|
+
|
|
67
|
+
**Actions**:
|
|
68
|
+
- Load source memory from `Memory_users_{userId}/{memory_id}`
|
|
69
|
+
- Generate composite ID: `{userId}.{memory_id}`
|
|
70
|
+
- For each group in `groups` array:
|
|
71
|
+
- Check if memory already exists in `Memory_groups_{groupId}` with composite ID
|
|
72
|
+
- If exists: Update `group_ids` array (add new group)
|
|
73
|
+
- If not exists: Create new memory with composite ID and `group_ids` array
|
|
74
|
+
- Update source memory's `group_ids` array
|
|
75
|
+
- Return success with published locations
|
|
76
|
+
|
|
77
|
+
**Expected Behavior**:
|
|
78
|
+
```typescript
|
|
79
|
+
// Publish to multiple groups
|
|
80
|
+
remember_publish({
|
|
81
|
+
memory_id: "my-recipe",
|
|
82
|
+
groups: ["{foodie-group}", "{recipe-club}"]
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
// Creates/updates:
|
|
86
|
+
// 1. Memory_groups_{foodie-group}/user123.my-recipe
|
|
87
|
+
// 2. Memory_groups_{recipe-club}/user123.my-recipe
|
|
88
|
+
// 3. Memory_users_user123/my-recipe with group_ids=["{foodie-group}", "{recipe-club}"]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 4. Implement Dual Publication
|
|
92
|
+
|
|
93
|
+
**Actions**:
|
|
94
|
+
- Support publishing to both spaces and groups simultaneously
|
|
95
|
+
- Ensure `space_ids` and `group_ids` arrays are synchronized across all copies
|
|
96
|
+
- Handle partial failures gracefully (rollback on error)
|
|
97
|
+
|
|
98
|
+
**Expected Behavior**:
|
|
99
|
+
```typescript
|
|
100
|
+
// Publish to both spaces and groups
|
|
101
|
+
remember_publish({
|
|
102
|
+
memory_id: "my-recipe",
|
|
103
|
+
spaces: ["cooking"],
|
|
104
|
+
groups: ["{foodie-group}"]
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
// Creates/updates:
|
|
108
|
+
// 1. Memory_spaces_public/user123.my-recipe with space_ids=["cooking"], group_ids=["{foodie-group}"]
|
|
109
|
+
// 2. Memory_groups_{foodie-group}/user123.my-recipe with space_ids=["cooking"], group_ids=["{foodie-group}"]
|
|
110
|
+
// 3. Memory_users_user123/my-recipe with space_ids=["cooking"], group_ids=["{foodie-group}"]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 5. Add Error Handling
|
|
114
|
+
|
|
115
|
+
**Actions**:
|
|
116
|
+
- Validate source memory exists
|
|
117
|
+
- Validate spaces and groups arrays are not empty
|
|
118
|
+
- Validate user has permission to publish to spaces/groups
|
|
119
|
+
- Handle Weaviate connection errors
|
|
120
|
+
- Rollback on partial failure (transaction-like behavior)
|
|
121
|
+
- Return clear error messages
|
|
122
|
+
|
|
123
|
+
### 6. Write Integration Tests
|
|
124
|
+
|
|
125
|
+
**File**: `tests/integration/remember-publish.test.ts`
|
|
126
|
+
|
|
127
|
+
**Actions**:
|
|
128
|
+
- Test single space publication
|
|
129
|
+
- Test multi-space publication
|
|
130
|
+
- Test single group publication
|
|
131
|
+
- Test multi-group publication
|
|
132
|
+
- Test dual publication (spaces + groups)
|
|
133
|
+
- Test updating existing published memory
|
|
134
|
+
- Test error cases (missing source, invalid IDs, etc.)
|
|
135
|
+
- Test rollback on partial failure
|
|
136
|
+
|
|
137
|
+
**Expected Output**: All tests passing
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Verification
|
|
142
|
+
|
|
143
|
+
- [ ] Tool schema updated correctly
|
|
144
|
+
- [ ] Multi-space publication works
|
|
145
|
+
- [ ] Multi-group publication works
|
|
146
|
+
- [ ] Dual publication works (spaces + groups)
|
|
147
|
+
- [ ] Composite IDs generated correctly
|
|
148
|
+
- [ ] Tracking arrays updated correctly
|
|
149
|
+
- [ ] Source memory updated with publication locations
|
|
150
|
+
- [ ] Error handling works correctly
|
|
151
|
+
- [ ] Rollback works on partial failure
|
|
152
|
+
- [ ] Integration tests passing
|
|
153
|
+
- [ ] TypeScript compiles without errors
|
|
154
|
+
- [ ] Tool description updated in MCP manifest
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Expected Output
|
|
159
|
+
|
|
160
|
+
### Files Modified
|
|
161
|
+
- `src/tools/remember-publish-v2.ts` (~250 lines)
|
|
162
|
+
|
|
163
|
+
### Files Created
|
|
164
|
+
- `tests/integration/remember-publish.test.ts` (~200 lines)
|
|
165
|
+
|
|
166
|
+
### Test Output
|
|
167
|
+
```
|
|
168
|
+
✓ Single space publication (3 tests)
|
|
169
|
+
✓ Multi-space publication (4 tests)
|
|
170
|
+
✓ Single group publication (3 tests)
|
|
171
|
+
✓ Multi-group publication (4 tests)
|
|
172
|
+
✓ Dual publication (5 tests)
|
|
173
|
+
✓ Error handling (6 tests)
|
|
174
|
+
|
|
175
|
+
Total: 25 tests passing
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Notes
|
|
181
|
+
|
|
182
|
+
- This is a breaking change from v1 (single space only)
|
|
183
|
+
- Consider maintaining v1 compatibility layer temporarily
|
|
184
|
+
- Composite IDs must be used for all published memories
|
|
185
|
+
- Tracking arrays must be synchronized across all copies
|
|
186
|
+
- Transaction-like behavior prevents partial failures
|
|
187
|
+
- Clear error messages help debugging
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
**Next Task**: [Task 167: Update remember_retract Tool](task-167-update-remember-retract.md)
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Task 167: Implement remember_retract Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: Milestone 14 - Memory Collection Pattern v2
|
|
4
|
+
**Estimated Time**: 4-6 hours
|
|
5
|
+
**Dependencies**: [Task 165: Core Infrastructure Setup](task-165-core-infrastructure-setup.md), [Task 166: Implement remember_publish Tool](task-166-update-remember-publish.md)
|
|
6
|
+
**Status**: Completed
|
|
7
|
+
**Completed**: 2026-02-26
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement the `remember_retract` tool to support selective retraction from specific spaces and groups, maintaining orphaned memories for historical reference.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create Tool Schema
|
|
20
|
+
|
|
21
|
+
**File**: `src/tools/remember-retract.ts`
|
|
22
|
+
|
|
23
|
+
**Actions**:
|
|
24
|
+
- Update input schema to accept `spaces` array (spaces to retract from)
|
|
25
|
+
- Update input schema to accept `groups` array (groups to retract from)
|
|
26
|
+
- Keep `memory_id` parameter (source memory ID)
|
|
27
|
+
- Add optional `user_id` parameter (defaults to current user)
|
|
28
|
+
- Update tool description to explain selective retraction
|
|
29
|
+
|
|
30
|
+
**Expected Schema**:
|
|
31
|
+
```typescript
|
|
32
|
+
{
|
|
33
|
+
memory_id: string,
|
|
34
|
+
spaces?: string[], // ["cooking"] - retract from these spaces
|
|
35
|
+
groups?: string[], // ["{group-id}"] - retract from these groups
|
|
36
|
+
user_id?: string // Defaults to current user
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. Implement Selective Space Retraction
|
|
41
|
+
|
|
42
|
+
**Actions**:
|
|
43
|
+
- Load source memory from `Memory_users_{userId}/{memory_id}`
|
|
44
|
+
- Generate composite ID: `{userId}.{memory_id}`
|
|
45
|
+
- For each space in `spaces` array:
|
|
46
|
+
- Load memory from `Memory_spaces_public` with composite ID
|
|
47
|
+
- Remove space from `space_ids` array
|
|
48
|
+
- If `space_ids` becomes empty AND `group_ids` is empty: Keep memory (orphaned)
|
|
49
|
+
- If `space_ids` still has items OR `group_ids` has items: Update memory
|
|
50
|
+
- Update source memory's `space_ids` array (remove retracted spaces)
|
|
51
|
+
- Return success with retraction details
|
|
52
|
+
|
|
53
|
+
**Expected Behavior**:
|
|
54
|
+
```typescript
|
|
55
|
+
// Retract from specific space
|
|
56
|
+
remember_retract({
|
|
57
|
+
memory_id: "my-recipe",
|
|
58
|
+
spaces: ["cooking"]
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// Updates:
|
|
62
|
+
// 1. Memory_spaces_public/user123.my-recipe: space_ids=["recipes"] (removed "cooking")
|
|
63
|
+
// 2. Memory_users_user123/my-recipe: space_ids=["recipes"]
|
|
64
|
+
// If space_ids becomes empty, memory remains (orphaned)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Implement Selective Group Retraction
|
|
68
|
+
|
|
69
|
+
**Actions**:
|
|
70
|
+
- Load source memory from `Memory_users_{userId}/{memory_id}`
|
|
71
|
+
- Generate composite ID: `{userId}.{memory_id}`
|
|
72
|
+
- For each group in `groups` array:
|
|
73
|
+
- Load memory from `Memory_groups_{groupId}` with composite ID
|
|
74
|
+
- Remove group from `group_ids` array
|
|
75
|
+
- If `group_ids` becomes empty: Delete memory from this group collection
|
|
76
|
+
- Update source memory's `group_ids` array (remove retracted groups)
|
|
77
|
+
- Return success with retraction details
|
|
78
|
+
|
|
79
|
+
**Expected Behavior**:
|
|
80
|
+
```typescript
|
|
81
|
+
// Retract from specific group
|
|
82
|
+
remember_retract({
|
|
83
|
+
memory_id: "my-recipe",
|
|
84
|
+
groups: ["{foodie-group}"]
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// Updates:
|
|
88
|
+
// 1. Deletes Memory_groups_{foodie-group}/user123.my-recipe
|
|
89
|
+
// 2. Memory_users_user123/my-recipe: group_ids=[] (removed group)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 4. Implement Orphaned Memory Handling
|
|
93
|
+
|
|
94
|
+
**Actions**:
|
|
95
|
+
- When retracting from all spaces, keep memory in `Memory_spaces_public`
|
|
96
|
+
- Mark memory as orphaned (empty `space_ids` and `group_ids`)
|
|
97
|
+
- Add `retracted_at` timestamp
|
|
98
|
+
- Keep for historical reference (can still be found by composite ID)
|
|
99
|
+
|
|
100
|
+
**Expected Behavior**:
|
|
101
|
+
```typescript
|
|
102
|
+
// Retract from all spaces
|
|
103
|
+
remember_retract({
|
|
104
|
+
memory_id: "my-recipe",
|
|
105
|
+
spaces: ["cooking", "recipes"] // All spaces
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// Result:
|
|
109
|
+
// Memory_spaces_public/user123.my-recipe remains with:
|
|
110
|
+
// - space_ids: []
|
|
111
|
+
// - group_ids: []
|
|
112
|
+
// - retracted_at: timestamp
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 5. Add Error Handling
|
|
116
|
+
|
|
117
|
+
**Actions**:
|
|
118
|
+
- Validate source memory exists
|
|
119
|
+
- Validate spaces and groups arrays are not empty
|
|
120
|
+
- Validate memory is actually published to specified spaces/groups
|
|
121
|
+
- Handle Weaviate connection errors
|
|
122
|
+
- Return clear error messages
|
|
123
|
+
|
|
124
|
+
### 6. Write Integration Tests
|
|
125
|
+
|
|
126
|
+
**File**: `tests/integration/remember-retract.test.ts`
|
|
127
|
+
|
|
128
|
+
**Actions**:
|
|
129
|
+
- Test single space retraction
|
|
130
|
+
- Test multi-space retraction
|
|
131
|
+
- Test single group retraction
|
|
132
|
+
- Test multi-group retraction
|
|
133
|
+
- Test orphaned memory creation
|
|
134
|
+
- Test error cases (not published, invalid IDs, etc.)
|
|
135
|
+
|
|
136
|
+
**Expected Output**: All tests passing
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Verification
|
|
141
|
+
|
|
142
|
+
- [ ] Tool schema updated correctly
|
|
143
|
+
- [ ] Selective space retraction works
|
|
144
|
+
- [ ] Selective group retraction works
|
|
145
|
+
- [ ] Orphaned memories handled correctly
|
|
146
|
+
- [ ] Tracking arrays updated correctly
|
|
147
|
+
- [ ] Source memory updated correctly
|
|
148
|
+
- [ ] Error handling works correctly
|
|
149
|
+
- [ ] Integration tests passing
|
|
150
|
+
- [ ] TypeScript compiles without errors
|
|
151
|
+
- [ ] Tool description updated in MCP manifest
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Expected Output
|
|
156
|
+
|
|
157
|
+
### Files Modified
|
|
158
|
+
- `src/tools/remember-retract-v2.ts` (~200 lines)
|
|
159
|
+
|
|
160
|
+
### Files Created
|
|
161
|
+
- `tests/integration/remember-retract.test.ts` (~150 lines)
|
|
162
|
+
|
|
163
|
+
### Test Output
|
|
164
|
+
```
|
|
165
|
+
✓ Single space retraction (3 tests)
|
|
166
|
+
✓ Multi-space retraction (3 tests)
|
|
167
|
+
✓ Single group retraction (3 tests)
|
|
168
|
+
✓ Multi-group retraction (3 tests)
|
|
169
|
+
✓ Orphaned memory handling (4 tests)
|
|
170
|
+
✓ Error handling (4 tests)
|
|
171
|
+
|
|
172
|
+
Total: 20 tests passing
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Notes
|
|
178
|
+
|
|
179
|
+
- Orphaned memories remain for historical reference
|
|
180
|
+
- Group memories are deleted when retracted (not orphaned)
|
|
181
|
+
- Space memories are orphaned when all spaces retracted
|
|
182
|
+
- Clear distinction between space and group retraction behavior
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
**Next Task**: [Task 168: Implement remember_revise Tool](task-168-implement-remember-revise.md)
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Task 168: Implement remember_revise Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: Milestone 14 - Memory Collection Pattern v2
|
|
4
|
+
**Estimated Time**: 6-8 hours
|
|
5
|
+
**Dependencies**: [Task 165: Core Infrastructure Setup](task-165-core-infrastructure-setup.md), [Task 166: Update remember_publish Tool](task-166-update-remember-publish.md)
|
|
6
|
+
**Status**: Completed
|
|
7
|
+
**Completed**: 2026-02-26
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Implement the new `remember_revise` tool to synchronize content updates across all published copies of a memory (spaces and groups), maintaining revision history.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
### 1. Create Tool Schema
|
|
20
|
+
|
|
21
|
+
**File**: `src/tools/remember-revise.ts`
|
|
22
|
+
|
|
23
|
+
**Actions**:
|
|
24
|
+
- Create input schema with `memory_id` parameter
|
|
25
|
+
- Add optional `user_id` parameter (defaults to current user)
|
|
26
|
+
- Add tool description explaining revision synchronization
|
|
27
|
+
- Register tool in MCP manifest
|
|
28
|
+
|
|
29
|
+
**Expected Schema**:
|
|
30
|
+
```typescript
|
|
31
|
+
{
|
|
32
|
+
memory_id: string,
|
|
33
|
+
user_id?: string // Defaults to current user
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Implement Content Synchronization
|
|
38
|
+
|
|
39
|
+
**Actions**:
|
|
40
|
+
- Load source memory from `Memory_users_{userId}/{memory_id}`
|
|
41
|
+
- Get current content from source memory
|
|
42
|
+
- Generate composite ID: `{userId}.{memory_id}`
|
|
43
|
+
- Find all published locations from source memory's tracking arrays:
|
|
44
|
+
- `space_ids` → `Memory_spaces_public`
|
|
45
|
+
- `group_ids` → `Memory_groups_{groupId}`
|
|
46
|
+
- For each published location:
|
|
47
|
+
- Load published memory
|
|
48
|
+
- Save current content to `revision_history` array
|
|
49
|
+
- Update content with source content
|
|
50
|
+
- Set `revised_at` timestamp
|
|
51
|
+
- Return success with revision details
|
|
52
|
+
|
|
53
|
+
**Expected Behavior**:
|
|
54
|
+
```typescript
|
|
55
|
+
// User updates source
|
|
56
|
+
remember_update_memory({ id: "my-recipe", content: "Updated recipe" })
|
|
57
|
+
|
|
58
|
+
// Revise all published versions
|
|
59
|
+
remember_revise({ memory_id: "my-recipe" })
|
|
60
|
+
|
|
61
|
+
// Updates:
|
|
62
|
+
// 1. Memory_spaces_public/user123.my-recipe: content updated, old added to revision_history
|
|
63
|
+
// 2. Memory_groups_{foodie-group}/user123.my-recipe: content updated, old added to revision_history
|
|
64
|
+
// 3. Both get revised_at timestamp
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Implement Revision History Management
|
|
68
|
+
|
|
69
|
+
**Actions**:
|
|
70
|
+
- Add old content to `revision_history` array before updating
|
|
71
|
+
- Include timestamp with each revision
|
|
72
|
+
- Limit revision history to last 10 versions (configurable)
|
|
73
|
+
- Compress old revisions if needed
|
|
74
|
+
|
|
75
|
+
**Expected Structure**:
|
|
76
|
+
```typescript
|
|
77
|
+
{
|
|
78
|
+
revision_history: [
|
|
79
|
+
{ content: "Old content 1", revised_at: "2026-02-25T10:00:00Z" },
|
|
80
|
+
{ content: "Old content 2", revised_at: "2026-02-26T14:30:00Z" }
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Handle Partial Failures
|
|
86
|
+
|
|
87
|
+
**Actions**:
|
|
88
|
+
- Track which locations were successfully revised
|
|
89
|
+
- Track which locations failed
|
|
90
|
+
- Rollback on critical failures
|
|
91
|
+
- Return detailed status for each location
|
|
92
|
+
|
|
93
|
+
**Expected Behavior**:
|
|
94
|
+
```typescript
|
|
95
|
+
// Partial failure scenario
|
|
96
|
+
remember_revise({ memory_id: "my-recipe" })
|
|
97
|
+
|
|
98
|
+
// Returns:
|
|
99
|
+
{
|
|
100
|
+
success: true,
|
|
101
|
+
revised: [
|
|
102
|
+
{ location: "Memory_spaces_public", status: "success" },
|
|
103
|
+
{ location: "Memory_groups_{foodie-group}", status: "success" },
|
|
104
|
+
{ location: "Memory_groups_{recipe-club}", status: "failed", error: "Connection timeout" }
|
|
105
|
+
],
|
|
106
|
+
warnings: ["Failed to revise 1 of 3 locations"]
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 5. Add Error Handling
|
|
111
|
+
|
|
112
|
+
**Actions**:
|
|
113
|
+
- Validate source memory exists
|
|
114
|
+
- Validate memory is published (has space_ids or group_ids)
|
|
115
|
+
- Handle Weaviate connection errors
|
|
116
|
+
- Handle missing published memories (orphaned references)
|
|
117
|
+
- Return clear error messages
|
|
118
|
+
|
|
119
|
+
### 6. Write Integration Tests
|
|
120
|
+
|
|
121
|
+
**File**: `tests/integration/remember-revise.test.ts`
|
|
122
|
+
|
|
123
|
+
**Actions**:
|
|
124
|
+
- Test revision to single space
|
|
125
|
+
- Test revision to multiple spaces
|
|
126
|
+
- Test revision to single group
|
|
127
|
+
- Test revision to multiple groups
|
|
128
|
+
- Test revision to spaces + groups
|
|
129
|
+
- Test revision history management
|
|
130
|
+
- Test partial failure handling
|
|
131
|
+
- Test error cases (not published, missing source, etc.)
|
|
132
|
+
|
|
133
|
+
**Expected Output**: All tests passing
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Verification
|
|
138
|
+
|
|
139
|
+
- [ ] Tool schema created correctly
|
|
140
|
+
- [ ] Content synchronization works
|
|
141
|
+
- [ ] Revision history managed correctly
|
|
142
|
+
- [ ] All published copies updated
|
|
143
|
+
- [ ] Timestamps set correctly
|
|
144
|
+
- [ ] Partial failures handled gracefully
|
|
145
|
+
- [ ] Error handling works correctly
|
|
146
|
+
- [ ] Integration tests passing
|
|
147
|
+
- [ ] TypeScript compiles without errors
|
|
148
|
+
- [ ] Tool registered in MCP manifest
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Expected Output
|
|
153
|
+
|
|
154
|
+
### Files Created
|
|
155
|
+
- `src/tools/remember-revise.ts` (~250 lines)
|
|
156
|
+
- `tests/integration/remember-revise.test.ts` (~180 lines)
|
|
157
|
+
|
|
158
|
+
### Test Output
|
|
159
|
+
```
|
|
160
|
+
✓ Single space revision (3 tests)
|
|
161
|
+
✓ Multi-space revision (3 tests)
|
|
162
|
+
✓ Single group revision (3 tests)
|
|
163
|
+
✓ Multi-group revision (3 tests)
|
|
164
|
+
✓ Dual revision (spaces + groups) (4 tests)
|
|
165
|
+
✓ Revision history management (5 tests)
|
|
166
|
+
✓ Partial failure handling (3 tests)
|
|
167
|
+
✓ Error handling (4 tests)
|
|
168
|
+
|
|
169
|
+
Total: 28 tests passing
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Notes
|
|
175
|
+
|
|
176
|
+
- This is a new tool (not in v1)
|
|
177
|
+
- Critical for maintaining consistency across published copies
|
|
178
|
+
- Revision history enables rollback if needed
|
|
179
|
+
- Partial failures should not prevent successful revisions
|
|
180
|
+
- Consider adding `remember_get_revision_history` tool in future
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
**Next Task**: [Task 169: Update remember_search_space Tool](task-169-update-remember-search-space.md)
|