@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
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Task 61: Enhance Confirmation Tool Descriptions with Safety Guidelines
|
|
2
|
+
|
|
3
|
+
**Milestone**: M10 (Shared Spaces & Confirmation Flow)
|
|
4
|
+
**Estimated Time**: 1 hour
|
|
5
|
+
**Dependencies**: Tasks 36-38 (Publish, Confirm, Deny tools)
|
|
6
|
+
**Status**: Not Started
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Objective
|
|
11
|
+
|
|
12
|
+
Update the tool descriptions for `remember_confirm` and `remember_deny` to include critical safety guidelines that prevent agents from chaining confirmation actions inappropriately. These guidelines ensure agents follow proper confirmation workflows and obtain explicit user consent before executing sensitive operations.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Context
|
|
17
|
+
|
|
18
|
+
The current tool descriptions for `remember_confirm` and `remember_deny` don't explicitly warn agents about the critical requirement to obtain user confirmation in a separate interaction. This can lead to agents attempting to chain confirmation calls immediately after receiving a token, bypassing the intended user consent step.
|
|
19
|
+
|
|
20
|
+
**Problem**: Agents might do this:
|
|
21
|
+
```typescript
|
|
22
|
+
// ❌ WRONG: Chaining confirm immediately
|
|
23
|
+
const publishResult = await remember_publish({ memory_id: "abc", spaces: ["the_void"] });
|
|
24
|
+
const confirmResult = await remember_confirm({ token: publishResult.token }); // NO USER CONSENT!
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Correct behavior**: Agents should do this:
|
|
28
|
+
```typescript
|
|
29
|
+
// ✅ CORRECT: Get token, ask user, then confirm in separate message
|
|
30
|
+
const publishResult = await remember_publish({ memory_id: "abc", spaces: ["the_void"] });
|
|
31
|
+
// Agent: "User, do you want to publish this memory to The Void? Token: xyz"
|
|
32
|
+
// [User responds in SEPARATE message: "Yes"]
|
|
33
|
+
// Agent in NEW message:
|
|
34
|
+
const confirmResult = await remember_confirm({ token: publishResult.token });
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Steps
|
|
40
|
+
|
|
41
|
+
### 1. Update remember_confirm Tool Description
|
|
42
|
+
|
|
43
|
+
Modify [`src/tools/confirm.ts`](../../src/tools/confirm.ts) tool description:
|
|
44
|
+
|
|
45
|
+
**Current**:
|
|
46
|
+
```typescript
|
|
47
|
+
description: 'Confirm and execute a pending action using the token. Works for any action that requires confirmation (publish, delete, etc.).',
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Updated**:
|
|
51
|
+
```typescript
|
|
52
|
+
description: `Confirm and execute a pending action using the token. Works for any action that requires confirmation (publish, delete, etc.).
|
|
53
|
+
|
|
54
|
+
⚠️ CRITICAL SAFETY REQUIREMENTS:
|
|
55
|
+
Before executing this tool, you MUST:
|
|
56
|
+
1. Have received the confirmation token in a PREVIOUS tool response
|
|
57
|
+
2. Have presented the token details to the user for review
|
|
58
|
+
3. Have received EXPLICIT user confirmation in a SEPARATE user message
|
|
59
|
+
4. NEVER chain this tool with other tool calls in the same response
|
|
60
|
+
5. ALWAYS treat confirmations as standalone, deliberate actions
|
|
61
|
+
|
|
62
|
+
Violating these requirements bypasses user consent and is a security violation.`,
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 2. Update remember_deny Tool Description
|
|
66
|
+
|
|
67
|
+
Modify [`src/tools/deny.ts`](../../src/tools/deny.ts) tool description:
|
|
68
|
+
|
|
69
|
+
**Current**:
|
|
70
|
+
```typescript
|
|
71
|
+
description: 'Deny a pending action. The request will be marked as denied and the token invalidated. Works for any action that requires confirmation.',
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Updated**:
|
|
75
|
+
```typescript
|
|
76
|
+
description: `Deny a pending action. The request will be marked as denied and the token invalidated. Works for any action that requires confirmation.
|
|
77
|
+
|
|
78
|
+
⚠️ CRITICAL SAFETY REQUIREMENTS:
|
|
79
|
+
Before executing this tool, you MUST:
|
|
80
|
+
1. Have received the confirmation token in a PREVIOUS tool response
|
|
81
|
+
2. Have presented the token details to the user for review
|
|
82
|
+
3. Have received EXPLICIT user denial in a SEPARATE user message
|
|
83
|
+
4. NEVER chain this tool with other tool calls in the same response
|
|
84
|
+
5. ALWAYS treat denials as standalone, deliberate actions
|
|
85
|
+
|
|
86
|
+
This ensures proper user consent workflow is followed.`,
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 3. Add Safety Notes to Tool Comments
|
|
90
|
+
|
|
91
|
+
Add JSDoc comments above the tool definitions emphasizing the safety requirements:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
/**
|
|
95
|
+
* Tool definition for remember_confirm
|
|
96
|
+
*
|
|
97
|
+
* CRITICAL SAFETY: This tool must ONLY be called after explicit user confirmation
|
|
98
|
+
* in a separate message. Never chain with other tools or call immediately after
|
|
99
|
+
* receiving a token. The confirmation workflow requires:
|
|
100
|
+
*
|
|
101
|
+
* 1. Agent calls remember_publish (or other confirmable action)
|
|
102
|
+
* 2. Agent receives token in response
|
|
103
|
+
* 3. Agent presents details to user and asks for confirmation
|
|
104
|
+
* 4. User responds in SEPARATE message with explicit yes/no
|
|
105
|
+
* 5. Agent calls remember_confirm or remember_deny in NEW response
|
|
106
|
+
*
|
|
107
|
+
* Chaining confirmations bypasses user consent and violates security model.
|
|
108
|
+
*/
|
|
109
|
+
export const confirmTool: Tool = {
|
|
110
|
+
// ... tool definition
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 4. Update Design Document
|
|
115
|
+
|
|
116
|
+
Update [`agent/design/publish-tools-confirmation-flow.md`](../../agent/design/publish-tools-confirmation-flow.md) to include these safety guidelines:
|
|
117
|
+
|
|
118
|
+
Add a new section:
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
## Safety Guidelines for Agents
|
|
122
|
+
|
|
123
|
+
### Critical Requirements
|
|
124
|
+
|
|
125
|
+
Agents using the confirmation flow MUST follow these rules:
|
|
126
|
+
|
|
127
|
+
1. **Separate Messages**: Confirmation must happen in a separate user message
|
|
128
|
+
- ❌ WRONG: Chain confirm immediately after publish
|
|
129
|
+
- ✅ CORRECT: Wait for user response, then confirm
|
|
130
|
+
|
|
131
|
+
2. **Explicit Consent**: User must explicitly say "yes" or "confirm"
|
|
132
|
+
- ❌ WRONG: Assume user wants to confirm
|
|
133
|
+
- ✅ CORRECT: Ask user and wait for explicit response
|
|
134
|
+
|
|
135
|
+
3. **No Chaining**: Never call confirm/deny with other tools
|
|
136
|
+
- ❌ WRONG: `[remember_publish, remember_confirm]` in same response
|
|
137
|
+
- ✅ CORRECT: `remember_publish` in one response, wait, then `remember_confirm`
|
|
138
|
+
|
|
139
|
+
4. **Present Details**: Show user what they're confirming
|
|
140
|
+
- ❌ WRONG: "Do you want to confirm?"
|
|
141
|
+
- ✅ CORRECT: "Do you want to publish 'My Memory' to The Void and Dogs spaces?"
|
|
142
|
+
|
|
143
|
+
5. **Standalone Actions**: Treat confirmations as deliberate, standalone operations
|
|
144
|
+
- ❌ WRONG: Confirm as part of larger workflow
|
|
145
|
+
- ✅ CORRECT: Confirm as dedicated action
|
|
146
|
+
|
|
147
|
+
### Example Correct Flow
|
|
148
|
+
|
|
149
|
+
\`\`\`
|
|
150
|
+
Agent Message 1:
|
|
151
|
+
Tool: remember_publish({ memory_id: "abc", spaces: ["the_void"] })
|
|
152
|
+
Response: { token: "xyz123" }
|
|
153
|
+
Agent to User: "I'd like to publish your memory 'Hiking Tips' to The Void.
|
|
154
|
+
This will make it discoverable by other users.
|
|
155
|
+
Do you want to proceed?"
|
|
156
|
+
|
|
157
|
+
User Message 2:
|
|
158
|
+
"Yes, publish it"
|
|
159
|
+
|
|
160
|
+
Agent Message 3:
|
|
161
|
+
Tool: remember_confirm({ token: "xyz123" })
|
|
162
|
+
Response: { success: true, space_memory_id: "def456" }
|
|
163
|
+
Agent to User: "Memory published successfully to The Void!"
|
|
164
|
+
\`\`\`
|
|
165
|
+
|
|
166
|
+
### Example Incorrect Flow
|
|
167
|
+
|
|
168
|
+
\`\`\`
|
|
169
|
+
Agent Message 1:
|
|
170
|
+
Tool 1: remember_publish({ memory_id: "abc", spaces: ["the_void"] })
|
|
171
|
+
Tool 2: remember_confirm({ token: "xyz123" }) // ❌ NO USER CONSENT!
|
|
172
|
+
Agent to User: "Published your memory!"
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
This bypasses user consent and violates the security model.
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 5. Test the Updated Descriptions
|
|
179
|
+
|
|
180
|
+
Verify the updated descriptions appear correctly:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Build the project
|
|
184
|
+
npm run build
|
|
185
|
+
|
|
186
|
+
# Check that tools are registered with updated descriptions
|
|
187
|
+
# (Manual verification in MCP client or by inspecting tool definitions)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Verification
|
|
193
|
+
|
|
194
|
+
- [ ] `remember_confirm` tool description includes safety requirements
|
|
195
|
+
- [ ] `remember_deny` tool description includes safety requirements
|
|
196
|
+
- [ ] JSDoc comments added above tool definitions
|
|
197
|
+
- [ ] Design document updated with safety guidelines section
|
|
198
|
+
- [ ] Safety guidelines include examples of correct and incorrect flows
|
|
199
|
+
- [ ] Tool descriptions use ⚠️ emoji for visibility
|
|
200
|
+
- [ ] All 5 critical requirements listed in both tools
|
|
201
|
+
- [ ] TypeScript compiles without errors: `npm run typecheck`
|
|
202
|
+
- [ ] Build successful: `npm run build`
|
|
203
|
+
- [ ] All tests passing: `npm test`
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Expected Output
|
|
208
|
+
|
|
209
|
+
### Updated Tool Descriptions
|
|
210
|
+
|
|
211
|
+
Both `remember_confirm` and `remember_deny` will have enhanced descriptions that:
|
|
212
|
+
- Clearly state the 5 critical safety requirements
|
|
213
|
+
- Use visual indicators (⚠️) to draw attention
|
|
214
|
+
- Explain the security implications
|
|
215
|
+
- Provide clear guidance on proper usage
|
|
216
|
+
|
|
217
|
+
### Design Document Enhancement
|
|
218
|
+
|
|
219
|
+
The publish-tools-confirmation-flow design document will have a new "Safety Guidelines for Agents" section that:
|
|
220
|
+
- Explains the correct confirmation workflow
|
|
221
|
+
- Shows examples of correct and incorrect flows
|
|
222
|
+
- Emphasizes the security model
|
|
223
|
+
- Provides clear dos and don'ts
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Common Issues and Solutions
|
|
228
|
+
|
|
229
|
+
### Issue 1: Tool descriptions too long
|
|
230
|
+
|
|
231
|
+
**Symptom**: MCP clients truncate or don't display full description
|
|
232
|
+
**Solution**: Keep critical requirements concise. Use numbered list format for scannability.
|
|
233
|
+
|
|
234
|
+
### Issue 2: Agents still chain confirmations
|
|
235
|
+
|
|
236
|
+
**Symptom**: Agents call confirm immediately after publish
|
|
237
|
+
**Solution**: This is an agent behavior issue, not a code issue. The enhanced descriptions help, but agent prompts may need adjustment. Consider adding system-level constraints in MCP client configuration.
|
|
238
|
+
|
|
239
|
+
### Issue 3: Description formatting issues
|
|
240
|
+
|
|
241
|
+
**Symptom**: Line breaks or formatting don't appear correctly in MCP clients
|
|
242
|
+
**Solution**: Use simple text formatting. Avoid complex markdown. Use numbered lists and clear sections.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Resources
|
|
247
|
+
|
|
248
|
+
- [MCP Tool Schema](https://github.com/modelcontextprotocol/specification): Tool description best practices
|
|
249
|
+
- [Confirmation Flow Design](../../agent/design/publish-tools-confirmation-flow.md): Original design document
|
|
250
|
+
- [Security Best Practices](https://owasp.org/www-community/controls/): General security guidelines
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Notes
|
|
255
|
+
|
|
256
|
+
- **This is a documentation/UX improvement**, not a code behavior change
|
|
257
|
+
- **Agents can still bypass** these guidelines if they choose to - this is guidance, not enforcement
|
|
258
|
+
- **Consider system-level enforcement** in future (e.g., MCP server could reject chained confirms)
|
|
259
|
+
- **Tool descriptions are agent-facing**, not user-facing - they guide agent behavior
|
|
260
|
+
- **Keep descriptions concise** while being comprehensive about safety requirements
|
|
261
|
+
- **Visual indicators** (⚠️, ❌, ✅) help draw attention to critical information
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
**Next Task**: Task 62: Add System-Level Confirmation Chaining Prevention (Optional)
|
|
266
|
+
**Related Design Docs**: [publish-tools-confirmation-flow.md](../../agent/design/publish-tools-confirmation-flow.md)
|
|
267
|
+
**Estimated Completion Date**: TBD
|