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

# Standing notes (MEMORY.md / USER.md)

> Tiny always-on memory files with a hard character cap — not a second MemoryManager.

# Standing notes

## In plain terms

Vector memory is a big library. These files are a **sticky note on the monitor**.

Two notes:

* **MEMORY.md** — facts about the project / environment ("deploys on Fridays")
* **USER.md** — facts about *this person* ("likes short answers")

They are always injected into the prompt (when they have content). They have a **hard size cap**. When the box is full, the agent must shorten old lines before adding new ones. That is on purpose — it keeps the prompt small.

This sits **next to** `MemoryManager`. It does not replace sessions, summaries, or vector learnings.

***

## Turn it on

```typescript theme={null}
const agent = new Agent({
  name: "assistant",
  model: openai("gpt-4o"),
  fileMemory: true,
});
```

`Agent.deep()` turns this on for you.

Optional caps (defaults: 2200 chars for memory, 1375 for user):

```typescript theme={null}
fileMemory: { memoryCharLimit: 2200, userCharLimit: 1375 }
```

Pass `storage` to keep notes in SQLite/Postgres instead of RAM.

***

## The `memory` tool

The model gets one tool named `memory`:

| `action`  | Needs                  | Does                                       |
| --------- | ---------------------- | ------------------------------------------ |
| `add`     | `content`              | Append a line (no-op if it already exists) |
| `replace` | `old_text` + `content` | Swap the one line that contains `old_text` |
| `remove`  | `old_text`             | Delete that line                           |

`target` is `"memory"` (default) or `"user"`.

If adding would overflow:

```json theme={null}
{
  "ok": false,
  "error": "Memory at 2100/2200 chars. … Consolidate with replace/remove, then retry.",
  "usage": "2100/2200",
  "current_entries": ["…"]
}
```

***

## What to use when

| Need                                           | Use                                   |
| ---------------------------------------------- | ------------------------------------- |
| This chat's turns                              | `memory: { storage }` sessions        |
| Old chats, compressed                          | `memory.summaries`                    |
| "Alex lives in Mumbai" extracted automatically | `memory.userFacts`                    |
| Reusable lessons, search by meaning            | `memory.learnings` / `learning: true` |
| Tiny facts that must always be in the prompt   | `fileMemory`                          |

***

## Deprecated overlap

| Old                | Use instead                                                    |
| ------------------ | -------------------------------------------------------------- |
| `Memory` class     | `memory: { storage, summaries: true }`                         |
| `UserMemory` class | `memory.userFacts` + `memory.userProfile`, or `fileMemory`     |
| `CultureManager`   | `contextFiles` (AGENTS.md) + `fileMemory` + `memory.learnings` |

The old classes still run. They will be removed in the next major version.
