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:
11
bot/bot.py
11
bot/bot.py
@@ -122,6 +122,17 @@ async def on_ready():
|
||||
else:
|
||||
logger.warning("OWNER_USER_ID not set, DM analysis feature disabled")
|
||||
|
||||
# Schedule nightly memory consolidation (runs at 4 AM UTC every day)
|
||||
from utils.consolidation_scheduler import run_nightly_consolidation
|
||||
globals.scheduler.add_job(
|
||||
run_nightly_consolidation,
|
||||
'cron',
|
||||
hour=4,
|
||||
minute=0,
|
||||
id='nightly_consolidation'
|
||||
)
|
||||
logger.info("🌙 Scheduled nightly memory consolidation at 4:00 AM UTC")
|
||||
|
||||
# Setup autonomous speaking (now handled by server manager)
|
||||
setup_autonomous_speaking()
|
||||
load_last_sent_tweets()
|
||||
|
||||
Reference in New Issue
Block a user