@prmichaelsen/remember-mcp 2.5.2 → 2.6.1
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 +95 -0
- package/agent/milestones/milestone-12-comment-system.md +239 -0
- package/agent/tasks/task-55-add-comment-fields-to-schema.md +171 -0
- package/agent/tasks/task-56-update-search-space-for-comments.md +192 -0
- package/agent/tasks/task-57-update-query-space-for-comments.md +167 -0
- package/agent/tasks/task-58-add-comment-unit-tests.md +255 -0
- package/agent/tasks/task-59-update-documentation-for-comments.md +324 -0
- package/agent/tasks/task-60-standardize-structured-logging.md +300 -0
- package/agent/tasks/task-70-draft.md +13 -0
- package/dist/server-factory.js +342 -141
- package/dist/server.js +385 -158
- package/dist/tools/query-space.d.ts +1 -0
- package/dist/tools/search-space.d.ts +1 -0
- package/package.json +1 -1
- package/src/config.ts +8 -1
- package/src/firestore/init.ts +21 -6
- package/src/services/confirmation-token.service.ts +42 -23
- package/src/tools/confirm.ts +46 -15
- package/src/tools/publish.ts +34 -9
- package/src/tools/query-space.ts +23 -6
- package/src/tools/search-space.ts +14 -1
- package/src/weaviate/client.ts +29 -7
- package/src/weaviate/schema.ts +34 -4
- package/src/weaviate/space-schema.ts +28 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,101 @@ 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.6.1] - 2026-02-16
|
|
9
|
+
|
|
10
|
+
### 🔧 Improved
|
|
11
|
+
|
|
12
|
+
- **Standardized Structured Logging**: Replaced all direct console calls with structured logger
|
|
13
|
+
- Replaced 54 console.log/error/warn calls across 8 files
|
|
14
|
+
- All logs now use structured JSON format with proper severity levels
|
|
15
|
+
- Logs respect LOG_LEVEL environment variable for filtering
|
|
16
|
+
- Better Cloud Run log aggregation and filtering
|
|
17
|
+
- Consistent context objects with relevant identifiers
|
|
18
|
+
|
|
19
|
+
### 📝 Changed
|
|
20
|
+
|
|
21
|
+
- Updated files with structured logging:
|
|
22
|
+
- `src/services/confirmation-token.service.ts` - 11 console calls replaced
|
|
23
|
+
- `src/tools/publish.ts` - 7 console calls replaced
|
|
24
|
+
- `src/tools/confirm.ts` - 11 console calls replaced
|
|
25
|
+
- `src/weaviate/client.ts` - 7 console calls replaced
|
|
26
|
+
- `src/weaviate/schema.ts` - 4 console calls replaced
|
|
27
|
+
- `src/weaviate/space-schema.ts` - 2 console calls replaced
|
|
28
|
+
- `src/firestore/init.ts` - 6 console calls replaced
|
|
29
|
+
- `src/config.ts` - 1 console call replaced
|
|
30
|
+
|
|
31
|
+
### 🎯 Benefits
|
|
32
|
+
|
|
33
|
+
- Log level filtering now works correctly (debug/info/warn/error)
|
|
34
|
+
- Structured JSON logs for cloud environments
|
|
35
|
+
- Consistent formatting across all services
|
|
36
|
+
- Better integration with Cloud Logging filters
|
|
37
|
+
- Easier to search and filter logs in production
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## [2.6.0] - 2026-02-16
|
|
42
|
+
|
|
43
|
+
### ✨ Added
|
|
44
|
+
|
|
45
|
+
- **Comment System (Phase 1)**: Threaded discussions in shared spaces
|
|
46
|
+
- Added 3 schema fields: `parent_id`, `thread_root_id`, `moderation_flags`
|
|
47
|
+
- Comments support infinite nesting (no depth limit)
|
|
48
|
+
- Per-space moderation flags (format: `"{space_id}:{flag_type}"`)
|
|
49
|
+
- Zero new tools required - reuses existing `remember_create_memory`
|
|
50
|
+
|
|
51
|
+
- **Comment Filtering**: Clean discovery experience
|
|
52
|
+
- Added `include_comments` parameter to `remember_search_space` (default: false)
|
|
53
|
+
- Added `include_comments` parameter to `remember_query_space` (default: false)
|
|
54
|
+
- Comments excluded from search by default for cleaner results
|
|
55
|
+
- Opt-in via `include_comments: true` to include discussions
|
|
56
|
+
|
|
57
|
+
### 🔧 Changed
|
|
58
|
+
|
|
59
|
+
- **Search behavior**: `remember_search_space` now excludes comments by default
|
|
60
|
+
- **Query behavior**: `remember_query_space` now excludes comments by default
|
|
61
|
+
- Tool descriptions updated to mention comment filtering
|
|
62
|
+
|
|
63
|
+
### 📚 Documentation
|
|
64
|
+
|
|
65
|
+
- Created Milestone 12: Comment System (Phase 1)
|
|
66
|
+
- Created Tasks 55-59 for comment implementation
|
|
67
|
+
- Updated design document with comment system architecture
|
|
68
|
+
|
|
69
|
+
### 🎯 Usage
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// Create a comment
|
|
73
|
+
remember_create_memory({
|
|
74
|
+
type: "comment",
|
|
75
|
+
content: "Great post!",
|
|
76
|
+
parent_id: "memory123",
|
|
77
|
+
thread_root_id: "memory123",
|
|
78
|
+
spaces: ["the_void"]
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// Search without comments (default)
|
|
82
|
+
remember_search_space({
|
|
83
|
+
spaces: ["the_void"],
|
|
84
|
+
query: "hiking"
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// Search with comments (opt-in)
|
|
88
|
+
remember_search_space({
|
|
89
|
+
spaces: ["the_void"],
|
|
90
|
+
query: "hiking",
|
|
91
|
+
include_comments: true
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### ⚠️ Notes
|
|
96
|
+
|
|
97
|
+
- Backward compatible - no breaking changes
|
|
98
|
+
- Comments are opt-in for search/query
|
|
99
|
+
- Future phases will add voting, moderation tools, and notifications
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
8
103
|
## [2.4.1] - 2026-02-16
|
|
9
104
|
|
|
10
105
|
### 🐛 Fixed
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Milestone 12: Comment System (Phase 1 - Basic Comments)
|
|
2
|
+
|
|
3
|
+
**Goal**: Enable threaded discussions in shared spaces using existing content type
|
|
4
|
+
**Duration**: 1 week
|
|
5
|
+
**Dependencies**: M11 (Unified Public Collection)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Implement basic comment functionality for shared spaces using the existing `comment` content type. This milestone requires **zero new tools** - we'll extend the Weaviate schema with 3 new fields and add an `include_comments` parameter to existing search tools.
|
|
13
|
+
|
|
14
|
+
**Key Innovation**: Reuse `remember_create_memory` with `type: "comment"` instead of creating new tools. This keeps the API surface small while enabling rich threaded discussions.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Deliverables
|
|
19
|
+
|
|
20
|
+
### 1. Schema Updates (3 new fields)
|
|
21
|
+
- Add `parent_id` field (text) - ID of parent memory or comment
|
|
22
|
+
- Add `thread_root_id` field (text) - Root memory ID for thread queries
|
|
23
|
+
- Add `moderation_flags` field (text[]) - Per-space moderation flags
|
|
24
|
+
|
|
25
|
+
### 2. Search Tool Updates (2 tools)
|
|
26
|
+
- Update `remember_search_space` - Add `include_comments` parameter (default: false)
|
|
27
|
+
- Update `remember_query_space` - Add `include_comments` parameter (default: false)
|
|
28
|
+
|
|
29
|
+
### 3. Documentation Updates
|
|
30
|
+
- Update design document with implementation details
|
|
31
|
+
- Add comment examples to README
|
|
32
|
+
- Document comment creation workflow
|
|
33
|
+
- Add API examples for threaded discussions
|
|
34
|
+
|
|
35
|
+
### 4. Testing
|
|
36
|
+
- Unit tests for comment filtering
|
|
37
|
+
- Unit tests for thread queries
|
|
38
|
+
- Integration tests for comment workflows
|
|
39
|
+
- Test infinite nesting support
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Success Criteria
|
|
44
|
+
|
|
45
|
+
- [ ] Schema has 3 new fields: `parent_id`, `thread_root_id`, `moderation_flags`
|
|
46
|
+
- [ ] Can create comments using `remember_create_memory` with `type: "comment"`
|
|
47
|
+
- [ ] Comments have `parent_id` and `thread_root_id` populated
|
|
48
|
+
- [ ] `remember_search_space` excludes comments by default
|
|
49
|
+
- [ ] `remember_search_space` includes comments when `include_comments: true`
|
|
50
|
+
- [ ] `remember_query_space` excludes comments by default
|
|
51
|
+
- [ ] `remember_query_space` includes comments when `include_comments: true`
|
|
52
|
+
- [ ] Can fetch entire thread by filtering on `thread_root_id`
|
|
53
|
+
- [ ] Comments support infinite nesting (no depth limit)
|
|
54
|
+
- [ ] Moderation flags are per-space (array field)
|
|
55
|
+
- [ ] All existing tests still passing
|
|
56
|
+
- [ ] New comment tests passing
|
|
57
|
+
- [ ] TypeScript compiles without errors
|
|
58
|
+
- [ ] Build successful
|
|
59
|
+
- [ ] Documentation updated with examples
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Key Files to Modify
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
src/
|
|
67
|
+
├── weaviate/
|
|
68
|
+
│ ├── schema.ts # Add 3 new fields to schema
|
|
69
|
+
│ └── space-schema.ts # Add 3 new fields to public collection
|
|
70
|
+
└── tools/
|
|
71
|
+
├── search-space.ts # Add include_comments parameter
|
|
72
|
+
└── query-space.ts # Add include_comments parameter
|
|
73
|
+
|
|
74
|
+
tests/
|
|
75
|
+
└── unit/
|
|
76
|
+
├── schema.test.ts # Test new fields
|
|
77
|
+
├── space-schema.test.ts # Test new fields in public collection
|
|
78
|
+
├── search-space.test.ts # Test comment filtering
|
|
79
|
+
└── query-space.test.ts # Test comment filtering
|
|
80
|
+
|
|
81
|
+
agent/
|
|
82
|
+
└── design/
|
|
83
|
+
└── comment-memory-type.md # Update with implementation notes
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Implementation Tasks
|
|
89
|
+
|
|
90
|
+
See individual task documents:
|
|
91
|
+
- Task 55: Add Comment Fields to Weaviate Schema
|
|
92
|
+
- Task 56: Update remember_search_space for Comments
|
|
93
|
+
- Task 57: Update remember_query_space for Comments
|
|
94
|
+
- Task 58: Add Comment Unit Tests
|
|
95
|
+
- Task 59: Update Documentation for Comments
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Architecture Notes
|
|
100
|
+
|
|
101
|
+
### Zero New Tools Required
|
|
102
|
+
|
|
103
|
+
**Create comment** (use existing tool):
|
|
104
|
+
```typescript
|
|
105
|
+
remember_create_memory({
|
|
106
|
+
type: "comment", // ✅ Existing content type!
|
|
107
|
+
content: "Great post!",
|
|
108
|
+
parent_id: "memory123", // ✅ New field
|
|
109
|
+
thread_root_id: "memory123", // ✅ New field
|
|
110
|
+
spaces: ["the_void"] // ✅ Inherited from parent
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Fetch thread** (use existing search):
|
|
115
|
+
```typescript
|
|
116
|
+
remember_search_space({
|
|
117
|
+
spaces: ["the_void"],
|
|
118
|
+
query: "",
|
|
119
|
+
content_type: "comment",
|
|
120
|
+
// Filter by thread_root_id in Weaviate
|
|
121
|
+
limit: 100
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Search without comments** (default behavior):
|
|
126
|
+
```typescript
|
|
127
|
+
remember_search_space({
|
|
128
|
+
spaces: ["the_void"],
|
|
129
|
+
query: "hiking trails"
|
|
130
|
+
// include_comments: false (default)
|
|
131
|
+
})
|
|
132
|
+
// Returns only memories, not comments
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Search with comments** (opt-in):
|
|
136
|
+
```typescript
|
|
137
|
+
remember_search_space({
|
|
138
|
+
spaces: ["the_void"],
|
|
139
|
+
query: "hiking trails",
|
|
140
|
+
include_comments: true // ✅ Include comments in results
|
|
141
|
+
})
|
|
142
|
+
// Returns memories + comments
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Schema Changes
|
|
146
|
+
|
|
147
|
+
**New Fields**:
|
|
148
|
+
```typescript
|
|
149
|
+
{
|
|
150
|
+
name: 'parent_id',
|
|
151
|
+
dataType: 'text' as any,
|
|
152
|
+
description: 'ID of parent memory or comment (for threading)'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'thread_root_id',
|
|
156
|
+
dataType: 'text' as any,
|
|
157
|
+
description: 'Root memory ID for fetching entire thread'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'moderation_flags',
|
|
161
|
+
dataType: 'text[]' as any,
|
|
162
|
+
description: 'Per-space moderation flags (e.g., ["the_void:hidden", "dogs:spam"])'
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Moderation Flags (Per-Space)
|
|
167
|
+
|
|
168
|
+
**Format**: `"{space_id}:{flag_type}"`
|
|
169
|
+
|
|
170
|
+
**Examples**:
|
|
171
|
+
- `"the_void:hidden"` - Hidden in The Void space
|
|
172
|
+
- `"dogs:spam"` - Marked as spam in Dogs space
|
|
173
|
+
- `"cats:flagged"` - Flagged for review in Cats space
|
|
174
|
+
|
|
175
|
+
**Why per-space?**: A comment might be inappropriate in one space but fine in another. Moderators manage their own spaces independently.
|
|
176
|
+
|
|
177
|
+
### Infinite Nesting Support
|
|
178
|
+
|
|
179
|
+
**No depth limit**: Comments can nest infinitely
|
|
180
|
+
- `parent_id` points to immediate parent
|
|
181
|
+
- `thread_root_id` always points to root memory
|
|
182
|
+
- UI builds tree structure from flat list
|
|
183
|
+
|
|
184
|
+
**Example**:
|
|
185
|
+
```
|
|
186
|
+
Memory (root)
|
|
187
|
+
├─ Comment 1 (parent_id: memory_id)
|
|
188
|
+
│ ├─ Comment 2 (parent_id: comment1_id)
|
|
189
|
+
│ │ └─ Comment 3 (parent_id: comment2_id)
|
|
190
|
+
│ │ └─ Comment 4 (parent_id: comment3_id)
|
|
191
|
+
│ │ └─ ... (infinite nesting)
|
|
192
|
+
│ └─ Comment 5 (parent_id: comment1_id)
|
|
193
|
+
└─ Comment 6 (parent_id: memory_id)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
All comments have `thread_root_id: memory_id` for efficient thread fetching.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Testing Strategy
|
|
201
|
+
|
|
202
|
+
1. **Unit Tests**: Schema fields, filtering logic
|
|
203
|
+
2. **Integration Tests**: Full comment workflow
|
|
204
|
+
3. **Performance Tests**: Large threads (1000+ comments)
|
|
205
|
+
4. **Edge Cases**: Infinite nesting, moderation flags
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Future Phases
|
|
210
|
+
|
|
211
|
+
**Phase 2: Engagement (v2.7.0)** - Deferred
|
|
212
|
+
- Voting system (requires ACL)
|
|
213
|
+
- Sort by popularity
|
|
214
|
+
- Vote tracking in Firestore
|
|
215
|
+
|
|
216
|
+
**Phase 3: Moderation (v2.8.0)** - Deferred
|
|
217
|
+
- Moderator tools (requires ACL)
|
|
218
|
+
- Auto-hide spam
|
|
219
|
+
- Moderator dashboard
|
|
220
|
+
|
|
221
|
+
**Phase 4: Notifications (v2.9.0)** - Deferred
|
|
222
|
+
- Notify authors of comments
|
|
223
|
+
- Email/push notifications
|
|
224
|
+
- Notification preferences
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Breaking Changes
|
|
229
|
+
|
|
230
|
+
**None** - This is a backward-compatible addition:
|
|
231
|
+
- Existing tools continue to work unchanged
|
|
232
|
+
- New fields are optional
|
|
233
|
+
- Default behavior (exclude comments) maintains current UX
|
|
234
|
+
- Opt-in via `include_comments: true`
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
**Next Milestone**: M13 - Comment Engagement (Voting & Popularity)
|
|
239
|
+
**Blockers**: None (builds on M11)
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Task 55: Add Comment Fields to Weaviate Schema
|
|
2
|
+
|
|
3
|
+
**Milestone**: M12 (Comment System - Phase 1)
|
|
4
|
+
**Estimated Time**: 2 hours
|
|
5
|
+
**Dependencies**: M11 (Unified Public Collection)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Add 3 new fields to the Weaviate schema to support threaded comments: `parent_id`, `thread_root_id`, and `moderation_flags`. These fields enable infinite nesting, efficient thread queries, and per-space moderation.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### 1. Update Memory Schema ([`src/weaviate/schema.ts`](../../src/weaviate/schema.ts))
|
|
19
|
+
|
|
20
|
+
Add 3 new properties to the Memory collection schema:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
{
|
|
24
|
+
name: 'parent_id',
|
|
25
|
+
dataType: 'text' as any,
|
|
26
|
+
description: 'ID of parent memory or comment (for threading)',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'thread_root_id',
|
|
30
|
+
dataType: 'text' as any,
|
|
31
|
+
description: 'Root memory ID for fetching entire thread',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'moderation_flags',
|
|
35
|
+
dataType: 'text[]' as any,
|
|
36
|
+
description: 'Per-space moderation flags (format: "{space_id}:{flag_type}")',
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Location**: Add after existing properties, before the closing bracket
|
|
41
|
+
|
|
42
|
+
### 2. Update Space Schema ([`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts))
|
|
43
|
+
|
|
44
|
+
Add the same 3 properties to the public collection schema:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
{
|
|
48
|
+
name: 'parent_id',
|
|
49
|
+
dataType: 'text' as any,
|
|
50
|
+
description: 'ID of parent memory or comment (for threading)',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'thread_root_id',
|
|
54
|
+
dataType: 'text' as any,
|
|
55
|
+
description: 'Root memory ID for fetching entire thread',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'moderation_flags',
|
|
59
|
+
dataType: 'text[]' as any,
|
|
60
|
+
description: 'Per-space moderation flags (format: "{space_id}:{flag_type}")',
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Location**: Add to `createSpaceCollection` function's properties array
|
|
65
|
+
|
|
66
|
+
### 3. Verify Schema Updates
|
|
67
|
+
|
|
68
|
+
**Check**:
|
|
69
|
+
- Both schemas have all 3 new fields
|
|
70
|
+
- Field names match exactly
|
|
71
|
+
- Data types are correct (`text` for IDs, `text[]` for flags)
|
|
72
|
+
- Descriptions are clear and consistent
|
|
73
|
+
|
|
74
|
+
### 4. Test Schema Creation
|
|
75
|
+
|
|
76
|
+
Run existing tests to ensure schema creation still works:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm test -- schema.test.ts
|
|
80
|
+
npm test -- space-schema.test.ts
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Expected**: All existing tests pass, no errors
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Verification
|
|
88
|
+
|
|
89
|
+
- [ ] `parent_id` field added to both schemas
|
|
90
|
+
- [ ] `thread_root_id` field added to both schemas
|
|
91
|
+
- [ ] `moderation_flags` field added to both schemas
|
|
92
|
+
- [ ] Field data types are correct
|
|
93
|
+
- [ ] Descriptions are clear
|
|
94
|
+
- [ ] TypeScript compiles without errors
|
|
95
|
+
- [ ] All existing schema tests passing
|
|
96
|
+
- [ ] No breaking changes to existing functionality
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Implementation Notes
|
|
101
|
+
|
|
102
|
+
### Field Purposes
|
|
103
|
+
|
|
104
|
+
**`parent_id`**:
|
|
105
|
+
- Points to immediate parent (memory or comment)
|
|
106
|
+
- Enables infinite nesting
|
|
107
|
+
- Used by UI to build tree structure
|
|
108
|
+
- Optional (null for root memories)
|
|
109
|
+
|
|
110
|
+
**`thread_root_id`**:
|
|
111
|
+
- Always points to root memory
|
|
112
|
+
- Enables efficient "get all comments in thread" queries
|
|
113
|
+
- Same as `parent_id` for direct replies to memories
|
|
114
|
+
- Optional (null for root memories)
|
|
115
|
+
|
|
116
|
+
**`moderation_flags`**:
|
|
117
|
+
- Array of strings in format `"{space_id}:{flag_type}"`
|
|
118
|
+
- Enables per-space moderation
|
|
119
|
+
- Examples: `["the_void:hidden", "dogs:spam"]`
|
|
120
|
+
- Empty array by default
|
|
121
|
+
|
|
122
|
+
### Example Comment
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
{
|
|
126
|
+
id: "comment123",
|
|
127
|
+
type: "comment",
|
|
128
|
+
content: "Great post!",
|
|
129
|
+
parent_id: "memory456", // ✅ New field
|
|
130
|
+
thread_root_id: "memory456", // ✅ New field
|
|
131
|
+
moderation_flags: [], // ✅ New field
|
|
132
|
+
spaces: ["the_void"],
|
|
133
|
+
author_id: "user789",
|
|
134
|
+
// ... other standard fields
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Example Nested Comment
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
{
|
|
142
|
+
id: "comment789",
|
|
143
|
+
type: "comment",
|
|
144
|
+
content: "I agree!",
|
|
145
|
+
parent_id: "comment123", // ✅ Points to parent comment
|
|
146
|
+
thread_root_id: "memory456", // ✅ Still points to root memory
|
|
147
|
+
moderation_flags: [],
|
|
148
|
+
spaces: ["the_void"],
|
|
149
|
+
author_id: "user999",
|
|
150
|
+
// ... other standard fields
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Files Modified
|
|
157
|
+
|
|
158
|
+
- [`src/weaviate/schema.ts`](../../src/weaviate/schema.ts) - Add 3 fields to Memory schema
|
|
159
|
+
- [`src/weaviate/space-schema.ts`](../../src/weaviate/space-schema.ts) - Add 3 fields to public collection
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Files Created
|
|
164
|
+
|
|
165
|
+
None (schema updates only)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Next Task
|
|
170
|
+
|
|
171
|
+
Task 56: Update remember_search_space for Comments
|
|
@@ -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
|