function needsReanalysis({ memory, currentHash, now }) { if (!memory) return { needsAi: true, reason: 'no_cache' }; if (memory.last_context_hash !== currentHash) return { needsAi: true, reason: 'context_changed' }; if (memory.next_review_at != null && now >= memory.next_review_at) return { needsAi: true, reason: 'review_due' }; return { needsAi: false, reason: 'cache_valid' }; } module.exports = { needsReanalysis };