# Memory

> A project's memory lets the agent keep facts and instructions from one conversation to the next.

Source: https://www.opendb.tools/en/docs/memory

## What memory is for

Each conversation starts from scratch. The project memory holds what the agent needs to know every time: a convention of the database, a preference, a business rule.

It belongs to one project and is read at the start of every answer.

## Have something remembered

Simply ask in a conversation:

```text
Remember that amounts in the orders table are in cents.
```

```text
Remember that I always export as CSV, without compression.
```

The agent records the fact with today's date. It can also replace or remove an entry if you ask.

## What to put in it

- **Database conventions**: units, formats, the meaning of a code or a status.
- **Preferences**: export format, how to present results.
- **Business rules**: which orders count as valid, which period is the reference.

Write instructions in the imperative, with their conditions: "Always exclude cancelled orders from revenue calculations."

## What the agent never memorizes

- secrets: passwords, keys, tokens;
- data from the database;
- short-lived information, valid for a single conversation.

## Read and edit the memory

Open **Project settings → Memory**. You can read the entries, add some, edit them, remove them or clear everything.

From a terminal, the same section is reachable with:

```bash
opendb project:settings
```

## Limits

- A memory holds **100 entries at most**.
- Memory can **never widen permissions**: an entry does not let the agent write in read-only mode, or reach a hidden table.
- Memory is **shared by the project's users** and deleted with the project.

## Where it is stored

A project's memory is a text file:

```text
~/.opendb/projects/{project}/MEMORY.md
```

Each fact takes one dated line in it.
