stats
View memory health statistics by category to monitor active, fading, and dead memories in AI agents.
Instructions
Memory health overview: active, fading, and dead memories by category.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:336-361 (handler)The handler function 'handleStats' which computes memory statistics (active/fading/dead counts and category distributions).
function handleStats() { const memories = loadMemories(); const now = Date.now(); let active = 0, fading = 0, dead = 0; const categories = {}; for (const m of memories) { const rel = computeRelevance(m, now); if (rel.status === 'ACTIVE') active++; else if (rel.status === 'FADING') fading++; else dead++; categories[m.category] = (categories[m.category] || 0) + 1; } return { total: memories.length, active, fading, dead, categories, health: dead > active ? 'NEEDS PRUNING' : active > 0 ? 'HEALTHY' : 'EMPTY', store_path: STORE_FILE, }; } - index.js:435-438 (schema)The MCP tool definition for 'stats', including its description and schema.
name: 'stats', description: 'Memory health overview: active, fading, and dead memories by category.', inputSchema: { type: 'object', properties: {} } } - index.js:467-467 (registration)The registration/dispatch logic within the 'tools/call' handler that maps the 'stats' name to the 'handleStats' function.
case 'stats': result = handleStats(); break;