Skip to main content

Memory Curator

The Curator provides maintenance operations across all memory stores. Access it via agent.memory.curator.

Pruning Old Data

Remove entries older than a specified number of days:

Deduplication

Remove duplicate user facts (case-insensitive):

Consolidation (LLM-Powered)

Go beyond exact-text dedup — use an LLM to identify and merge semantically similar facts:
Consolidation:
  • Groups semantically similar facts using the LLM
  • Merges each group into a single authoritative fact
  • Preserves the most specific/recent information
  • Returns the count of facts that were merged
This is more powerful than deduplicate(), which only catches exact text matches.

Clear All Data

Wipe all memory data for a user and/or agent:

Scoping

You can scope clearAll to different levels:
clearAll({ userId }) never wipes data belonging to other users, regardless of how it is called. See Multi-User Isolation for the full contract.

Scheduling Maintenance

For production use, run curator operations on a schedule:

Full Maintenance Example

A production-ready maintenance script that runs daily:

Learnings Pruning (v2.6+)

prune({ maxAgeDays, agentName }) (or userId) now also sweeps the learnings store. Conservative defaults: only unverified (llm-extracted) learnings are age-pruned and old invalidated ones purged — human-authored knowledge is never removed. For fine-grained control (sources, includeUntagged), call learnings.pruneLearnings() directly.

Reconcile (v2.5+)

Vector-backed stores (Learnings, Corrections) dual-write to KV storage and the vector index. A crash between the two writes leaves KV records that are never retrieved. reconcile() repairs the drift by re-embedding and re-indexing anything missing from the vector store:
Run it alongside prune/consolidate in your maintenance schedule.

Why Maintenance Matters

Without periodic maintenance:
  • User facts accumulate — duplicate or stale facts waste context tokens
  • Old sessions pile up — storage costs increase
  • Entity memory grows — irrelevant entities dilute search results
  • Decision logs expand — outdated decisions may mislead the agent
  • Dual-write drift accumulates — KV/vector divergence silently hides learnings from retrieval
A weekly or monthly maintenance run keeps memory lean and context relevant.