feat(memory): add automated nightly consolidation at 4:00 AM UTC
Step 2 of memory system overhaul: automated scheduling. - New consolidation_scheduler.py: run_nightly_consolidation() function that checks Cat health, triggers consolidation via WebSocket, and tracks run history with success/failure stats - bot.py on_ready: register APScheduler cron job (hour=4, minute=0) alongside the existing daily DM analysis job - routes/memory.py: expose consolidation status (last_run, last_result, last_error, is_running, total_runs, successful_runs) in the /memory/status API response - Web UI: show consolidation schedule info (last run time, success/fail, run counts) below the manual consolidate button, with 'running now' indicator when active The 'sleep consolidation' metaphor is now actually automated instead of being manual-only.
This commit is contained in:
@@ -39,6 +39,30 @@ async function refreshMemoryStats() {
|
||||
document.getElementById('stat-declarative-count').textContent = '—';
|
||||
document.getElementById('stat-procedural-count').textContent = '—';
|
||||
}
|
||||
|
||||
// Show consolidation schedule info if available
|
||||
const consInfo = document.getElementById('consolidation-schedule-info');
|
||||
if (consInfo && statusData.consolidation) {
|
||||
let infoHtml = '';
|
||||
const cons = statusData.consolidation;
|
||||
if (cons.last_run) {
|
||||
const lastRun = new Date(cons.last_run).toLocaleString();
|
||||
infoHtml += `🕐 Last run: ${lastRun}`;
|
||||
if (cons.last_error) {
|
||||
infoHtml += ` <span style="color: #ff6b6b;">❌ ${escapeHtml(cons.last_error)}</span>`;
|
||||
} else if (cons.last_result) {
|
||||
infoHtml += ` <span style="color: #6fdc6f;">✅</span>`;
|
||||
}
|
||||
infoHtml += `<br>`;
|
||||
} else {
|
||||
infoHtml += `🕐 Last run: never<br>`;
|
||||
}
|
||||
infoHtml += `📊 Runs: ${cons.successful_runs}/${cons.total_runs} successful`;
|
||||
if (cons.is_running) {
|
||||
infoHtml += ` <span style="color: #dcb06f;">⏳ (running now)</span>`;
|
||||
}
|
||||
consInfo.innerHTML = infoHtml;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error refreshing memory stats:', err);
|
||||
document.getElementById('cat-status-indicator').innerHTML = '<span style="color: #ff6b6b;">● Error checking status</span>';
|
||||
|
||||
Reference in New Issue
Block a user