MemoryManager.curator provides maintenance operations for enabled stores. Schedule it in your application; the SDK does not discover all your users or start a recurring maintenance job.
Deduplication
This local example creates facts, invokes maintenance, and inspects the result without a model or database:UserFacts already normalizes duplicate writes. A zero deduplication count can be the correct result. The curator removes facts with duplicate normalized text; it does not infer semantic equivalence without a model.
Pruning Old Data
prune({ maxAgeDays, userId?, agentName? }) handles supported facts, decisions, and learnings. It is not an automatic retention policy for every session, graph, vector, and artifact. In v4, age pruning of learnings conservatively targets unverified extracted records; review broader deletion in application code.
Consolidation (LLM-Powered)
consolidate({ userId, model }) asks a model to merge redundant active facts. It makes provider calls and mutates data. Inspect the input records and resulting count; the implementation logs failures and can return zero, so zero does not prove a provider request succeeded.
Clear All Data
Despite its name,clearAll({ userId?, agentName? }) clears the configured user facts, profile, entities, and matching Agent decision log. It does not delete every session, procedure, correction, vector index, graph record, or external artifact. Build an explicit application deletion workflow when the requirement is to erase all data for an identity.
Scheduling Maintenance
Pass an application-owned list of authorized users to a maintenance job.StorageDriver and MongoDBStorage do not expose listUsers(). Keep overlapping jobs serialized per scope and apply a host deadline. Avoid invoking destructive maintenance from untrusted tool inputs.
Full Maintenance Example
This integration helper has no hidden scheduler or user directory. The caller ownsmemory, supplies the users, and decides when to run it:
Reconcile (v2.5+)
reconcile() repairs missing vector entries from the key-value records for enabled learnings and corrections. It returns separate repair counts. Verify vector-store credentials and availability; this is not a generic database consistency repair or a graph migration.