@prmichaelsen/remember-mcp 2.3.4 → 2.5.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 +42 -0
- package/README.md +50 -5
- package/agent/milestones/milestone-11-unified-public-collection.md +205 -0
- package/agent/tasks/task-46-update-spacememory-types.md +94 -0
- package/agent/tasks/task-47-update-space-schema.md +102 -0
- package/agent/tasks/task-48-create-memory-public-collection.md +96 -0
- package/agent/tasks/task-49-update-remember-publish.md +153 -0
- package/agent/tasks/task-50-update-remember-confirm.md +111 -0
- package/agent/tasks/task-51-update-remember-search-space.md +154 -0
- package/agent/tasks/task-52-update-remember-query-space.md +142 -0
- package/agent/tasks/task-53-add-multispace-tests.md +193 -0
- package/agent/tasks/task-54-update-documentation-multispace.md +191 -0
- package/dist/server-factory.js +137 -80
- package/dist/server.js +137 -80
- package/dist/tools/publish.d.ts +1 -1
- package/dist/tools/query-space.d.ts +1 -1
- package/dist/tools/search-space.d.ts +1 -1
- package/dist/types/space-memory.d.ts +5 -3
- package/dist/weaviate/space-schema.d.ts +16 -0
- package/package.json +1 -1
- package/src/tools/confirm.ts +15 -16
- package/src/tools/publish.ts +42 -20
- package/src/tools/query-space.ts +38 -24
- package/src/tools/search-space.ts +51 -28
- package/src/types/space-memory.ts +5 -3
- package/src/weaviate/space-schema.spec.ts +55 -0
- package/src/weaviate/space-schema.ts +45 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,48 @@ 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
|
+
## [2.4.0] - 2026-02-16
|
|
9
|
+
|
|
10
|
+
### ✨ Added
|
|
11
|
+
|
|
12
|
+
- **Multi-Space Support**: Publish and search across multiple spaces simultaneously
|
|
13
|
+
- `spaces` array parameter in `remember_publish` (replaces `target`)
|
|
14
|
+
- `spaces` array parameter in `remember_search_space` (replaces `space`)
|
|
15
|
+
- `spaces` array parameter in `remember_query_space` (replaces `space`)
|
|
16
|
+
- Single memory can belong to multiple spaces
|
|
17
|
+
- No duplication - one memory, multiple spaces
|
|
18
|
+
- Search multiple spaces in one query
|
|
19
|
+
|
|
20
|
+
- **Unified Public Collection**: `Memory_public` replaces per-space collections
|
|
21
|
+
- All public memories in single collection
|
|
22
|
+
- Efficient storage (N× reduction in documents)
|
|
23
|
+
- Simpler architecture
|
|
24
|
+
- Uses `containsAny` filter for multi-space queries
|
|
25
|
+
|
|
26
|
+
### 🔧 Changed
|
|
27
|
+
|
|
28
|
+
- **SpaceMemory type**: `space_id: string` → `spaces: string[]`
|
|
29
|
+
- **remember_publish**: `target` parameter → `spaces` array
|
|
30
|
+
- **remember_search_space**: `space` parameter → `spaces` array
|
|
31
|
+
- **remember_query_space**: `space` parameter → `spaces` array
|
|
32
|
+
- **Collection strategy**: Per-space collections → Unified `Memory_public`
|
|
33
|
+
- **Search results**: Include `spaces_searched` or `spaces_queried` in response
|
|
34
|
+
|
|
35
|
+
### 📚 Documentation
|
|
36
|
+
|
|
37
|
+
- Created Milestone 11: Unified Public Collection
|
|
38
|
+
- Created Tasks 46-54 for implementation
|
|
39
|
+
- Created design document: `agent/design/unified-public-collection.md`
|
|
40
|
+
- Created design document: `agent/design/comment-memory-type.md`
|
|
41
|
+
|
|
42
|
+
### ⚠️ Deprecation
|
|
43
|
+
|
|
44
|
+
- `ensureSpaceCollection()` deprecated (use `ensurePublicCollection()`)
|
|
45
|
+
- `getSpaceCollectionName()` deprecated (use `PUBLIC_COLLECTION_NAME`)
|
|
46
|
+
- Per-space collections (`Memory_the_void`, etc.) will be removed in v3.0.0
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
8
50
|
## [2.3.3] - 2026-02-16
|
|
9
51
|
|
|
10
52
|
### 🐛 Fixed
|
package/README.md
CHANGED
|
@@ -149,12 +149,41 @@ await wrapped.start();
|
|
|
149
149
|
## Architecture
|
|
150
150
|
|
|
151
151
|
- **Weaviate**: Vector storage for memories, relationships, and shared spaces
|
|
152
|
-
- Personal collections: `Memory_{user_id}`
|
|
153
|
-
-
|
|
152
|
+
- Personal collections: `Memory_{user_id}` (per-user isolation)
|
|
153
|
+
- Unified public collection: `Memory_public` (all public spaces)
|
|
154
|
+
- Multi-space support: Memories can belong to multiple spaces via `spaces` array
|
|
154
155
|
- **Firestore**: Permissions, preferences, confirmation tokens
|
|
155
156
|
- User data: `users/{user_id}/preferences`, `users/{user_id}/requests`
|
|
156
157
|
- **Firebase Auth**: User authentication
|
|
157
158
|
|
|
159
|
+
### Multi-Space Architecture (v2.4.0+)
|
|
160
|
+
|
|
161
|
+
**Unified Collection**: All public memories stored in single `Memory_public` collection
|
|
162
|
+
|
|
163
|
+
**Benefits**:
|
|
164
|
+
- ✅ Search multiple spaces in one query
|
|
165
|
+
- ✅ Publish to multiple spaces in one operation
|
|
166
|
+
- ✅ No memory duplication
|
|
167
|
+
- ✅ Efficient storage (N× reduction)
|
|
168
|
+
|
|
169
|
+
**Example**:
|
|
170
|
+
```typescript
|
|
171
|
+
// One memory, three spaces
|
|
172
|
+
{
|
|
173
|
+
"id": "abc123",
|
|
174
|
+
"spaces": ["the_void", "dogs", "cats"],
|
|
175
|
+
"content": "My dog is adorable!",
|
|
176
|
+
"author_id": "user123"
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Search across spaces
|
|
180
|
+
remember_search_space({
|
|
181
|
+
spaces: ["the_void", "dogs"],
|
|
182
|
+
query: "adorable pets"
|
|
183
|
+
})
|
|
184
|
+
// Finds memories published to ANY of the requested spaces
|
|
185
|
+
```
|
|
186
|
+
|
|
158
187
|
## Shared Spaces
|
|
159
188
|
|
|
160
189
|
Publish memories to shared discovery spaces where other users can find them.
|
|
@@ -167,19 +196,35 @@ Publish memories to shared discovery spaces where other users can find them.
|
|
|
167
196
|
|
|
168
197
|
1. **Request Publication**: Generate confirmation token
|
|
169
198
|
```typescript
|
|
170
|
-
|
|
199
|
+
// Publish to single space
|
|
200
|
+
remember_publish({ memory_id: "abc123", spaces: ["the_void"] })
|
|
201
|
+
|
|
202
|
+
// Publish to multiple spaces at once!
|
|
203
|
+
remember_publish({ memory_id: "abc123", spaces: ["the_void", "dogs", "cats"] })
|
|
204
|
+
|
|
171
205
|
// Returns: { success: true, token: "xyz789" }
|
|
172
206
|
```
|
|
173
207
|
|
|
174
208
|
2. **User Confirms**: Execute the publication
|
|
175
209
|
```typescript
|
|
176
210
|
remember_confirm({ token: "xyz789" })
|
|
177
|
-
// Returns: {
|
|
211
|
+
// Returns: {
|
|
212
|
+
// success: true,
|
|
213
|
+
// space_memory_id: "new-id",
|
|
214
|
+
// spaces: ["the_void", "dogs", "cats"]
|
|
215
|
+
// }
|
|
178
216
|
```
|
|
179
217
|
|
|
180
218
|
3. **Discover**: Search shared spaces
|
|
181
219
|
```typescript
|
|
182
|
-
|
|
220
|
+
// Search single space
|
|
221
|
+
remember_search_space({ query: "interesting ideas", spaces: ["the_void"] })
|
|
222
|
+
|
|
223
|
+
// Search multiple spaces at once!
|
|
224
|
+
remember_search_space({
|
|
225
|
+
query: "cute dog pictures",
|
|
226
|
+
spaces: ["the_void", "dogs"]
|
|
227
|
+
})
|
|
183
228
|
```
|
|
184
229
|
|
|
185
230
|
### Space Tools (5 new)
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Milestone 11: Unified Public Collection
|
|
2
|
+
|
|
3
|
+
**Goal**: Implement unified `Memory_public` collection with multi-space support
|
|
4
|
+
**Duration**: 1-2 weeks
|
|
5
|
+
**Dependencies**: M10 (Shared Spaces & Confirmation Flow)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Replace per-space collections (`Memory_the_void`, `Memory_dogs`, etc.) with a unified `Memory_public` collection where memories can belong to multiple spaces simultaneously. This enables multi-space search, eliminates duplication, and provides a more flexible and scalable architecture.
|
|
13
|
+
|
|
14
|
+
This milestone introduces:
|
|
15
|
+
- **Unified Collection**: Single `Memory_public` for all public spaces
|
|
16
|
+
- **Multi-Space Support**: `spaces: string[]` array instead of single `space_id`
|
|
17
|
+
- **Multi-Space Search**: Query multiple spaces in one call
|
|
18
|
+
- **No Duplication**: One memory, multiple spaces
|
|
19
|
+
- **Efficient Storage**: N× reduction in documents
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Deliverables
|
|
24
|
+
|
|
25
|
+
### 1. Type System Updates
|
|
26
|
+
- Update `SpaceMemory` interface: `space_id: string` → `spaces: string[]`
|
|
27
|
+
- Update type exports and constants
|
|
28
|
+
- Backward compatibility considerations
|
|
29
|
+
|
|
30
|
+
### 2. Schema Updates
|
|
31
|
+
- Add `spaces` array field to Weaviate schema
|
|
32
|
+
- Create `Memory_public` collection
|
|
33
|
+
- Update space schema utilities
|
|
34
|
+
- Collection name constants
|
|
35
|
+
|
|
36
|
+
### 3. Tool Updates (5 tools)
|
|
37
|
+
- Update `remember_publish` - Support `spaces` array parameter
|
|
38
|
+
- Update `remember_confirm` - Handle multi-space publishing
|
|
39
|
+
- Update `remember_search_space` - Multi-space search with `containsAny`
|
|
40
|
+
- Update `remember_query_space` - Multi-space RAG queries
|
|
41
|
+
- Update `remember_deny` - No changes needed
|
|
42
|
+
|
|
43
|
+
### 4. Migration Strategy
|
|
44
|
+
- Backward compatibility during transition
|
|
45
|
+
- Data migration plan (if needed)
|
|
46
|
+
- Deprecation timeline
|
|
47
|
+
|
|
48
|
+
### 5. Testing & Documentation
|
|
49
|
+
- Update unit tests for all affected tools
|
|
50
|
+
- Add multi-space test scenarios
|
|
51
|
+
- Update README with multi-space examples
|
|
52
|
+
- Update API documentation
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Success Criteria
|
|
57
|
+
|
|
58
|
+
- [ ] `SpaceMemory` type uses `spaces: string[]`
|
|
59
|
+
- [ ] `Memory_public` collection created successfully
|
|
60
|
+
- [ ] `remember_publish` accepts `spaces` array
|
|
61
|
+
- [ ] Can publish to multiple spaces in one call
|
|
62
|
+
- [ ] `remember_search_space` accepts `spaces` array
|
|
63
|
+
- [ ] Multi-space search returns results from all requested spaces
|
|
64
|
+
- [ ] No memory duplication across spaces
|
|
65
|
+
- [ ] All 5 space tools work with new architecture
|
|
66
|
+
- [ ] TypeScript compiles without errors
|
|
67
|
+
- [ ] All tests passing (including new multi-space tests)
|
|
68
|
+
- [ ] Build successful
|
|
69
|
+
- [ ] README updated with multi-space examples
|
|
70
|
+
- [ ] Backward compatibility maintained (if applicable)
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Key Files to Modify
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
src/
|
|
78
|
+
├── types/
|
|
79
|
+
│ └── space-memory.ts # Update SpaceMemory interface
|
|
80
|
+
├── weaviate/
|
|
81
|
+
│ └── space-schema.ts # Update schema, add Memory_public
|
|
82
|
+
└── tools/
|
|
83
|
+
├── publish.ts # Support spaces array
|
|
84
|
+
├── confirm.ts # Handle multi-space publish
|
|
85
|
+
├── search-space.ts # Multi-space search
|
|
86
|
+
└── query-space.ts # Multi-space query
|
|
87
|
+
|
|
88
|
+
tests/
|
|
89
|
+
└── unit/
|
|
90
|
+
├── space-schema.test.ts # Add multi-space tests
|
|
91
|
+
├── publish.test.ts # Add multi-space tests
|
|
92
|
+
├── search-space.test.ts # Add multi-space tests
|
|
93
|
+
└── query-space.test.ts # Add multi-space tests
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Implementation Tasks
|
|
99
|
+
|
|
100
|
+
See individual task documents:
|
|
101
|
+
- Task 46: Update SpaceMemory Types for Multi-Space
|
|
102
|
+
- Task 47: Update Space Schema with Spaces Array
|
|
103
|
+
- Task 48: Create Memory_public Collection
|
|
104
|
+
- Task 49: Update remember_publish for Multi-Space
|
|
105
|
+
- Task 50: Update remember_confirm for Multi-Space
|
|
106
|
+
- Task 51: Update remember_search_space for Multi-Space
|
|
107
|
+
- Task 52: Update remember_query_space for Multi-Space
|
|
108
|
+
- Task 53: Add Multi-Space Unit Tests
|
|
109
|
+
- Task 54: Update Documentation for Multi-Space
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Architecture Notes
|
|
114
|
+
|
|
115
|
+
### Before (Per-Space Collections)
|
|
116
|
+
```
|
|
117
|
+
Memory_the_void → Only "The Void" memories
|
|
118
|
+
Memory_dogs → Only "Dogs" memories
|
|
119
|
+
Memory_cats → Only "Cats" memories
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Problems**:
|
|
123
|
+
- Can't search multiple spaces at once
|
|
124
|
+
- Memory duplication if published to multiple spaces
|
|
125
|
+
- Collection proliferation
|
|
126
|
+
|
|
127
|
+
### After (Unified Collection)
|
|
128
|
+
```
|
|
129
|
+
Memory_public → ALL public memories
|
|
130
|
+
- spaces: ["the_void"]
|
|
131
|
+
- spaces: ["dogs", "cats"]
|
|
132
|
+
- spaces: ["the_void", "dogs"]
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Benefits**:
|
|
136
|
+
- ✅ Multi-space search in one query
|
|
137
|
+
- ✅ No duplication
|
|
138
|
+
- ✅ Efficient storage
|
|
139
|
+
- ✅ Flexible space management
|
|
140
|
+
|
|
141
|
+
### Multi-Space Search Example
|
|
142
|
+
```typescript
|
|
143
|
+
remember_search_space({
|
|
144
|
+
spaces: ["the_void", "dogs"], // ✅ Multiple spaces!
|
|
145
|
+
query: "cute dog pictures"
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
// Weaviate filter:
|
|
149
|
+
collection.filter.byProperty('spaces').containsAny(['the_void', 'dogs'])
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Migration Strategy
|
|
155
|
+
|
|
156
|
+
### Phase 1: Add Support (v2.4.0 - Backward Compatible)
|
|
157
|
+
- Add `spaces` field to schema (keep `space_id` temporarily)
|
|
158
|
+
- Support both `space` and `spaces` parameters
|
|
159
|
+
- Create `Memory_public` collection
|
|
160
|
+
- Dual-write to both old and new collections
|
|
161
|
+
|
|
162
|
+
### Phase 2: Migrate Data (v2.5.0)
|
|
163
|
+
- Copy existing memories from per-space to unified
|
|
164
|
+
- Verify data integrity
|
|
165
|
+
- Mark old collections as deprecated
|
|
166
|
+
|
|
167
|
+
### Phase 3: Remove Old (v3.0.0 - Breaking Change)
|
|
168
|
+
- Remove `space_id` field
|
|
169
|
+
- Remove per-space collections
|
|
170
|
+
- Remove backward compatibility code
|
|
171
|
+
- Update all documentation
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Testing Strategy
|
|
176
|
+
|
|
177
|
+
1. **Unit Tests**: Each tool with multi-space scenarios
|
|
178
|
+
2. **Integration Tests**: Full publish → search workflow
|
|
179
|
+
3. **Migration Tests**: Data migration validation
|
|
180
|
+
4. **Performance Tests**: Compare single vs. multi-space queries
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Breaking Changes
|
|
185
|
+
|
|
186
|
+
**v3.0.0 (Future)**:
|
|
187
|
+
- Remove `space_id` field from SpaceMemory
|
|
188
|
+
- Remove per-space collections
|
|
189
|
+
- Remove `space` parameter (use `spaces` only)
|
|
190
|
+
|
|
191
|
+
**Migration Guide**:
|
|
192
|
+
```typescript
|
|
193
|
+
// Before (v2.3.x)
|
|
194
|
+
remember_publish({ memory_id: "abc", target: "the_void" })
|
|
195
|
+
remember_search_space({ space: "the_void", query: "..." })
|
|
196
|
+
|
|
197
|
+
// After (v3.0.0)
|
|
198
|
+
remember_publish({ memory_id: "abc", spaces: ["the_void"] })
|
|
199
|
+
remember_search_space({ spaces: ["the_void"], query: "..." })
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
**Next Milestone**: M12 - Comment System (3 schema fields only!)
|
|
205
|
+
**Blockers**: None (builds on M10)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Task 46: Update SpaceMemory Types for Multi-Space
|
|
2
|
+
|
|
3
|
+
**Milestone**: M11 - Unified Public Collection
|
|
4
|
+
**Estimated Time**: 1 hour
|
|
5
|
+
**Dependencies**: None
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Update the `SpaceMemory` interface to use `spaces: string[]` instead of `space_id: string`, enabling memories to belong to multiple spaces simultaneously.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Update SpaceMemory Interface
|
|
19
|
+
|
|
20
|
+
**File**: `src/types/space-memory.ts`
|
|
21
|
+
|
|
22
|
+
**Changes**:
|
|
23
|
+
```typescript
|
|
24
|
+
// Before
|
|
25
|
+
export interface SpaceMemory extends Omit<Memory, 'user_id' | 'doc_type'> {
|
|
26
|
+
space_id: string; // ❌ Single space
|
|
27
|
+
author_id: string;
|
|
28
|
+
// ...
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// After
|
|
32
|
+
export interface SpaceMemory extends Omit<Memory, 'user_id' | 'doc_type'> {
|
|
33
|
+
spaces: string[]; // ✅ Multiple spaces!
|
|
34
|
+
author_id: string;
|
|
35
|
+
// ...
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Update Type Exports
|
|
40
|
+
|
|
41
|
+
**File**: `src/types/space-memory.ts`
|
|
42
|
+
|
|
43
|
+
- Update `SpaceSearchOptions` if needed
|
|
44
|
+
- Update `SpaceSearchResult` if needed
|
|
45
|
+
- Keep `SpaceId` type and `SUPPORTED_SPACES` constant
|
|
46
|
+
|
|
47
|
+
### 3. Add Backward Compatibility (Optional)
|
|
48
|
+
|
|
49
|
+
Consider adding a migration helper:
|
|
50
|
+
```typescript
|
|
51
|
+
export function migrateSpaceMemory(old: any): SpaceMemory {
|
|
52
|
+
if (old.space_id && !old.spaces) {
|
|
53
|
+
return {
|
|
54
|
+
...old,
|
|
55
|
+
spaces: [old.space_id],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return old;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. Update Type Tests
|
|
63
|
+
|
|
64
|
+
**File**: Create `src/types/space-memory.spec.ts` if needed
|
|
65
|
+
|
|
66
|
+
Test that:
|
|
67
|
+
- SpaceMemory interface has `spaces` array
|
|
68
|
+
- Type checking works correctly
|
|
69
|
+
- Migration helper works (if implemented)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Verification
|
|
74
|
+
|
|
75
|
+
- [ ] `SpaceMemory` interface uses `spaces: string[]`
|
|
76
|
+
- [ ] No `space_id` field in interface
|
|
77
|
+
- [ ] Type exports updated
|
|
78
|
+
- [ ] TypeScript compiles without errors
|
|
79
|
+
- [ ] No breaking changes to existing code (yet)
|
|
80
|
+
- [ ] Documentation comments updated
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Files Modified
|
|
85
|
+
|
|
86
|
+
- `src/types/space-memory.ts` - Update interface
|
|
87
|
+
|
|
88
|
+
## Files Created
|
|
89
|
+
|
|
90
|
+
- `src/types/space-memory.spec.ts` - Type tests (optional)
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
**Next Task**: Task 47 - Update Space Schema with Spaces Array
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Task 47: Update Space Schema with Spaces Array
|
|
2
|
+
|
|
3
|
+
**Milestone**: M11 - Unified Public Collection
|
|
4
|
+
**Estimated Time**: 2 hours
|
|
5
|
+
**Dependencies**: Task 46
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Update the Weaviate space collection schema to include a `spaces` array field and prepare for the unified `Memory_public` collection.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Add Spaces Field to Schema
|
|
19
|
+
|
|
20
|
+
**File**: `src/weaviate/space-schema.ts`
|
|
21
|
+
|
|
22
|
+
**Add property**:
|
|
23
|
+
```typescript
|
|
24
|
+
{
|
|
25
|
+
name: 'spaces',
|
|
26
|
+
dataType: 'text[]' as any,
|
|
27
|
+
description: 'Spaces this memory is published to (e.g., ["the_void", "dogs"])',
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Update Collection Name Constant
|
|
32
|
+
|
|
33
|
+
**File**: `src/weaviate/space-schema.ts`
|
|
34
|
+
|
|
35
|
+
**Add**:
|
|
36
|
+
```typescript
|
|
37
|
+
export const PUBLIC_COLLECTION_NAME = 'Memory_public';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. Create ensurePublicCollection Function
|
|
41
|
+
|
|
42
|
+
**File**: `src/weaviate/space-schema.ts`
|
|
43
|
+
|
|
44
|
+
**Add**:
|
|
45
|
+
```typescript
|
|
46
|
+
/**
|
|
47
|
+
* Ensure the unified public collection exists
|
|
48
|
+
*/
|
|
49
|
+
export async function ensurePublicCollection(
|
|
50
|
+
client: WeaviateClient
|
|
51
|
+
): Promise<Collection<any>> {
|
|
52
|
+
const collectionName = PUBLIC_COLLECTION_NAME;
|
|
53
|
+
|
|
54
|
+
const exists = await client.collections.exists(collectionName);
|
|
55
|
+
|
|
56
|
+
if (!exists) {
|
|
57
|
+
await createSpaceCollection(client, 'public');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return client.collections.get(collectionName);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 4. Keep Backward Compatibility
|
|
65
|
+
|
|
66
|
+
**File**: `src/weaviate/space-schema.ts`
|
|
67
|
+
|
|
68
|
+
- Keep `ensureSpaceCollection()` function for now
|
|
69
|
+
- Keep `getSpaceCollectionName()` function for now
|
|
70
|
+
- Add deprecation comments
|
|
71
|
+
|
|
72
|
+
### 5. Update Schema Tests
|
|
73
|
+
|
|
74
|
+
**File**: `src/weaviate/space-schema.spec.ts`
|
|
75
|
+
|
|
76
|
+
**Add tests**:
|
|
77
|
+
- Test `ensurePublicCollection()` creates `Memory_public`
|
|
78
|
+
- Test `spaces` field is in schema
|
|
79
|
+
- Test backward compatibility functions still work
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Verification
|
|
84
|
+
|
|
85
|
+
- [ ] `spaces` field added to schema as `text[]`
|
|
86
|
+
- [ ] `PUBLIC_COLLECTION_NAME` constant defined
|
|
87
|
+
- [ ] `ensurePublicCollection()` function created
|
|
88
|
+
- [ ] Backward compatibility maintained
|
|
89
|
+
- [ ] Schema tests updated and passing
|
|
90
|
+
- [ ] TypeScript compiles without errors
|
|
91
|
+
- [ ] Build successful
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Files Modified
|
|
96
|
+
|
|
97
|
+
- `src/weaviate/space-schema.ts` - Add spaces field, public collection
|
|
98
|
+
- `src/weaviate/space-schema.spec.ts` - Add tests
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**Next Task**: Task 48 - Create Memory_public Collection
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Task 48: Create Memory_public Collection
|
|
2
|
+
|
|
3
|
+
**Milestone**: M11 - Unified Public Collection
|
|
4
|
+
**Estimated Time**: 1 hour
|
|
5
|
+
**Dependencies**: Task 47
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Create the unified `Memory_public` Weaviate collection that will store all public space memories with the new `spaces` array field.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Update Collection Creation Logic
|
|
19
|
+
|
|
20
|
+
**File**: `src/weaviate/space-schema.ts`
|
|
21
|
+
|
|
22
|
+
**Modify `createSpaceCollection`**:
|
|
23
|
+
```typescript
|
|
24
|
+
async function createSpaceCollection(
|
|
25
|
+
client: WeaviateClient,
|
|
26
|
+
spaceId: string
|
|
27
|
+
): Promise<void> {
|
|
28
|
+
// Handle 'public' as special case
|
|
29
|
+
const collectionName = spaceId === 'public'
|
|
30
|
+
? PUBLIC_COLLECTION_NAME
|
|
31
|
+
: getSpaceCollectionName(spaceId);
|
|
32
|
+
|
|
33
|
+
console.log(`[Weaviate] Creating space collection ${collectionName}...`);
|
|
34
|
+
|
|
35
|
+
// ... rest of schema creation
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Test Collection Creation
|
|
40
|
+
|
|
41
|
+
**File**: `src/weaviate/space-schema.spec.ts`
|
|
42
|
+
|
|
43
|
+
**Add test**:
|
|
44
|
+
```typescript
|
|
45
|
+
it('should create Memory_public collection', async () => {
|
|
46
|
+
const collection = await ensurePublicCollection(mockClient);
|
|
47
|
+
|
|
48
|
+
expect(mockClient.collections.exists).toHaveBeenCalledWith('Memory_public');
|
|
49
|
+
expect(mockClient.collections.create).toHaveBeenCalled();
|
|
50
|
+
expect(collection.name).toBe('Memory_public');
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Verify Schema Properties
|
|
55
|
+
|
|
56
|
+
Ensure `Memory_public` has all required fields:
|
|
57
|
+
- `spaces` array (new)
|
|
58
|
+
- `space_id` (deprecated, for migration)
|
|
59
|
+
- `author_id`
|
|
60
|
+
- `attribution`
|
|
61
|
+
- `published_at`
|
|
62
|
+
- `discovery_count`
|
|
63
|
+
- All standard memory fields
|
|
64
|
+
|
|
65
|
+
### 4. Test with Actual Weaviate (Optional)
|
|
66
|
+
|
|
67
|
+
If Weaviate instance available:
|
|
68
|
+
```typescript
|
|
69
|
+
// Manual test
|
|
70
|
+
const client = getWeaviateClient();
|
|
71
|
+
const collection = await ensurePublicCollection(client);
|
|
72
|
+
console.log('Collection created:', collection.name);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Verification
|
|
78
|
+
|
|
79
|
+
- [ ] `Memory_public` collection can be created
|
|
80
|
+
- [ ] Collection has `spaces` array field
|
|
81
|
+
- [ ] Collection has all required properties
|
|
82
|
+
- [ ] `ensurePublicCollection()` works correctly
|
|
83
|
+
- [ ] Tests passing
|
|
84
|
+
- [ ] TypeScript compiles without errors
|
|
85
|
+
- [ ] Build successful
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Files Modified
|
|
90
|
+
|
|
91
|
+
- `src/weaviate/space-schema.ts` - Update collection creation
|
|
92
|
+
- `src/weaviate/space-schema.spec.ts` - Add tests
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
**Next Task**: Task 49 - Update remember_publish for Multi-Space
|