> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cruq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory

> Long-term facts recalled semantically across threads.

Memory stores durable facts that agents can recall across threads. Thread-level
conversation history is handled separately by the runtime checkpointer; memory is
for long-lived knowledge.

## How it works

Each memory is embedded on save. Recall embeds the query and returns the closest
matches by cosine similarity. Memories are workspace-scoped, with optional
per-agent scoping.

## From the CLI

```bash theme={null}
cruqai memory add "The customer prefers email over phone."
cruqai memory search "how should we contact the customer?"
```

## From an agent

Two built-in tools:

* `memory_search` - recall relevant facts for a query.
* `memory_write` - persist a new fact.

Reference them from an agent node to give the agent read/write memory.

## API

* `POST /v1/memory` - store a memory
* `POST /v1/memory/search` - recall
