@prmichaelsen/remember-mcp 2.3.1 → 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.
Files changed (34) hide show
  1. package/AGENT.md +20 -2
  2. package/CHANGELOG.md +69 -0
  3. package/README.md +50 -5
  4. package/agent/commands/acp.commit.md +511 -0
  5. package/agent/design/comment-memory-type.md +556 -0
  6. package/agent/design/unified-public-collection.md +545 -0
  7. package/agent/milestones/milestone-11-unified-public-collection.md +205 -0
  8. package/agent/progress.yaml +26 -0
  9. package/agent/scripts/install.sh +25 -1
  10. package/agent/scripts/update.sh +37 -0
  11. package/agent/tasks/task-46-update-spacememory-types.md +94 -0
  12. package/agent/tasks/task-47-update-space-schema.md +102 -0
  13. package/agent/tasks/task-48-create-memory-public-collection.md +96 -0
  14. package/agent/tasks/task-49-update-remember-publish.md +153 -0
  15. package/agent/tasks/task-50-update-remember-confirm.md +111 -0
  16. package/agent/tasks/task-51-update-remember-search-space.md +154 -0
  17. package/agent/tasks/task-52-update-remember-query-space.md +142 -0
  18. package/agent/tasks/task-53-add-multispace-tests.md +193 -0
  19. package/agent/tasks/task-54-update-documentation-multispace.md +191 -0
  20. package/dist/server-factory.js +140 -83
  21. package/dist/server.js +140 -83
  22. package/dist/tools/publish.d.ts +1 -1
  23. package/dist/tools/query-space.d.ts +1 -1
  24. package/dist/tools/search-space.d.ts +1 -1
  25. package/dist/types/space-memory.d.ts +5 -3
  26. package/dist/weaviate/space-schema.d.ts +16 -0
  27. package/package.json +1 -1
  28. package/src/tools/confirm.ts +20 -19
  29. package/src/tools/publish.ts +42 -20
  30. package/src/tools/query-space.ts +38 -24
  31. package/src/tools/search-space.ts +51 -28
  32. package/src/types/space-memory.ts +5 -3
  33. package/src/weaviate/space-schema.spec.ts +55 -0
  34. package/src/weaviate/space-schema.ts +45 -6
@@ -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)
@@ -391,6 +391,32 @@ progress:
391
391
  overall: 50%
392
392
 
393
393
  recent_work:
394
+ - date: 2026-02-16
395
+ description: ACP Initialization Complete - Project Status Verified
396
+ items:
397
+ - ✅ ACP initialization workflow executed via @acp.init command
398
+ - ⚠️ ACP updates available (v1.2.1 with new command format)
399
+ - ✅ All agent documentation reviewed (23 design docs, 10 milestones, 33 tasks, 5 patterns)
400
+ - ✅ Project status verified: M1-M4 complete (100%), M10 in progress
401
+ - ✅ Version 2.3.1 confirmed (latest patch release)
402
+ - ✅ 53 unit tests passing (1 skipped integration test)
403
+ - ✅ Test coverage: 29.76% overall
404
+ - ✅ TypeScript compiles without errors
405
+ - ✅ Build successful (dual export: server + factory)
406
+ - ✅ All 17 MCP tools implemented and working
407
+ - ✅ M10 Shared Spaces: 5 tools implemented (publish, confirm, deny, search_space, query_space)
408
+ - ✅ Token-based confirmation system operational
409
+ - ✅ Space collections: Memory_the_void with snake_case naming
410
+ - ✅ Confirmation token service with 5-minute expiry
411
+ - ✅ Space memory types and schema complete
412
+ - ✅ Multi-tenant architecture with per-user isolation
413
+ - ✅ Vector search with Weaviate + metadata with Firestore
414
+ - ✅ 45 content types with dynamic descriptions
415
+ - ✅ N-way relationships with bidirectional tracking
416
+ - ✅ User preferences system (6 categories)
417
+ - 📋 M10 implementation appears complete - needs verification
418
+ - 📋 Ready to verify M10 completion and update documentation
419
+
394
420
  - date: 2026-02-16
395
421
  description: Created Milestone 10 and Tasks for Shared Spaces
396
422
  items:
@@ -55,6 +55,7 @@ mkdir -p "$TARGET_DIR/agent/patterns"
55
55
  mkdir -p "$TARGET_DIR/agent/tasks"
56
56
  mkdir -p "$TARGET_DIR/agent/commands"
57
57
  mkdir -p "$TARGET_DIR/agent/scripts"
58
+ mkdir -p "$TARGET_DIR/agent/reports"
58
59
 
59
60
  # Create .gitkeep files
60
61
  touch "$TARGET_DIR/agent/design/.gitkeep"
@@ -62,6 +63,15 @@ touch "$TARGET_DIR/agent/milestones/.gitkeep"
62
63
  touch "$TARGET_DIR/agent/patterns/.gitkeep"
63
64
  touch "$TARGET_DIR/agent/tasks/.gitkeep"
64
65
 
