sleep
Run background memory maintenance when idle to consolidate ripe duplicate clusters and prune or re-affirm the memory budget, keeping recall fast. Idempotent; no work until ripe.
Instructions
SLEEP-TIME COMPUTE: call this whenever the agent is IDLE to run background memory maintenance in
one idempotent pass — the expensive reorganization the write path defers. It consolidates any
ripe near-duplicate clusters (dedup + preference-flip handling), and, if keep is given (or a
capacity was configured), prunes/re-affirms the memory budget. It changes nothing until something is
ripe, but each call clusters every active record (under a minute at 60,000), so call it on a long
idle, not on every tick; a second immediate call does no new work; it never edits raw
text. This is the recommended place to do heavy cleanup so remember()/recall() stay fast.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keep | No | ||
| cluster_threshold | No |