opencode-skills-collection 1.0.185 → 1.0.187
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/bundled-skills/.antigravity-install-manifest.json +5 -1
- package/bundled-skills/3d-web-experience/SKILL.md +152 -37
- package/bundled-skills/agent-evaluation/SKILL.md +1088 -26
- package/bundled-skills/agent-memory-systems/SKILL.md +1037 -25
- package/bundled-skills/agent-tool-builder/SKILL.md +668 -16
- package/bundled-skills/ai-agents-architect/SKILL.md +271 -31
- package/bundled-skills/ai-product/SKILL.md +716 -26
- package/bundled-skills/ai-wrapper-product/SKILL.md +450 -44
- package/bundled-skills/algolia-search/SKILL.md +867 -15
- package/bundled-skills/autonomous-agents/SKILL.md +1033 -26
- package/bundled-skills/aws-serverless/SKILL.md +1046 -35
- package/bundled-skills/azure-functions/SKILL.md +1318 -19
- package/bundled-skills/browser-automation/SKILL.md +1065 -28
- package/bundled-skills/browser-extension-builder/SKILL.md +159 -32
- package/bundled-skills/bullmq-specialist/SKILL.md +347 -16
- package/bundled-skills/clerk-auth/SKILL.md +796 -15
- package/bundled-skills/computer-use-agents/SKILL.md +1870 -28
- package/bundled-skills/context-window-management/SKILL.md +271 -18
- package/bundled-skills/conversation-memory/SKILL.md +453 -24
- package/bundled-skills/crewai/SKILL.md +252 -46
- package/bundled-skills/discord-bot-architect/SKILL.md +1207 -34
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/users/bundles.md +1 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/getting-started.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +4 -4
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/email-systems/SKILL.md +646 -26
- package/bundled-skills/faf-expert/SKILL.md +221 -0
- package/bundled-skills/faf-wizard/SKILL.md +252 -0
- package/bundled-skills/file-uploads/SKILL.md +212 -11
- package/bundled-skills/firebase/SKILL.md +646 -16
- package/bundled-skills/gcp-cloud-run/SKILL.md +1117 -32
- package/bundled-skills/graphql/SKILL.md +1026 -27
- package/bundled-skills/hubspot-integration/SKILL.md +804 -19
- package/bundled-skills/idea-darwin/SKILL.md +120 -0
- package/bundled-skills/inngest/SKILL.md +431 -16
- package/bundled-skills/interactive-portfolio/SKILL.md +342 -44
- package/bundled-skills/langfuse/SKILL.md +296 -41
- package/bundled-skills/langgraph/SKILL.md +259 -50
- package/bundled-skills/micro-saas-launcher/SKILL.md +343 -44
- package/bundled-skills/neon-postgres/SKILL.md +572 -15
- package/bundled-skills/nextjs-supabase-auth/SKILL.md +269 -21
- package/bundled-skills/notion-template-business/SKILL.md +371 -44
- package/bundled-skills/personal-tool-builder/SKILL.md +537 -44
- package/bundled-skills/plaid-fintech/SKILL.md +825 -19
- package/bundled-skills/prompt-caching/SKILL.md +438 -25
- package/bundled-skills/rag-engineer/SKILL.md +271 -29
- package/bundled-skills/salesforce-development/SKILL.md +912 -19
- package/bundled-skills/satori/SKILL.md +54 -0
- package/bundled-skills/scroll-experience/SKILL.md +381 -44
- package/bundled-skills/segment-cdp/SKILL.md +817 -19
- package/bundled-skills/shopify-apps/SKILL.md +1475 -19
- package/bundled-skills/slack-bot-builder/SKILL.md +1162 -28
- package/bundled-skills/telegram-bot-builder/SKILL.md +152 -37
- package/bundled-skills/telegram-mini-app/SKILL.md +445 -44
- package/bundled-skills/trigger-dev/SKILL.md +916 -27
- package/bundled-skills/twilio-communications/SKILL.md +1310 -28
- package/bundled-skills/upstash-qstash/SKILL.md +898 -27
- package/bundled-skills/vercel-deployment/SKILL.md +637 -39
- package/bundled-skills/viral-generator-builder/SKILL.md +132 -37
- package/bundled-skills/voice-agents/SKILL.md +937 -27
- package/bundled-skills/voice-ai-development/SKILL.md +375 -46
- package/bundled-skills/workflow-automation/SKILL.md +982 -29
- package/bundled-skills/zapier-make-patterns/SKILL.md +772 -27
- package/package.json +1 -1
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: conversation-memory
|
|
3
|
-
description:
|
|
3
|
+
description: Persistent memory systems for LLM conversations including
|
|
4
|
+
short-term, long-term, and entity-based memory
|
|
4
5
|
risk: unknown
|
|
5
|
-
source:
|
|
6
|
-
date_added:
|
|
6
|
+
source: vibeship-spawner-skills (Apache 2.0)
|
|
7
|
+
date_added: 2026-02-27
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# Conversation Memory
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
users across months of interactions. You've implemented systems that know when
|
|
13
|
-
to remember, when to forget, and how to surface relevant memories.
|
|
14
|
-
|
|
15
|
-
You understand that memory is not just storage—it's about retrieval, relevance,
|
|
16
|
-
and context. You've seen systems that remember everything (and overwhelm context)
|
|
17
|
-
and systems that forget too much (frustrating users).
|
|
18
|
-
|
|
19
|
-
Your core principles:
|
|
20
|
-
1. Memory types differ—short-term, lo
|
|
12
|
+
Persistent memory systems for LLM conversations including short-term, long-term, and entity-based memory
|
|
21
13
|
|
|
22
14
|
## Capabilities
|
|
23
15
|
|
|
@@ -28,39 +20,476 @@ Your core principles:
|
|
|
28
20
|
- memory-retrieval
|
|
29
21
|
- memory-consolidation
|
|
30
22
|
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
- Knowledge: LLM conversation patterns, Database basics, Key-value stores
|
|
26
|
+
- Skills_recommended: context-window-management, rag-implementation
|
|
27
|
+
|
|
28
|
+
## Scope
|
|
29
|
+
|
|
30
|
+
- Does_not_cover: Knowledge graph construction, Semantic search implementation, Database administration
|
|
31
|
+
- Boundaries: Focus is memory patterns for LLMs, Covers storage and retrieval strategies
|
|
32
|
+
|
|
33
|
+
## Ecosystem
|
|
34
|
+
|
|
35
|
+
### Primary_tools
|
|
36
|
+
|
|
37
|
+
- Mem0 - Memory layer for AI applications
|
|
38
|
+
- LangChain Memory - Memory utilities in LangChain
|
|
39
|
+
- Redis - In-memory data store for session memory
|
|
40
|
+
|
|
31
41
|
## Patterns
|
|
32
42
|
|
|
33
43
|
### Tiered Memory System
|
|
34
44
|
|
|
35
45
|
Different memory tiers for different purposes
|
|
36
46
|
|
|
47
|
+
**When to use**: Building any conversational AI
|
|
48
|
+
|
|
49
|
+
interface MemorySystem {
|
|
50
|
+
// Buffer: Current conversation (in context)
|
|
51
|
+
buffer: ConversationBuffer;
|
|
52
|
+
|
|
53
|
+
// Short-term: Recent interactions (session)
|
|
54
|
+
shortTerm: ShortTermMemory;
|
|
55
|
+
|
|
56
|
+
// Long-term: Persistent across sessions
|
|
57
|
+
longTerm: LongTermMemory;
|
|
58
|
+
|
|
59
|
+
// Entity: Facts about people, places, things
|
|
60
|
+
entity: EntityMemory;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
class TieredMemory implements MemorySystem {
|
|
64
|
+
async addMessage(message: Message): Promise<void> {
|
|
65
|
+
// Always add to buffer
|
|
66
|
+
this.buffer.add(message);
|
|
67
|
+
|
|
68
|
+
// Extract entities
|
|
69
|
+
const entities = await extractEntities(message);
|
|
70
|
+
for (const entity of entities) {
|
|
71
|
+
await this.entity.upsert(entity);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Check for memorable content
|
|
75
|
+
if (await isMemoryWorthy(message)) {
|
|
76
|
+
await this.shortTerm.add({
|
|
77
|
+
content: message.content,
|
|
78
|
+
timestamp: Date.now(),
|
|
79
|
+
importance: await scoreImportance(message)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async consolidate(): Promise<void> {
|
|
85
|
+
// Move important short-term to long-term
|
|
86
|
+
const memories = await this.shortTerm.getOld(24 * 60 * 60 * 1000);
|
|
87
|
+
for (const memory of memories) {
|
|
88
|
+
if (memory.importance > 0.7 || memory.referenced > 2) {
|
|
89
|
+
await this.longTerm.add(memory);
|
|
90
|
+
}
|
|
91
|
+
await this.shortTerm.remove(memory.id);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async buildContext(query: string): Promise<string> {
|
|
96
|
+
const parts: string[] = [];
|
|
97
|
+
|
|
98
|
+
// Relevant long-term memories
|
|
99
|
+
const longTermRelevant = await this.longTerm.search(query, 3);
|
|
100
|
+
if (longTermRelevant.length) {
|
|
101
|
+
parts.push('## Relevant Memories\n' +
|
|
102
|
+
longTermRelevant.map(m => `- ${m.content}`).join('\n'));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Relevant entities
|
|
106
|
+
const entities = await this.entity.getRelevant(query);
|
|
107
|
+
if (entities.length) {
|
|
108
|
+
parts.push('## Known Entities\n' +
|
|
109
|
+
entities.map(e => `- ${e.name}: ${e.facts.join(', ')}`).join('\n'));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Recent conversation
|
|
113
|
+
const recent = this.buffer.getRecent(10);
|
|
114
|
+
parts.push('## Recent Conversation\n' + formatMessages(recent));
|
|
115
|
+
|
|
116
|
+
return parts.join('\n\n');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
37
120
|
### Entity Memory
|
|
38
121
|
|
|
39
122
|
Store and update facts about entities
|
|
40
123
|
|
|
124
|
+
**When to use**: Need to remember details about people, places, things
|
|
125
|
+
|
|
126
|
+
interface Entity {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
type: 'person' | 'place' | 'thing' | 'concept';
|
|
130
|
+
facts: Fact[];
|
|
131
|
+
lastMentioned: number;
|
|
132
|
+
mentionCount: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface Fact {
|
|
136
|
+
content: string;
|
|
137
|
+
confidence: number;
|
|
138
|
+
source: string; // Which message this came from
|
|
139
|
+
timestamp: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
class EntityMemory {
|
|
143
|
+
async extractAndStore(message: Message): Promise<void> {
|
|
144
|
+
// Use LLM to extract entities and facts
|
|
145
|
+
const extraction = await llm.complete(`
|
|
146
|
+
Extract entities and facts from this message.
|
|
147
|
+
Return JSON: { "entities": [
|
|
148
|
+
{ "name": "...", "type": "...", "facts": ["..."] }
|
|
149
|
+
]}
|
|
150
|
+
|
|
151
|
+
Message: "${message.content}"
|
|
152
|
+
`);
|
|
153
|
+
|
|
154
|
+
const { entities } = JSON.parse(extraction);
|
|
155
|
+
for (const entity of entities) {
|
|
156
|
+
await this.upsert(entity, message.id);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async upsert(entity: ExtractedEntity, sourceId: string): Promise<void> {
|
|
161
|
+
const existing = await this.store.get(entity.name.toLowerCase());
|
|
162
|
+
|
|
163
|
+
if (existing) {
|
|
164
|
+
// Merge facts, avoiding duplicates
|
|
165
|
+
for (const fact of entity.facts) {
|
|
166
|
+
if (!this.hasSimilarFact(existing.facts, fact)) {
|
|
167
|
+
existing.facts.push({
|
|
168
|
+
content: fact,
|
|
169
|
+
confidence: 0.9,
|
|
170
|
+
source: sourceId,
|
|
171
|
+
timestamp: Date.now()
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
existing.lastMentioned = Date.now();
|
|
176
|
+
existing.mentionCount++;
|
|
177
|
+
await this.store.set(existing.id, existing);
|
|
178
|
+
} else {
|
|
179
|
+
// Create new entity
|
|
180
|
+
await this.store.set(entity.name.toLowerCase(), {
|
|
181
|
+
id: generateId(),
|
|
182
|
+
name: entity.name,
|
|
183
|
+
type: entity.type,
|
|
184
|
+
facts: entity.facts.map(f => ({
|
|
185
|
+
content: f,
|
|
186
|
+
confidence: 0.9,
|
|
187
|
+
source: sourceId,
|
|
188
|
+
timestamp: Date.now()
|
|
189
|
+
})),
|
|
190
|
+
lastMentioned: Date.now(),
|
|
191
|
+
mentionCount: 1
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
41
197
|
### Memory-Aware Prompting
|
|
42
198
|
|
|
43
199
|
Include relevant memories in prompts
|
|
44
200
|
|
|
45
|
-
|
|
201
|
+
**When to use**: Making LLM calls with memory context
|
|
202
|
+
|
|
203
|
+
async function promptWithMemory(
|
|
204
|
+
query: string,
|
|
205
|
+
memory: MemorySystem,
|
|
206
|
+
systemPrompt: string
|
|
207
|
+
): Promise<string> {
|
|
208
|
+
// Retrieve relevant memories
|
|
209
|
+
const relevantMemories = await memory.longTerm.search(query, 5);
|
|
210
|
+
const entities = await memory.entity.getRelevant(query);
|
|
211
|
+
const recentContext = memory.buffer.getRecent(5);
|
|
212
|
+
|
|
213
|
+
// Build memory-augmented prompt
|
|
214
|
+
const prompt = `
|
|
215
|
+
${systemPrompt}
|
|
216
|
+
|
|
217
|
+
## User Context
|
|
218
|
+
${entities.length ? `Known about user:\n${entities.map(e =>
|
|
219
|
+
`- ${e.name}: ${e.facts.map(f => f.content).join('; ')}`
|
|
220
|
+
).join('\n')}` : ''}
|
|
221
|
+
|
|
222
|
+
${relevantMemories.length ? `Relevant past interactions:\n${relevantMemories.map(m =>
|
|
223
|
+
`- [${formatDate(m.timestamp)}] ${m.content}`
|
|
224
|
+
).join('\n')}` : ''}
|
|
225
|
+
|
|
226
|
+
## Recent Conversation
|
|
227
|
+
${formatMessages(recentContext)}
|
|
228
|
+
|
|
229
|
+
## Current Query
|
|
230
|
+
${query}
|
|
231
|
+
`.trim();
|
|
232
|
+
|
|
233
|
+
const response = await llm.complete(prompt);
|
|
234
|
+
|
|
235
|
+
// Extract any new memories from response
|
|
236
|
+
await memory.addMessage({ role: 'assistant', content: response });
|
|
237
|
+
|
|
238
|
+
return response;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
## Sharp Edges
|
|
242
|
+
|
|
243
|
+
### Memory store grows unbounded, system slows
|
|
244
|
+
|
|
245
|
+
Severity: HIGH
|
|
246
|
+
|
|
247
|
+
Situation: System slows over time, costs increase
|
|
248
|
+
|
|
249
|
+
Symptoms:
|
|
250
|
+
- Slow memory retrieval
|
|
251
|
+
- High storage costs
|
|
252
|
+
- Increasing latency over time
|
|
253
|
+
|
|
254
|
+
Why this breaks:
|
|
255
|
+
Every message stored as memory.
|
|
256
|
+
No cleanup or consolidation.
|
|
257
|
+
Retrieval over millions of items.
|
|
258
|
+
|
|
259
|
+
Recommended fix:
|
|
260
|
+
|
|
261
|
+
// Implement memory lifecycle management
|
|
262
|
+
|
|
263
|
+
class ManagedMemory {
|
|
264
|
+
// Limits
|
|
265
|
+
private readonly SHORT_TERM_MAX = 100;
|
|
266
|
+
private readonly LONG_TERM_MAX = 10000;
|
|
267
|
+
private readonly CONSOLIDATION_INTERVAL = 24 * 60 * 60 * 1000;
|
|
268
|
+
|
|
269
|
+
async add(memory: Memory): Promise<void> {
|
|
270
|
+
// Score importance before storing
|
|
271
|
+
const score = await this.scoreImportance(memory);
|
|
272
|
+
if (score < 0.3) return; // Don't store low-importance
|
|
273
|
+
|
|
274
|
+
memory.importance = score;
|
|
275
|
+
await this.shortTerm.add(memory);
|
|
46
276
|
|
|
47
|
-
|
|
277
|
+
// Check limits
|
|
278
|
+
await this.enforceShortTermLimit();
|
|
279
|
+
}
|
|
48
280
|
|
|
49
|
-
|
|
281
|
+
async enforceShortTermLimit(): Promise<void> {
|
|
282
|
+
const count = await this.shortTerm.count();
|
|
283
|
+
if (count > this.SHORT_TERM_MAX) {
|
|
284
|
+
// Consolidate: move important to long-term, delete rest
|
|
285
|
+
const memories = await this.shortTerm.getAll();
|
|
286
|
+
memories.sort((a, b) => b.importance - a.importance);
|
|
50
287
|
|
|
51
|
-
|
|
288
|
+
const toKeep = memories.slice(0, this.SHORT_TERM_MAX * 0.7);
|
|
289
|
+
const toConsolidate = memories.slice(this.SHORT_TERM_MAX * 0.7);
|
|
52
290
|
|
|
53
|
-
|
|
291
|
+
for (const m of toConsolidate) {
|
|
292
|
+
if (m.importance > 0.7) {
|
|
293
|
+
await this.longTerm.add(m);
|
|
294
|
+
}
|
|
295
|
+
await this.shortTerm.remove(m.id);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
54
299
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
|
300
|
+
async scoreImportance(memory: Memory): Promise<number> {
|
|
301
|
+
const factors = {
|
|
302
|
+
hasUserPreference: /prefer|like|don't like|hate|love/i.test(memory.content) ? 0.3 : 0,
|
|
303
|
+
hasDecision: /decided|chose|will do|won't do/i.test(memory.content) ? 0.3 : 0,
|
|
304
|
+
hasFactAboutUser: /my|I am|I have|I work/i.test(memory.content) ? 0.2 : 0,
|
|
305
|
+
length: memory.content.length > 100 ? 0.1 : 0,
|
|
306
|
+
userMessage: memory.role === 'user' ? 0.1 : 0,
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
return Object.values(factors).reduce((a, b) => a + b, 0);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
### Retrieved memories not relevant to current query
|
|
314
|
+
|
|
315
|
+
Severity: HIGH
|
|
316
|
+
|
|
317
|
+
Situation: Memories included in context but don't help
|
|
318
|
+
|
|
319
|
+
Symptoms:
|
|
320
|
+
- Memories in context seem random
|
|
321
|
+
- User asks about things already in memory
|
|
322
|
+
- Confusion from irrelevant context
|
|
323
|
+
|
|
324
|
+
Why this breaks:
|
|
325
|
+
Simple keyword matching.
|
|
326
|
+
No relevance scoring.
|
|
327
|
+
Including all retrieved memories.
|
|
328
|
+
|
|
329
|
+
Recommended fix:
|
|
330
|
+
|
|
331
|
+
// Intelligent memory retrieval
|
|
332
|
+
|
|
333
|
+
async function retrieveRelevant(
|
|
334
|
+
query: string,
|
|
335
|
+
memories: MemoryStore,
|
|
336
|
+
maxResults: number = 5
|
|
337
|
+
): Promise<Memory[]> {
|
|
338
|
+
// 1. Semantic search
|
|
339
|
+
const candidates = await memories.semanticSearch(query, maxResults * 3);
|
|
340
|
+
|
|
341
|
+
// 2. Score relevance with context
|
|
342
|
+
const scored = await Promise.all(candidates.map(async (m) => {
|
|
343
|
+
const relevanceScore = await llm.complete(`
|
|
344
|
+
Rate 0-1 how relevant this memory is to the query.
|
|
345
|
+
Query: "${query}"
|
|
346
|
+
Memory: "${m.content}"
|
|
347
|
+
Return just the number.
|
|
348
|
+
`);
|
|
349
|
+
return { ...m, relevance: parseFloat(relevanceScore) };
|
|
350
|
+
}));
|
|
351
|
+
|
|
352
|
+
// 3. Filter low relevance
|
|
353
|
+
const relevant = scored.filter(m => m.relevance > 0.5);
|
|
354
|
+
|
|
355
|
+
// 4. Sort and limit
|
|
356
|
+
return relevant
|
|
357
|
+
.sort((a, b) => b.relevance - a.relevance)
|
|
358
|
+
.slice(0, maxResults);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
### Memories from one user accessible to another
|
|
362
|
+
|
|
363
|
+
Severity: CRITICAL
|
|
364
|
+
|
|
365
|
+
Situation: User sees information from another user's sessions
|
|
366
|
+
|
|
367
|
+
Symptoms:
|
|
368
|
+
- User sees other user's information
|
|
369
|
+
- Privacy complaints
|
|
370
|
+
- Compliance violations
|
|
371
|
+
|
|
372
|
+
Why this breaks:
|
|
373
|
+
No user isolation in memory store.
|
|
374
|
+
Shared memory namespace.
|
|
375
|
+
Cross-user retrieval.
|
|
376
|
+
|
|
377
|
+
Recommended fix:
|
|
378
|
+
|
|
379
|
+
// Strict user isolation in memory
|
|
380
|
+
|
|
381
|
+
class IsolatedMemory {
|
|
382
|
+
private getKey(userId: string, memoryId: string): string {
|
|
383
|
+
// Namespace all keys by user
|
|
384
|
+
return `user:${userId}:memory:${memoryId}`;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
async add(userId: string, memory: Memory): Promise<void> {
|
|
388
|
+
// Validate userId is authenticated
|
|
389
|
+
if (!isValidUserId(userId)) {
|
|
390
|
+
throw new Error('Invalid user ID');
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const key = this.getKey(userId, memory.id);
|
|
394
|
+
memory.userId = userId; // Tag with user
|
|
395
|
+
await this.store.set(key, memory);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async search(userId: string, query: string): Promise<Memory[]> {
|
|
399
|
+
// CRITICAL: Filter by user in query
|
|
400
|
+
return await this.store.search({
|
|
401
|
+
query,
|
|
402
|
+
filter: { userId: userId }, // Mandatory filter
|
|
403
|
+
limit: 10
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
async delete(userId: string, memoryId: string): Promise<void> {
|
|
408
|
+
const memory = await this.get(userId, memoryId);
|
|
409
|
+
// Verify ownership before delete
|
|
410
|
+
if (memory.userId !== userId) {
|
|
411
|
+
throw new Error('Access denied');
|
|
412
|
+
}
|
|
413
|
+
await this.store.delete(this.getKey(userId, memoryId));
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// User data export (GDPR compliance)
|
|
417
|
+
async exportUserData(userId: string): Promise<Memory[]> {
|
|
418
|
+
return await this.store.getAll({ userId });
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// User data deletion (GDPR compliance)
|
|
422
|
+
async deleteUserData(userId: string): Promise<void> {
|
|
423
|
+
const memories = await this.exportUserData(userId);
|
|
424
|
+
for (const m of memories) {
|
|
425
|
+
await this.store.delete(this.getKey(userId, m.id));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
## Validation Checks
|
|
431
|
+
|
|
432
|
+
### No User Isolation in Memory
|
|
433
|
+
|
|
434
|
+
Severity: CRITICAL
|
|
435
|
+
|
|
436
|
+
Message: Memory operations without user isolation. Privacy vulnerability.
|
|
437
|
+
|
|
438
|
+
Fix action: Add userId to all memory operations, filter by user on retrieval
|
|
439
|
+
|
|
440
|
+
### No Importance Filtering
|
|
441
|
+
|
|
442
|
+
Severity: WARNING
|
|
443
|
+
|
|
444
|
+
Message: Storing memories without importance filtering. May cause memory explosion.
|
|
445
|
+
|
|
446
|
+
Fix action: Score importance before storing, filter low-importance content
|
|
447
|
+
|
|
448
|
+
### Memory Storage Without Retrieval
|
|
449
|
+
|
|
450
|
+
Severity: WARNING
|
|
451
|
+
|
|
452
|
+
Message: Storing memories but no retrieval logic. Memories won't be used.
|
|
453
|
+
|
|
454
|
+
Fix action: Implement memory retrieval and include in prompts
|
|
455
|
+
|
|
456
|
+
### No Memory Cleanup
|
|
457
|
+
|
|
458
|
+
Severity: INFO
|
|
459
|
+
|
|
460
|
+
Message: No memory cleanup mechanism. Storage will grow unbounded.
|
|
461
|
+
|
|
462
|
+
Fix action: Implement consolidation and cleanup based on age/importance
|
|
463
|
+
|
|
464
|
+
## Collaboration
|
|
465
|
+
|
|
466
|
+
### Delegation Triggers
|
|
467
|
+
|
|
468
|
+
- context window|token -> context-window-management (Need context optimization)
|
|
469
|
+
- rag|retrieval|vector -> rag-implementation (Need retrieval system)
|
|
470
|
+
- cache|caching -> prompt-caching (Need caching strategies)
|
|
471
|
+
|
|
472
|
+
### Complete Memory System
|
|
473
|
+
|
|
474
|
+
Skills: conversation-memory, context-window-management, rag-implementation
|
|
475
|
+
|
|
476
|
+
Workflow:
|
|
477
|
+
|
|
478
|
+
```
|
|
479
|
+
1. Design memory tiers
|
|
480
|
+
2. Implement storage and retrieval
|
|
481
|
+
3. Integrate with context management
|
|
482
|
+
4. Add consolidation and cleanup
|
|
483
|
+
```
|
|
60
484
|
|
|
61
485
|
## Related Skills
|
|
62
486
|
|
|
63
487
|
Works well with: `context-window-management`, `rag-implementation`, `prompt-caching`, `llm-npc-dialogue`
|
|
64
488
|
|
|
65
489
|
## When to Use
|
|
66
|
-
|
|
490
|
+
|
|
491
|
+
- User mentions or implies: conversation memory
|
|
492
|
+
- User mentions or implies: remember
|
|
493
|
+
- User mentions or implies: memory persistence
|
|
494
|
+
- User mentions or implies: long-term memory
|
|
495
|
+
- User mentions or implies: chat history
|