# Knowledge graph

Memory is a graph of facts kept between runs. A run reads what the organization already knows before it works, and a turn that completes teaches it what the run found.

Read: Memory is read → Turn: The turn works → Done: The turn completes → Write: Memory is written

Failed, cancelled and replaced turns teach nothing. Work done inside a called workflow or an agent is learned from once, when the turn that holds it completes.

## Three graphs

| Graph | Belongs to | What it holds |
| --- | --- | --- |
| World | The organization | What the organization knows about the world, taught or learned: people, places, organizations, events and ideas. |
| User | The signed-in person | What Momor knows about the person, kept so answers fit them, including their preferences. It follows them across every organization they belong to. |
| Flow | One run | What the run has found, for its own later turns. Deleting the run erases it. |

Each fact keeps where it came from. Memory points back to the run evidence behind a fact rather than copying it, and a fact supported by more independent sources carries more weight.

## How a turn reads memory

- **The map.** Every root turn’s instructions include a map of the organization’s world graph: what kinds of things it holds and how many.
- **Graph reads.** Model steps of the root workflow whose output admits calls are offered GraphResolve, GraphExpand and GraphSource. A workflow’s Budget.MemoryProbes caps how many reads a turn makes.
- **Nested work reads none.** A called workflow, an agent or a debater touches no graph: it is offered no graph reads and writes none.

## Settings

Four settings belong to the organization. Workflows do not declare them and people cannot override them. The organization’s owner reads and changes them with `GET` and `PATCH /organization/preferences`, under `workflow`.

| Setting | Default | What it decides |
| --- | --- | --- |
| `AllowEphemeralRuns` | Off | Whether a run may be ephemeral at all. Off, a run asked for as ephemeral is stored as permanent. |
| `LearnFromEphemeralRuns` | On | Whether an ephemeral run teaches the world graph. Permanent runs always do. |
| `LearnFromUsers` | On | Whether a person’s own words, the request that opened a turn and their answers to questions, may become world knowledge. |
| `NoMemoryShortcuts` | Off | Whether every turn runs all its steps, even where memory already holds a strong enough answer. |

> **Momor Search**
> Search admits ephemeral runs, and learns neither from them nor from what people type, so public questions do not become memory.

## Erasure

Deleting a run erases its flow graph. A person’s user graph is deleted with their account. Facts in the world graph stay as long as their own evidence and corrections allow; a deleted run’s contribution to a fact’s weight remains, without the run it came from.
