@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.
- package/CHANGELOG.md +123 -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-61-enhance-confirmation-tool-descriptions.md +267 -0
- package/dist/server-factory.js +364 -143
- package/dist/server.js +407 -160
- package/dist/tools/confirm.d.ts +12 -0
- package/dist/tools/deny.d.ts +12 -0
- 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 +69 -16
- package/src/tools/deny.ts +23 -1
- 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,129 @@ 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.2] - 2026-02-16
|
|
9
|
+
|
|
10
|
+
### 🔒 Security
|
|
11
|
+
|
|
12
|
+
- **Enhanced Confirmation Tool Safety Guidelines**
|
|
13
|
+
- Added critical safety requirements to `remember_confirm` tool description
|
|
14
|
+
- Added critical safety requirements to `remember_deny` tool description
|
|
15
|
+
- Added JSDoc comments emphasizing proper confirmation workflow
|
|
16
|
+
- Prevents agents from bypassing user consent by chaining confirmations
|
|
17
|
+
|
|
18
|
+
### 📝 Changed
|
|
19
|
+
|
|
20
|
+
- Updated `remember_confirm` description with 5 critical safety requirements
|
|
21
|
+
- Updated `remember_deny` description with 5 critical safety requirements
|
|
22
|
+
- Added ⚠️ visual indicators for safety requirements
|
|
23
|
+
- Added detailed JSDoc comments explaining proper workflow
|
|
24
|
+
|
|
25
|
+
### 🎯 Safety Requirements
|
|
26
|
+
|
|
27
|
+
Both confirmation tools now explicitly require:
|
|
28
|
+
1. Token received in PREVIOUS tool response
|
|
29
|
+
2. Details presented to user for review
|
|
30
|
+
3. EXPLICIT user confirmation/denial in SEPARATE message
|
|
31
|
+
4. NEVER chain with other tool calls
|
|
32
|
+
5. ALWAYS treat as standalone, deliberate actions
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## [2.6.1] - 2026-02-16
|
|
37
|
+
|
|
38
|
+
### 🔧 Improved
|
|
39
|
+
|
|
40
|
+
- **Standardized Structured Logging**: Replaced all direct console calls with structured logger
|
|
41
|
+
- Replaced 54 console.log/error/warn calls across 8 files
|
|
42
|
+
- All logs now use structured JSON format with proper severity levels
|
|
43
|
+
- Logs respect LOG_LEVEL environment variable for filtering
|
|
44
|
+
- Better Cloud Run log aggregation and filtering
|
|
45
|
+
- Consistent context objects with relevant identifiers
|
|
46
|
+
|
|
47
|
+
### 📝 Changed
|
|
48
|
+
|
|
49
|
+
- Updated files with structured logging:
|
|
50
|
+
- `src/services/confirmation-token.service.ts` - 11 console calls replaced
|
|
51
|
+
- `src/tools/publish.ts` - 7 console calls replaced
|
|
52
|
+
- `src/tools/confirm.ts` - 11 console calls replaced
|
|
53
|
+
- `src/weaviate/client.ts` - 7 console calls replaced
|
|
54
|
+
- `src/weaviate/schema.ts` - 4 console calls replaced
|
|
55
|
+
- `src/weaviate/space-schema.ts` - 2 console calls replaced
|
|
56
|
+
- `src/firestore/init.ts` - 6 console calls replaced
|
|
57
|
+
- `src/config.ts` - 1 console call replaced
|
|
58
|
+
|
|
59
|
+
### 🎯 Benefits
|
|
60
|
+
|
|
61
|
+
- Log level filtering now works correctly (debug/info/warn/error)
|
|
62
|
+
- Structured JSON logs for cloud environments
|
|
63
|
+
- Consistent formatting across all services
|
|
64
|
+
- Better integration with Cloud Logging filters
|
|
65
|
+
- Easier to search and filter logs in production
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## [2.6.0] - 2026-02-16
|
|
70
|
+
|
|
71
|
+
### ✨ Added
|
|
72
|
+
|
|
73
|
+
- **Comment System (Phase 1)**: Threaded discussions in shared spaces
|
|
74
|
+
- Added 3 schema fields: `parent_id`, `thread_root_id`, `moderation_flags`
|
|
75
|
+
- Comments support infinite nesting (no depth limit)
|
|
76
|
+
- Per-space moderation flags (format: `"{space_id}:{flag_type}"`)
|
|
77
|
+
- Zero new tools required - reuses existing `remember_create_memory`
|
|
78
|
+
|
|
79
|
+
- **Comment Filtering**: Clean discovery experience
|
|
80
|
+
- Added `include_comments` parameter to `remember_search_space` (default: false)
|
|
81
|
+
- Added `include_comments` parameter to `remember_query_space` (default: false)
|
|
82
|
+
- Comments excluded from search by default for cleaner results
|
|
83
|
+
- Opt-in via `include_comments: true` to include discussions
|
|
84
|
+
|
|
85
|
+
### 🔧 Changed
|
|
86
|
+
|
|
87
|
+
- **Search behavior**: `remember_search_space` now excludes comments by default
|
|
88
|
+
- **Query behavior**: `remember_query_space` now excludes comments by default
|
|
89
|
+
- Tool descriptions updated to mention comment filtering
|
|
90
|
+
|
|
91
|
+
### 📚 Documentation
|
|
92
|
+
|
|
93
|
+
- Created Milestone 12: Comment System (Phase 1)
|
|
94
|
+
- Created Tasks 55-59 for comment implementation
|
|
95
|
+
- Updated design document with comment system architecture
|
|
96
|
+
|
|
97
|
+
### 🎯 Usage
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// Create a comment
|
|
101
|
+
remember_create_memory({
|
|
102
|
+
type: "comment",
|
|
103
|
+
content: "Great post!",
|
|
104
|
+
parent_id: "memory123",
|
|
105
|
+
thread_root_id: "memory123",
|
|
106
|
+
spaces: ["the_void"]
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
// Search without comments (default)
|
|
110
|
+
remember_search_space({
|
|
111
|
+
spaces: ["the_void"],
|
|
112
|
+
query: "hiking"
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
// Search with comments (opt-in)
|
|
116
|
+
remember_search_space({
|
|
117
|
+
spaces: ["the_void"],
|
|
118
|
+
query: "hiking",
|
|
119
|
+
include_comments: true
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### ⚠️ Notes
|
|
124
|
+
|
|
125
|
+
- Backward compatible - no breaking changes
|
|
126
|
+
- Comments are opt-in for search/query
|
|
127
|
+
- Future phases will add voting, moderation tools, and notifications
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
8
131
|
## [2.4.1] - 2026-02-16
|
|
9
132
|
|
|
10
133
|
### 🐛 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
|