@prmichaelsen/remember-mcp 2.5.2 → 2.6.2

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.
@@ -0,0 +1,192 @@
1
+ # Task 56: Update remember_search_space for Comments
2
+
3
+ **Milestone**: M12 (Comment System - Phase 1)
4
+ **Estimated Time**: 2 hours
5
+ **Dependencies**: Task 55 (Add Comment Fields)
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Add `include_comments` parameter to `remember_search_space` tool to control whether comments are included in search results. Default behavior excludes comments to keep discovery clean.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Update Tool Schema ([`src/tools/search-space.ts`](../../src/tools/search-space.ts))
19
+
20
+ Add new parameter to `inputSchema`:
21
+
22
+ ```typescript
23
+ include_comments: {
24
+ type: 'boolean',
25
+ description: 'Include comments in search results (default: false)',
26
+ default: false
27
+ }
28
+ ```
29
+
30
+ **Location**: Add after existing parameters, before `required` array
31
+
32
+ ### 2. Update TypeScript Interface
33
+
34
+ Add to `SearchSpaceArgs` interface:
35
+
36
+ ```typescript
37
+ interface SearchSpaceArgs {
38
+ // ... existing fields
39
+ include_comments?: boolean;
40
+ }
41
+ ```
42
+
43
+ ### 3. Update Filter Logic
44
+
45
+ Modify the search logic to exclude comments by default:
46
+
47
+ ```typescript
48
+ // After building other filters, add content type filter
49
+ if (!args.include_comments) {
50
+ // Exclude comments by default
51
+ filterList.push(
52
+ publicCollection.filter.byProperty('type').notEqual('comment')
53
+ );
54
+ }
55
+ ```
56
+
57
+ **Location**: Add before executing the query, after other filters are built
58
+
59
+ ### 4. Update Tool Description
60
+
61
+ Update the tool description to mention comment filtering:
62
+
63
+ ```typescript
64
+ description: 'Search shared spaces to discover thoughts, ideas, and memories. By default, excludes comments to keep discovery clean. Set include_comments: true to include threaded discussions.',
65
+ ```
66
+
67
+ ### 5. Test the Changes
68
+
69
+ Create test cases for comment filtering:
70
+
71
+ ```typescript
72
+ // Test 1: Default behavior (exclude comments)
73
+ const results1 = await handleSearchSpace({
74
+ spaces: ['the_void'],
75
+ query: 'test'
76
+ // include_comments not specified = false
77
+ }, userId);
78
+ // Should not include type: "comment"
79
+
80
+ // Test 2: Include comments
81
+ const results2 = await handleSearchSpace({
82
+ spaces: ['the_void'],
83
+ query: 'test',
84
+ include_comments: true
85
+ }, userId);
86
+ // Should include type: "comment"
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Verification
92
+
93
+ - [ ] `include_comments` parameter added to schema
94
+ - [ ] Parameter has correct type (boolean)
95
+ - [ ] Parameter has correct default (false)
96
+ - [ ] Parameter has clear description
97
+ - [ ] TypeScript interface updated
98
+ - [ ] Filter logic excludes comments by default
99
+ - [ ] Filter logic includes comments when `include_comments: true`
100
+ - [ ] Tool description updated
101
+ - [ ] TypeScript compiles without errors
102
+ - [ ] All existing tests passing
103
+ - [ ] New comment filtering tests passing
104
+
105
+ ---
106
+
107
+ ## Implementation Notes
108
+
109
+ ### Default Behavior (Exclude Comments)
110
+
111
+ **Why**: Keep discovery experience clean
112
+ - Users searching for "hiking trails" want memories, not 100 comments
113
+ - Comments are opt-in via `include_comments: true`
114
+ - Follows positive flag pattern (explicit opt-in)
115
+
116
+ **Example**:
117
+ ```typescript
118
+ remember_search_space({
119
+ spaces: ["the_void"],
120
+ query: "hiking trails"
121
+ // include_comments: false (default)
122
+ })
123
+ // Returns: 10 memories (no comments)
124
+ ```
125
+
126
+ ### Opt-In Comments
127
+
128
+ **When to use**: Viewing a specific thread or searching within discussions
129
+
130
+ **Example**:
131
+ ```typescript
132
+ remember_search_space({
133
+ spaces: ["the_void"],
134
+ query: "hiking trails",
135
+ include_comments: true // ✅ Include comments
136
+ })
137
+ // Returns: 10 memories + 50 comments = 60 results
138
+ ```
139
+
140
+ ### Fetching Entire Thread
141
+
142
+ **Use case**: Get all comments for a specific memory
143
+
144
+ **Example**:
145
+ ```typescript
146
+ remember_search_space({
147
+ spaces: ["the_void"],
148
+ query: "", // Empty query = get all
149
+ content_type: "comment", // Only comments
150
+ // Add filter for thread_root_id in Weaviate query
151
+ limit: 100
152
+ })
153
+ // Returns: All comments in the thread
154
+ ```
155
+
156
+ **Note**: This requires adding support for filtering by `thread_root_id` in the Weaviate query. Consider adding a `thread_id` parameter in a future enhancement.
157
+
158
+ ### Filter Implementation
159
+
160
+ **Weaviate v3 API**:
161
+ ```typescript
162
+ // Exclude comments (default)
163
+ publicCollection.filter.byProperty('type').notEqual('comment')
164
+
165
+ // Or use content_type filter if already implemented
166
+ if (args.content_type) {
167
+ // Existing content type filter
168
+ } else if (!args.include_comments) {
169
+ // Exclude comments
170
+ filterList.push(
171
+ publicCollection.filter.byProperty('type').notEqual('comment')
172
+ );
173
+ }
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Files Modified
179
+
180
+ - [`src/tools/search-space.ts`](../../src/tools/search-space.ts) - Add `include_comments` parameter and filter logic
181
+
182
+ ---
183
+
184
+ ## Files Created
185
+
186
+ None (tool update only)
187
+
188
+ ---
189
+
190
+ ## Next Task
191
+
192
+ Task 57: Update remember_query_space for Comments
@@ -0,0 +1,167 @@
1
+ # Task 57: Update remember_query_space for Comments
2
+
3
+ **Milestone**: M12 (Comment System - Phase 1)
4
+ **Estimated Time**: 1 hour
5
+ **Dependencies**: Task 56 (Update search_space)
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Add `include_comments` parameter to `remember_query_space` tool to control whether comments are included in RAG query results. Default behavior excludes comments to keep answers focused on original content.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Update Tool Schema ([`src/tools/query-space.ts`](../../src/tools/query-space.ts))
19
+
20
+ Add new parameter to `inputSchema`:
21
+
22
+ ```typescript
23
+ include_comments: {
24
+ type: 'boolean',
25
+ description: 'Include comments in query results (default: false)',
26
+ default: false
27
+ }
28
+ ```
29
+
30
+ **Location**: Add after existing parameters, before `required` array
31
+
32
+ ### 2. Update TypeScript Interface
33
+
34
+ Add to `QuerySpaceArgs` interface:
35
+
36
+ ```typescript
37
+ interface QuerySpaceArgs {
38
+ // ... existing fields
39
+ include_comments?: boolean;
40
+ }
41
+ ```
42
+
43
+ ### 3. Update Filter Logic
44
+
45
+ Modify the query logic to exclude comments by default (same as search_space):
46
+
47
+ ```typescript
48
+ // After building other filters, add content type filter
49
+ if (!args.include_comments) {
50
+ // Exclude comments by default
51
+ filterList.push(
52
+ publicCollection.filter.byProperty('type').notEqual('comment')
53
+ );
54
+ }
55
+ ```
56
+
57
+ **Location**: Add before executing the query, after other filters are built
58
+
59
+ ### 4. Update Tool Description
60
+
61
+ Update the tool description to mention comment filtering:
62
+
63
+ ```typescript
64
+ description: 'Ask natural language questions about memories in shared spaces. By default, excludes comments to focus on original content. Set include_comments: true to include discussions in answers.',
65
+ ```
66
+
67
+ ### 5. Test the Changes
68
+
69
+ Reuse test pattern from search_space:
70
+
71
+ ```typescript
72
+ // Test 1: Default behavior (exclude comments)
73
+ const results1 = await handleQuerySpace({
74
+ question: 'What are good hiking trails?',
75
+ spaces: ['the_void']
76
+ // include_comments not specified = false
77
+ }, userId);
78
+ // Should not include type: "comment" in results
79
+
80
+ // Test 2: Include comments
81
+ const results2 = await handleQuerySpace({
82
+ question: 'What are good hiking trails?',
83
+ spaces: ['the_void'],
84
+ include_comments: true
85
+ }, userId);
86
+ // Should include type: "comment" in results
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Verification
92
+
93
+ - [ ] `include_comments` parameter added to schema
94
+ - [ ] Parameter has correct type (boolean)
95
+ - [ ] Parameter has correct default (false)
96
+ - [ ] Parameter has clear description
97
+ - [ ] TypeScript interface updated
98
+ - [ ] Filter logic excludes comments by default
99
+ - [ ] Filter logic includes comments when `include_comments: true`
100
+ - [ ] Tool description updated
101
+ - [ ] TypeScript compiles without errors
102
+ - [ ] All existing tests passing
103
+ - [ ] New comment filtering tests passing
104
+
105
+ ---
106
+
107
+ ## Implementation Notes
108
+
109
+ ### Why Exclude Comments by Default?
110
+
111
+ **RAG queries focus on original content**:
112
+ - Question: "What are good hiking trails?"
113
+ - Want: Original memories about trails
114
+ - Don't want: 100 comments saying "I agree!" or "Thanks!"
115
+
116
+ **Comments add noise to RAG answers**:
117
+ - Comments are often short, low-information
118
+ - Original memories have richer content
119
+ - Better to query memories, then show comments separately
120
+
121
+ ### When to Include Comments?
122
+
123
+ **Use case**: Searching within discussions
124
+
125
+ **Example**:
126
+ ```typescript
127
+ remember_query_space({
128
+ question: "What did people say about Bear Lake Trail?",
129
+ spaces: ["the_void"],
130
+ include_comments: true // ✅ Include discussions
131
+ })
132
+ // Returns: Memory + all comments mentioning Bear Lake
133
+ ```
134
+
135
+ ### Implementation Pattern
136
+
137
+ **Same as search_space**:
138
+ - Both tools use identical filtering logic
139
+ - Consistent user experience
140
+ - Reuse filter implementation
141
+
142
+ ```typescript
143
+ // Shared filter logic (consider extracting to utility)
144
+ if (!args.include_comments) {
145
+ filterList.push(
146
+ publicCollection.filter.byProperty('type').notEqual('comment')
147
+ );
148
+ }
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Files Modified
154
+
155
+ - [`src/tools/query-space.ts`](../../src/tools/query-space.ts) - Add `include_comments` parameter and filter logic
156
+
157
+ ---
158
+
159
+ ## Files Created
160
+
161
+ None (tool update only)
162
+
163
+ ---
164
+
165
+ ## Next Task
166
+
167
+ Task 58: Add Comment Unit Tests
@@ -0,0 +1,255 @@
1
+ # Task 58: Add Comment Unit Tests
2
+
3
+ **Milestone**: M12 (Comment System - Phase 1)
4
+ **Estimated Time**: 3 hours
5
+ **Dependencies**: Tasks 55-57 (Schema and tool updates)
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Create comprehensive unit tests for comment functionality, including schema validation, comment filtering, thread queries, and edge cases like infinite nesting and per-space moderation.
13
+
14
+ ---
15
+
16
+ ## Steps
17
+
18
+ ### 1. Test Schema Fields ([`tests/unit/schema.test.ts`](../../tests/unit/schema.test.ts))
19
+
20
+ Add tests for new comment fields:
21
+
22
+ ```typescript
23
+ describe('Comment Fields', () => {
24
+ it('should have parent_id field', () => {
25
+ const schema = getMemorySchema();
26
+ const parentIdField = schema.properties.find(p => p.name === 'parent_id');
27
+ expect(parentIdField).toBeDefined();
28
+ expect(parentIdField.dataType).toBe('text');
29
+ });
30
+
31
+ it('should have thread_root_id field', () => {
32
+ const schema = getMemorySchema();
33
+ const threadField = schema.properties.find(p => p.name === 'thread_root_id');
34
+ expect(threadField).toBeDefined();
35
+ expect(threadField.dataType).toBe('text');
36
+ });
37
+
38
+ it('should have moderation_flags field', () => {
39
+ const schema = getMemorySchema();
40
+ const flagsField = schema.properties.find(p => p.name === 'moderation_flags');
41
+ expect(flagsField).toBeDefined();
42
+ expect(flagsField.dataType).toContain('text'); // text[]
43
+ });
44
+ });
45
+ ```
46
+
47
+ ### 2. Test Space Schema Fields ([`tests/unit/space-schema.test.ts`](../../tests/unit/space-schema.test.ts))
48
+
49
+ Add tests for public collection comment fields:
50
+
51
+ ```typescript
52
+ describe('Comment Fields in Public Collection', () => {
53
+ it('should have parent_id field in Memory_public', async () => {
54
+ const collection = await ensurePublicCollection(mockClient);
55
+ const schema = await collection.config.get();
56
+ const parentIdField = schema.properties.find(p => p.name === 'parent_id');
57
+ expect(parentIdField).toBeDefined();
58
+ });
59
+
60
+ it('should have thread_root_id field in Memory_public', async () => {
61
+ const collection = await ensurePublicCollection(mockClient);
62
+ const schema = await collection.config.get();
63
+ const threadField = schema.properties.find(p => p.name === 'thread_root_id');
64
+ expect(threadField).toBeDefined();
65
+ });
66
+
67
+ it('should have moderation_flags field in Memory_public', async () => {
68
+ const collection = await ensurePublicCollection(mockClient);
69
+ const schema = await collection.config.get();
70
+ const flagsField = schema.properties.find(p => p.name === 'moderation_flags');
71
+ expect(flagsField).toBeDefined();
72
+ });
73
+ });
74
+ ```
75
+
76
+ ### 3. Test Comment Filtering ([`tests/unit/search-space.test.ts`](../../tests/unit/search-space.test.ts))
77
+
78
+ Add tests for `include_comments` parameter:
79
+
80
+ ```typescript
81
+ describe('Comment Filtering', () => {
82
+ it('should exclude comments by default', async () => {
83
+ const result = await handleSearchSpace({
84
+ spaces: ['the_void'],
85
+ query: 'test'
86
+ // include_comments not specified
87
+ }, 'user123');
88
+
89
+ // Verify filter was applied to exclude comments
90
+ expect(mockFilter.notEqual).toHaveBeenCalledWith('comment');
91
+ });
92
+
93
+ it('should include comments when include_comments: true', async () => {
94
+ const result = await handleSearchSpace({
95
+ spaces: ['the_void'],
96
+ query: 'test',
97
+ include_comments: true
98
+ }, 'user123');
99
+
100
+ // Verify no comment filter was applied
101
+ expect(mockFilter.notEqual).not.toHaveBeenCalledWith('comment');
102
+ });
103
+
104
+ it('should filter by content_type: comment', async () => {
105
+ const result = await handleSearchSpace({
106
+ spaces: ['the_void'],
107
+ query: 'test',
108
+ content_type: 'comment'
109
+ }, 'user123');
110
+
111
+ // Verify filter for comments only
112
+ expect(mockFilter.equal).toHaveBeenCalledWith('comment');
113
+ });
114
+ });
115
+ ```
116
+
117
+ ### 4. Test Query Space Comment Filtering ([`tests/unit/query-space.test.ts`](../../tests/unit/query-space.test.ts))
118
+
119
+ Add similar tests for query_space:
120
+
121
+ ```typescript
122
+ describe('Comment Filtering in Query', () => {
123
+ it('should exclude comments by default', async () => {
124
+ const result = await handleQuerySpace({
125
+ question: 'What are good hiking trails?',
126
+ spaces: ['the_void']
127
+ // include_comments not specified
128
+ }, 'user123');
129
+
130
+ // Verify filter was applied
131
+ expect(mockFilter.notEqual).toHaveBeenCalledWith('comment');
132
+ });
133
+
134
+ it('should include comments when include_comments: true', async () => {
135
+ const result = await handleQuerySpace({
136
+ question: 'What are good hiking trails?',
137
+ spaces: ['the_void'],
138
+ include_comments: true
139
+ }, 'user123');
140
+
141
+ // Verify no comment filter
142
+ expect(mockFilter.notEqual).not.toHaveBeenCalledWith('comment');
143
+ });
144
+ });
145
+ ```
146
+
147
+ ### 5. Test Edge Cases
148
+
149
+ Create tests for edge cases:
150
+
151
+ ```typescript
152
+ describe('Comment Edge Cases', () => {
153
+ it('should support infinite nesting', () => {
154
+ // Create deeply nested comment structure
155
+ const comments = [
156
+ { id: '1', parent_id: 'memory', thread_root_id: 'memory' },
157
+ { id: '2', parent_id: '1', thread_root_id: 'memory' },
158
+ { id: '3', parent_id: '2', thread_root_id: 'memory' },
159
+ { id: '4', parent_id: '3', thread_root_id: 'memory' },
160
+ { id: '5', parent_id: '4', thread_root_id: 'memory' },
161
+ // ... up to 100 levels
162
+ ];
163
+
164
+ // Verify all have same thread_root_id
165
+ comments.forEach(c => {
166
+ expect(c.thread_root_id).toBe('memory');
167
+ });
168
+ });
169
+
170
+ it('should support per-space moderation flags', () => {
171
+ const comment = {
172
+ id: 'comment123',
173
+ moderation_flags: [
174
+ 'the_void:hidden',
175
+ 'dogs:spam',
176
+ 'cats:flagged'
177
+ ]
178
+ };
179
+
180
+ // Verify flag format
181
+ comment.moderation_flags.forEach(flag => {
182
+ expect(flag).toMatch(/^[a-z_]+:(hidden|spam|flagged)$/);
183
+ });
184
+ });
185
+
186
+ it('should handle empty moderation_flags array', () => {
187
+ const comment = {
188
+ id: 'comment123',
189
+ moderation_flags: []
190
+ };
191
+
192
+ expect(Array.isArray(comment.moderation_flags)).toBe(true);
193
+ expect(comment.moderation_flags.length).toBe(0);
194
+ });
195
+ });
196
+ ```
197
+
198
+ ### 6. Run All Tests
199
+
200
+ ```bash
201
+ npm test
202
+ ```
203
+
204
+ **Expected**: All tests passing, including new comment tests
205
+
206
+ ---
207
+
208
+ ## Verification
209
+
210
+ - [ ] Schema field tests passing
211
+ - [ ] Space schema field tests passing
212
+ - [ ] Comment filtering tests passing (search_space)
213
+ - [ ] Comment filtering tests passing (query_space)
214
+ - [ ] Edge case tests passing
215
+ - [ ] All existing tests still passing
216
+ - [ ] Test coverage maintained or improved
217
+ - [ ] TypeScript compiles without errors
218
+ - [ ] No test failures or warnings
219
+
220
+ ---
221
+
222
+ ## Test Coverage Goals
223
+
224
+ **Minimum Coverage**:
225
+ - Schema fields: 100%
226
+ - Comment filtering: 100%
227
+ - Edge cases: 80%
228
+
229
+ **Focus Areas**:
230
+ - Default behavior (exclude comments)
231
+ - Opt-in behavior (include comments)
232
+ - Content type filtering
233
+ - Moderation flags format
234
+ - Infinite nesting support
235
+
236
+ ---
237
+
238
+ ## Files Modified
239
+
240
+ - [`tests/unit/schema.test.ts`](../../tests/unit/schema.test.ts) - Add comment field tests
241
+ - [`tests/unit/space-schema.test.ts`](../../tests/unit/space-schema.test.ts) - Add public collection tests
242
+ - [`tests/unit/search-space.test.ts`](../../tests/unit/search-space.test.ts) - Add filtering tests
243
+ - [`tests/unit/query-space.test.ts`](../../tests/unit/query-space.test.ts) - Add filtering tests
244
+
245
+ ---
246
+
247
+ ## Files Created
248
+
249
+ None (test updates only)
250
+
251
+ ---
252
+
253
+ ## Next Task
254
+
255
+ Task 59: Update Documentation for Comments