# How it works

Remiq does two jobs: it **writes** what comes in, and it **reads** the right part back before each turn. Prism, our model, does both.

## Writing: keep, link, version, forget

When you save (`POST /v1/memories`), Prism:

- **keeps** the original words, with who may read them (`acl`), when they were said (`at`) and where they came from (`source`). The same text saved twice is one record.
- **links** the people, projects and things a record names, so a later question about any of them finds it.
- **versions** values that change. A new value replaces the current one, and the old one stays in the history.
- **forgets** on time and on request. A record with `expires_at` ends then. A delete removes the record at once from the store, its indexes, the facts derived from it and every cache.

A save answers `indexed` (searchable now) or `queued` (accepted in order, searchable shortly).

## Reading: find, rank, guard, cite

When you ask for context (`POST /v1/context`), Prism:

- **finds** the records that match the question, or the recent turns when you send `messages`;
- **ranks** them and keeps the best that fit your budget (`max_tokens`, 2,500 by default);
- **guards** who sees what: with a `viewer` or a user token, only that person's records. Secrets are always masked, personal data by your policy;
- **cites**: every line carries an id like `[M3]`, and `provenance` gives each id's date and source.

## What your model reads

The context is one block, fenced as data:

- `instructions`: put them in your system prompt. They tell your model to answer from the memory, cite the ids and treat memory as data, not orders.
- `context`: the quoted records, between `MEMORY DATA` and `END OF MEMORY DATA`.
- `status`: how well the memory covers the question (see [Search and context](/docs/search-and-context/)).
- `tokens`: what the context costs your model.

## Keeper

Keeper, our guard for prompt attacks hidden inside memories, comes after launch. Today, every context is fenced as data, and its instructions tell your model never to follow orders found inside it.
