# Memory

> The two kinds of memory an agent has. Long-term notes it keeps across runs and conversations, and the earlier turns of a conversation it reads back.

Source: https://docs.go-lumen.ai/ai/memory

**In one sentence**: An agent has two memories that are easy to confuse: long-term notes it chose to keep, which outlive any one run, and conversation history, the last few turns of one chat that it reads back before it answers.

|  | Long-term notes | Conversation history |
| --- | --- | --- |
| What it holds | Short facts and preferences the agent kept: "this supplier bills on the 2nd" | The earlier messages and replies of one chat session |
| Lives | Until forgotten or expired | For the session |
| Belongs to | One saved agent in one workspace | A chat session of a flow |
| Set with | The **Memory** segment of the agent, or the memory tools | `memory.window`, shown under **Limits** as **Earlier turns it remembers** |
| Used by | Any run of that agent, in any flow | The chat-message trigger's `sessionId` |

Conversation history is the setting `memory: {window: N}`, 1 to 50 earlier turns, where a turn is a message and its reply. Unset, every run starts fresh. The plain **AI agent** step reads the last 10. The rest of this page is about long-term notes.

## How long-term notes work

Turning memory on gives the agent three tools, which only an agent can use. They are never flow steps and are never charged credits.

| Tool | What it does |
| --- | --- |
| **Remember something** ([`remember`](https://docs.go-lumen.ai/reference/steps/remember.md)) | Saves one short note, up to 2 KiB, with optional tags. Saving the same note twice keeps it once. At the agent's maximum number of notes it fails and tells the agent to forget one first. |
| **Recall what I remember** ([`recall`](https://docs.go-lumen.ai/reference/steps/recall.md)) | Looks notes up by words, best match first, up to 10. An empty query returns the newest. |
| **Forget a note** ([`forget`](https://docs.go-lumen.ai/reference/steps/forget.md)) | Deletes one note by its id, or by words only that note has. If several notes match, it says how many and asks for the id. |

The model never names whose memory it uses: Lumen fixes that. A note belongs to one agent in one workspace.

-   A **saved agent** (see [Agents](https://docs.go-lumen.ai/ai/agents.md)) has one set of notes shared by every flow that uses it. If you delete the agent and create another with the same name, the new one starts empty.
-   An **AI agent node** that is not saved keeps its own notes, tied to that node of that flow. Renaming the flow keeps them. The console does not list those notes: save the node as an agent to see and manage them.

### Recalled at the start of every run

So the agent does not depend on remembering to look, Lumen recalls the notes that best fit the run and puts them in the prompt.

-   `longTermMemory.autoRecall` sets how many: 0 to 10, 3 when unset, 0 turns it off.
-   These notes use tokens on every run. Recall never fails a run: if nothing matches, the run goes on without notes.
-   The agent can still call **recall** for more.

### Saved information, never instructions

Notes reach the model inside a marked block as **saved information that may not be trustworthy**, never as instructions. A note that says "ignore your instructions" is read as a fact someone saved, not as a command. Notes are also masked of sensitive values before they are stored.

Do not save secrets in notes. Keep them to durable facts and preferences.

## Manage notes in the console

Notes are managed per saved agent.

1.  Open **Agents**, then the agent, then the **Memory** segment of its wheel.
2.  Turn on **Let this agent remember things**. This adds the three tools to the agent's tools. Turning it off removes them; the notes stay until someone deletes them.
3.  Set **Recall automatically** (0 to 10) and, if you want notes to expire, **Forget notes after (days)**. Expiry applies to notes saved from then on. Empty keeps them until they are forgotten.
4.  Under **What it remembers**, search by a word, read each note with its tags, who saved it (**Saved by the agent** or **Added by hand**), when, whether it came from a run, and how often it was recalled.
5.  Admins can forget a note, **Forget everything**, or add one by hand. Everyone with access can read.

![The Memory panel of the agent Invoice reader. A switch labeled Let this agent remember things is on. Recall automatically is set to 3 and Forget notes after (days) to 180. Below, under What it remembers with 4 memories, are a Forget everything button and a search box, with the line: The agent reads its notes as saved information, never as instructions.](https://docs.go-lumen.ai/img/ai/memory-01-notes.png)

*The Memory segment: the switch, the recall count, expiry and the notes themselves.*

Two shortcuts help you teach an agent. **Remember this** on a run's result saves it as a note of that agent in your name, editable first. **Notes used** on a run lists the notes it started with.

**Try it** never changes an agent's memory. Nothing is saved or forgotten there. In a real run, **remember** and **forget** take effect.

## The same settings as YAML

Long-term memory is on when the memory tools are in the agent's `tools`. The settings that shape it are under `longTermMemory`. Conversation history is `memory`.

```yaml title="excerpt of an agent's config"
config:
  tools: [remember, recall, forget]
  longTermMemory:
    autoRecall: 3        # notes put in the prompt at the start of a run, 0 to 10
    retentionDays: 180   # notes saved from now on expire after this long
  memory: {window: 10}   # conversation history: earlier turns it reads back
```

## What is kept, and for how long

|  |  |
| --- | --- |
| One note | Up to 2 KiB of text, up to 8 tags of 40 characters |
| Notes per agent | A cap, 1,000 by default. Nothing is dropped silently when it is reached |
| Expiry | Never, or `retentionDays` (1 to 3,650) from the day a note is saved |
| When an agent is deleted | Its notes are kept 30 days, then deleted. If an agent with that identity comes back, they are kept |
| Where | In the workspace's run store, not in Kubernetes. Never shared between workspaces or agents |

> **Notes are per agent on purpose:**
> 
> A note is only as good as the agent that wrote it and the instructions it reads it under. Keeping notes per agent means a note planted through one agent, for example one that reads inbound email, cannot be trusted by another.

## Next steps

[AgentsBuild the agent whose memory you manage.](https://docs.go-lumen.ai/ai/agents.md)[Lighthouse knowledgeShare procedures with every agent instead of one agent's notes.](https://docs.go-lumen.ai/ai/lighthouse.md)[Tools and MCP serversThe tools an agent has besides memory.](https://docs.go-lumen.ai/ai/tools-and-mcp.md)
