remember
Store user memories with automatic duplicate detection and category-based decay rates to maintain relevant information over time.
Instructions
Store a memory about the user. Automatically detects duplicates and reinforces existing memories instead. Categories: one-time, question, interest, preference, correction, fact, context. Each category decays at a different rate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | What to remember | |
| category | No | Memory type. "one-time" decays in 7 days. "preference" lasts 6 months. Default: question (14 days) | |
| tags | No | Comma-separated tags for better recall matching |
Implementation Reference
- index.js:122-172 (handler)The `handleRemember` function processes the "remember" tool call, creating or updating memories based on existing content.
function handleRemember(args) { const { content, category = 'question', tags = '' } = args; if (!content) return { error: 'Missing "content"' }; const validCats = Object.keys(CATEGORY_CONFIG); const cat = validCats.includes(category) ? category : 'question'; const memories = loadMemories(); // Check for duplicate/similar content — reinforce instead of duplicate const existing = memories.find(m => m.content.toLowerCase().includes(content.toLowerCase().slice(0, 50)) || content.toLowerCase().includes(m.content.toLowerCase().slice(0, 50)) ); if (existing) { existing.mention_count += 1; existing.last_reinforced = Date.now(); // Upgrade category if mentioned enough if (existing.mention_count >= 5 && existing.category === 'question') { existing.category = 'interest'; existing.base_weight = CATEGORY_CONFIG['interest'].base_weight; existing.decay_halflife_days = CATEGORY_CONFIG['interest'].decay_halflife_days; } saveMemories(memories); const rel = computeRelevance(existing); return { action: 'reinforced_existing', id: existing.id, mention_count: existing.mention_count, category: existing.category, relevance: rel.relevance, status: rel.status, message: `Memory reinforced (mention #${existing.mention_count}). ${existing.mention_count >= 5 ? 'Upgraded to "interest".' : ''}` }; } const memory = createMemory(content, cat, tags); memories.push(memory); saveMemories(memories); const rel = computeRelevance(memory); return { action: 'created', id: memory.id, category: memory.category, relevance: rel.relevance, decay_halflife: `${memory.decay_halflife_days} days`, message: `Stored as "${cat}". Will fade to 50% relevance in ${memory.decay_halflife_days} days unless reinforced.` }; } - index.js:371-384 (registration)Definition of the "remember" tool within the `getToolDefinitions` method of `MCPMemoryServer`.
return [ { name: 'remember', description: 'Store a memory about the user. Automatically detects duplicates and reinforces existing memories instead. Categories: one-time, question, interest, preference, correction, fact, context. Each category decays at a different rate.', inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'What to remember' }, category: { type: 'string', enum: Object.keys(CATEGORY_CONFIG), description: 'Memory type. "one-time" decays in 7 days. "preference" lasts 6 months. Default: question (14 days)' }, tags: { type: 'string', description: 'Comma-separated tags for better recall matching' } }, required: ['content'] } }, - index.js:461-461 (registration)Tool call handling logic in `handleRequest` which routes the "remember" tool call to `handleRemember`.
case 'remember': result = handleRemember(args); break;