feat(v2): add safe AI fallback and cache/reanalysis decision
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c445e00fc5
commit
efba7792fa
@@ -0,0 +1,8 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user