memory_clear
Clears all stored facts for a namespace by deleting its SQLite file. Irreversible; use when the entire history must be forgotten. Other namespaces remain untouched.
Instructions
Delete ALL memory for a namespace by removing its SQLite file. Irreversible.
Use only when the namespace's entire history should be forgotten; there is no per-fact deletion. Idempotent — clearing a missing namespace succeeds as a no-op. Other namespaces are untouched.
Refuses (returns an explanatory message, changing nothing) while a LIVE maintenance lease with a fresh heartbeat is held for the namespace (spec §7.3): a POSIX unlink cannot safely interrupt an in-flight maintenance run — the run's open handle would keep committing to the unlinked (ghost) inode, silently losing that work. So clear waits for the run to finish or its lease to go stale. A stale or absent lease clears normally; the maintenance runner itself independently skips a namespace cleared mid-run at its next batch boundary.
Residual race (spec §7.3, known limitation): a clear that lands in the sliver BETWEEN this lease-check and the unlink is not prevented — full cross-process file locking is deliberately out of scope for v1. The two guards (this refusal + the runner's batch-boundary skip) shrink the window; they do not close it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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 |
|---|---|---|---|
| result | Yes |