@prmichaelsen/remember-mcp 3.12.0 → 3.14.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/CHANGELOG.md +20 -0
- package/agent/milestones/milestone-17-remember-core-migration.md +140 -0
- package/agent/progress.yaml +123 -6
- package/agent/tasks/milestone-17-remember-core-migration/task-193-foundation-setup.md +58 -0
- package/agent/tasks/milestone-17-remember-core-migration/task-194-migrate-relationship-tools.md +47 -0
- package/agent/tasks/milestone-17-remember-core-migration/task-195-migrate-preference-tools.md +34 -0
- package/agent/tasks/milestone-17-remember-core-migration/task-196-migrate-memory-tools.md +46 -0
- package/agent/tasks/milestone-17-remember-core-migration/task-197-migrate-space-confirmation-tools.md +49 -0
- package/agent/tasks/milestone-17-remember-core-migration/task-198-migrate-space-search-moderate.md +46 -0
- package/agent/tasks/milestone-17-remember-core-migration/task-199-migrate-delete-memory.md +43 -0
- package/agent/tasks/milestone-17-remember-core-migration/task-200-code-cleanup-verification.md +52 -0
- package/dist/core-services.d.ts +25 -0
- package/dist/server-factory.js +3578 -4485
- package/dist/server.js +3070 -3973
- package/dist/tools/confirm-publish-moderation.spec.d.ts +3 -2
- package/dist/tools/create-memory.d.ts +1 -1
- package/dist/tools/query-space.d.ts +1 -1
- package/dist/tools/search-space.d.ts +10 -14
- package/jest.config.js +11 -0
- package/package.json +2 -1
- package/src/core-services.ts +50 -0
- package/src/tools/confirm-publish-moderation.spec.ts +120 -176
- package/src/tools/confirm.ts +70 -1035
- package/src/tools/create-memory.ts +16 -67
- package/src/tools/create-relationship.ts +13 -181
- package/src/tools/delete-memory.ts +7 -72
- package/src/tools/delete-relationship.ts +7 -91
- package/src/tools/deny.ts +4 -14
- package/src/tools/find-similar.ts +16 -110
- package/src/tools/get-preferences.ts +3 -8
- package/src/tools/moderate.spec.ts +65 -81
- package/src/tools/moderate.ts +18 -121
- package/src/tools/publish.ts +7 -204
- package/src/tools/query-space.ts +28 -140
- package/src/tools/retract.ts +7 -185
- package/src/tools/revise.ts +4 -136
- package/src/tools/search-relationship.ts +17 -116
- package/src/tools/search-space.ts +58 -304
- package/src/tools/set-preference.ts +3 -8
- package/src/tools/update-memory.ts +22 -190
- package/src/tools/update-relationship.ts +16 -90
- package/src/v2-smoke.e2e.ts +3 -2
- package/dist/collections/composite-ids.d.ts +0 -106
- package/dist/collections/core-infrastructure.spec.d.ts +0 -11
- package/dist/collections/dot-notation.d.ts +0 -106
- package/dist/collections/tracking-arrays.d.ts +0 -176
- package/dist/constants/content-types.d.ts +0 -61
- package/dist/services/confirmation-token.service.d.ts +0 -99
- package/dist/services/confirmation-token.service.spec.d.ts +0 -5
- package/dist/services/preferences-database.service.d.ts +0 -22
- package/dist/services/space-config.service.d.ts +0 -23
- package/dist/services/space-config.service.spec.d.ts +0 -2
- package/src/collections/composite-ids.ts +0 -193
- package/src/collections/core-infrastructure.spec.ts +0 -353
- package/src/collections/dot-notation.ts +0 -212
- package/src/collections/tracking-arrays.ts +0 -298
- package/src/constants/content-types.ts +0 -490
- package/src/services/confirmation-token.service.spec.ts +0 -254
- package/src/services/confirmation-token.service.ts +0 -328
- package/src/services/preferences-database.service.ts +0 -120
- package/src/services/space-config.service.spec.ts +0 -102
- package/src/services/space-config.service.ts +0 -79
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.13.0] - 2026-02-28
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
**Ghost Mode — Server-Side Resolution (M16 hardening)**
|
|
13
|
+
|
|
14
|
+
- Ghost context now resolved server-side via `AuthContext.ghostMode` instead of LLM-accessible `ghost_context` tool parameter
|
|
15
|
+
- `ServerOptions.ghostMode` added to server factory — agentbase.me passes ghost owner/accessor via mcp-auth extras, trust level resolved from Firestore at server creation
|
|
16
|
+
- `GhostModeContext` type added to `src/types/auth.ts` with `owner_user_id`, `accessor_user_id`, `accessor_trust_level`
|
|
17
|
+
- `AuthContext` extended with optional `ghostMode` field
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
|
|
21
|
+
- `ghost_context` parameter from `remember_search_memory` and `remember_query_memory` tool schemas — trust levels are no longer LLM-controllable
|
|
22
|
+
- `GhostContext` interface from `search-memory.ts` — replaced by `GhostModeContext` in `types/auth.ts`
|
|
23
|
+
|
|
24
|
+
### Security
|
|
25
|
+
|
|
26
|
+
- Trust level escalation prevention: accessor trust is resolved from GhostConfig (Firestore) at server creation time, not from tool arguments
|
|
27
|
+
|
|
8
28
|
## [3.12.0] - 2026-02-27
|
|
9
29
|
|
|
10
30
|
### Added
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Milestone 17: remember-core Migration
|
|
2
|
+
|
|
3
|
+
**Goal**: Migrate remember-mcp tool handlers from inline business logic to remember-core service calls
|
|
4
|
+
**Duration**: 2-3 weeks
|
|
5
|
+
**Dependencies**: M16 (Ghost System complete), remember-core v0.12.0 published
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
remember-mcp has 21 tool handlers with 50-200 lines of inline business logic each (Weaviate queries, validation, CRUD operations). remember-core (`@prmichaelsen/remember-core` v0.12.0) extracts that logic into 5 DI services (MemoryService, RelationshipService, SpaceService, PreferencesDatabaseService, ConfirmationTokenService) with 120 passing tests.
|
|
13
|
+
|
|
14
|
+
This milestone migrates 18 of 21 tools to use remember-core as their business logic layer, reducing each tool handler to a thin 10-20 line adapter. 3 tools (search_memory, query_memory, ghost_config) are deferred — they depend on ghost/trust features not yet in remember-core.
|
|
15
|
+
|
|
16
|
+
Migration guide: `/home/prmichaelsen/.acp/projects/remember-core/docs/migration-guide.md`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Deliverables
|
|
21
|
+
|
|
22
|
+
### 1. Foundation Layer
|
|
23
|
+
- Install `@prmichaelsen/remember-core` as dependency
|
|
24
|
+
- Create `src/core-services.ts` — service initialization bridge
|
|
25
|
+
- Wire core services into `server-factory.ts` and `server.ts`
|
|
26
|
+
|
|
27
|
+
### 2. Tool Handler Migration (18 tools)
|
|
28
|
+
- Relationship tools (4): create, update, search, delete → `RelationshipService`
|
|
29
|
+
- Preference tools (2): get, set → `PreferencesDatabaseService`
|
|
30
|
+
- Memory tools (3): create, update, find_similar → `MemoryService`
|
|
31
|
+
- Space confirmation tools (5): publish, retract, revise, confirm, deny → `SpaceService`
|
|
32
|
+
- Space search/moderate tools (3): search_space, query_space, moderate → `SpaceService`
|
|
33
|
+
- Delete memory (1): delete_memory → `MemoryService` + `ConfirmationTokenService`
|
|
34
|
+
|
|
35
|
+
### 3. Code Cleanup
|
|
36
|
+
- Remove duplicated source files now provided by remember-core
|
|
37
|
+
- Update imports across codebase
|
|
38
|
+
- Verify no broken references
|
|
39
|
+
|
|
40
|
+
### 4. Deferred (out of scope)
|
|
41
|
+
- `search_memory` — requires ghost/trust support in core
|
|
42
|
+
- `query_memory` — requires ghost/trust support in core
|
|
43
|
+
- `ghost_config` — no core equivalent
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Success Criteria
|
|
48
|
+
|
|
49
|
+
- [ ] 18 of 21 tool handlers delegate to remember-core services
|
|
50
|
+
- [ ] Each migrated handler is ≤30 lines (thin adapter pattern)
|
|
51
|
+
- [ ] All 454+ tests pass after migration
|
|
52
|
+
- [ ] Build succeeds with no TypeScript errors
|
|
53
|
+
- [ ] Response shapes unchanged (backwards compatible)
|
|
54
|
+
- [ ] Duplicated source files removed
|
|
55
|
+
- [ ] 3 deferred tools (search_memory, query_memory, ghost_config) still work unchanged
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Key Files to Create
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
src/
|
|
63
|
+
├── core-services.ts # Service initialization bridge
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Key Files to Modify
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
src/
|
|
70
|
+
├── server-factory.ts # Wire core services into registerHandlers
|
|
71
|
+
├── server.ts # Wire core services (standalone mode)
|
|
72
|
+
├── tools/
|
|
73
|
+
│ ├── create-memory.ts # → MemoryService.create()
|
|
74
|
+
│ ├── update-memory.ts # → MemoryService.update()
|
|
75
|
+
│ ├── find-similar.ts # → MemoryService.findSimilar()
|
|
76
|
+
│ ├── delete-memory.ts # → MemoryService.delete() + tokens
|
|
77
|
+
│ ├── create-relationship.ts # → RelationshipService.create()
|
|
78
|
+
│ ├── update-relationship.ts # → RelationshipService.update()
|
|
79
|
+
│ ├── search-relationship.ts # → RelationshipService.search()
|
|
80
|
+
│ ├── delete-relationship.ts # → RelationshipService.delete()
|
|
81
|
+
│ ├── get-preferences.ts # → PreferencesDatabaseService
|
|
82
|
+
│ ├── set-preference.ts # → PreferencesDatabaseService
|
|
83
|
+
│ ├── publish.ts # → SpaceService.publish()
|
|
84
|
+
│ ├── retract.ts # → SpaceService.retract()
|
|
85
|
+
│ ├── revise.ts # → SpaceService.revise()
|
|
86
|
+
│ ├── confirm.ts # → SpaceService.confirm() + MemoryService.delete()
|
|
87
|
+
│ ├── deny.ts # → SpaceService.deny()
|
|
88
|
+
│ ├── moderate.ts # → SpaceService.moderate()
|
|
89
|
+
│ ├── search-space.ts # → SpaceService.search()
|
|
90
|
+
│ └── query-space.ts # → SpaceService.query()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Key Files to Remove (Phase 5)
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
src/
|
|
97
|
+
├── services/
|
|
98
|
+
│ ├── confirmation-token.service.ts # → core ConfirmationTokenService
|
|
99
|
+
│ ├── preferences-database.service.ts # → core PreferencesDatabaseService
|
|
100
|
+
│ ├── space-config.service.ts # → core getSpaceConfig
|
|
101
|
+
│ └── credentials-provider.ts # → core credentialsProvider
|
|
102
|
+
├── utils/
|
|
103
|
+
│ └── weaviate-filters.ts # → core filter utilities
|
|
104
|
+
├── collections/
|
|
105
|
+
│ ├── dot-notation.ts # → core getCollectionName
|
|
106
|
+
│ ├── composite-ids.ts # → core generateCompositeId
|
|
107
|
+
│ └── tracking-arrays.ts # → core tracking array utils
|
|
108
|
+
└── constants/
|
|
109
|
+
└── content-types.ts # → core isValidContentType
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Tasks
|
|
115
|
+
|
|
116
|
+
1. [Task 193: Foundation setup](../tasks/milestone-17-remember-core-migration/task-193-foundation-setup.md) - Install core, create service init, wire server-factory (2-3h)
|
|
117
|
+
2. [Task 194: Migrate relationship tools](../tasks/milestone-17-remember-core-migration/task-194-migrate-relationship-tools.md) - 4 tools → RelationshipService (3-4h)
|
|
118
|
+
3. [Task 195: Migrate preference tools](../tasks/milestone-17-remember-core-migration/task-195-migrate-preference-tools.md) - 2 tools → PreferencesDatabaseService (2-3h)
|
|
119
|
+
4. [Task 196: Migrate memory tools](../tasks/milestone-17-remember-core-migration/task-196-migrate-memory-tools.md) - 3 tools → MemoryService (3-4h)
|
|
120
|
+
5. [Task 197: Migrate space confirmation tools](../tasks/milestone-17-remember-core-migration/task-197-migrate-space-confirmation-tools.md) - publish, retract, revise, confirm, deny → SpaceService (6-8h)
|
|
121
|
+
6. [Task 198: Migrate space search/moderate tools](../tasks/milestone-17-remember-core-migration/task-198-migrate-space-search-moderate.md) - search_space, query_space, moderate → SpaceService (4-6h)
|
|
122
|
+
7. [Task 199: Migrate delete_memory tool](../tasks/milestone-17-remember-core-migration/task-199-migrate-delete-memory.md) - delete_memory → MemoryService + ConfirmationTokenService (2-3h)
|
|
123
|
+
8. [Task 200: Code cleanup & verification](../tasks/milestone-17-remember-core-migration/task-200-code-cleanup-verification.md) - Remove duplicated files, full regression (3-4h)
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Risks and Mitigation
|
|
128
|
+
|
|
129
|
+
| Risk | Impact | Probability | Mitigation Strategy |
|
|
130
|
+
|------|--------|-------------|---------------------|
|
|
131
|
+
| Response shape changes break LLM behavior | High | Medium | Every adapter must match current JSON output exactly |
|
|
132
|
+
| Test mock breakage from refactor | Medium | High | Update mocks from inline Weaviate calls to core service methods |
|
|
133
|
+
| Double Firestore initialization | High | Low | Only use remember-mcp's existing initFirestore(), never core's |
|
|
134
|
+
| ensureMemoryCollection ordering | Medium | Medium | Call in createCoreServices() before constructing services |
|
|
135
|
+
| Singleton vs instance pattern mismatch | Medium | Medium | Create ConfirmationTokenService and PreferencesDatabaseService once in core-services.ts |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
**Next Milestone**: Ghost/trust support in remember-core (enables deferred tools migration)
|
|
140
|
+
**Blockers**: None (remember-core v0.12.0 published and ready)
|
package/agent/progress.yaml
CHANGED
|
@@ -5,8 +5,8 @@ project:
|
|
|
5
5
|
version: 3.12.0
|
|
6
6
|
started: 2026-02-11
|
|
7
7
|
status: in_progress
|
|
8
|
-
current_milestone:
|
|
9
|
-
last_updated: 2026-02-
|
|
8
|
+
current_milestone: M17
|
|
9
|
+
last_updated: 2026-02-28
|
|
10
10
|
|
|
11
11
|
milestones:
|
|
12
12
|
- id: M1
|
|
@@ -325,6 +325,22 @@ milestones:
|
|
|
325
325
|
progress: 0%
|
|
326
326
|
estimated_weeks: 1
|
|
327
327
|
|
|
328
|
+
- id: M17
|
|
329
|
+
name: remember-core Migration
|
|
330
|
+
status: completed
|
|
331
|
+
progress: 100%
|
|
332
|
+
estimated_weeks: 2-3
|
|
333
|
+
tasks_completed: 8
|
|
334
|
+
tasks_total: 8
|
|
335
|
+
completed: 2026-02-28
|
|
336
|
+
notes: |
|
|
337
|
+
✅ All 18 tool handlers migrated from inline business logic to remember-core service calls.
|
|
338
|
+
✅ Each handler is now a thin 10-20 line adapter calling core services.
|
|
339
|
+
✅ 10 duplicated source files removed (services, constants, collections).
|
|
340
|
+
✅ Build passing, 390 tests (389 passed, 1 skipped). 64 tests removed (now in core).
|
|
341
|
+
3 tools deferred (search_memory, query_memory, ghost_config) — require core ghost/trust support.
|
|
342
|
+
See: agent/milestones/milestone-17-remember-core-migration.md
|
|
343
|
+
|
|
328
344
|
tasks:
|
|
329
345
|
milestone_1:
|
|
330
346
|
- id: task-1
|
|
@@ -879,18 +895,119 @@ tasks:
|
|
|
879
895
|
✅ Design doc status updated to Implemented
|
|
880
896
|
✅ 454 tests passing, typecheck clean, build clean
|
|
881
897
|
|
|
898
|
+
milestone_17:
|
|
899
|
+
- id: task-193
|
|
900
|
+
name: Foundation Setup
|
|
901
|
+
status: completed
|
|
902
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-193-foundation-setup.md
|
|
903
|
+
estimated_hours: 2-3
|
|
904
|
+
completed_date: 2026-02-28
|
|
905
|
+
notes: |
|
|
906
|
+
✅ Installed @prmichaelsen/remember-core v0.12.0
|
|
907
|
+
✅ Created src/core-services.ts (bridge module)
|
|
908
|
+
✅ Build passing, 454 tests (453 passed, 1 skipped)
|
|
909
|
+
|
|
910
|
+
- id: task-194
|
|
911
|
+
name: Migrate Relationship Tools
|
|
912
|
+
status: completed
|
|
913
|
+
completed_date: 2026-02-28
|
|
914
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-194-migrate-relationship-tools.md
|
|
915
|
+
estimated_hours: 3-4
|
|
916
|
+
dependencies: [task-193]
|
|
917
|
+
notes: |
|
|
918
|
+
4 tools → RelationshipService: create, update, search, delete
|
|
919
|
+
|
|
920
|
+
- id: task-195
|
|
921
|
+
name: Migrate Preference Tools
|
|
922
|
+
status: completed
|
|
923
|
+
completed_date: 2026-02-28
|
|
924
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-195-migrate-preference-tools.md
|
|
925
|
+
estimated_hours: 2-3
|
|
926
|
+
dependencies: [task-193]
|
|
927
|
+
notes: |
|
|
928
|
+
2 tools → PreferencesDatabaseService: get, set
|
|
929
|
+
|
|
930
|
+
- id: task-196
|
|
931
|
+
name: Migrate Memory Tools
|
|
932
|
+
status: completed
|
|
933
|
+
completed_date: 2026-02-28
|
|
934
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-196-migrate-memory-tools.md
|
|
935
|
+
estimated_hours: 3-4
|
|
936
|
+
dependencies: [task-193]
|
|
937
|
+
notes: |
|
|
938
|
+
✅ 3 tools → MemoryService: create, update, find_similar.
|
|
939
|
+
✅ Ghost exclusion post-filter in find-similar adapter.
|
|
940
|
+
search_memory and query_memory deferred (ghost-dependent).
|
|
941
|
+
|
|
942
|
+
- id: task-197
|
|
943
|
+
name: Migrate Space Confirmation Tools
|
|
944
|
+
status: completed
|
|
945
|
+
completed_date: 2026-02-28
|
|
946
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-197-migrate-space-confirmation-tools.md
|
|
947
|
+
estimated_hours: 6-8
|
|
948
|
+
dependencies: [task-193]
|
|
949
|
+
notes: |
|
|
950
|
+
✅ 5 tools → SpaceService: publish, retract, revise, confirm, deny.
|
|
951
|
+
✅ confirm.ts: 1180→120 lines. delete_memory handled inline, rest delegates to core.
|
|
952
|
+
|
|
953
|
+
- id: task-198
|
|
954
|
+
name: Migrate Space Search/Moderate Tools
|
|
955
|
+
status: completed
|
|
956
|
+
completed_date: 2026-02-28
|
|
957
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-198-migrate-space-search-moderate.md
|
|
958
|
+
estimated_hours: 4-6
|
|
959
|
+
dependencies: [task-193]
|
|
960
|
+
notes: |
|
|
961
|
+
✅ 3 tools → SpaceService: search_space, query_space, moderate.
|
|
962
|
+
✅ query_space format options stay in adapter.
|
|
963
|
+
✅ Deprecated buildBaseFilters/buildModerationFilter kept for test compat.
|
|
964
|
+
|
|
965
|
+
- id: task-199
|
|
966
|
+
name: Migrate delete_memory Tool
|
|
967
|
+
status: completed
|
|
968
|
+
completed_date: 2026-02-28
|
|
969
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-199-migrate-delete-memory.md
|
|
970
|
+
estimated_hours: 2-3
|
|
971
|
+
dependencies: [task-193, task-197]
|
|
972
|
+
notes: |
|
|
973
|
+
✅ 1 tool → ConfirmationTokenService.createRequest().
|
|
974
|
+
✅ Memory validation deferred to confirm phase.
|
|
975
|
+
|
|
976
|
+
- id: task-200
|
|
977
|
+
name: Code Cleanup & Verification
|
|
978
|
+
status: completed
|
|
979
|
+
completed_date: 2026-02-28
|
|
980
|
+
file: agent/tasks/milestone-17-remember-core-migration/task-200-code-cleanup-verification.md
|
|
981
|
+
estimated_hours: 3-4
|
|
982
|
+
dependencies: [task-194, task-195, task-196, task-197, task-198, task-199]
|
|
983
|
+
notes: |
|
|
984
|
+
✅ Removed 10 duplicated files (3 services, 1 constant, 3 collections, 3 specs).
|
|
985
|
+
✅ Updated imports in create-memory.ts and v2-smoke.e2e.ts to use @prmichaelsen/remember-core.
|
|
986
|
+
✅ Removed empty src/constants/ and src/collections/ directories.
|
|
987
|
+
✅ Build passing, 390 tests (389 passed, 1 skipped).
|
|
988
|
+
|
|
882
989
|
documentation:
|
|
883
990
|
design_documents: 31
|
|
884
|
-
milestone_documents:
|
|
991
|
+
milestone_documents: 13
|
|
885
992
|
pattern_documents: 7
|
|
886
|
-
task_documents:
|
|
993
|
+
task_documents: 83
|
|
887
994
|
|
|
888
995
|
progress:
|
|
889
996
|
planning: 100%
|
|
890
|
-
implementation:
|
|
891
|
-
overall:
|
|
997
|
+
implementation: 80%
|
|
998
|
+
overall: 85%
|
|
892
999
|
|
|
893
1000
|
recent_work:
|
|
1001
|
+
- date: 2026-02-28
|
|
1002
|
+
description: M17 remember-core Migration COMPLETED
|
|
1003
|
+
items:
|
|
1004
|
+
- ✅ All 8 tasks completed (task-193 through task-200)
|
|
1005
|
+
- ✅ 18 tool handlers migrated to thin adapters calling core services
|
|
1006
|
+
- ✅ 10 duplicated files removed, 2 imports updated to use core
|
|
1007
|
+
- ✅ Build passing, 390 tests (389 passed, 1 skipped)
|
|
1008
|
+
- 📋 3 tools deferred (search_memory, query_memory, ghost_config)
|
|
1009
|
+
- 📋 Phased approach: foundation → relationships → preferences → memory → space → cleanup
|
|
1010
|
+
|
|
894
1011
|
- date: 2026-02-27
|
|
895
1012
|
description: M16 Ghost System COMPLETE (v3.12.0)
|
|
896
1013
|
items:
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Task 193: Foundation Setup
|
|
2
|
+
|
|
3
|
+
**Milestone**: M17 — remember-core Migration
|
|
4
|
+
**Status**: not_started
|
|
5
|
+
**Dependencies**: None
|
|
6
|
+
**Estimated Hours**: 2-3
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Install remember-core, create the service initialization bridge module, and wire core services into both server entry points without changing any tool behavior.
|
|
13
|
+
|
|
14
|
+
## Deliverables
|
|
15
|
+
|
|
16
|
+
### 1. Install `@prmichaelsen/remember-core`
|
|
17
|
+
|
|
18
|
+
Add to `package.json`:
|
|
19
|
+
```json
|
|
20
|
+
"@prmichaelsen/remember-core": "^0.12.0"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2. Create `src/core-services.ts`
|
|
24
|
+
|
|
25
|
+
Service initialization bridge that creates core services scoped to a userId:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { MemoryService, RelationshipService, SpaceService,
|
|
29
|
+
PreferencesDatabaseService, ConfirmationTokenService, createLogger
|
|
30
|
+
} from '@prmichaelsen/remember-core';
|
|
31
|
+
|
|
32
|
+
export function createCoreServices(userId: string) { ... }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Key requirements:
|
|
36
|
+
- Use remember-mcp's existing `getWeaviateClient()` and `getMemoryCollection(userId)`
|
|
37
|
+
- Call `ensureMemoryCollection(userId)` before constructing services
|
|
38
|
+
- Create `ConfirmationTokenService` and `PreferencesDatabaseService` as singletons (shared across users)
|
|
39
|
+
- Do NOT call core's `initFirestore()` — use remember-mcp's existing init
|
|
40
|
+
|
|
41
|
+
### 3. Wire into `src/server-factory.ts`
|
|
42
|
+
|
|
43
|
+
- Create core services in `createServer()` after `ensureDatabasesInitialized()`
|
|
44
|
+
- Pass services to `registerHandlers()` as new parameter
|
|
45
|
+
- No tool handler changes yet — services are created but unused
|
|
46
|
+
|
|
47
|
+
### 4. Wire into `src/server.ts`
|
|
48
|
+
|
|
49
|
+
- Create core services per-request or use lazy cache by userId
|
|
50
|
+
- Pass services to tool handlers (unused initially)
|
|
51
|
+
|
|
52
|
+
## Acceptance Criteria
|
|
53
|
+
|
|
54
|
+
- [ ] `npm install` succeeds with remember-core dependency
|
|
55
|
+
- [ ] `npm run build` passes with no TypeScript errors
|
|
56
|
+
- [ ] `npm test` — all 454 tests still pass (no behavior changes)
|
|
57
|
+
- [ ] `createCoreServices(userId)` returns all 5 service instances
|
|
58
|
+
- [ ] Both server.ts and server-factory.ts create and pass services
|
package/agent/tasks/milestone-17-remember-core-migration/task-194-migrate-relationship-tools.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Task 194: Migrate Relationship Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: M17 — remember-core Migration
|
|
4
|
+
**Status**: not_started
|
|
5
|
+
**Dependencies**: Task 193 (Foundation setup)
|
|
6
|
+
**Estimated Hours**: 3-4
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Migrate 4 relationship tool handlers from inline Weaviate logic to `RelationshipService` adapters.
|
|
13
|
+
|
|
14
|
+
## Tools to Migrate
|
|
15
|
+
|
|
16
|
+
| Tool | File | Core Method |
|
|
17
|
+
|------|------|-------------|
|
|
18
|
+
| `remember_create_relationship` | `src/tools/create-relationship.ts` | `RelationshipService.create()` |
|
|
19
|
+
| `remember_update_relationship` | `src/tools/update-relationship.ts` | `RelationshipService.update()` |
|
|
20
|
+
| `remember_search_relationship` | `src/tools/search-relationship.ts` | `RelationshipService.search()` |
|
|
21
|
+
| `remember_delete_relationship` | `src/tools/delete-relationship.ts` | `RelationshipService.delete()` |
|
|
22
|
+
|
|
23
|
+
## Adapter Pattern
|
|
24
|
+
|
|
25
|
+
Each handler becomes ~15-20 lines:
|
|
26
|
+
1. Create debug logger (stays in adapter)
|
|
27
|
+
2. Get `relationship` service from `services` param or `createCoreServices(userId)`
|
|
28
|
+
3. Map MCP args to core input type
|
|
29
|
+
4. Call core service method
|
|
30
|
+
5. Add supplementary response fields (`message`, etc.) to match current JSON shape
|
|
31
|
+
6. Wrap in `handleToolError()` catch
|
|
32
|
+
|
|
33
|
+
## Key Requirements
|
|
34
|
+
|
|
35
|
+
- **Response shape preservation**: JSON output must be identical to current output
|
|
36
|
+
- **Debug logging**: `createDebugLogger()` stays in adapter layer
|
|
37
|
+
- **Tool definitions**: `createRelationshipTool` etc. unchanged (MCP schemas stay)
|
|
38
|
+
- **Error handling**: `handleToolError()` wrapper stays in adapter
|
|
39
|
+
|
|
40
|
+
## Acceptance Criteria
|
|
41
|
+
|
|
42
|
+
- [ ] All 4 relationship tool handlers delegate to RelationshipService
|
|
43
|
+
- [ ] Each handler is ≤25 lines
|
|
44
|
+
- [ ] Existing relationship tests pass without mock changes (or mocks updated)
|
|
45
|
+
- [ ] `npm run build` passes
|
|
46
|
+
- [ ] `npm test` passes
|
|
47
|
+
- [ ] Response JSON shapes match pre-migration output
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Task 195: Migrate Preference Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: M17 — remember-core Migration
|
|
4
|
+
**Status**: not_started
|
|
5
|
+
**Dependencies**: Task 193 (Foundation setup)
|
|
6
|
+
**Estimated Hours**: 2-3
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Migrate 2 preference tool handlers from static method calls to `PreferencesDatabaseService` instance methods.
|
|
13
|
+
|
|
14
|
+
## Tools to Migrate
|
|
15
|
+
|
|
16
|
+
| Tool | File | Core Method |
|
|
17
|
+
|------|------|-------------|
|
|
18
|
+
| `remember_get_preferences` | `src/tools/get-preferences.ts` | `PreferencesDatabaseService.getPreferences()` |
|
|
19
|
+
| `remember_set_preference` | `src/tools/set-preference.ts` | `PreferencesDatabaseService.updatePreferences()` |
|
|
20
|
+
|
|
21
|
+
## Key Differences
|
|
22
|
+
|
|
23
|
+
- **Static → Instance**: remember-mcp uses `PreferencesDatabaseService.getPreferences(userId)` (static). Core uses `preferencesService.getPreferences(userId)` (instance method).
|
|
24
|
+
- **Category filtering**: `get_preferences` does category filtering in the tool handler. This presentation logic stays in the adapter.
|
|
25
|
+
- **formatPreferenceChangeMessage()**: MCP-specific helper stays in adapter.
|
|
26
|
+
|
|
27
|
+
## Acceptance Criteria
|
|
28
|
+
|
|
29
|
+
- [ ] Both preference tool handlers delegate to core PreferencesDatabaseService
|
|
30
|
+
- [ ] Category filtering preserved in get_preferences adapter
|
|
31
|
+
- [ ] `formatPreferenceChangeMessage()` still used in set_preference
|
|
32
|
+
- [ ] `npm run build` passes
|
|
33
|
+
- [ ] `npm test` passes
|
|
34
|
+
- [ ] Response JSON shapes match pre-migration output
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Task 196: Migrate Memory Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: M17 — remember-core Migration
|
|
4
|
+
**Status**: not_started
|
|
5
|
+
**Dependencies**: Task 193 (Foundation setup)
|
|
6
|
+
**Estimated Hours**: 3-4
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Migrate 3 non-ghost memory tool handlers to `MemoryService` adapters.
|
|
13
|
+
|
|
14
|
+
## Tools to Migrate
|
|
15
|
+
|
|
16
|
+
| Tool | File | Core Method |
|
|
17
|
+
|------|------|-------------|
|
|
18
|
+
| `remember_create_memory` | `src/tools/create-memory.ts` | `MemoryService.create()` |
|
|
19
|
+
| `remember_update_memory` | `src/tools/update-memory.ts` | `MemoryService.update()` |
|
|
20
|
+
| `remember_find_similar` | `src/tools/find-similar.ts` | `MemoryService.findSimilar()` |
|
|
21
|
+
|
|
22
|
+
## NOT Migrated (deferred — ghost-dependent)
|
|
23
|
+
|
|
24
|
+
- `remember_search_memory` — uses `buildTrustFilter()`, ghost exclusion
|
|
25
|
+
- `remember_query_memory` — uses `buildTrustFilter()`, ghost exclusion
|
|
26
|
+
|
|
27
|
+
## Key Gaps
|
|
28
|
+
|
|
29
|
+
### create_memory
|
|
30
|
+
- `structured_content` and `skip_template_suggestion` args exist in MCP but NOT in core's `CreateMemoryInput`. Handle in adapter layer (pass through to response, not to core).
|
|
31
|
+
- `context_summary` default differs: MCP uses `'Memory created via MCP'`, core uses `'Memory created'`. Set explicitly in adapter.
|
|
32
|
+
|
|
33
|
+
### find_similar
|
|
34
|
+
- **Ghost exclusion**: MCP applies `content_type != 'ghost'` filter. Core doesn't exclude ghosts. Post-filter ghost results in adapter.
|
|
35
|
+
|
|
36
|
+
### update_memory
|
|
37
|
+
- `structured_content` may exist in MCP args but not core input. Handle in adapter.
|
|
38
|
+
|
|
39
|
+
## Acceptance Criteria
|
|
40
|
+
|
|
41
|
+
- [ ] All 3 memory tool handlers delegate to MemoryService
|
|
42
|
+
- [ ] Ghost exclusion in find_similar handled via post-filtering
|
|
43
|
+
- [ ] `structured_content` and `skip_template_suggestion` handled in adapter
|
|
44
|
+
- [ ] `npm run build` passes
|
|
45
|
+
- [ ] `npm test` passes
|
|
46
|
+
- [ ] Response JSON shapes match pre-migration output
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Task 197: Migrate Space Confirmation Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: M17 — remember-core Migration
|
|
4
|
+
**Status**: not_started
|
|
5
|
+
**Dependencies**: Task 193 (Foundation setup)
|
|
6
|
+
**Estimated Hours**: 6-8
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Migrate 5 space confirmation-flow tools to `SpaceService` adapters. This is the most complex task — `confirm.ts` is 1180 lines with 4 action branches.
|
|
13
|
+
|
|
14
|
+
## Tools to Migrate
|
|
15
|
+
|
|
16
|
+
| Tool | File | Core Method |
|
|
17
|
+
|------|------|-------------|
|
|
18
|
+
| `remember_publish` | `src/tools/publish.ts` | `SpaceService.publish()` |
|
|
19
|
+
| `remember_retract` | `src/tools/retract.ts` | `SpaceService.retract()` |
|
|
20
|
+
| `remember_revise` | `src/tools/revise.ts` | `SpaceService.revise()` |
|
|
21
|
+
| `remember_confirm` | `src/tools/confirm.ts` | `SpaceService.confirm()` + `MemoryService.delete()` |
|
|
22
|
+
| `remember_deny` | `src/tools/deny.ts` | `SpaceService.deny()` |
|
|
23
|
+
|
|
24
|
+
## Key Complexity: confirm.ts
|
|
25
|
+
|
|
26
|
+
`confirm.ts` dispatches to 4 action executors:
|
|
27
|
+
- `executePublishMemory` → `SpaceService.confirm()` (action: publish_memory)
|
|
28
|
+
- `executeDeleteMemory` → `MemoryService.delete()` (core does direct soft-delete)
|
|
29
|
+
- `executeRetractMemory` → `SpaceService.confirm()` (action: retract_memory)
|
|
30
|
+
- `executeReviseMemory` → `SpaceService.confirm()` (action: revise_memory)
|
|
31
|
+
|
|
32
|
+
**Critical**: Core's `SpaceService.confirm()` handles publish/retract/revise. For delete_memory, use `MemoryService.delete()` since confirmation token was already validated.
|
|
33
|
+
|
|
34
|
+
## Error Handling
|
|
35
|
+
|
|
36
|
+
- MCP tools return verbose JSON error responses (`{ success: false, error: '...', message: '...' }`)
|
|
37
|
+
- Core throws errors
|
|
38
|
+
- Adapters must catch core errors and format into expected JSON responses
|
|
39
|
+
|
|
40
|
+
## Acceptance Criteria
|
|
41
|
+
|
|
42
|
+
- [ ] publish, retract, revise generate tokens via SpaceService
|
|
43
|
+
- [ ] confirm delegates to SpaceService.confirm() for publish/retract/revise
|
|
44
|
+
- [ ] confirm delegates to MemoryService.delete() for delete_memory action
|
|
45
|
+
- [ ] deny delegates to SpaceService.deny()
|
|
46
|
+
- [ ] Error responses match current JSON format
|
|
47
|
+
- [ ] `npm run build` passes
|
|
48
|
+
- [ ] `npm test` passes (especially confirm-publish-moderation tests)
|
|
49
|
+
- [ ] Response JSON shapes match pre-migration output
|
package/agent/tasks/milestone-17-remember-core-migration/task-198-migrate-space-search-moderate.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Task 198: Migrate Space Search/Moderate Tools
|
|
2
|
+
|
|
3
|
+
**Milestone**: M17 — remember-core Migration
|
|
4
|
+
**Status**: not_started
|
|
5
|
+
**Dependencies**: Task 193 (Foundation setup)
|
|
6
|
+
**Estimated Hours**: 4-6
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Migrate 3 space search and moderation tools to `SpaceService` adapters.
|
|
13
|
+
|
|
14
|
+
## Tools to Migrate
|
|
15
|
+
|
|
16
|
+
| Tool | File | Core Method |
|
|
17
|
+
|------|------|-------------|
|
|
18
|
+
| `remember_search_space` | `src/tools/search-space.ts` | `SpaceService.search()` |
|
|
19
|
+
| `remember_query_space` | `src/tools/query-space.ts` | `SpaceService.query()` |
|
|
20
|
+
| `remember_moderate` | `src/tools/moderate.ts` | `SpaceService.moderate()` |
|
|
21
|
+
|
|
22
|
+
## Key Details
|
|
23
|
+
|
|
24
|
+
### search_space
|
|
25
|
+
- Maps directly to `SpaceService.search(input, authContext)`
|
|
26
|
+
- No ghost dependency (ghost filtering only on personal collections)
|
|
27
|
+
- Moderator permission checks handled by core service
|
|
28
|
+
|
|
29
|
+
### query_space
|
|
30
|
+
- **Format gap**: MCP has `format: 'detailed'|'compact'` and `include_context` options not in core's `QuerySpaceInput`
|
|
31
|
+
- Core returns raw results; adapter applies formatting (compact text summary vs detailed objects)
|
|
32
|
+
- Formatting logic stays in adapter
|
|
33
|
+
|
|
34
|
+
### moderate
|
|
35
|
+
- Maps to `SpaceService.moderate(input, authContext)`
|
|
36
|
+
- Core's AuthContext (no ghostMode) is fine — moderate doesn't use ghostMode
|
|
37
|
+
- Permission checking (`canModerate`, `canModerateAny`) handled by core
|
|
38
|
+
|
|
39
|
+
## Acceptance Criteria
|
|
40
|
+
|
|
41
|
+
- [ ] All 3 tools delegate to SpaceService
|
|
42
|
+
- [ ] query_space format/include_context options handled in adapter
|
|
43
|
+
- [ ] Moderator permission checks work correctly via core
|
|
44
|
+
- [ ] `npm run build` passes
|
|
45
|
+
- [ ] `npm test` passes
|
|
46
|
+
- [ ] Response JSON shapes match pre-migration output
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Task 199: Migrate delete_memory Tool
|
|
2
|
+
|
|
3
|
+
**Milestone**: M17 — remember-core Migration
|
|
4
|
+
**Status**: not_started
|
|
5
|
+
**Dependencies**: Task 193 (Foundation setup), Task 197 (confirm.ts migration)
|
|
6
|
+
**Estimated Hours**: 2-3
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Migrate the delete_memory tool to use core services while preserving the two-phase confirmation flow.
|
|
13
|
+
|
|
14
|
+
## Tool to Migrate
|
|
15
|
+
|
|
16
|
+
| Tool | File | Core Methods |
|
|
17
|
+
|------|------|-------------|
|
|
18
|
+
| `remember_delete_memory` | `src/tools/delete-memory.ts` | `MemoryService` (fetch/validate) + `ConfirmationTokenService` (token) |
|
|
19
|
+
|
|
20
|
+
## Two-Phase Pattern
|
|
21
|
+
|
|
22
|
+
**Phase 1** (`handleDeleteMemory`):
|
|
23
|
+
1. Use `MemoryService` to fetch and validate the memory (ownership, doc_type, not-deleted checks)
|
|
24
|
+
2. Detect orphaned relationships (relationships that would be orphaned by deletion)
|
|
25
|
+
3. Use `ConfirmationTokenService` from core to create confirmation token
|
|
26
|
+
4. Return token preview to user
|
|
27
|
+
|
|
28
|
+
**Phase 2** (in `confirm.ts`, already migrated in Task 197):
|
|
29
|
+
- Use `MemoryService.delete()` for soft-delete when token is confirmed
|
|
30
|
+
|
|
31
|
+
## Key Requirement
|
|
32
|
+
|
|
33
|
+
- The confirmation token flow MUST be preserved — no direct deletion
|
|
34
|
+
- Orphan detection logic may need to stay in adapter if core doesn't provide it
|
|
35
|
+
|
|
36
|
+
## Acceptance Criteria
|
|
37
|
+
|
|
38
|
+
- [ ] Phase 1 uses core services for fetch/validate and token creation
|
|
39
|
+
- [ ] Phase 2 (in confirm.ts) uses MemoryService.delete()
|
|
40
|
+
- [ ] Orphan detection still works
|
|
41
|
+
- [ ] `npm run build` passes
|
|
42
|
+
- [ ] `npm test` passes
|
|
43
|
+
- [ ] Response JSON shapes match pre-migration output
|