66
+ # Create agent/.gitignore to exclude reports from version control
67
+ cat > "$TARGET_DIR/agent/.gitignore" << 'EOF'
68
+ # Agent Context Protocol - Local Files
69
+ # These files are generated locally and should not be committed
70
+
71
+ # Reports directory - generated by @acp.report command
72
+ reports/
73
+ EOF
74
+
65
75
  echo -e "${GREEN}✓${NC} Directory structure created"
66
76
  echo ""
67
77
 
@@ -113,6 +123,20 @@ echo " cp agent/progress.template.yaml agent/progress.yaml"
113
123
  echo ""
114
124
  echo "4. Read AGENT.md for complete documentation"
115
125
  echo ""
126
+ echo -e "${BLUE}ACP Commands Available:${NC}"
127
+ echo ""
128
+ echo " ${GREEN}@acp.init${NC} - Initialize agent context (start here!)"
129
+ echo " ${GREEN}@acp.proceed${NC} - Continue with next task"
130
+ echo " ${GREEN}@acp.status${NC} - Display project status"
131
+ echo " ${GREEN}@acp.update${NC} - Update progress tracking"
132
+ echo " ${GREEN}@acp.sync${NC} - Sync documentation with code"
133
+ echo " ${GREEN}@acp.validate${NC} - Validate ACP documents"
134
+ echo " ${GREEN}@acp.report${NC} - Generate project report"
135
+ echo " ${GREEN}@acp.version-check${NC} - Show current ACP version"
136
+ echo " ${GREEN}@acp.version-check-for-updates${NC} - Check for ACP updates"
137
+ echo " ${GREEN}@acp.version-update${NC} - Update ACP to latest version"
138
+ echo " ${GREEN}@acp.package-install${NC} - Install third-party command packages"
139
+ echo ""
116
140
  echo -e "${BLUE}For AI agents:${NC}"
117
- echo "Type 'AGENT.md: Initialize' to get started."
141
+ echo "Type '${GREEN}@acp.init${NC}' to get started."
118
142
  echo ""
@@ -41,6 +41,20 @@ fi
41
41
  echo -e "${GREEN}✓${NC} Latest files fetched"
42
42
  echo ""
43
43
 
44
+ # Ensure reports directory exists and is ignored
45
+ mkdir -p "agent/reports"
46
+ if [ ! -f "agent/.gitignore" ]; then
47
+ echo "Creating agent/.gitignore..."
48
+ cat > "agent/.gitignore" << 'EOF'
49
+ # Agent Context Protocol - Local Files
50
+ # These files are generated locally and should not be committed
51
+
52
+ # Reports directory - generated by @acp.report command
53
+ reports/
54
+ EOF
55
+ echo -e "${GREEN}✓${NC} Created agent/.gitignore"
56
+ fi
57
+
44
58
  echo "Updating ACP files..."
45
59
 
46
60
  # Update template files (only .template.md files from these directories)
@@ -77,6 +91,12 @@ echo -e "${GREEN}✓${NC} All files updated"
77
91
  echo ""
78
92
  echo -e "${GREEN}Update complete!${NC}"
79
93
  echo ""
94
+ echo -e "${BLUE}What was updated:${NC}"
95
+ echo " ✓ AGENT.md (methodology documentation)"
96
+ echo " ✓ Template files (design, milestone, task, pattern)"
97
+ echo " ✓ Command files (all ACP commands)"
98
+ echo " ✓ Utility scripts (update, check-for-updates, version, etc.)"
99
+ echo ""
80
100
  echo -e "${BLUE}Next steps:${NC}"
81
101
  echo "1. Review changes: git diff"
82
102
  echo "2. See what changed: git status"
@@ -85,3 +105,20 @@ echo ""
85
105
  echo "For detailed changelog:"
86
106
  echo " https://github.com/prmichaelsen/agent-context-protocol/blob/mainline/CHANGELOG.md"
87
107
  echo ""
108
+ echo -e "${BLUE}ACP Commands Available:${NC}"
109
+ echo ""
110
+ echo " ${GREEN}@acp.init${NC} - Initialize agent context (run after update!)"
111
+ echo " ${GREEN}@acp.proceed${NC} - Continue with next task"
112
+ echo " ${GREEN}@acp.status${NC} - Display project status"
113
+ echo " ${GREEN}@acp.update${NC} - Update progress tracking"
114
+ echo " ${GREEN}@acp.sync${NC} - Sync documentation with code"
115
+ echo " ${GREEN}@acp.validate${NC} - Validate ACP documents"
116
+ echo " ${GREEN}@acp.report${NC} - Generate project report"
117
+ echo " ${GREEN}@acp.version-check${NC} - Show current ACP version"
118
+ echo " ${GREEN}@acp.version-check-for-updates${NC} - Check for ACP updates"
119
+ echo " ${GREEN}@acp.version-update${NC} - Update ACP to latest version"
120
+ echo " ${GREEN}@acp.package-install${NC} - Install third-party command packages"
121
+ echo ""
122
+ echo -e "${BLUE}For AI agents:${NC}"
123
+ echo "Type '${GREEN}@acp.init${NC}' to reload context with updated files."
124
+ echo ""
@@ -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