Skip to main content

Module maintenance

Module maintenance 

Source
Expand description

Rule based maintenance sweep (consolidate, decay, archive). Built-in maintenance sweep for self-hosted deployments.

Runs the rule-based “overnight” jobs that keep memory healthy: consolidate near-duplicates, decay salience, forget cold memories, and evict the stale speculative cache. A self-hoster gets the same upkeep the cloud worker provides, either automatically on a timer (--maintenance-interval-hours) or one-shot via the maintenance subcommand for external cron, without writing any code. Per-turn fact extraction is handled separately by --auto-extract.

Structs§

MaintenanceReport
What one maintenance sweep did.

Functions§

canonicalize_topics
Give recent trajectory topics a stable semantic label via the configured LLM, so topic prediction and the speculative cache stop keying on raw message text. No-op when no LLM is configured. Async because the LLM call is; call it outside the sweep’s blocking pool.
detect_conflicts
Detect genuine contradictions and supersessions among stored memories via the configured LLM, recording them as the typed edges the Conflicts view shows. Unlike the old cosine-similarity heuristic (removed for ~0% precision), the judge reads both texts. No-op when no LLM is configured. Async because the LLM calls are; call it outside the sweep’s blocking pool.
run_sweep
Run one maintenance sweep synchronously. Each job is best-effort: a failure in one is logged and the remaining jobs still run.
spawn_scheduler
Spawn a background task that runs a sweep every interval_hours. A value of 0 disables the scheduler (run the maintenance subcommand from cron instead). When an LLM is configured, each cycle also canonicalizes recent topics.