Skip to content

Commit 35c199f

Browse files
committed
fix(user-learning): enforce user scope requirement for learned memories
Add mandatory scope field to user memory learning tool schema to ensure all learned patterns are correctly scoped to 'user'. This prevents scope-related issues when saving user preferences and patterns. - Add scope field with enum constraint to tool schema - Update required fields to include scope - Add instruction emphasizing user scope requirement - Bump version to 2.0.1
1 parent 6c98f0e commit 35c199f

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opencode-mem",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "OpenCode plugin that gives coding agents persistent memory using local vector database",
55
"type": "module",
66
"main": "dist/plugin.js",

src/services/user-memory-learning.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ async function analyzeUserPatterns(
139139
140140
Your task is to analyze user prompts fy patterns, preferences, and workflows.
141141
142-
Use the save_user_memories tool to save identified patterns. Only save patterns that are clearly evident from the prompts.`;
142+
Use the save_user_memories tool to save identified patterns. Only save patterns that are clearly evident from the prompts.
143+
144+
IMPORTANT: All memories must have scope set to "user".`;
143145

144146
const toolSchema = {
145147
type: "function" as const,
@@ -159,6 +161,11 @@ Use the save_user_memories tool to save identified patterns. Only save patterns
159161
type: "string",
160162
description: "Clear description of the pattern or preference",
161163
},
164+
scope: {
165+
type: "string",
166+
enum: ["user"],
167+
description: "Memory scope (must be 'user' for user learning)",
168+
},
162169
type: {
163170
type: "string",
164171
description:
@@ -169,7 +176,7 @@ Use the save_user_memories tool to save identified patterns. Only save patterns
169176
description: "Why this pattern is significant (optial)",
170177
},
171178
},
172-
required: ["summary", "type"],
179+
required: ["summary", "scope", "type"],
173180
},
174181
},
175182
},

0 commit comments

Comments
 (0)