inspect
View all memories with decay status, relevance scores, ages, health stats, and category breakdown to debug memory performance.
Instructions
Debug view: all memories with decay status, relevance scores, ages, and health stats. Also shows category breakdown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:348-384 (handler)The handleInspect() function that executes the inspect tool logic. Loads all memories, computes relevance for each, categorizes their status (ACTIVE/FADING/DEAD), and returns debug view with health stats, category breakdown, and all memories sorted by relevance.
function handleInspect() { const memories = loadMemories(); const now = Date.now(); let active = 0, fading = 0, dead = 0; const categories = {}; const inspected = memories.map(m => { 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 { id: m.id, content: m.content.slice(0, 100) + (m.content.length > 100 ? '...' : ''), category: m.category, mentions: m.mention_count, age_days: rel.age_days, relevance: rel.relevance, decay: rel.decay, status: rel.status, }; }).sort((a, b) => b.relevance - a.relevance); return { total: inspected.length, active, fading, dead, categories, health: dead > active ? 'NEEDS_PRUNING' : active > 0 ? 'HEALTHY' : 'EMPTY', memories: inspected, store_path: STORE_FILE, }; } - index.js:456-459 (schema)The input schema for the inspect tool. It has no required properties (empty object), meaning inspect takes no arguments.
name: 'inspect', description: 'Debug view: all memories with decay status, relevance scores, ages, and health stats. Also shows category breakdown.', inputSchema: { type: 'object', properties: {} } }, - index.js:513-513 (registration)The tool dispatch case where 'inspect' maps to handleInspect() in the tools/call handler.
case 'inspect': result = handleInspect(); break; - index.js:417-461 (registration)Tool definitions including the inspect tool's name and description registered in getToolDefinitions().
getToolDefinitions() { return [ { name: 'remember', description: 'IMPORTANT: Call this whenever the user reveals a preference, fact about themselves, correction, or recurring interest. Auto-categorizes if no category given. Auto-deduplicates similar content. Categories: one-time (7d), question (14d), interest (60d), preference (180d), correction (365d), fact (365d), context (30d).', inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'What to remember. Keep concise — under 20 words.' }, category: { type: 'string', enum: Object.keys(CATEGORY_CONFIG), description: 'Optional. Auto-detected if omitted.' }, tags: { type: 'string', description: 'Optional comma-separated tags.' } }, required: ['content'] } }, { name: 'recall', description: 'Search memories by topic. Auto-reinforces strong matches. Auto-prunes dead memories. Leave query empty to get all active memories ranked by relevance.', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query. Leave empty for all.' }, limit: { type: 'number', description: 'Max results. Default: 10.' }, min_relevance: { type: 'number', description: 'Min relevance 0-1. Default: 0.05.' } } } }, { name: 'forget', description: 'Delete a memory by ID or content match (fuzzy). Use when the user says to forget something.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Memory ID (from inspect)' }, content: { type: 'string', description: 'Fuzzy content match' } } } }, { name: 'inspect', description: 'Debug view: all memories with decay status, relevance scores, ages, and health stats. Also shows category breakdown.', inputSchema: { type: 'object', properties: {} } }, ]; } - index.js:122-136 (helper)The computeRelevance helper function used by handleInspect to calculate decay status, relevance score, and health for each memory.
function computeRelevance(memory, now = Date.now()) { const age_ms = now - memory.last_reinforced; const age_days = age_ms / (1000 * 60 * 60 * 24); const decay = Math.pow(0.5, age_days / memory.decay_halflife_days); const freq_boost = 1 + Math.log2(memory.mention_count); const relevance = memory.base_weight * decay * freq_boost; return { relevance: Math.round(relevance * 1000) / 1000, decay: Math.round(decay * 1000) / 1000, freq_boost: Math.round(freq_boost * 100) / 100, age_days: Math.round(age_days * 10) / 10, status: relevance > 0.5 ? 'ACTIVE' : relevance > 0.1 ? 'FADING' : 'DEAD', }; }