memory_add
Extract durable facts from natural-language text and store them in an isolated namespace for later retrieval. Use it to remember preferences, decisions, and biographical details; existing facts are never overwritten.
Instructions
Distill durable facts from text and write them to a namespace's memory.
The raw text is NOT stored verbatim: an extraction pass distills it into discrete facts, which are embedded and indexed for memory_search. Returns how many facts were written (possibly 0 if nothing extractable). Additive only — never overwrites or deletes existing facts; contradictions are handled by supersession, with full history retained. Creates the namespace on first write.
Use it after learning durable information worth recalling in later sessions (preferences, decisions, biographical facts) — not for transient chatter, and not to re-state facts already in memory (use memory_search to check what is already known; use memory_clear to delete a namespace). With the [extract]/[models] extras installed, the first call in a fresh environment downloads model weights (one-time, can take minutes); the call blocks until done.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Natural-language text to remember (a message, note, or observation). It is distilled into discrete facts, not stored verbatim. | |
| 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 |