prune
Remove outdated memories that fall below a set relevance threshold to maintain efficient memory storage for AI agents.
Instructions
Remove memories that have decayed below a relevance threshold. Cleans up old one-time questions automatically.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threshold | No | Remove memories below this relevance (default: 0.05) |
Implementation Reference
- index.js:316-327 (handler)The handler function for the 'prune' tool which filters memories based on relevance and saves them back.
function handlePrune(args) { const { threshold = 0.05 } = args; const memories = loadMemories(); const now = Date.now(); const before = memories.length; const surviving = memories.filter(m => { const rel = computeRelevance(m, now); return rel.relevance >= threshold; }); saveMemories(surviving); - index.js:424-429 (registration)Registration of the 'prune' tool with its description and input schema.
{ name: 'prune', description: 'Remove memories that have decayed below a relevance threshold. Cleans up old one-time questions automatically.', inputSchema: { type: 'object', properties: {