# Memory (mem0)

> Long-term memory your agents share across sessions — they save facts and decisions and recall them later. Kept on your computer.

Source: https://docs.neurosquad.ai/en/plugins/mem0-memory

An agent forgets everything when its session ends. The **Memory** plugin gives connected agents a
long-term memory: they save what is worth keeping — a decision, a convention, your preference, a
fact about the project — and find it again in later sessions, in other agents, after a restart.

It runs on [mem0](https://github.com/mem0ai/mem0), an open-source memory engine (Apache-2.0), built
into NeuroSquad. The memory is stored on your computer, in NeuroSquad's data folder. There is no
account to create and no server to run.

## How to use it

1. In the add-card menu choose **Plugin…**, open **Memory (mem0)** in the **Plugins** tab and press
**Add to canvas**.
2. Draw an [arrow](https://docs.neurosquad.ai/en/canvas/arrows) from an agent to the card.

The agent now has memory tools. Ask it to remember something ("remember that we deploy only through
GitHub Actions") or just work — agents are told to search memory before work that may depend on
earlier decisions and to save lasting facts. Remove the arrow and the tools are gone; the memories
stay on the card.

Most agents get the tools right away, without a restart. Codex, Kimi Code, Cursor and Crush read
their tool list once at start, so they see the memory tools from the start and the arrow decides
whether a call goes through. Qwen Code and Cline pick them up on their next start.

## What the agent can do

| Tool | What it does |
| --- | --- |
| `memory_search` | Finds the memories relevant to a question, best first |
| `memory_add` | Saves a fact (or a piece of conversation to extract facts from) |
| `memory_list` | Lists the memories, newest first |
| `memory_get` | Reads one memory |
| `memory_update` | Corrects a memory that became wrong |
| `memory_delete` | Forgets a memory |

An agent can change or delete only the memories **it** saved. To let agents edit any memory —
yours and other agents' — turn on **Agents may edit any memory** in the card's settings.

## The card

The card shows how many memories there are, the newest first, who saved each and when. A memory an
agent has just written glows for a moment. You can search, add a memory yourself with **+**, edit
or delete any memory, export everything to a JSON file and clear the memory.

## Whose memory: the scope

Open the settings (the sliders icon on the card) and pick a **scope**:

- **This workspace** (default) — every agent connected to a Memory card in this workspace shares one
memory.
- **All workspaces** — one memory for every workspace: good for what holds everywhere, like your
preferences and conventions.
- **Per agent** — each connected agent has its own private memory; the card shows them all.

Memories belong to the scope, not to the card: delete the card and add a new one with the same scope,
and the memories are still there. **Clear** in the settings deletes them.

## Search: by words or by meaning

Out of the box the card searches by **keywords** — shared words and word parts, so "postgres" finds
"PostgreSQL". It works offline with nothing set up, but it won't connect synonyms ("car" and
"automobile").

For search **by meaning**, press **Download 150 MB** under **Smart search** on the card (or pick it in
Settings → Search). It downloads a small multilingual model once — it runs on your computer, works
offline and understands English, Russian, Chinese and dozens of other languages, so a question in
Russian finds a memory written in English. Every file is checked against its checksum.

You can also use an embedding model from [OpenRouter](https://docs.neurosquad.ai/en/providers/openrouter) or from a
[model server](https://docs.neurosquad.ai/en/providers) you added in Settings → Providers that speaks the OpenAI API — for
example Ollama with `nomic-embed-text`, or LM Studio.

The choice applies to every Memory card. When you switch, every memory is re-indexed; the card
shows the progress, and agents wait until it finishes.

## Fact extraction

By default a memory is stored exactly as written. Choose a model under **Fact extraction** and mem0
turns what agents save into short facts and skips what it already knows. This costs one request to
that model per save.

## Automatic memory

Two switches in the settings, both off by default:

- **Automatic recall** — before each of your prompts, the most relevant memories are added to the
agent's turn as notes. Works with **Claude Code**, **Codex**, **Qwen Code**, **OpenCode**,
**Kilo Code**, **Gemini CLI**, **pi** and **omp**. Other agents use `memory_search` themselves.
- **Automatic saving** — when a connected agent finishes a turn, your prompt and the agent's final
answer go to the fact-extraction model, which keeps only lasting facts (often none). Needs a
fact-extraction model.

## History, export and import

- The clock button on a memory shows its history: when it was added and each edit, with the text
before.
- **Export** in the settings saves the card's memories to a JSON file. **Import** reads such a file,
shows how many are new and how many are already there (they are skipped), lets you choose the
scope, and adds the new ones. **Undo** on the card removes exactly what the last import added.

## WSL and SSH workspaces

Agents in a workspace inside WSL or on an SSH host use the card the same way: their arrow gives them
the `memory_*` tools, and automatic recall reaches Claude Code there through its prompt hook. The
memories themselves stay in NeuroSquad's data folder on this computer — nothing is stored on the
other side — and the workspace scope keeps each workspace's memories apart as usual.

## Deleting a workspace or an agent

Deleting a workspace also deletes the memories saved for it; deleting an agent deletes its private
memories (per-agent scope). The confirmation says how many. Memories shared by all workspaces stay.

> Your keys stay in NeuroSquad: they are only sent to the provider you chose, with each request.
> Nothing is sent to mem0 — the engine's own usage reporting is switched off.

> Memories are notes from the past, not instructions: they can be outdated. Don't ask an agent to
> remember passwords or keys.
