memory_maintenance_run
Run maintenance on a memory namespace: dry-run for a zero-write report, or apply to retire duplicates, evict auto-band entries, and stage judgment-call proposals for review.
Instructions
Run one sleep-time maintenance pass on a namespace (§6.3).
DRY-RUN by default (apply=False): computes the full would-do report with ZERO
writes — no ledger row, no proposals. apply=True claims the lease, runs the
provably-safe auto band (exact-dup retirement + auto-band eviction) AND stages the
judgment-call proposals for human review. Symmetric with lean-memory-maintain.
NOTE the asymmetry with the LM_MAINT_AUTO auto-spawn path: that fires
--apply --auto-only (auto band only, never stages proposals), so unattended
runs cannot grow the review queue — only interactive apply=True stages.
Returns the run summary: mode, staged/merged/demoted counts, and threshold stats.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apply | No | False (default): dry-run — compute the full would-do report with zero writes. True: claim the maintenance lease, apply the provably-safe auto band, and stage judgment-call proposals for review via memory_review_queue. | |
| namespace | Yes | Isolation key for one memory store. Each namespace is a separate local SQLite file under LM_DATA_ROOT (default ~/.lean_memory); namespaces never see each other's facts. Use one per agent, project, or user whose memory must stay separate. Created on first access. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||