# Tune Memory

**Settings → Memory**. Changes save at once and apply on the next turn; only **Enable Memory** needs a restart. Config keys: `memory.*` in [Configuration keys](https://fzkuji.github.io/OpenProgram/docs/reference/config-keys.html).

## Background writing

| Setting | Effect |
| --- | --- |
| **Writer model** | Writes and organizes Memory. **Automatic**: the default Agent's model, or the last used model when it has none. |
| **Automatic writing** | Turns finished conversation into Topic records |
| **Write frequency** | About 8K, 16K or 32K tokens gather before a write |
| **Verify after writing** | Asks about one fact just recorded, looks it up in a copy of Memory, repairs Topics if not found. Off by default: at least three more model calls per write, three more per repair. |

`openprogram memory status` reports these under `verification`: passed, repaired, unrepaired, errors and the latest.

## Recall

| Setting | Effect |
| --- | --- |
| **Recall method** | **Agent**: adds nothing automatically, the model reads with its tools. **Keyword**: BM25. **Semantic**: embeddings. **Hybrid**: both, merged. |
| **Hybrid weighting** | **Keyword first** 70/30, **Balanced** 50/50, **Semantic first** 30/70. **Automatic** leans on keywords when a message has a date, quoted phrase or name, otherwise balances. Hybrid only. |
| **Favour well-matched Topics** | Ranks a Topic higher when several paragraphs match. On by default. Hybrid only. |
| **Recall depth** | Most records added to a turn: 3, 5, 8 or 10 |

**Embedding model for Semantic and Hybrid**

They need the model plus sentence-transformers and PyTorch, which the App does not include. **Install** next to **Embedding model** downloads all of them: about 1 GB of packages and a 90 MB model. Packages go to `~/.openprogram/extras/embedding/`, so an App update keeps them.

## Project memory

| Setting | Effect |
| --- | --- |
| **Project memory** | A project conversation also reads `~/.openprogram/projects/<project>/memory`. Recall, Memory tools and Core Memory cover both, project first. On by default. |
| **Write to project memory** | Writes a project's conversations there instead of your personal Memory. Needs Project memory. On by default. |

- Conversations outside a project read your personal Memory only: the home project's, at `~/.openprogram/projects/default/memory`.
- A project's Memory counts once something is written. Nothing goes into the project's own folder. History shows it under its Memory tab.
- With both layers, Memory tools name the layer in paths: `project:topics/api.md`.
- A turn is written to one layer, so switching writes never copies a conversation across. A chat moved to another project writes only later turns there; earlier records stay.

## Context and history

| Setting | Effect |
| --- | --- |
| **Core Memory in every chat** | Adds the compact Core view to every system prompt |
| **Recent view size** | How many latest records the Recent view keeps |

[Read and edit Memory](https://fzkuji.github.io/OpenProgram/docs/capabilities/memory.html)
